Skip to content

Commit

Permalink
Merge branch 't/11677'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Mar 31, 2014
2 parents 32de5b6 + 0ba8eac commit 954f689
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -5,6 +5,7 @@ CKEditor 4 Changelog

Fixed Issues:

* [#11677](http://dev.ckeditor.com/ticket/11677): Fixed: undo/redo keystrokes are blocked in source mode.
* [#11717](http://dev.ckeditor.com/ticket/11717): [Docprops](http://ckeditor.com/addon/docprops) plugin requires the [Colordialog](http://ckeditor.com/addon/colordialog) plugin to work.

## CKEditor 4.3.4
Expand Down
11 changes: 2 additions & 9 deletions core/config.js
Expand Up @@ -333,22 +333,15 @@ CKEDITOR.config = {
* config.blockedKeystrokes = [
* CKEDITOR.CTRL + 66, // CTRL+B
* CKEDITOR.CTRL + 73, // CTRL+I
* CKEDITOR.CTRL + 85, // CTRL+U
* CKEDITOR.CTRL + 89, // CTRL+Y
* CKEDITOR.CTRL + 90, // CTRL+Z
* CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 // CTRL+SHIFT+Z
* CKEDITOR.CTRL + 85 // CTRL+U
* ];
*
* @cfg {Array} [blockedKeystrokes=see example]
*/
blockedKeystrokes: [
CKEDITOR.CTRL + 66, // CTRL+B
CKEDITOR.CTRL + 73, // CTRL+I
CKEDITOR.CTRL + 85, // CTRL+U

CKEDITOR.CTRL + 89, // CTRL+Y
CKEDITOR.CTRL + 90, // CTRL+Z
CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 // CTRL+SHIFT+Z
CKEDITOR.CTRL + 85 // CTRL+U
]
};

Expand Down
17 changes: 14 additions & 3 deletions plugins/undo/plugin.js
Expand Up @@ -38,12 +38,23 @@
canUndo: false
} );

var keystrokes = [ CKEDITOR.CTRL + 90 /*Z*/, CKEDITOR.CTRL + 89 /*Y*/, CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/ ];

editor.setKeystroke( [
[ CKEDITOR.CTRL + 90 /*Z*/, 'undo' ],
[ CKEDITOR.CTRL + 89 /*Y*/, 'redo' ],
[ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/, 'redo' ]
[ keystrokes[ 0 ], 'undo' ],
[ keystrokes[ 1 ], 'redo' ],
[ keystrokes[ 2 ], 'redo' ]
] );

// Block undo/redo keystrokes when at the bottom/top of the undo stack (#11126 and #11677).
editor.on( 'contentDom', function() {
var editable = editor.editable();
editable.attachListener( editable, 'keydown', function( evt ) {
if ( CKEDITOR.tools.indexOf( keystrokes, evt.data.getKeystroke() ) > -1 )
evt.data.preventDefault();
} );
} );

undoManager.onChange = function() {
undoCommand.setState( undoManager.undoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
redoCommand.setState( undoManager.redoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
Expand Down

0 comments on commit 954f689

Please sign in to comment.