12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- CKEDITOR.dialog.add( 'chainDialog', function( editor ) {
- return {
- title: 'Âñòàâêà Îïðîñà',
- minWidth: 400,
- minHeight: 200,
- contents: [
- {
- id: 'tab-basic',
- label: 'Áàçîâûå',
- elements: [
- {
- type: 'text',
- id: 'url',
- label: 'Âñòàâüòå íîìåð òðàíñëÿöèè, áðàòü ó ðîáîòà',
- validate: CKEDITOR.dialog.validate.notEmpty( "Ïîëå äëÿ íîìåðà òðàíñëÿöèè, íå äîëæíî áûòü ïóñòûì" ),
- setup: function( element ) {
- //his.setValue( 'hhhh' );
- this.setValue( element.getAttribute( "url" ) );
- console.log( element );
- },
- commit: function( element ) {
- element.setText( this.getValue() );
- }
- },
- {
- type: 'radio',
- id: 'type',
- label: 'Âûáðàòü',
- items: [ [ 'Âàðèàíò - timeline', '1' ], [ 'Âàðèàíò - ñòðîãèé', '2' ] ],
- 'default': '1',
- setup: function( element ) {
- console.log(element.getAttribute( "type" ));
- this.setValue( element.getAttribute( "type" ) );
- },
- commit: function( element ) {
- element.setAttribute( "type", this.getValue() );
- }
- }
- ]
- },
- ],
- onShow: function() {
- var selection = editor.getSelection();
- var element = selection.getStartElement();
- // if ( element )
- // element = element.getAttribute( 'url' );
- //console.log($(element).attr('id'));
- if ( !element || $(element).attr('id') != 'widgetchain' ) {
- element = editor.document.createElement( 'chain' );
- this.insertMode = true;
- }
- else
- this.insertMode = false;
- this.element = element;
- // console.log(element);
- // console.log(selection);
- if ( !this.insertMode )
- this.setupContent( this.element );
- },
- onOk: function() {
- var dialog = this;
- var chain = editor.document.createElement( 'div' );
- chain.setAttribute('id', 'widgetchain');
- chain.setAttribute( 'type', dialog.getValueOf('tab-basic', 'type') );
- chain.setAttribute( 'url', dialog.getValueOf( 'tab-basic', 'url' ) );
- chain.setHtml(' ');
- //this.commitContent( chain );
- editor.insertElement( chain );
- }
- };
- });
|