Skip to content
Permalink
Browse files

Merge branch 't/13548'

  • Loading branch information...
Comandeer committed Aug 23, 2016
2 parents 8ec2d2f + fad8078 commit 24f2f3ce910b3eabf0c2281e56ff72e9ed94bfe1
Showing with 75 additions and 5 deletions.
  1. +1 −0 CHANGES.md
  2. +12 −3 plugins/elementspath/plugin.js
  3. +48 −2 tests/core/command/command.js
  4. +4 −0 tests/tickets/13548/1.html
  5. +10 −0 tests/tickets/13548/1.md
@@ -10,6 +10,7 @@ New Features:
Fixed Issues:

* [#13755](http://dev.ckeditor.com/ticket/13755): [Edge] Fixed: Pasting images in Edge does not work.
* [#13548](http://dev.ckeditor.com/ticket/13548): [Internet Explorer] Fixed: Clicking on element's path disables cut/copy icons.

## CKEditor 4.5.10

@@ -91,13 +91,22 @@
} );

function onClick( elementIndex ) {
var element = elementsPath.list[ elementIndex ];
var element = elementsPath.list[ elementIndex ],
selection;

if ( element.equals( editor.editable() ) || element.getAttribute( 'contenteditable' ) == 'true' ) {
var range = editor.createRange();
range.selectNodeContents( element );
range.select();

selection = range.select();
} else {
editor.getSelection().selectElement( element );
selection = editor.getSelection();
selection.selectElement( element );
}

// Explicitly fire selectionChange when clicking on an element path button. (#13548)
if ( CKEDITOR.env.ie ) {
editor.fire( 'selectionChange', { selection: selection, path: new CKEDITOR.dom.elementPath( element ) } );
}

// It is important to focus() *after* the above selection
@@ -1,6 +1,6 @@
/* bender-tags: editor,unit */
// jscs:disable maximumLineLength
/* bender-ckeditor-plugins: basicstyles,bidi,blockquote,button,clipboard,colorbutton,dialog,div,docprops,find,flash,font,format,forms,horizontalrule,iframe,iframedialog,image,indent,justify,link,list,listblock,maximize,newpage,pagebreak,pastefromword,pastetext,placeholder,preview,print,removeformat,save,selectall,showblocks,showborders,smiley,sourcearea,specialchar,stylescombo,table,templates,toolbar,uicolor,undo */
/* bender-ckeditor-plugins: basicstyles,bidi,blockquote,button,clipboard,colorbutton,dialog,div,docprops,elementspath,find,flash,font,format,forms,horizontalrule,iframe,iframedialog,image,indent,justify,link,list,listblock,maximize,newpage,pagebreak,pastefromword,pastetext,placeholder,preview,print,removeformat,save,selectall,showblocks,showborders,smiley,sourcearea,specialchar,stylescombo,table,templates,toolbar,uicolor,undo */
// jscs:enable maximumLineLength

// This list of commands are to be maintained whenever new commands are added.
@@ -256,5 +256,51 @@ bender.test( {

assert.isFalse( cmd.checkAllowed(), 'is not allowed - cache' );
assert.isTrue( cmd.checkAllowed( true ), 'is allowed - no cache' );
},

// #13548
'test copy command not disabled after clicking on elements path': function() {
if ( !CKEDITOR.env.ie ) {
assert.ignore();
return;
}

var editor = this.editor,
cmd = editor.getCommand( 'copy' );

var bot = this.editorBot;
bot.setHtmlWithSelection( '<p><strong>test^</strong></p>' );

editor.once( 'selectionChange', function() {
resume( function() {
assert.areNotSame( cmd.state, CKEDITOR.TRISTATE_DISABLED );
} );
} );
editor._.elementsPath.onClick( 0 );

wait();
},

// #13548
'test cut command not disabled after clicking on elements path': function() {
if ( !CKEDITOR.env.ie ) {
assert.ignore();
return;
}

var editor = this.editor,
cmd = editor.getCommand( 'cut' );

var bot = this.editorBot;
bot.setHtmlWithSelection( '<p><strong>test^</strong></p>' );

editor.once( 'selectionChange', function() {
resume( function() {
assert.areNotSame( cmd.state, CKEDITOR.TRISTATE_DISABLED );
} );
} );
editor._.elementsPath.onClick( 0 );

wait();
}
} );
} );
@@ -0,0 +1,4 @@
<textarea id="editor1"><p><strong>Test</strong></p></textarea>
<script>
var editor = CKEDITOR.replace( 'editor1' );
</script>
@@ -0,0 +1,10 @@
@bender-tags: 4.5.11, tc, elementspath, 13548
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, toolbar, clipboard, elementspath, basicstyles

### Only in IE 9-11

1. Place the caret at the end of the text.
2. Click the "body" button in the elements path.

**Expected**: "Test" should get selected and the cut and copy buttons should activate.

0 comments on commit 24f2f3c

Please sign in to comment.
You can’t perform that action at this time.