Skip to content
Permalink
Browse files

Merge branch 't/16850' into major

  • Loading branch information...
Comandeer committed Feb 28, 2017
2 parents 191a00e + c9ba18c commit 56e6fdaebdae3665b149463f6fa7ede4e2588e91
@@ -6,6 +6,7 @@
New Features:

* [#16818](http://dev.ckeditor.com/ticket/16818): Added table cell height parsing in the [Paste from Word](http://ckeditor.com/addon/pastefromword) plugin.
* [#16850](http://dev.ckeditor.com/ticket/16850): Added new `config.enableContextMenu` configuration option for enabling and disabling [Context Menu](http://ckeditor.com/addon/contextmenu).

Fixed Issues:

@@ -111,6 +111,10 @@ CKEDITOR.plugins.add( 'contextmenu', {
* @param {Number} [offsetY]
*/
open: function( offsetParent, corner, offsetX, offsetY ) {
if ( this.editor.config.enableContextMenu === false ) {
return;
}

this.editor.focus();
offsetParent = offsetParent || CKEDITOR.document.getDocumentElement();

@@ -157,3 +161,13 @@ CKEDITOR.plugins.add( 'contextmenu', {
* @cfg {Boolean} [browserContextMenuOnCtrl=true]
* @member CKEDITOR.config
*/

/**
* Whether to enable the context menu. Regardless of the setting the plugin is still loaded.
*
* config.enableContextMenu = true;
*
* @since 4.7.0
* @cfg {Boolean} [enableContextMenu=true]
* @member CKEDITOR.config
*/
@@ -31,6 +31,33 @@
} );
},

'test opening context menu default config': function() {
bender.editorBot.create( {
name: 'editor_nocontextmenu1'
}, function( bot ) {
bot.editor.contextMenu.show = sinon.spy();

bot.editor.contextMenu.open( bot.editor.editable() );

assert.isTrue( bot.editor.contextMenu.show.called );
} );
},

'test opening disabled context menu': function() {
bender.editorBot.create( {
name: 'editor_nocontextmenu2',
config: {
enableContextMenu: false
}
}, function( bot ) {
bot.editor.contextMenu.show = sinon.spy();

bot.editor.contextMenu.open( bot.editor.editable() );

assert.isFalse( bot.editor.contextMenu.show.called );
} );
},

'#9706: test opening contextmenu in editable that does not autoparagraph': function() {
bender.editorBot.create( {
name: 'editor3',
@@ -0,0 +1,22 @@
<textarea id="editor1" cols="10" rows="10">
<table border="1" cellspacing="1" cellpadding="1" style="width:500px">
<tbody>
<tr>
<td colspan="2" style="background-color:#ffdddd"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</textarea>
<script>
CKEDITOR.replace( 'editor1', {
enableContextMenu: false
} );
</script>
@@ -0,0 +1,12 @@
@bender-ui: collapsed
@bender-tags: wyswigarea, tc, 4.7.0, 16850
@bender-ckeditor-plugins: wysiwygarea,toolbar,table,tabletools,sourcearea

**Test Scenario**

1. Make sure you see a table with a pink, one-cell first row.
2. Try to open the context menu by right-clicking on the table.

**Expected**

Context menu does not appear.

0 comments on commit 56e6fda

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