Opened 9 years ago

Last modified 7 years ago

#5877 confirmed Bug

can't bind Ctrl+X to plugin commands (h1, p)

Reported by: Fredrik Wendt Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0
Keywords: Cc: fredrik@…

Description

TinyMCE and other enterprise wiki wysiwyg editors by default ship keybindings for changing a line into headline (h1, h2, h3 are accessed using CTRL+1, CTRL+2, ...).

In order to make CKEditor work the same way I had to go into the plugins I wanted to add keybindings for, and add this line of code

editor.addCommand(tag, new CKEDITOR.styleCommand(style));

to enable h1..h6 and CTRL+0 for p (turn headline back to normal paragraph).

Change History (2)

comment:1 Changed 9 years ago by Fredrik Wendt

Cc: fredrik@… added

diff -u -p tells me my workaround is

--- format/plugin.js	2010-06-24 14:02:07.000000000 +0200
+++ /home/ceda/localworkspace/.../_source/plugins/format/plugin.js	2010-06-24 14:12:15.000000000 +0200
@@ -22,6 +22,7 @@ CKEDITOR.plugins.add( 'format',
 			var tag = tags[ i ];
 			styles[ tag ] = new CKEDITOR.style( config[ 'format_' + tag ] );
 			styles[ tag ]._.enterMode = editor.config.enterMode;
+			editor.addCommand(tag, new CKEDITOR.styleCommand(styles[tag]));
 		}
 
 		editor.ui.addRichCombo( 'Format',

and then to setup the keybindings (called keystrokes) in the ckConfig object handed to CKEDITOR:

...
[ CKEDITOR.CTRL + 48 /*0*/, 'p' ],
[ CKEDITOR.CTRL + 49 /*1*/, 'h1' ],
[ CKEDITOR.CTRL + 50 /*2*/, 'h2' ],
[ CKEDITOR.CTRL + 51 /*3*/, 'h3' ],
[ CKEDITOR.CTRL + 52 /*4*/, 'h4' ],
[ CKEDITOR.CTRL + 53 /*5*/, 'h5' ],
[ CKEDITOR.CTRL + 54 /*6*/, 'h6' ]
...

comment:2 Changed 7 years ago by Jakub Ś

Status: newconfirmed
Version: 3.2.23.0
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy