Search code examples
propertiesckeditorwysiwygweb-partskentico

Kentico 10 | Toolbar for Rich Text Editor in a Custom Component


I can create a custom toolbar for the EditableText Web Part in Kentico 10, as there is plenty of documentation on how to create/set custom toolbars .. but I can ONLY find documentation for the EditableTextWebPart.

I need to create unique toolbars to be used within several custom Web parts for certain properties / fields. I can't find any documentation on setting them within my own custom Web part, and am hoping someone could point me in the correct direction.


Solution

  • So the answer was under my nose, albeit a bit hidden.

    1. In the /CMS/CMSAdminControls/CKeditor/config.js I added my own custom toolbar, which I had already created, but hand't figured out how to hand it off to the Web part property.
        config.toolbar_Caption =
        [
            ['Undo', 'Redo', '-'],
            ['Cut', 'Copy', 'Paste', 'PasteText', 'Scayt', '-'],
            ['Bold', '-'],
            ['InsertLink', 'Unlink', '-'],
            ['Maximize']
        ];
    
    1. The web part has a property, named Caption, with the Data type set to Long text and the Form Comtrol set to Rich Text Editor.

    2. Under Editing control settings, expand Advanced to access Toolbar set and set it to the custom toolbar. In my example, that would be Caption.

    3. Also set the Toolbar location to In so that the toolbar is within the text area vs. floating on top of the entire form.