Skip to content

Commit ca537ae

Browse files
committed
Merge branch 't/11002' into major
2 parents 74daa1f + 0966519 commit ca537ae

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CKEditor 4 Changelog
66
New Features:
77

88
* [#10855](http://dev.ckeditor.com/ticket/10855): Change extension of emotes in BBCode sample from GIF to PNG.
9+
* [#11002](http://dev.ckeditor.com/ticket/11002): Added option to disable widgets drag and drop support.
910
* [#10430](http://dev.ckeditor.com/ticket/10430): Resolve dependence of image plugin if forms plugin.
1011
* [#10937](http://dev.ckeditor.com/ticket/10937): MathJax widget improvements:
1112
* loading indicator,

plugins/widget/plugin.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,8 @@
770770
*/
771771
repository: widgetsRepo,
772772

773+
draggable: widgetDef.draggable !== false,
774+
773775
// WAAARNING: Overwrite widgetDef's priv object, because otherwise violent unicorn's gonna visit you.
774776
_: {
775777
downcastFn: ( widgetDef.downcast && typeof widgetDef.downcast == 'string' ) ?
@@ -2309,6 +2311,9 @@
23092311
}
23102312

23112313
function setupDragHandler( widget ) {
2314+
if ( !widget.draggable )
2315+
return;
2316+
23122317
var editor = widget.editor,
23132318
img = new CKEDITOR.dom.element( 'img', editor.document ),
23142319
container = new CKEDITOR.dom.element( 'span', editor.document );
@@ -2425,9 +2430,11 @@
24252430
if ( widgetDef.edit )
24262431
widget.on( 'edit', widgetDef.edit );
24272432

2428-
widget.on( 'data', function() {
2429-
positionDragHandler( widget );
2430-
}, null, null, 999 );
2433+
if ( widget.draggable ) {
2434+
widget.on( 'data', function() {
2435+
positionDragHandler( widget );
2436+
}, null, null, 999 );
2437+
}
24312438
}
24322439

24332440
function setupWidgetData( widget, startupData ) {
@@ -2716,6 +2723,13 @@
27162723
* @property {String} button
27172724
*/
27182725

2726+
/**
2727+
* Whether widget should be draggable. Defaults to `true`.
2728+
* If set to `false` drag handler will not be displayed when hovering widget.
2729+
*
2730+
* @property {Boolean} draggable
2731+
*/
2732+
27192733
/**
27202734
* This is an abstract class that describes the definition of a widget's nested editable.
27212735
* It is a type of values in the {@link CKEDITOR.plugins.widget.definition#editables} object.

0 commit comments

Comments
 (0)