|
770 | 770 | */
|
771 | 771 | repository: widgetsRepo,
|
772 | 772 |
|
| 773 | + draggable: widgetDef.draggable !== false, |
| 774 | + |
773 | 775 | // WAAARNING: Overwrite widgetDef's priv object, because otherwise violent unicorn's gonna visit you.
|
774 | 776 | _: {
|
775 | 777 | downcastFn: ( widgetDef.downcast && typeof widgetDef.downcast == 'string' ) ?
|
|
2309 | 2311 | }
|
2310 | 2312 |
|
2311 | 2313 | function setupDragHandler( widget ) {
|
| 2314 | + if ( !widget.draggable ) |
| 2315 | + return; |
| 2316 | + |
2312 | 2317 | var editor = widget.editor,
|
2313 | 2318 | img = new CKEDITOR.dom.element( 'img', editor.document ),
|
2314 | 2319 | container = new CKEDITOR.dom.element( 'span', editor.document );
|
|
2425 | 2430 | if ( widgetDef.edit )
|
2426 | 2431 | widget.on( 'edit', widgetDef.edit );
|
2427 | 2432 |
|
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 | + } |
2431 | 2438 | }
|
2432 | 2439 |
|
2433 | 2440 | function setupWidgetData( widget, startupData ) {
|
|
2716 | 2723 | * @property {String} button
|
2717 | 2724 | */
|
2718 | 2725 |
|
| 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 | + |
2719 | 2733 | /**
|
2720 | 2734 | * This is an abstract class that describes the definition of a widget's nested editable.
|
2721 | 2735 | * It is a type of values in the {@link CKEDITOR.plugins.widget.definition#editables} object.
|
|
0 commit comments