Skip to content

Commit

Permalink
Merge branch 't/11002' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Oct 18, 2013
2 parents 74daa1f + 0966519 commit ca537ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 17 additions & 3 deletions plugins/widget/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) ?
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit ca537ae

Please sign in to comment.