Skip to content

Commit 3b38fe9

Browse files
committed
Merge branch 't/9761'
2 parents beb5383 + 56df89a commit 3b38fe9

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CKEditor 4 Changelog
44
## CKEditor 4.1.2
55

66
* [#10389](http://dev.ckeditor.com/ticket/10389): Invalid closing tag </tr> in a sample "Text and Table" template.
7+
* [#9761](http://dev.ckeditor.com/ticket/9761): Update BACKSPACE key state in blockedKeystrokes when using editor.setReadOnly().
78

89
## CKEditor 4.1.1
910

core/editable.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,11 @@
432432

433433
// Setup editor keystroke handlers on this element.
434434
var keystrokeHandler = editor.keystrokeHandler;
435-
keystrokeHandler.blockedKeystrokes[ 8 ] = editor.readOnly;
435+
436+
// If editor is read-only, then make sure that BACKSPACE key
437+
// is blocked to prevent browser history navigation.
438+
keystrokeHandler.blockedKeystrokes[ 8 ] = +editor.readOnly;
439+
436440
editor.keystrokeHandler.attach( this );
437441

438442
// Update focus states.

core/editor.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,10 @@
840840
if ( this.readOnly != isReadOnly ) {
841841
this.readOnly = isReadOnly;
842842

843+
// Block or release BACKSPACE key according to current read-only
844+
// state to prevent browser's history navigation (#9761).
845+
this.keystrokeHandler.blockedKeystrokes[ 8 ] = +isReadOnly;
846+
843847
this.editable().setReadOnly( isReadOnly );
844848

845849
// Fire the readOnly event so the editor features can update

0 commit comments

Comments
 (0)