ckeditor/ckeditor-dev — pull request #152 by tiemevanveen (2014-12-17 13:40:15+00:00)
Title: Added commandData to addWidgetCommand

Currently it's not possible to instantiate a new widget with existing data.
See bug: http://dev.ckeditor.com/ticket/12770

> According to the execCommand docs it should be possible to provide data to the execCommand ​http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-execCommand
> But when using this code none of that data ends up in the newly created widget, or in it's init or data methods
> `editor.execCommand( 'simplebox', { align: 'right', opened: false } );`

This commit fixes the bug.

Now new widgets can be instantiated with predefined data.

editor.execCommand( 'simplebox', { align: 'right', opened: false } );

Or completely custom

var element = editor.createElement( 'div' );
editor.insertElement( element );
var widget = editor.widgets.initOn( element, 'simplebox', { align: 'right', opened: false } );

I've ran these tests with bender to confirm this does not break anything:

- name:nestedwidgets
- name:widgetapi
- name:widgets
- name:widgetselection
- name:widgetsintegration
- name:widgetsrepoapi
- path:/tests/plugins/widget
- tag:widget
- tag:widgetcore