ad111ffc480e727c6b13ca4d46b1af1963ac50e7
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
9 function setupAdvParams( element
)
11 var attrName
= this.att
;
13 var value
= element
&& element
.hasAttribute( attrName
) && element
.getAttribute( attrName
) || '';
15 if ( value
!== undefined )
16 this.setValue( value
);
19 function commitAdvParams()
21 // Dialogs may use different parameters in the commit list, so, by
22 // definition, we take the first CKEDITOR.dom.element available.
25 for ( var i
= 0 ; i
< arguments
.length
; i
++ )
27 if ( arguments
[ i
] instanceof CKEDITOR
.dom
.element
)
29 element
= arguments
[ i
];
36 var attrName
= this.att
,
37 value
= this.getValue();
40 element
.setAttribute( attrName
, value
);
42 element
.removeAttribute( attrName
, value
);
46 CKEDITOR
.plugins
.add( 'dialogadvtab',
51 * id, dir, classes, styles
53 createAdvancedTab : function( editor
, tabConfig
)
56 tabConfig
= { id
:1, dir
:1, classes
:1, styles
:1 };
58 var lang
= editor
.lang
.common
;
63 label
: lang
.advancedTab
,
64 title
: lang
.advancedTab
,
77 if ( tabConfig
.id
|| tabConfig
.dir
)
87 setup
: setupAdvParams
,
88 commit
: commitAdvParams
101 style
: 'width:100%',
105 [ lang
.langDirLTR
, 'ltr' ],
106 [ lang
.langDirRTL
, 'rtl' ]
108 setup
: setupAdvParams
,
109 commit
: commitAdvParams
113 result
.elements
[ 0 ].children
.push(
116 widths
: [ '50%', '50%' ],
117 children
: [].concat( contents
)
121 if ( tabConfig
.styles
|| tabConfig
.classes
)
125 if ( tabConfig
.styles
)
135 onChange : function(){},
137 getStyle : function( name
, defaultValue
)
139 var match
= this.getValue().match( new RegExp( name
+ '\\s*:\\s*([^;]*)', 'i') );
140 return match
? match
[ 1 ] : defaultValue
;
143 updateStyle : function( name
, value
)
145 var styles
= this.getValue();
147 // Remove the current value.
151 .replace( new RegExp( '\\s*' + name
+ '\s*:[^;]*(?:$|;\s*)', 'i' ), '' )
152 .replace( /^[;\s]+/, '' )
153 .replace( /\s+$/, '' );
158 styles
&& !(/;\s*$/).test( styles
) && ( styles
+= '; ' );
159 styles
+= name
+ ': ' + value
;
162 this.setValue( styles
, 1 );
166 setup
: setupAdvParams
,
168 commit
: commitAdvParams
173 if ( tabConfig
.classes
)
178 widths
: [ '45%', '55%' ],
182 id
: 'advCSSClasses',
185 label
: lang
.cssClasses
,
187 setup
: setupAdvParams
,
188 commit
: commitAdvParams
195 result
.elements
[ 0 ].children
.push(
198 widths
: [ '50%', '50%' ],
199 children
: [].concat( contents
)