0

I am using TinyMCE 6 (Core Editor) classic editing mode. I want to create custom keyboard shortcuts to enable numbered and bulleted lists.

* + spacebar => Enable Bulleted List

1 + ) => Enable Numbered List

1 + . => Enable Numbered List

I followed the steps and tried both APIs (tinymce.Editor.addShortcut & tinymce.Shortcuts.add) mentioned in the TinyMCE documentation. But I am unable to achieve the functionality. The keyboard shortcuts/modifiers discussed above are not working with APIs for adding custom keyboard shortcuts.

Can anyone tell me how to create custom keyboard shortcuts with the modifiers mentioned above (space, digit, dot)? Code Sample :

tinymce.init(
    selector:'#tinyEditorPOC',
    setup: (editor) => {
          editor.on('init', function (e) {
            editor.addShortcut('* + Spacebar ', 'Enables Bulleted List', () => {
              tinymce.activeEditor.execCommand('InsertOrderedList');
            }),
            editor.addShortcut('1 + )', 'Enables Numbered List', () => {
              tinymce.activeEditor.execCommand('InsertOrderedList');
            }),
            editor.addShortcut('1 + .', 'Enables Numbered List', () => {
              tinymce.activeEditor.execCommand('InsertOrderedList');
            }),
         })
      },
 )

I cannot create a custom keyboard shortcut with the modifier " * + space" to enable the bulleted list. tried creating shortcuts for numbered lists with modifiers "1 + ." and "1 + )". But unable to achieve that.

0 Answers0