From 07adffb1d73ba4003dee802c69e67efc33ef613e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Wed, 16 Oct 2013 20:21:22 +0200 Subject: [PATCH 1/2] Added widgetDef.draggable option. --- plugins/widget/plugin.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/widget/plugin.js b/plugins/widget/plugin.js index 67ea6850d88..fbbfbb12321 100644 --- a/plugins/widget/plugin.js +++ b/plugins/widget/plugin.js @@ -770,6 +770,8 @@ */ repository: widgetsRepo, + draggable: widgetDef.draggable !== false, + // WAAARNING: Overwrite widgetDef's priv object, because otherwise violent unicorn's gonna visit you. _: { downcastFn: ( widgetDef.downcast && typeof widgetDef.downcast == 'string' ) ? @@ -2309,6 +2311,9 @@ } function setupDragHandler( widget ) { + if ( !widget.draggable ) + return; + var editor = widget.editor, img = new CKEDITOR.dom.element( 'img', editor.document ), container = new CKEDITOR.dom.element( 'span', editor.document ); @@ -2425,9 +2430,11 @@ if ( widgetDef.edit ) widget.on( 'edit', widgetDef.edit ); - widget.on( 'data', function() { - positionDragHandler( widget ); - }, null, null, 999 ); + if ( widget.draggable ) { + widget.on( 'data', function() { + positionDragHandler( widget ); + }, null, null, 999 ); + } } function setupWidgetData( widget, startupData ) { @@ -2716,6 +2723,13 @@ * @property {String} button */ +/** + * Whether widget should be draggable. Defaults to `true`. + * If set to `false` drag handler will not be displayed when hovering widget. + * + * @property {Boolean} draggable + */ + /** * This is an abstract class that describes the definition of a widget's nested editable. * It is a type of values in the {@link CKEDITOR.plugins.widget.definition#editables} object. From 0966519448281542253eb18fccf4bac41a098f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Fri, 18 Oct 2013 18:20:58 +0200 Subject: [PATCH 2/2] Changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index f693be48700..1d2a807f968 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ CKEditor 4 Changelog New Features: * [#10855](http://dev.ckeditor.com/ticket/10855): Change extension of emotes in BBCode sample from GIF to PNG. +* [#11002](http://dev.ckeditor.com/ticket/11002): Added option to disable widgets drag and drop support. * [#10430](http://dev.ckeditor.com/ticket/10430): Resolve dependence of image plugin if forms plugin. * [#10937](http://dev.ckeditor.com/ticket/10937): MathJax widget improvements: * loading indicator,