Changeset 6518
- Timestamp:
- 03/03/11 15:49:29 (2 years ago)
- Location:
- CKEditor/trunk
- Files:
-
- 3 edited
-
CHANGES.html (modified) (1 diff)
-
_source/plugins/scayt/dialogs/options.js (modified) (24 diffs)
-
_source/plugins/scayt/plugin.js (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/trunk/CHANGES.html
r6486 r6518 65 65 <li><a href="http://dev.ckeditor.com/ticket/6865">#6865</a> : BiDi mirroring doesn't work when a text direction change is done through dialog.</li> 66 66 <li><a href="http://dev.ckeditor.com/ticket/6966">#6966</a> : [IE] Unintended paragraph is created on empty document in enter mode BR and DIV.</li> 67 <li><a href="http://dev.ckeditor.com/ticket/7084">#7084</a> : SCAYT dialog window is now working properly with more than one editor instance in a page.</li> 67 68 <li>Updated the following language files:<ul> 68 69 <li><a href="http://dev.ckeditor.com/ticket/7124">#7124</a> : Czech;</li> -
CKEditor/trunk/_source/plugins/scayt/dialogs/options.js
r6348 r6518 9 9 captions, 10 10 doc = CKEDITOR.document, 11 tags = [], 11 editorName = editor.name, 12 tags = CKEDITOR.plugins.scayt.getUiTabs( editor ), 12 13 i, 13 14 contents = [], … … 15 16 dic_buttons = [ 16 17 // [0] contains buttons for creating 17 "dic_create ,dic_restore",18 "dic_create_" + editorName + ",dic_restore_" + editorName, 18 19 // [1] contains buton for manipulation 19 "dic_rename ,dic_delete"20 "dic_rename_" + editorName + ",dic_delete_" + editorName 20 21 ], 21 22 optionsIds = [ 'mixedCase', 'mixedWithDigits', 'allCaps', 'ignoreDomainNames' ]; … … 25 26 function getBOMAllOptions() 26 27 { 27 return document.forms.optionsbar["options"]; 28 if (typeof document.forms["optionsbar_" + editorName] != "undefined") 29 return document.forms["optionsbar_" + editorName]["options"]; 30 return []; 28 31 } 29 32 function getBOMAllLangs() 30 33 { 31 return document.forms.languagesbar["scayt_lang"]; 34 if (typeof document.forms["languagesbar_" + editorName] != "undefined") 35 return document.forms["languagesbar_" + editorName]["scayt_lang"]; 36 return []; 32 37 } 33 38 … … 59 64 type : 'html', 60 65 id : 'options', 61 html : '<form name="optionsbar "><div class="inner_options">' +66 html : '<form name="optionsbar_' + editorName + '"><div class="inner_options">' + 62 67 ' <div class="messagebox"></div>' + 63 68 ' <div style="display:none;">' + 64 ' <input type="checkbox" name="options" id="allCaps " />' +65 ' <label for="allCaps" id="label_allCaps "></label>' +69 ' <input type="checkbox" name="options" id="allCaps_' + editorName + '" />' + 70 ' <label for="allCaps" id="label_allCaps_' + editorName + '"></label>' + 66 71 ' </div>' + 67 72 ' <div style="display:none;">' + 68 ' <input name="options" type="checkbox" id="ignoreDomainNames " />' +69 ' <label for="ignoreDomainNames" id="label_ignoreDomainNames "></label>' +73 ' <input name="options" type="checkbox" id="ignoreDomainNames_' + editorName + '" />' + 74 ' <label for="ignoreDomainNames" id="label_ignoreDomainNames_' + editorName + '"></label>' + 70 75 ' </div>' + 71 76 ' <div style="display:none;">' + 72 ' <input name="options" type="checkbox" id="mixedCase " />' +73 ' <label for="mixedCase" id="label_mixedCase "></label>' +77 ' <input name="options" type="checkbox" id="mixedCase_' + editorName + '" />' + 78 ' <label for="mixedCase" id="label_mixedCase_' + editorName + '"></label>' + 74 79 ' </div>' + 75 80 ' <div style="display:none;">' + 76 ' <input name="options" type="checkbox" id="mixedWithDigits " />' +77 ' <label for="mixedWithDigits" id="label_mixedWithDigits "></label>' +81 ' <input name="options" type="checkbox" id="mixedWithDigits_' + editorName + '" />' + 82 ' <label for="mixedWithDigits" id="label_mixedWithDigits_' + editorName + '"></label>' + 78 83 ' </div>' + 79 84 '</div></form>' … … 88 93 type : 'html', 89 94 id : 'langs', 90 html : '<form name="languagesbar "><div class="inner_langs">' +95 html : '<form name="languagesbar_' + editorName + '"><div class="inner_langs">' + 91 96 ' <div class="messagebox"></div> ' + 92 ' <div style="float:left;width:45%;margin-left:5px;" id="scayt_lcol " ></div>' +93 ' <div style="float:left;width:45%;margin-left:15px;" id="scayt_rcol "></div>' +97 ' <div style="float:left;width:45%;margin-left:5px;" id="scayt_lcol_' + editorName + '" ></div>' + 98 ' <div style="float:left;width:45%;margin-left:15px;" id="scayt_rcol_' + editorName + '"></div>' + 94 99 '</div></form>' 95 100 } … … 104 109 style: '', 105 110 id : 'dictionaries', 106 html : '<form name="dictionarybar "><div class="inner_dictionary" style="text-align:left; white-space:normal; width:320px; overflow: hidden;">' +107 ' <div style="margin:5px auto; width:80%;white-space:normal; overflow:hidden;" id="dic_message "> </div>' +111 html : '<form name="dictionarybar_' + editorName + '"><div class="inner_dictionary" style="text-align:left; white-space:normal; width:320px; overflow: hidden;">' + 112 ' <div style="margin:5px auto; width:80%;white-space:normal; overflow:hidden;" id="dic_message_' + editorName + '"> </div>' + 108 113 ' <div style="margin:5px auto; width:80%;white-space:normal;"> ' + 109 114 ' <span class="cke_dialog_ui_labeled_label" >Dictionary name</span><br>'+ 110 115 ' <span class="cke_dialog_ui_labeled_content" >'+ 111 116 ' <div class="cke_dialog_ui_input_text">'+ 112 ' <input id="dic_name " type="text" class="cke_dialog_ui_input_text"/>'+117 ' <input id="dic_name_' + editorName + '" type="text" class="cke_dialog_ui_input_text"/>'+ 113 118 ' </div></span></div>'+ 114 119 ' <div style="margin:5px auto; width:80%;white-space:normal;">'+ 115 ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_create ">'+120 ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_create_' + editorName + '">'+ 116 121 ' </a>' + 117 ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_delete ">'+122 ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_delete_' + editorName + '">'+ 118 123 ' </a>' + 119 ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_rename ">'+124 ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_rename_' + editorName + '">'+ 120 125 ' </a>' + 121 ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_restore ">'+126 ' <a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_restore_' + editorName + '">'+ 122 127 ' </a>' + 123 128 ' </div>' + 124 ' <div style="margin:5px auto; width:95%;white-space:normal;" id="dic_info "></div>' +129 ' <div style="margin:5px auto; width:95%;white-space:normal;" id="dic_info_' + editorName + '"></div>' + 125 130 '</div></form>' 126 131 } … … 135 140 id : 'about', 136 141 style : 'margin: 5px 5px;', 137 html : '<div id="scayt_about "></div>'142 html : '<div id="scayt_about_' + editorName + '"></div>' 138 143 } 139 144 ] … … 150 155 dialog.data = editor.fire( 'scaytDialog', {} ); 151 156 dialog.options = dialog.data.scayt_control.option(); 152 dialog. sLang = dialog.data.scayt_control.sLang;153 157 dialog.chosed_lang = dialog.sLang = dialog.data.scayt_control.sLang; 158 154 159 if ( !dialog.data || !dialog.data.scayt || !dialog.data.scayt_control ) 155 160 { … … 181 186 var scayt_control = this.data.scayt_control; 182 187 scayt_control.option( this.options ); 183 // Setup langu ge if it was changed.188 // Setup language if it was changed. 184 189 var csLang = this.chosed_lang; 185 190 scayt_control.setLang( csLang ); … … 199 204 var scayt_control = CKEDITOR.plugins.scayt.getScayt( editor ); 200 205 201 tags = CKEDITOR.plugins.scayt.uiTabs; 202 203 for ( i in tags ) 206 for ( var i = 0; i < tags.length; i++ ) 204 207 { 205 208 if ( tags[ i ] == 1 ) … … 209 212 userDicActive = 1; 210 213 211 212 214 var init_with_captions = function() 213 215 { 214 216 var dialog = this, 215 217 lang_list = dialog.data.scayt.getLangList(), 216 buttons = [ 'dic_create', 'dic_delete', 'dic_rename', 'dic_restore' ], 218 buttonCaptions = [ 'dic_create', 'dic_delete', 'dic_rename', 'dic_restore' ], 219 buttonIds = [], 220 langList = [], 217 221 labels = optionsIds, 218 222 i; … … 221 225 if ( userDicActive ) 222 226 { 223 for ( i = 0; i < buttons.length; i++ ) 224 { 225 var button = buttons[ i ]; 226 doc.getById( button ).setHtml( '<span class="cke_dialog_ui_button">' + captions[ 'button_' + button] +'</span>' ); 227 } 228 doc.getById( 'dic_info' ).setHtml( captions[ 'dic_info' ] ); 229 } 230 227 for ( i = 0; i < buttonCaptions.length; i++ ) 228 { 229 buttonIds[ i ] = buttonCaptions[ i ] + "_" + editorName; 230 doc.getById( buttonIds[ i ] ).setHtml( '<span class="cke_dialog_ui_button">' + captions[ 'button_' + buttonCaptions[ i ]] +'</span>' ); 231 } 232 doc.getById( 'dic_info_' + editorName ).setHtml( captions[ 'dic_info' ] ); 233 } 231 234 232 235 // Fill options and dictionary labels. … … 235 238 for ( i in labels ) 236 239 { 237 var label = 'label_' + labels[ i ], 238 labelElement = doc.getById( label ); 239 240 var labelCaption = 'label_' + labels[ i ], 241 labelId = labelCaption + '_' + editorName, 242 labelElement = doc.getById( labelId ); 243 240 244 if ( 'undefined' != typeof labelElement 241 && 'undefined' != typeof captions[ label ]245 && 'undefined' != typeof captions[ labelCaption ] 242 246 && 'undefined' != typeof dialog.options[labels[ i ]] ) 243 247 { 244 labelElement.setHtml( captions[ label ] );248 labelElement.setHtml( captions[ labelCaption ] ); 245 249 var labelParent = labelElement.getParent(); 246 250 labelParent.$.style.display = "block"; … … 253 257 '<p>' + captions[ 'about_throwt_copy' ] + '</p>'; 254 258 255 doc.getById( 'scayt_about ').setHtml( about );259 doc.getById( 'scayt_about_' + editorName ).setHtml( about ); 256 260 257 261 // Create languages tab. … … 287 291 }; 288 292 289 var langList = [];290 293 if ( tags[1] ==1 ) 291 294 { … … 301 304 }); 302 305 303 var fieldL = doc.getById( 'scayt_lcol '),304 fieldR = doc.getById( 'scayt_rcol ');306 var fieldL = doc.getById( 'scayt_lcol_' + editorName ), 307 fieldR = doc.getById( 'scayt_rcol_' + editorName ); 305 308 for ( i=0; i < langList.length; i++ ) 306 309 { … … 404 407 function onDicButtonClick( ev ) 405 408 { 406 var dic_name = doc.getById('dic_name ').getValue();409 var dic_name = doc.getById('dic_name_' + editorName).getValue(); 407 410 if ( !dic_name ) 408 411 { … … 411 414 } 412 415 try{ 413 var el = id =ev.data.getTarget().getParent();414 var id = el.getId();416 var el = ev.data.getTarget().getParent(); 417 var id = /(dic_\w+)_[\w\d]+/.exec(el.getId())[1]; 415 418 dic[ id ].apply( null, [ el, dic_name, dic_buttons ] ); 416 419 } … … 453 456 opto[k].checked = false; 454 457 //alert (opto[k].removeAttribute) 455 if ( dialog.options[ i ] == 1 )458 if ( dialog.options[ i.split("_")[0] ] == 1 ) 456 459 { 457 460 opto[k].checked = true; … … 464 467 checkbox.on( 'click', function() 465 468 { 466 dialog.options[ this.getId() ] = this.$.checked ? 1 : 0 ;469 dialog.options[ this.getId().split("_")[0] ] = this.$.checked ? 1 : 0 ; 467 470 }); 468 471 } … … 488 491 if ( dic_name ) 489 492 { 490 doc.getById( 'dic_name ').setValue(dic_name);493 doc.getById( 'dic_name_' + editorName ).setValue(dic_name); 491 494 display_dic_buttons( dic_buttons[1] ); 492 495 } … … 497 500 function() 498 501 { 499 doc.getById( 'dic_name ').setValue("");502 doc.getById( 'dic_name_' + editorName ).setValue(""); 500 503 }); 501 504 dic_success_message(""); … … 506 509 function dic_error_message( m ) 507 510 { 508 doc.getById('dic_message ').setHtml('<span style="color:red;">' + m + '</span>' );511 doc.getById('dic_message_' + editorName).setHtml('<span style="color:red;">' + m + '</span>' ); 509 512 } 510 513 function dic_success_message( m ) 511 514 { 512 doc.getById('dic_message ').setHtml('<span style="color:blue;">' + m + '</span>') ;515 doc.getById('dic_message_' + editorName).setHtml('<span style="color:blue;">' + m + '</span>') ; 513 516 } 514 517 function display_dic_buttons( sIds ) … … 528 531 function set_dic_name( dic_name ) 529 532 { 530 doc.getById('dic_name ').$.value= dic_name;533 doc.getById('dic_name_' + editorName).$.value= dic_name; 531 534 } 532 535 -
CKEditor/trunk/_source/plugins/scayt/plugin.js
r6439 r6518 96 96 plugin.instances[ editor.name ] = scayt_control; 97 97 98 //window.scayt.uiTags99 var menuGroup = 'scaytButton';100 var uiTabs = window.scayt.uiTags;101 var fTabs = [];102 103 for ( var i = 0, l=4; i < l; i++ )104 fTabs.push( uiTabs[i] && plugin.uiTabs[i] );105 106 plugin.uiTabs = fTabs;107 98 try { 108 99 scayt_control.setDisabled( plugin.isPaused( editor ) === false ); … … 356 347 var scayt_instance = this.getScayt( editor ); 357 348 return ( scayt_instance ) ? scayt_instance.disabled === false : false; 349 }, 350 getUiTabs : function( editor ) 351 { 352 var uiTabs = []; 353 354 // read UI tabs value from config 355 var configUiTabs = editor.config.scayt_uiTabs || "1,1,1"; 356 357 // convert string to array 358 configUiTabs = configUiTabs.split( ',' ); 359 360 // "About us" should be always shown for standard config 361 configUiTabs[3] = "1"; 362 363 for ( var i = 0; i < 4; i++ ) { 364 uiTabs[i] = (typeof window.scayt != "undefined" && typeof window.scayt.uiTags != "undefined") 365 ? (parseInt(configUiTabs[i],10) && window.scayt.uiTags[i]) 366 : parseInt(configUiTabs[i],10); 367 } 368 return uiTabs; 358 369 }, 359 370 loadEngine : function( editor ) … … 529 540 // Add Options dialog. 530 541 CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) ); 531 // read ui tags 532 var confuiTabs = editor.config.scayt_uiTabs || '1,1,1'; 533 var uiTabs =[]; 534 // string to array convert 535 confuiTabs = confuiTabs.split( ',' ); 536 // check array length ! always must be 3 filled with 1 or 0 537 for ( var i=0, l=3; i < l; i++ ) 538 { 539 var flag = parseInt( confuiTabs[i] || '1', 10 ); 540 uiTabs.push( flag ); 541 } 542 542 543 var uiTabs = plugin.getUiTabs( editor ); 544 543 545 var menuGroup = 'scaytButton'; 544 546 editor.addMenuGroup( menuGroup ); 545 547 // combine menu items to render 546 var uiM uneItems = {};548 var uiMenuItems = {}; 547 549 548 550 var lang = editor.lang.scayt; 549 551 550 552 // always added 551 uiM uneItems.scaytToggle =553 uiMenuItems.scaytToggle = 552 554 { 553 555 label : lang.enable, … … 557 559 558 560 if ( uiTabs[0] == 1 ) 559 uiM uneItems.scaytOptions =561 uiMenuItems.scaytOptions = 560 562 { 561 563 label : lang.options, … … 569 571 570 572 if ( uiTabs[1] == 1 ) 571 uiM uneItems.scaytLangs =573 uiMenuItems.scaytLangs = 572 574 { 573 575 label : lang.langs, … … 580 582 }; 581 583 if ( uiTabs[2] == 1 ) 582 uiM uneItems.scaytDict =584 uiMenuItems.scaytDict = 583 585 { 584 586 label : lang.dictionariesTab, … … 591 593 }; 592 594 // always added 593 uiM uneItems.scaytAbout =595 uiMenuItems.scaytAbout = 594 596 { 595 597 label : editor.lang.scayt.about, … … 601 603 } 602 604 }; 603 604 uiTabs[3] = 1; // about us tab is always on 605 plugin.uiTabs = uiTabs; 606 607 editor.addMenuItems( uiMuneItems ); 605 606 editor.addMenuItems( uiMenuItems ); 608 607 609 608 editor.ui.add( 'Scayt', CKEDITOR.UI_MENUBUTTON, … … 626 625 627 626 editor.getMenuItem( 'scaytToggle' ).label = lang[ isEnabled ? 'disable' : 'enable' ]; 628 627 628 var uiTabs = plugin.getUiTabs( editor ); 629 629 630 return { 630 631 scaytToggle : CKEDITOR.TRISTATE_OFF, 631 scaytOptions : isEnabled && plugin.uiTabs[0] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,632 scaytLangs : isEnabled && plugin.uiTabs[1] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,633 scaytDict : isEnabled && plugin.uiTabs[2] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,634 scaytAbout : isEnabled && plugin.uiTabs[3] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED632 scaytOptions : isEnabled && uiTabs[0] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, 633 scaytLangs : isEnabled && uiTabs[1] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, 634 scaytDict : isEnabled && uiTabs[2] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED, 635 scaytAbout : isEnabled && uiTabs[3] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED 635 636 }; 636 637 }
Note: See TracChangeset
for help on using the changeset viewer.
