]>
Commit | Line | Data |
---|---|---|
1 | // Note: This automatic widget to dialog window binding (the fact that every field is set up from the widget\r | |
2 | // and is committed to the widget) is only possible when the dialog is opened by the Widgets System\r | |
3 | // (i.e. the widgetDef.dialog property is set).\r | |
4 | // When you are opening the dialog window by yourself, you need to take care of this by yourself too.\r | |
5 | \r | |
6 | CKEDITOR.dialog.add( 'simplebox', function( editor ) {\r | |
7 | return {\r | |
8 | title: 'Edit Simple Box',\r | |
9 | minWidth: 200,\r | |
10 | minHeight: 100,\r | |
11 | contents: [\r | |
12 | {\r | |
13 | id: 'info',\r | |
14 | elements: [\r | |
15 | {\r | |
16 | id: 'align',\r | |
17 | type: 'select',\r | |
18 | label: 'Align',\r | |
19 | items: [\r | |
20 | [ editor.lang.common.notSet, '' ],\r | |
21 | [ editor.lang.common.alignLeft, 'left' ],\r | |
22 | [ editor.lang.common.alignRight, 'right' ],\r | |
23 | [ editor.lang.common.alignCenter, 'center' ]\r | |
24 | ],\r | |
25 | // When setting up this field, set its value to the "align" value from widget data.\r | |
26 | // Note: Align values used in the widget need to be the same as those defined in the "items" array above.\r | |
27 | setup: function( widget ) {\r | |
28 | this.setValue( widget.data.align );\r | |
29 | },\r | |
30 | // When committing (saving) this field, set its value to the widget data.\r | |
31 | commit: function( widget ) {\r | |
32 | widget.setData( 'align', this.getValue() );\r | |
33 | }\r | |
34 | },\r | |
35 | {\r | |
36 | id: 'width',\r | |
37 | type: 'text',\r | |
38 | label: 'Width',\r | |
39 | width: '50px',\r | |
40 | setup: function( widget ) {\r | |
41 | this.setValue( widget.data.width );\r | |
42 | },\r | |
43 | commit: function( widget ) {\r | |
44 | widget.setData( 'width', this.getValue() );\r | |
45 | }\r | |
46 | }\r | |
47 | ]\r | |
48 | }\r | |
49 | ]\r | |
50 | };\r | |
51 | } );\r |