Nevron Open Vision Documentation
Rich Text Editor / Commanding / Commanding Overview
In This Topic
    Commanding Overview
    In This Topic

    As part of the NOV platform, NOV Rich Text Editor is subject to commanding and you can easily build powerful commanding user interfaces around a rich text view. The NOV Rich Text component provides predefined builders for the following command UIs:

    All rich text commands are defined as static readonly fields in the NRichTextView class and you can freely reuse them whenever necessary to create your own commanding UI. All icons used by the predefined rich text ribbon, command bars, and context menu builders are also publicly available. They are exposed by the Nevron.Nov.Text.NResources static class.

     Custom Command Actions

    If you want to provide additional functionality to your users, you should create your own custom commands and command actions, which inherit from the NTextCommandAction class. The following example demonstrates how to create a custom command action that shows a message box when executed. This command action is used in the rest of the topics in this chapter for a custom command added to the commanding UI of the rich text.

    Create custom command action
    Copy Code
    public class CustomCommandAction : NTextCommandAction
    {
        public CustomCommandAction()
        {
        }
    
        static CustomCommandAction()
        {
            CustomCommandActionSchema = NSchema.Create(typeof(CustomCommandAction), NTextCommandAction.NTextCommandActionSchema);
        }
    
        public override NCommand GetCommand()
        {
            return MyCustomType.CustomCommand;
        }
    
        public override void Execute(NNode target, object parameter)
        {
            NRichTextView richTextView = GetRichTextView(target);
            NMessageBox.Show("Rich Text Custom Command executed!", "Custom Command", ENMessageBoxButtons.OK, ENMessageBoxIcon.Information);
        }
    
        public static readonly NSchema CustomCommandActionSchema;
    }
    

    You will also have to add your custom command actions to the Commander of the rich text view:

    Add a custom command action
    Copy Code
    richTextView.Commander.Add(new CustomCommandAction());
    

    You should also define a custom command, which you should later use in custom builders:

    Define a custom command
    Copy Code
    public static readonly NCommand CustomCommand = NCommand.Create(typeof(MyCustomType), "CustomCommand", "Custom Command");
    

    For more information about commanding and command builders, check out the topics in the "See Also" section below.

    See Also