X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdialogadvtab%2Fplugin.js;h=8b5cb32b10f8113e3aae03982e1883f0ac369a7a;hb=a272c66d841421f8bf933c16535bdcde1c4649fc;hp=434911c4dc34f09488959eb4d900465a29c255a4;hpb=e371ddf8abcb89013e20e6d0dd746adec344d0e5;p=ckeditor.git diff --git a/_source/plugins/dialogadvtab/plugin.js b/_source/plugins/dialogadvtab/plugin.js index 434911c..8b5cb32 100644 --- a/_source/plugins/dialogadvtab/plugin.js +++ b/_source/plugins/dialogadvtab/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -43,8 +43,6 @@ function commitAdvParams() } } -var isUpdating; - CKEDITOR.plugins.add( 'dialogadvtab', { /** @@ -62,8 +60,8 @@ CKEDITOR.plugins.add( 'dialogadvtab', var result = { id : 'advanced', - label : lang.advanced, - title : lang.advanced, + label : lang.advancedTab, + title : lang.advancedTab, elements : [ { @@ -100,7 +98,7 @@ CKEDITOR.plugins.add( 'dialogadvtab', type : 'select', label : lang.langDir, 'default' : '', - style : 'width:110px', + style : 'width:100%', items : [ [ lang.notSet, '' ], @@ -124,7 +122,7 @@ CKEDITOR.plugins.add( 'dialogadvtab', { contents = []; - if ( tabConfig.id ) + if ( tabConfig.styles ) { contents.push( { @@ -134,42 +132,25 @@ CKEDITOR.plugins.add( 'dialogadvtab', label : lang.styles, 'default' : '', + validate : CKEDITOR.dialog.validate.inlineStyle( lang.invalidInlineStyle ), onChange : function(){}, getStyle : function( name, defaultValue ) { - var match = this.getValue().match( new RegExp( name + '\\s*:\s*([^;]*)', 'i') ); + var match = this.getValue().match( new RegExp( '(?:^|;)\\s*' + name + '\\s*:\\s*([^;]*)', 'i' ) ); return match ? match[ 1 ] : defaultValue; }, updateStyle : function( name, value ) { - if ( isUpdating ) - return; - - // Flag to avoid recursion. - isUpdating = 1; - var styles = this.getValue(); - // Remove the current value. - if ( styles ) - { - styles = styles - .replace( new RegExp( '\\s*' + name + '\s*:[^;]*(?:$|;\s*)', 'i' ), '' ) - .replace( /^[;\s]+/, '' ) - .replace( /\s+$/, '' ); - } - - if ( value ) - { - styles && !(/;\s*$/).test( styles ) && ( styles += '; ' ); - styles += name + ': ' + value; - } - - this.setValue( styles ); + var tmp = editor.document.createElement( 'span' ); + tmp.setAttribute( 'style', styles ); + tmp.setStyle( name, value ); + styles = CKEDITOR.tools.normalizeCssText( tmp.getAttribute( 'style' ) ); - isUpdating = 0; + this.setValue( styles, 1 ); }, setup : setupAdvParams,