seting.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. CKEDITOR.dialog.add( 'setingDialog', function( editor ) {
  2. return {
  3. title: 'Âñòàâêà Íàñòðîåê',
  4. minWidth: 400,
  5. minHeight: 200,
  6. contents: [
  7. {
  8. id: 'tab-basic',
  9. label: 'Áàçîâûå',
  10. elements: [
  11. {
  12. type: 'select',
  13. id: 'window',
  14. label: 'Ðàñòÿíóòü áëîê íà âñþ øèðèíó?',
  15. items: [
  16. [ 'íåò', '' ],
  17. [ 'Äà', '100' ],
  18. [ 'Íà âåñü ýêðàí', 'full' ]
  19. ],
  20. 'default': '',
  21. setup: function( element ) {
  22. console.log(element.getAttribute( "windows" ));
  23. this.setValue( element.getAttribute( "windows" ) );
  24. },
  25. commit: function( element ) {
  26. element.setAttribute( "windows", this.getValue() );
  27. }
  28. }
  29. ]
  30. },
  31. ],
  32. onShow: function() {
  33. var selection = editor.getSelection();
  34. // var element = selection.getStartElement();
  35. // console.log(selection);
  36. var element = selection.document.getById( 'widgetseting' );
  37. console.log(element);
  38. if ( !element || element.getAttribute('id') != 'widgetseting' ) {
  39. element = editor.document.createElement( 'div' );
  40. console.log('new');
  41. this.insertMode = true;
  42. }
  43. else
  44. this.insertMode = false;
  45. this.element = element;
  46. // console.log(element);
  47. // console.log(this);
  48. if ( !this.insertMode )
  49. this.setupContent( this.element );
  50. },
  51. onOk: function() {
  52. var dialog = this;
  53. var selection = editor.getSelection();
  54. var element = selection.document.getById( 'widgetseting' );
  55. if( !element ){
  56. var seting = editor.document.createElement( 'div' );
  57. }else{
  58. var seting = element;
  59. }
  60. seting.setAttribute('id', 'widgetseting');
  61. seting.setAttribute( 'windows', dialog.getValueOf('tab-basic', 'window') );
  62. // seting.data( 'setings' );
  63. editor.insertElement( seting );
  64. }
  65. };
  66. });