Skip to content

Commit e857553

Browse files
committed
Merge branch 't/13344'
2 parents 5f9e21c + bb29482 commit e857553

File tree

6 files changed

+65
-2
lines changed

6 files changed

+65
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Fixed Issues:
2424
* [#13164](http://dev.ckeditor.com/ticket/13164): Fixed: Error when inserting a hidden field.
2525
* [#13155](http://dev.ckeditor.com/ticket/13155): Fixed: Incorrect [Line Utilities](http://ckeditor.com/addon/lineutils) positioning when `<body>` has a margin.
2626
* [#13351](http://dev.ckeditor.com/ticket/13351): Fixed: Link lost when editing linked image with the link tab disabled. Also, fixed a bug when inserting an image into fully selected link would throw an error ([#12847](https://dev.ckeditor.com/ticket/12847)).
27+
* [#13344](http://dev.ckeditor.com/ticket/13344): [Webkit/Blink] Fixed: It is possible to remove/change editor contents in readonly mode.
2728

2829
Other Changes:
2930

core/editable.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,10 @@
906906
// blocks on BACKSPACE/DEL (#11861,#9998).
907907
if ( CKEDITOR.env.webkit ) {
908908
this.attachListener( editor, 'key', function( evt ) {
909+
if ( editor.readOnly ) {
910+
return true;
911+
}
912+
909913
// Use getKey directly in order to ignore modifiers.
910914
// Justification: http://dev.ckeditor.com/ticket/11861#comment:13
911915
var key = evt.data.domEvent.getKey();

tests/core/editable/keystrokes/delbackspacequirks/collapsed.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@
5959
} );
6060
},
6161

62+
'test backspace on two paragraphs in read-only mode': function() {
63+
this.editor.setReadOnly( true );
64+
65+
try {
66+
bf( '<p>Test</p><p>^Test</p>', '<p>Test</p><p>^Test</p>' ).call( this );
67+
} catch ( e ) {
68+
throw e;
69+
} finally {
70+
this.editor.setReadOnly( false );
71+
}
72+
},
73+
6274
'test CTRL+backspace works as backspace when merging blocks': assertKeystroke( BACKSPACE, CKEDITOR.CTRL, 0, '<p>x</p><p>^y</p>', '<p>x^y</p>' ),
6375
'test SHIFT+backspace works as backspace when merging blocks': assertKeystroke( BACKSPACE, CKEDITOR.SHIFT, 0, '<p>x</p><p>^y</p>', '<p>x^y</p>' ),
6476
'test CTRL+delete works as delete when merging blocks': assertKeystroke( DEL, CKEDITOR.CTRL, 0, '<p>x^</p><p>y</p>', '<p>x^y</p>' ),

tests/core/editable/keystrokes/delbackspacequirks/expanded.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* bender-ckeditor-plugins: list,table,undo */
33
/* global quirksTools */
44

5-
( function( bd, bdf, b ) {
5+
( function( bd, bdf, b, df ) {
66
'use strict';
77

88
bender.editor = {
@@ -48,6 +48,18 @@
4848
} );
4949
},
5050

51+
'test delete on two paragraphs in read-only mode': function() {
52+
this.editor.setReadOnly( true );
53+
54+
try {
55+
df( '<p>[Test</p><p>Test]</p>', '<p>[Test</p><p>Test]</p>' ).call( this );
56+
} catch ( e ) {
57+
throw e;
58+
} finally {
59+
this.editor.setReadOnly( false );
60+
}
61+
},
62+
5163
'test backspace and delete #1': bd( '<p>xx[x</p><p>y]yy</p>', '<p>xx^yy</p>' ),
5264
'test backspace and delete #2': bd( '<div>xx[x</div><div>y]yy</div>', '<div>xx^yy</div>' ),
5365
'test backspace and delete #3': bd( '<p>x<strong>x[x</strong></p><p>y]yy</p>', '<p>x<strong>x^</strong>yy</p>' ),
@@ -87,4 +99,6 @@
8799
'test backspace and delete, no action #5': bdf( '<p>x[xy]y</p>' ),
88100
'test backspace and delete, no action #6': bdf( '<table><tbody><tr><td>x[x</td></tr></tbody></table><table><tbody><tr><td>y]y</td></tr></tbody></table>' )
89101
} );
90-
} )( quirksTools.bd, quirksTools.bdf, quirksTools.b );
102+
103+
104+
} )( quirksTools.bd, quirksTools.bdf, quirksTools.b, quirksTools.df );
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<div id="editor">
2+
<h1>TC1:</h1>
3+
<p>Foo [bar</p>
4+
<p>Bom] bom</p>
5+
6+
<h1>TC2:</h1>
7+
<p>^Foo bar</p>
8+
</div>
9+
10+
<script>
11+
CKEDITOR.replace( 'editor', {
12+
readOnly: true,
13+
height: 500
14+
} );
15+
</script>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@bender-tags: 4.4.8, tc, 13344
2+
@bender-ui: collapsed
3+
@bender-ckeditor-plugins: toolbar, format, wysiwygarea
4+
5+
Note: Editor is in the read-only mode.
6+
7+
## TC1:
8+
9+
1. Make selection as shown with `[ ]`.
10+
2. Press *Delete/Backspace*.
11+
3. Nothing should happen.
12+
13+
## TC2:
14+
15+
1. Click before `^` (as you would like to make a selection there).
16+
2. Press *Delete/Backspace*.
17+
3. Nothing should happen.

0 commit comments

Comments
 (0)