CKEDITOR.dialog.add( 'setingDialog', function( editor ) { return { title: 'Вставка Настроек', minWidth: 400, minHeight: 200, contents: [ { id: 'tab-basic', label: 'Базовые', elements: [ { type: 'select', id: 'window', label: 'Растянуть блок на всю ширину?', items: [ [ 'нет', '' ], [ 'Да', '100' ], [ 'На весь экран', 'full' ] ], 'default': '', setup: function( element ) { console.log(element.getAttribute( "windows" )); this.setValue( element.getAttribute( "windows" ) ); }, commit: function( element ) { element.setAttribute( "windows", this.getValue() ); } } ] }, ], onShow: function() { var selection = editor.getSelection(); // var element = selection.getStartElement(); // console.log(selection); var element = selection.document.getById( 'widgetseting' ); console.log(element); if ( !element || element.getAttribute('id') != 'widgetseting' ) { element = editor.document.createElement( 'div' ); console.log('new'); this.insertMode = true; } else this.insertMode = false; this.element = element; // console.log(element); // console.log(this); if ( !this.insertMode ) this.setupContent( this.element ); }, onOk: function() { var dialog = this; var selection = editor.getSelection(); var element = selection.document.getById( 'widgetseting' ); if( !element ){ var seting = editor.document.createElement( 'div' ); }else{ var seting = element; } seting.setAttribute('id', 'widgetseting'); seting.setAttribute( 'windows', dialog.getValueOf('tab-basic', 'window') ); // seting.data( 'setings' ); editor.insertElement( seting ); } }; });