1CKEDITOR.dialog.add( 'wrapDialolg', function( editor ) { 2 var wr_lang = editor.config.wrap_lang; 3 var installed_lang =editor.lang.wrap; 4 var icon_path = DOKU_BASE + 'lib/plugins/wrap/images/'; 5 var toolbar_path = icon_path + 'toolbar/'; 6 var icons16_path = icon_path + 'note/16/'; 7 8 var cols = installed_lang['column'] || wr_lang['column'] || 'columns'; 9 var box = installed_lang['box'] || wr_lang['box'] || 'simple centered box'; 10 var info_box = installed_lang['info'] || wr_lang['info'] || 'info box'; 11 var tip_box = installed_lang['tip'] || wr_lang['tip'] || 'tip box'; 12 var important_box = installed_lang['important'] || wr_lang['important'] || 'important box'; 13 var alert_box = installed_lang['alert'] || wr_lang['alert'] || 'alert box'; 14 var help_box = installed_lang['help'] || wr_lang['help'] || 'help box'; 15 var download_box = installed_lang['download'] || wr_lang['download'] || 'download box'; 16 var todo_box = installed_lang['todo'] || wr_lang['todo'] || 'todo box'; 17 var clear_floats = installed_lang['clear'] || wr_lang['clear'] || 'clear floats'; 18 var emphasized = installed_lang['em'] || wr_lang['em'] || 'especially emphasised'; 19 var highlighted = installed_lang['hi'] || wr_lang['hi'] || 'highlighted'; 20 var less_significant = installed_lang['lo'] || wr_lang['lo'] || 'less significant'; 21 var Columns = '<img src= "' + toolbar_path + 'column.png" title="' +cols+'">'; 22 var Box = '<img src= "' + toolbar_path + 'box.png" title="' +box + '">'; 23 var InfoBox = '<img src= "' + icons16_path + 'info.png" title="'+info_box+'">'; 24 var TipBox = '<img src= "' + icons16_path + 'tip.png" title="'+tip_box+'">'; 25 var ImportantBox = '<img src= "' + icons16_path + 'important.png" title="'+important_box+'">'; 26 var AlertBox='<img src= "' + icons16_path + 'alert.png" title="'+alert_box+'">'; 27 var HelpBox='<img src= "' + icons16_path + 'help.png" title="'+help_box+'">'; 28 var DownloadBox='<img src= "' + icons16_path + 'download.png" title="'+download_box+'">'; 29 var ToDoBox='<img src= "' + icons16_path + 'todo.png" title="'+todo_box+'">'; 30 var Clear ='<img src= "' + toolbar_path + 'clear.png" title="'+clear_floats+'">'; 31 var Emphasis ='<img src= "' + toolbar_path + 'em.png" title="'+emphasized+'">'; 32 var Hi ='<img src= "' + toolbar_path + 'hi.png" title="'+highlighted+'">'; 33 var Lo ='<img src= "' + toolbar_path + 'lo.png" title="'+less_significant+'">'; 34 return { 35 title: 'wrap Properties', 36 minWidth: 460, 37 minHeight: 200, 38 contents: [ 39 { 40 id: 'tab-basic', 41 label: 'Basic wrap', 42 elements: [ 43 { 44 type: 'radio', 45 id: 'div_types', 46 label: editor.lang.wrap.boxes_title||'Box types:', 47 //label: editor.lang.wrap.selectOption, 48 items: [ [Box, 'box' ] , [ InfoBox, 'info' ] ,[TipBox,'tip'],[ImportantBox,'important'],[AlertBox,'alert'], 49 [HelpBox ,'help box'],[DownloadBox,'download'],[ ToDoBox,'todo']], 50 style: 'color: black', 51 'default': '', 52 }, 53 { 54 type: 'radio', 55 id: 'specials', 56 label: editor.lang.wrap.specials_title || 'Special types and Styles', 57 //label: editor.lang.wrap.selectOption, 58 items: [[ Columns, 'column' ], [Clear,'clear floats'],[Emphasis,'em'],[Hi,'hi'],[Lo,'lo']], 59 style: 'color: black', 60 'default': '', 61 }, 62 { 63 type: 'text', 64 id: 'wrap', 65 label: editor.lang.wrap.content || 'Content (optional):', 66 'default': '' 67 } 68 ] 69 } 70 ], 71 // Invoked when the dialog is loaded. 72 onShow: function() { 73 // Get the selection from the editor. 74 var text = editor.getSelection().getSelectedText(); 75 if(text) { 76 this.getContentElement( 'tab-basic', 'wrap').disable(); 77 this.setValueOf( 'tab-basic', 'wrap',text); 78 } 79 else this.text = false; 80 }, 81 82 onOk: function() { 83 var dialog = this; 84 85 var syntaxDiv = editor.config.wrapSyntaxDiv ? editor.config.wrapSyntaxDiv : 'WRAP'; 86 var syntaxSpan = editor.config.wrapSyntaxSpan ? editor.config.wrapSyntaxSpan : 'wrap'; 87 var syntaxDiv = syntaxDiv; 88 var syntaxSpan = syntaxSpan; 89 var open = ""; 90 var close = ""; 91 92 var TypeValue = dialog.getValueOf( 'tab-basic', 'div_types' ); 93 if(!TypeValue) TypeValue = dialog.getValueOf( 'tab-basic', 'specials' ); 94 95 switch (TypeValue) { 96 case 'column': 97 open = '<'+syntaxDiv+' group>\n<'+syntaxDiv+' half column>\n'; 98 close = '\n</'+syntaxDiv+'>\n\n<'+syntaxDiv+' half column>\n\n</'+syntaxDiv+'>\n</'+syntaxDiv+'>\n'; 99 break; 100 case 'box': 101 open = '<'+syntaxDiv+' center round box 60%>\n'; 102 close = '\n</'+syntaxDiv+'>\n'; 103 break; 104 case 'info': 105 open = '<'+syntaxDiv+' center round info 60%>\n'; 106 close = '\n</'+syntaxDiv+'>\n'; 107 break; 108 case 'tip': 109 open = '<'+syntaxDiv+' center round tip 60%>\n'; 110 close = '\n</'+syntaxDiv+'>\n'; 111 break; 112 case 'important': 113 open = '<'+syntaxDiv+' center round important 60%>\n'; 114 close = '\n</'+syntaxDiv+'>\n'; 115 break; 116 case 'alert': 117 open = '<'+syntaxDiv+' center round alert 60%>\n'; 118 close = '\n</'+syntaxDiv+'>\n'; 119 break; 120 case 'help': 121 open = '<'+syntaxDiv+' center round help 60%>\n'; 122 close = '\n</'+syntaxDiv+'>\n'; 123 break; 124 case 'download' : 125 open = '<'+syntaxDiv+' center round download 60%>\n'; 126 close = '\n</'+syntaxDiv+'>\n'; 127 break; 128 case 'todo': 129 open = '<'+syntaxDiv+' center round todo 60%>\n'; 130 close = '\n</'+syntaxDiv+'>\n'; 131 break; 132 case 'clear': 133 open = '<'+syntaxDiv+' clear/>\n'; 134 close = ""; 135 break; 136 case 'em': 137 open = '<'+syntaxSpan+' em>'; 138 close = '</'+syntaxSpan+'>'; 139 break; 140 case 'hi': 141 open = '<'+syntaxSpan+' hi>'; 142 close = '</'+syntaxSpan+'>'; 143 break; 144 case 'lo': 145 open = '<'+syntaxSpan+' lo>'; 146 close = '</'+syntaxSpan+'>'; 147 break; 148 } 149 150 var wrapText = this.text ? this.text: dialog.getValueOf( 'tab-basic', 'wrap' ); 151 editor.insertText ( open + wrapText + close); 152 153 } 154 }; 155});