Skip to content

Commit

Permalink
Merge branch 't/13344'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Jun 11, 2015
2 parents 5f9e21c + bb29482 commit e857553
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -24,6 +24,7 @@ Fixed Issues:
* [#13164](http://dev.ckeditor.com/ticket/13164): Fixed: Error when inserting a hidden field.
* [#13155](http://dev.ckeditor.com/ticket/13155): Fixed: Incorrect [Line Utilities](http://ckeditor.com/addon/lineutils) positioning when `<body>` has a margin.
* [#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)).
* [#13344](http://dev.ckeditor.com/ticket/13344): [Webkit/Blink] Fixed: It is possible to remove/change editor contents in readonly mode.

Other Changes:

Expand Down
4 changes: 4 additions & 0 deletions core/editable.js
Expand Up @@ -906,6 +906,10 @@
// blocks on BACKSPACE/DEL (#11861,#9998).
if ( CKEDITOR.env.webkit ) {
this.attachListener( editor, 'key', function( evt ) {
if ( editor.readOnly ) {
return true;
}

// Use getKey directly in order to ignore modifiers.
// Justification: http://dev.ckeditor.com/ticket/11861#comment:13
var key = evt.data.domEvent.getKey();
Expand Down
12 changes: 12 additions & 0 deletions tests/core/editable/keystrokes/delbackspacequirks/collapsed.js
Expand Up @@ -59,6 +59,18 @@
} );
},

'test backspace on two paragraphs in read-only mode': function() {
this.editor.setReadOnly( true );

try {
bf( '<p>Test</p><p>^Test</p>', '<p>Test</p><p>^Test</p>' ).call( this );
} catch ( e ) {
throw e;
} finally {
this.editor.setReadOnly( false );
}
},

'test CTRL+backspace works as backspace when merging blocks': assertKeystroke( BACKSPACE, CKEDITOR.CTRL, 0, '<p>x</p><p>^y</p>', '<p>x^y</p>' ),
'test SHIFT+backspace works as backspace when merging blocks': assertKeystroke( BACKSPACE, CKEDITOR.SHIFT, 0, '<p>x</p><p>^y</p>', '<p>x^y</p>' ),
'test CTRL+delete works as delete when merging blocks': assertKeystroke( DEL, CKEDITOR.CTRL, 0, '<p>x^</p><p>y</p>', '<p>x^y</p>' ),
Expand Down
18 changes: 16 additions & 2 deletions tests/core/editable/keystrokes/delbackspacequirks/expanded.js
Expand Up @@ -2,7 +2,7 @@
/* bender-ckeditor-plugins: list,table,undo */
/* global quirksTools */

( function( bd, bdf, b ) {
( function( bd, bdf, b, df ) {
'use strict';

bender.editor = {
Expand Down Expand Up @@ -48,6 +48,18 @@
} );
},

'test delete on two paragraphs in read-only mode': function() {
this.editor.setReadOnly( true );

try {
df( '<p>[Test</p><p>Test]</p>', '<p>[Test</p><p>Test]</p>' ).call( this );
} catch ( e ) {
throw e;
} finally {
this.editor.setReadOnly( false );
}
},

'test backspace and delete #1': bd( '<p>xx[x</p><p>y]yy</p>', '<p>xx^yy</p>' ),
'test backspace and delete #2': bd( '<div>xx[x</div><div>y]yy</div>', '<div>xx^yy</div>' ),
'test backspace and delete #3': bd( '<p>x<strong>x[x</strong></p><p>y]yy</p>', '<p>x<strong>x^</strong>yy</p>' ),
Expand Down Expand Up @@ -87,4 +99,6 @@
'test backspace and delete, no action #5': bdf( '<p>x[xy]y</p>' ),
'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>' )
} );
} )( quirksTools.bd, quirksTools.bdf, quirksTools.b );


} )( quirksTools.bd, quirksTools.bdf, quirksTools.b, quirksTools.df );
@@ -0,0 +1,15 @@
<div id="editor">
<h1>TC1:</h1>
<p>Foo [bar</p>
<p>Bom] bom</p>

<h1>TC2:</h1>
<p>^Foo bar</p>
</div>

<script>
CKEDITOR.replace( 'editor', {
readOnly: true,
height: 500
} );
</script>
@@ -0,0 +1,17 @@
@bender-tags: 4.4.8, tc, 13344
@bender-ui: collapsed
@bender-ckeditor-plugins: toolbar, format, wysiwygarea

Note: Editor is in the read-only mode.

## TC1:

1. Make selection as shown with `[ ]`.
2. Press *Delete/Backspace*.
3. Nothing should happen.

## TC2:

1. Click before `^` (as you would like to make a selection there).
2. Press *Delete/Backspace*.
3. Nothing should happen.

0 comments on commit e857553

Please sign in to comment.