X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fscayt%2Fdialogs%2Foptions.js;h=3bd9916309a433e6eca07bd8b18693240d84777d;hp=ca7d53f4c5e4262def261eafe106b43b46ecce4e;hb=4e90e78dc97789709ee7404359a5517540c27553;hpb=8f6c203fdaa543c3bca40baea6ae4ddcdf1a77f5 diff --git a/_source/plugins/scayt/dialogs/options.js b/_source/plugins/scayt/dialogs/options.js index ca7d53f..3bd9916 100644 --- a/_source/plugins/scayt/dialogs/options.js +++ b/_source/plugins/scayt/dialogs/options.js @@ -8,15 +8,16 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) var firstLoad = true, captions, doc = CKEDITOR.document, - tags = [], + editorName = editor.name, + tags = CKEDITOR.plugins.scayt.getUiTabs( editor ), i, contents = [], userDicActive = 0, dic_buttons = [ // [0] contains buttons for creating - "dic_create,dic_restore", + "dic_create_" + editorName + ",dic_restore_" + editorName, // [1] contains buton for manipulation - "dic_rename,dic_delete" + "dic_rename_" + editorName + ",dic_delete_" + editorName ], optionsIds = [ 'mixedCase', 'mixedWithDigits', 'allCaps', 'ignoreDomainNames' ]; @@ -24,11 +25,15 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) function getBOMAllOptions() { - return document.forms.optionsbar["options"]; + if (typeof document.forms["optionsbar_" + editorName] != "undefined") + return document.forms["optionsbar_" + editorName]["options"]; + return []; } function getBOMAllLangs() { - return document.forms.languagesbar["scayt_lang"]; + if (typeof document.forms["languagesbar_" + editorName] != "undefined") + return document.forms["languagesbar_" + editorName]["scayt_lang"]; + return []; } function setCheckedValue( radioObj, newValue ) @@ -58,23 +63,23 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) { type : 'html', id : 'options', - html : '
' + + html : '
' + '
' + '
' + - ' ' + - ' ' + + ' ' + + ' ' + '
' + '
' + - ' ' + - ' ' + + ' ' + + ' ' + '
' + '
' + - ' ' + - ' ' + + ' ' + + ' ' + '
' + '
' + - ' ' + - ' ' + + ' ' + + ' ' + '
' + '
' } @@ -87,10 +92,10 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) { type : 'html', id : 'langs', - html : '
' + + html : '
' + '
' + - '
' + - '
' + + '
' + + '
' + '
' } ] @@ -103,25 +108,25 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) type : 'html', style: '', id : 'dictionaries', - html : '
' + - '
' + + html : '
' + + '
' + '
' + ' Dictionary name
'+ ' '+ '
'+ - ' '+ + ' '+ '
'+ '
'+ - ' ' + - ' ' + - ' ' + - ' ' + '
' + - '
' + + '
' + '
' } ] @@ -134,7 +139,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) type : 'html', id : 'about', style : 'margin: 5px 5px;', - html : '
' + html : '
' } ] } @@ -149,7 +154,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) var dialog = this; dialog.data = editor.fire( 'scaytDialog', {} ); dialog.options = dialog.data.scayt_control.option(); - dialog.sLang = dialog.data.scayt_control.sLang; + dialog.chosed_lang = dialog.sLang = dialog.data.scayt_control.sLang; if ( !dialog.data || !dialog.data.scayt || !dialog.data.scayt_control ) { @@ -180,7 +185,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) { var scayt_control = this.data.scayt_control; scayt_control.option( this.options ); - // Setup languge if it was changed. + // Setup language if it was changed. var csLang = this.chosed_lang; scayt_control.setLang( csLang ); scayt_control.refresh(); @@ -198,9 +203,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) var scayt_control = CKEDITOR.plugins.scayt.getScayt( editor ); - tags = CKEDITOR.plugins.scayt.uiTabs; - - for ( i in tags ) + for ( i = 0; i < tags.length; i++ ) { if ( tags[ i ] == 1 ) contents[ contents.length ] = tags_contents[ i ]; @@ -208,40 +211,41 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) if ( tags[2] == 1 ) userDicActive = 1; - var init_with_captions = function() { var dialog = this, lang_list = dialog.data.scayt.getLangList(), - buttons = [ 'dic_create', 'dic_delete', 'dic_rename', 'dic_restore' ], + buttonCaptions = [ 'dic_create', 'dic_delete', 'dic_rename', 'dic_restore' ], + buttonIds = [], + langList = [], labels = optionsIds, i; // Add buttons titles if ( userDicActive ) { - for ( i = 0; i < buttons.length; i++ ) + for ( i = 0; i < buttonCaptions.length; i++ ) { - var button = buttons[ i ]; - doc.getById( button ).setHtml( '' + captions[ 'button_' + button] +'' ); + buttonIds[ i ] = buttonCaptions[ i ] + "_" + editorName; + doc.getById( buttonIds[ i ] ).setHtml( '' + captions[ 'button_' + buttonCaptions[ i ]] +'' ); } - doc.getById( 'dic_info' ).setHtml( captions[ 'dic_info' ] ); + doc.getById( 'dic_info_' + editorName ).setHtml( captions[ 'dic_info' ] ); } - // Fill options and dictionary labels. if ( tags[0] == 1 ) { for ( i in labels ) { - var label = 'label_' + labels[ i ], - labelElement = doc.getById( label ); + var labelCaption = 'label_' + labels[ i ], + labelId = labelCaption + '_' + editorName, + labelElement = doc.getById( labelId ); if ( 'undefined' != typeof labelElement - && 'undefined' != typeof captions[ label ] + && 'undefined' != typeof captions[ labelCaption ] && 'undefined' != typeof dialog.options[labels[ i ]] ) { - labelElement.setHtml( captions[ label ] ); + labelElement.setHtml( captions[ labelCaption ] ); var labelParent = labelElement.getParent(); labelParent.$.style.display = "block"; } @@ -252,7 +256,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) '

' + captions[ 'version' ] + window.scayt.getAboutInfo().version.toString() + '

' + '

' + captions[ 'about_throwt_copy' ] + '

'; - doc.getById( 'scayt_about' ).setHtml( about ); + doc.getById( 'scayt_about_' + editorName ).setHtml( about ); // Create languages tab. var createOption = function( option, list ) @@ -286,7 +290,6 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) }; }; - var langList = []; if ( tags[1] ==1 ) { for ( i in lang_list.rtl ) @@ -300,8 +303,8 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) return ( lang2.lang > lang1.lang ) ? -1 : 1 ; }); - var fieldL = doc.getById( 'scayt_lcol' ), - fieldR = doc.getById( 'scayt_rcol' ); + var fieldL = doc.getById( 'scayt_lcol_' + editorName ), + fieldR = doc.getById( 'scayt_rcol_' + editorName ); for ( i=0; i < langList.length; i++ ) { var field = ( i < langList.length / 2 ) ? fieldL : fieldR; @@ -403,15 +406,15 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) function onDicButtonClick( ev ) { - var dic_name = doc.getById('dic_name').getValue(); + var dic_name = doc.getById('dic_name_' + editorName).getValue(); if ( !dic_name ) { dic_error_message(" Dictionary name should not be empty. "); return false; } try{ - var el = id = ev.data.getTarget().getParent(); - var id = el.getId(); + var el = ev.data.getTarget().getParent(); + var id = /(dic_\w+)_[\w\d]+/.exec(el.getId())[1]; dic[ id ].apply( null, [ el, dic_name, dic_buttons ] ); } catch(err) @@ -452,7 +455,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) { opto[k].checked = false; //alert (opto[k].removeAttribute) - if ( dialog.options[ i ] == 1 ) + if ( dialog.options[ i.split("_")[0] ] == 1 ) { opto[k].checked = true; } @@ -463,7 +466,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) { checkbox.on( 'click', function() { - dialog.options[ this.getId() ] = this.$.checked ? 1 : 0 ; + dialog.options[ this.getId().split("_")[0] ] = this.$.checked ? 1 : 0 ; }); } } @@ -487,7 +490,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) hide_dic_buttons( dic_buttons[0] + ',' + dic_buttons[1] ); if ( dic_name ) { - doc.getById( 'dic_name' ).setValue(dic_name); + doc.getById( 'dic_name_' + editorName ).setValue(dic_name); display_dic_buttons( dic_buttons[1] ); } else @@ -496,7 +499,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) }, function() { - doc.getById( 'dic_name' ).setValue(""); + doc.getById( 'dic_name_' + editorName ).setValue(""); }); dic_success_message(""); } @@ -505,11 +508,11 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) function dic_error_message( m ) { - doc.getById('dic_message').setHtml('' + m + '' ); + doc.getById('dic_message_' + editorName).setHtml('' + m + '' ); } function dic_success_message( m ) { - doc.getById('dic_message').setHtml('' + m + '') ; + doc.getById('dic_message_' + editorName).setHtml('' + m + '') ; } function display_dic_buttons( sIds ) { @@ -527,7 +530,7 @@ CKEDITOR.dialog.add( 'scaytcheck', function( editor ) } function set_dic_name( dic_name ) { - doc.getById('dic_name').$.value= dic_name; + doc.getById('dic_name_' + editorName).$.value= dic_name; } return dialogDefiniton;