Ticket #138 (closed defect: fixed)
Fix for "prototyped functions" in Dynamic CSS dropdown
| Reported by: | TriGen | Owned by: | gogo |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Plugin_Stylist | Version: | |
| Severity: | trivial | Keywords: | CSS dropdown prototyped functions |
| Cc: |
Description
In IE 6 on xinha-latest\examples\fully-loaded.html the CSS dropdown showed the functions function (a) { ... } & function (needle) { ... } ).. (It read the CSS styles via an @import if i'm correct)
These long functions made the dropdown very wide, and they shouldn't be there, so I added these two if statements in DynamicCSS\dynamiccss.js:
DynamicCSS.prototype.updateValue = function(editor, obj) {
cssArray=DynamicCSS.cssArray;
// initial style init
if(!cssArray){
DynamicCSS.cssLength=0;
DynamicCSS.parseStyleSheet(editor);
cssArray=DynamicCSS.cssArray;
DynamicCSS.cssOldLength=DynamicCSS.cssLength;
DynamicCSS.parseCount=1;
this.reparseTimer(editor,obj,this);
}
var parent = editor.getParentElement();
var tagName = parent.tagName.toLowerCase();
var className = parent.className;
if(DynamicCSS.lastTag!=tagName || DynamicCSS.lastClass!=className){
DynamicCSS.lastTag=tagName;
DynamicCSS.lastClass=className;
var i18n = DynamicCSS.I18N;
var select = editor._toolbarObjects[obj.id].element;
while(select.length>0){
select.options[select.length-1] = null;
}
select.options[0]=new Option(i18n["Default"],'none');
if(cssArray){
// style class only allowed if parent tag is not body or editor is in fullpage mode
if(tagName!='body' || editor.config.fullPage){
if(cssArray[tagName]){
for(cssClass in cssArray[tagName]){
// "functions" should not be listed in the select box -- TriGen
if (typeof cssArray[tagName][cssClass] == 'function')
continue;
if(cssClass=='none') select.options[0]=new Option(cssArray[tagName][cssClass],cssClass);
else select.options[select.length]=new Option(cssArray[tagName][cssClass],cssClass);
}
}
if(cssArray['all']){
for(cssClass in cssArray['all']){
// "functions" should not be listed in the select box -- TriGen
if (typeof cssArray['all'][cssClass] == 'function')
continue;
select.options[select.length]=new Option(cssArray['all'][cssClass],cssClass);
}
}
}
else if(cssArray[tagName] && cssArray[tagName]['none']) select.options[0]=new Option(cssArray[tagName]['none'],'none');
}
select.selectedIndex = 0;
if (typeof className != "undefined" && /\S/.test(className)) {
var options = select.options;
for (var i = options.length; --i >= 0;) {
var option = options[i];
if (className == option.value) {
select.selectedIndex = i;
break;
}
}
if(select.selectedIndex == 0){
select.options[select.length]=new Option(i18n["Undefined"],className);
select.selectedIndex=select.length-1;
}
}
if(select.length>1) select.disabled=false;
else select.disabled=true;
}
};
Cheers!
Change History
Note: See
TracTickets for help on using
tickets.
