X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdialogadvtab%2Fplugin.js;h=8b5cb32b10f8113e3aae03982e1883f0ac369a7a;hb=a272c66d841421f8bf933c16535bdcde1c4649fc;hp=63222d20ff715edb599804417bf227ce56bf0a40;hpb=48b1db88210b4160dce439c6e3e32e14af8c106b;p=ckeditor.git diff --git a/_source/plugins/dialogadvtab/plugin.js b/_source/plugins/dialogadvtab/plugin.js index 63222d2..8b5cb32 100644 --- a/_source/plugins/dialogadvtab/plugin.js +++ b/_source/plugins/dialogadvtab/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, 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 */ @@ -36,14 +36,6 @@ function commitAdvParams() var attrName = this.att, value = this.getValue(); - // Broadcast Lang Dir change - if ( attrName == 'dir' ) - { - var dir = element.getAttribute( attrName ); - if ( dir != value && element.getParent() ) - this._.dialog._.editor.fire( 'dirChanged', { node : element, dir : value || element.getDirection( 1 ) } ); - } - if ( value ) element.setAttribute( attrName, value ); else @@ -140,9 +132,12 @@ 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; }, @@ -150,23 +145,12 @@ CKEDITOR.plugins.add( 'dialogadvtab', { 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; - } + var tmp = editor.document.createElement( 'span' ); + tmp.setAttribute( 'style', styles ); + tmp.setStyle( name, value ); + styles = CKEDITOR.tools.normalizeCssText( tmp.getAttribute( 'style' ) ); this.setValue( styles, 1 ); - }, setup : setupAdvParams,