X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2Fpackagist%2Fpiedsjaloux-ckeditor-component.git;a=blobdiff_plain;f=sources%2Fplugins%2Fwidget%2Fdev%2Fassets%2Fsimplebox%2Fdialogs%2Fsimplebox.js;fp=sources%2Fplugins%2Fwidget%2Fdev%2Fassets%2Fsimplebox%2Fdialogs%2Fsimplebox.js;h=45a150c2f0bc291c8a86fd1556b21044135b9a71;hp=0000000000000000000000000000000000000000;hb=317f8f8f0651488f226b5280a8f036c7c135c639;hpb=1096cdefb1c9a3f3c4ca6807e272da6c92e5ed9c diff --git a/sources/plugins/widget/dev/assets/simplebox/dialogs/simplebox.js b/sources/plugins/widget/dev/assets/simplebox/dialogs/simplebox.js new file mode 100644 index 0000000..45a150c --- /dev/null +++ b/sources/plugins/widget/dev/assets/simplebox/dialogs/simplebox.js @@ -0,0 +1,51 @@ +// Note: This automatic widget to dialog window binding (the fact that every field is set up from the widget +// and is committed to the widget) is only possible when the dialog is opened by the Widgets System +// (i.e. the widgetDef.dialog property is set). +// When you are opening the dialog window by yourself, you need to take care of this by yourself too. + +CKEDITOR.dialog.add( 'simplebox', function( editor ) { + return { + title: 'Edit Simple Box', + minWidth: 200, + minHeight: 100, + contents: [ + { + id: 'info', + elements: [ + { + id: 'align', + type: 'select', + label: 'Align', + items: [ + [ editor.lang.common.notSet, '' ], + [ editor.lang.common.alignLeft, 'left' ], + [ editor.lang.common.alignRight, 'right' ], + [ editor.lang.common.alignCenter, 'center' ] + ], + // When setting up this field, set its value to the "align" value from widget data. + // Note: Align values used in the widget need to be the same as those defined in the "items" array above. + setup: function( widget ) { + this.setValue( widget.data.align ); + }, + // When committing (saving) this field, set its value to the widget data. + commit: function( widget ) { + widget.setData( 'align', this.getValue() ); + } + }, + { + id: 'width', + type: 'text', + label: 'Width', + width: '50px', + setup: function( widget ) { + this.setValue( widget.data.width ); + }, + commit: function( widget ) { + widget.setData( 'width', this.getValue() ); + } + } + ] + } + ] + }; +} );