* Fixed bug 5839: In htmlArea RTE, paragraph & text dropdown boxes inactive when...
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 15 Oct 2007 15:40:59 +0000 (15:40 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 15 Oct 2007 15:40:59 +0000 (15:40 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-1@2556 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/plugins/DynamicCSS/dynamiccss-compressed.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DynamicCSS/dynamiccss.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineCSS/inlinecss-compressed.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineCSS/inlinecss.js

index 6e645d1..bf8180f 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2007-10-15  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
-       * Fix bug  5855: Missing unlink icon in htmlArea RTE
+       * Fixed bug 5855: Missing unlink icon in htmlArea RTE
+       * Fixed bug 5839: In htmlArea RTE, paragraph & text dropdown boxes inactive when using @media clause in stylesheet
 
 2007-10-08  Martin Kutschker  <martin.t.kutschker@blackbox.net>
 
index 5b06efc..064a76a 100644 (file)
@@ -1,2 +1,2 @@
-DynamicCSS=function(editor,args){this.editor=editor;var cfg=editor.config;var toolbar=cfg.toolbar;var editorNumber=editor._editorNumber;var obj={id:"DynamicCSS-class",tooltip:DynamicCSS_langArray["DynamicCSSStyleTooltip"],options:{"":""},action:null,refresh:null,context:"*",cssArray:new Object(),parseCount:1,loaded:false,timeout:null,lastTag:"",lastClass:"",showTagFreeClasses:RTEarea[editorNumber]["showTagFreeClasses"],classesUrl:RTEarea[editorNumber]["classesUrl"],classesTag:RTEarea[editorNumber]["classesTag"]};var actionHandlerFunctRef=DynamicCSS.actionHandler(this,obj);obj.action=actionHandlerFunctRef;var refreshHandlerFunctRef=DynamicCSS.refreshHandler(this);obj.refresh=refreshHandlerFunctRef;cfg.registerDropdown(obj);};DynamicCSS.actionHandler=function(instance,obj){return(function(editor){instance.onSelect(editor,obj);});};DynamicCSS.refreshHandler=function(instance){return(function(editor){instance.generate(editor);});};DynamicCSS.I18N=DynamicCSS_langArray;DynamicCSS.parseStyleSheet=function(editor){var obj=editor.config.customSelects["DynamicCSS-class"];var iframe=editor._iframe.contentWindow?editor._iframe.contentWindow.document:editor._iframe.contentDocument;var newCssArray=new Object();obj.loaded=true;for(var i=0;i<iframe.styleSheets.length;i++){if(HTMLArea.is_gecko){try{newCssArray=DynamicCSS.applyCSSRule(editor,DynamicCSS.I18N,iframe.styleSheets[i].cssRules,newCssArray);}catch(e){obj.loaded=false;}}else{try{if(iframe.styleSheets[i].imports)newCssArray=DynamicCSS.applyCSSIEImport(editor,DynamicCSS.I18N,iframe.styleSheets[i].imports,newCssArray);if(iframe.styleSheets[i].rules)newCssArray=DynamicCSS.applyCSSRule(editor,DynamicCSS.I18N,iframe.styleSheets[i].rules,newCssArray);}catch(e){obj.loaded=false;}}};return newCssArray;};DynamicCSS.applyCSSRule=function(editor,i18n,cssRules,cssArray){var cssElements=new Array(),cssElement=new Array(),newCssArray=new Object(),classParts=new Array(),tagName,className,rule,k,obj=editor.config.customSelects["DynamicCSS-class"];newCssArray=cssArray;for(rule=0;rule<cssRules.length;rule++){if(cssRules[rule].selectorText){if(cssRules[rule].selectorText.search(/:+/)==-1){cssElements=cssRules[rule].selectorText.split(",");for(k=0;k<cssElements.length;k++){cssElement=cssElements[k].split(".");tagName=cssElement[0].toLowerCase().trim();if(!tagName)tagName="all";className=cssElement[1];if(className){classParts=className.trim().split(" ");className=classParts[0];};if(!HTMLArea.reservedClassNames.test(className)&&((tagName=="all"&&obj["showTagFreeClasses"]==true)||(tagName!="all"&&(!obj["classesTag"]||!obj["classesTag"][tagName]))||(tagName!="all"&&obj["classesTag"][tagName].indexOf(className)!=-1))){if(!newCssArray[tagName])newCssArray[tagName]=new Object();if(className){cssName=className;if(HTMLArea.classesLabels)cssName=HTMLArea.classesLabels[className]?HTMLArea.classesLabels[className]:cssName;if(tagName!='all')cssName='<'+cssName+'>';}else{className='none';if(tagName=='all')cssName=i18n["Default"];else cssName='<'+i18n["Default"]+'>';};newCssArray[tagName][className]=cssName;}}}}else if(cssRules[rule].styleSheet){newCssArray=DynamicCSS.applyCSSRule(editor,i18n,cssRules[rule].styleSheet.cssRules,newCssArray);}};return newCssArray;};DynamicCSS.applyCSSIEImport=function(editor,i18n,cssIEImport,cssArray){var newCssArray=new Object();newCssArray=cssArray;for(var i=0;i<cssIEImport.length;i++){if(cssIEImport[i].imports){newCssArray=DynamicCSS.applyCSSIEImport(editor,i18n,cssIEImport[i].imports,newCssArray);};if(cssIEImport[i].rules){newCssArray=DynamicCSS.applyCSSRule(editor,i18n,cssIEImport[i].rules,newCssArray);}};return newCssArray;};DynamicCSS._pluginInfo={name:"DynamicCSS",version:"1.9",developer:"Holger Hees & Stanislas Rolland",developer_url:"http://www.fructifor.ca/",c_owner:"Holger Hees & Stanislas Rolland",sponsor:"System Concept GmbH & Fructifor Inc.",sponsor_url:"http://www.fructifor.ca/",license:"GPL"};DynamicCSS.prototype.getSelectedBlocks=function(editor){var block,range,i=0,blocks=[];if(HTMLArea.is_gecko&&!HTMLArea.is_safari&&!HTMLArea.is_opera){var sel=editor._getSelection();try{while(range=sel.getRangeAt(i++)){block=editor.getParentElement(sel,range);blocks.push(block);}}catch(e){}}else{blocks.push(editor.getParentElement());};return blocks;};DynamicCSS.prototype.onSelect=function(editor,obj){var tbobj=editor._toolbarObjects[obj.id];var index=document.getElementById(tbobj.elementId).selectedIndex;var className=document.getElementById(tbobj.elementId).value;editor.focusEditor();var blocks=this.getSelectedBlocks(editor);for(var k=0;k<blocks.length;++k){var parent=blocks[k];while(typeof(parent)!="undefined"&&!HTMLArea.isBlockElement(parent)&&parent.nodeName.toLowerCase()!="img")parent=parent.parentNode;if(!k)var tagName=parent.tagName.toLowerCase();if(parent.tagName.toLowerCase()==tagName){var cls=parent.className.trim().split(" ");for(var i=cls.length;i>0;)if(!HTMLArea.reservedClassNames.test(cls[--i]))HTMLArea._removeClass(parent,cls[i]);if(className!='none'){HTMLArea._addClass(parent,className);obj.lastClass=className;}}}editor.updateToolbar();};DynamicCSS.prototype.onGenerate=function(){var editor=this.editor;var obj=editor.config.customSelects["DynamicCSS-class"];if(HTMLArea.is_gecko)this.generate(editor);};DynamicCSS.prototype.onUpdateToolbar=function(){var editor=this.editor;var obj=editor.config.customSelects["DynamicCSS-class"];if(HTMLArea.is_gecko&&editor._editMode!="textmode"){if(obj.loaded){this.updateValue(editor,obj);}else{if(obj.timeout){if(editor._iframe.contentWindow){editor._iframe.contentWindow.clearTimeout(obj.timeout);}else{window.clearTimeout(obj.timeout);};obj.timeout=null;};this.generate(editor);}}else if(editor._editMode=="textmode"){var select=document.getElementById(editor._toolbarObjects[obj.id].elementId);select.disabled=true;select.className="buttonDisabled";}};DynamicCSS.prototype.generate=function(editor){var obj=editor.config.customSelects["DynamicCSS-class"];var classesUrl=obj["classesUrl"];if(classesUrl&&typeof(HTMLArea.classesLabels)=="undefined"){var classesData=HTMLArea._getScript(0,false,classesUrl);if(classesData)eval(classesData);};if(obj.loaded)this.updateValue(editor,obj);else this.getCSSArray(editor);};DynamicCSS.prototype.getCSSArray=function(editor){var obj=editor.config.customSelects["DynamicCSS-class"];obj.cssArray=DynamicCSS.parseStyleSheet(editor);if(!obj.loaded&&obj.parseCount<17){var getCSSArrayLaterFunctRef=DynamicCSS.getCSSArrayLater(editor,this);obj.timeout=editor._iframe.contentWindow?editor._iframe.contentWindow.setTimeout(getCSSArrayLaterFunctRef,200):window.setTimeout(getCSSArrayLaterFunctRef,200);obj.parseCount++;}else{obj.timeout=null;obj.loaded=true;this.updateValue(editor,obj);}};DynamicCSS.getCSSArrayLater=function(editor,instance){return(function(){instance.getCSSArray(editor);});};DynamicCSS.prototype.onMode=function(mode){var editor=this.editor;if(mode=='wysiwyg'){var obj=editor.config.customSelects["DynamicCSS-class"];if(obj.loaded){this.updateValue(editor,obj);}else{if(obj.timeout){if(editor._iframe.contentWindow)editor._iframe.contentWindow.clearTimeout(obj.timeout);else window.clearTimeout(obj.timeout);obj.timeout=null;};this.generate(editor);}}};DynamicCSS.prototype.updateValue=function(editor,obj){var cssClass,i;if(!obj.loaded){if(obj.timeout){if(editor._iframe.contentWindow)editor._iframe.contentWindow.clearTimeout(obj.timeout);else window.clearTimeout(obj.timeout);obj.timeout=null;};this.generate(editor);};var cssArray=obj.cssArray;var tagName="body";var className="";var parent=editor.getParentElement();while(parent&&typeof(parent)!="undefined"&&!HTMLArea.isBlockElement(parent)&&parent.nodeName.toLowerCase()!="img")parent=parent.parentNode;if(parent){tagName=parent.nodeName.toLowerCase();className=parent.className;if(HTMLArea.reservedClassNames.test(className)){var cls=className.split(" ");for(var i=cls.length;i>0;)if(!HTMLArea.reservedClassNames.test(cls[--i]))className=cls[i];}};if(obj.lastTag!=tagName||obj.lastClass!=className){obj.lastTag=tagName;obj.lastClass=className;var select=document.getElementById(editor._toolbarObjects[obj.id].elementId);while(select.options.length>0)select.options[select.length-1]=null;select.options[0]=new Option(DynamicCSS.I18N["Default"],'none');if(cssArray){if(tagName!='body'||editor.config.fullPage){if(cssArray[tagName]){for(cssClass in cssArray[tagName]){if(cssClass=='none'){select.options[0]=new Option(cssArray[tagName][cssClass],cssClass);}else{select.options[select.options.length]=new Option(cssArray[tagName][cssClass],cssClass);if(!editor.config.disablePCexamples&&HTMLArea.classesValues&&HTMLArea.classesValues[cssClass]&&!HTMLArea.classesNoShow[cssClass])select.options[select.options.length-1].setAttribute("style",HTMLArea.classesValues[cssClass]);}}};if(cssArray['all']){for(cssClass in cssArray['all']){select.options[select.options.length]=new Option(cssArray['all'][cssClass],cssClass);if(!editor.config.disablePCexamples&&HTMLArea.classesValues&&HTMLArea.classesValues[cssClass]&&!HTMLArea.classesNoShow[cssClass])select.options[select.options.length-1].setAttribute("style",HTMLArea.classesValues[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)&&!HTMLArea.reservedClassNames.test(className)){for(i=select.options.length;--i>=0;){var option=select.options[i];if(className==option.value){select.selectedIndex=i;break;}};if(select.selectedIndex==0){select.options[select.options.length]=new Option(DynamicCSS.I18N["Undefined"],className);select.selectedIndex=select.options.length-1;}};if(select.options.length>1){select.disabled=false;}else select.disabled=true;if(HTMLArea.is_gecko)select.removeAttribute('class');else select.removeAttribute('className');if(select.disabled)HTMLArea._addClass(select,"buttonDisabled");}};
+/**Dynamic CSS Plugin for TYPO3 htmlArea RTE**TYPO3 CVS ID:$Id:dynamiccss.js 1809 2006-11-23 12:04:14Z ingmars $*/DynamicCSS=function(editor,args){this.editor=editor;var cfg=editor.config;var toolbar=cfg.toolbar;var editorNumber=editor._editorNumber;var obj={id:"DynamicCSS-class",tooltip:DynamicCSS_langArray["DynamicCSSStyleTooltip"],options:{"":""},action:null,refresh:null,context:"*",cssArray:new Object(),parseCount:1,loaded:false,timeout:null,lastTag:"",lastClass:"",showTagFreeClasses:RTEarea[editorNumber]["showTagFreeClasses"],classesUrl:RTEarea[editorNumber]["classesUrl"],classesTag:RTEarea[editorNumber]["classesTag"]};var actionHandlerFunctRef=DynamicCSS.actionHandler(this,obj);obj.action=actionHandlerFunctRef;var refreshHandlerFunctRef=DynamicCSS.refreshHandler(this);obj.refresh=refreshHandlerFunctRef;cfg.registerDropdown(obj);};DynamicCSS.actionHandler=function(instance,obj){return(function(editor){instance.onSelect(editor,obj);});};DynamicCSS.refreshHandler=function(instance){return(function(editor){instance.generate(editor);});};DynamicCSS.I18N=DynamicCSS_langArray;DynamicCSS.parseStyleSheet=function(editor){var obj=editor.config.customSelects["DynamicCSS-class"];var iframe=editor._iframe.contentWindow?editor._iframe.contentWindow.document:editor._iframe.contentDocument;var newCssArray=new Object();obj.loaded=true;for(var i=0;i<iframe.styleSheets.length;i++){if(HTMLArea.is_gecko){try{newCssArray=DynamicCSS.applyCSSRule(editor,DynamicCSS.I18N,iframe.styleSheets[i].cssRules,newCssArray);}catch(e){obj.loaded=false;}}else{try{if(iframe.styleSheets[i].imports)newCssArray=DynamicCSS.applyCSSIEImport(editor,DynamicCSS.I18N,iframe.styleSheets[i].imports,newCssArray);if(iframe.styleSheets[i].rules)newCssArray=DynamicCSS.applyCSSRule(editor,DynamicCSS.I18N,iframe.styleSheets[i].rules,newCssArray);}catch(e){obj.loaded=false;}}}return newCssArray;};DynamicCSS.applyCSSRule=function(editor,i18n,cssRules,cssArray){var cssElements=new Array(),cssElement=new Array(),newCssArray=new Object(),classParts=new Array(),tagName,className,rule,k,obj=editor.config.customSelects["DynamicCSS-class"];newCssArray=cssArray;for(rule=0;rule<cssRules.length;rule++){if(cssRules[rule].selectorText){if(cssRules[rule].selectorText.search(/:+/)==-1){cssElements=cssRules[rule].selectorText.split(",");for(k=0;k<cssElements.length;k++){cssElement=cssElements[k].split(".");tagName=cssElement[0].toLowerCase().trim();if(!tagName)tagName="all";className=cssElement[1];if(className){classParts=className.trim().split(" ");className=classParts[0];}if(!HTMLArea.reservedClassNames.test(className)&&((tagName=="all"&&obj["showTagFreeClasses"]==true)||(tagName!="all"&&(!obj["classesTag"]||!obj["classesTag"][tagName]))||(tagName!="all"&&obj["classesTag"][tagName].indexOf(className)!=-1))){if(!newCssArray[tagName])newCssArray[tagName]=new Object();if(className){cssName=className;if(HTMLArea.classesLabels)cssName=HTMLArea.classesLabels[className]?HTMLArea.classesLabels[className]:cssName;if(tagName!='all')cssName='<'+cssName+'>';}else{className='none';if(tagName=='all')cssName=i18n["Default"];else cssName='<'+i18n["Default"]+'>';}newCssArray[tagName][className]=cssName;}}}}else{if(cssRules[rule].styleSheet){newCssArray=DynamicCSS.applyCSSRule(editor,i18n,cssRules[rule].styleSheet.cssRules,newCssArray);}if(cssRules[rule].cssRules){newCssArray=DynamicCSS.applyCSSRule(editor,i18n,cssRules[rule].cssRules,newCssArray);}}}return newCssArray;};DynamicCSS.applyCSSIEImport=function(editor,i18n,cssIEImport,cssArray){var newCssArray=new Object();newCssArray=cssArray;for(var i=0;i<cssIEImport.length;i++){if(cssIEImport[i].imports){newCssArray=DynamicCSS.applyCSSIEImport(editor,i18n,cssIEImport[i].imports,newCssArray);}if(cssIEImport[i].rules){newCssArray=DynamicCSS.applyCSSRule(editor,i18n,cssIEImport[i].rules,newCssArray);}}return newCssArray;};DynamicCSS._pluginInfo={name:"DynamicCSS",version:"1.9",developer:"Holger Hees & Stanislas Rolland",developer_url:"http://www.fructifor.ca/",c_owner:"Holger Hees & Stanislas Rolland",sponsor:"System Concept GmbH & Fructifor Inc.",sponsor_url:"http://www.fructifor.ca/",license:"GPL"};DynamicCSS.prototype.getSelectedBlocks=function(editor){var block,range,i=0,blocks=[];if(HTMLArea.is_gecko&&!HTMLArea.is_safari&&!HTMLArea.is_opera){var sel=editor._getSelection();try{while(range=sel.getRangeAt(i++)){block=editor.getParentElement(sel,range);blocks.push(block);}}catch(e){}}else{blocks.push(editor.getParentElement());}return blocks;};DynamicCSS.prototype.onSelect=function(editor,obj){var tbobj=editor._toolbarObjects[obj.id];var index=document.getElementById(tbobj.elementId).selectedIndex;var className=document.getElementById(tbobj.elementId).value;editor.focusEditor();var blocks=this.getSelectedBlocks(editor);for(var k=0;k<blocks.length;++k){var parent=blocks[k];while(typeof(parent)!="undefined"&&!HTMLArea.isBlockElement(parent)&&parent.nodeName.toLowerCase()!="img")parent=parent.parentNode;if(!k)var tagName=parent.tagName.toLowerCase();if(parent.tagName.toLowerCase()==tagName){var cls=parent.className.trim().split(" ");for(var i=cls.length;i>0;)if(!HTMLArea.reservedClassNames.test(cls[--i]))HTMLArea._removeClass(parent,cls[i]);if(className!='none'){HTMLArea._addClass(parent,className);obj.lastClass=className;}}}editor.updateToolbar();};DynamicCSS.prototype.onGenerate=function(){var editor=this.editor;var obj=editor.config.customSelects["DynamicCSS-class"];if(HTMLArea.is_gecko)this.generate(editor);};DynamicCSS.prototype.onUpdateToolbar=function(){var editor=this.editor;var obj=editor.config.customSelects["DynamicCSS-class"];if(HTMLArea.is_gecko&&editor._editMode!="textmode"){if(obj.loaded){this.updateValue(editor,obj);}else{if(obj.timeout){if(editor._iframe.contentWindow){editor._iframe.contentWindow.clearTimeout(obj.timeout);}else{window.clearTimeout(obj.timeout);}obj.timeout=null;}this.generate(editor);}}else if(editor._editMode=="textmode"){var select=document.getElementById(editor._toolbarObjects[obj.id].elementId);select.disabled=true;select.className="buttonDisabled";}};DynamicCSS.prototype.generate=function(editor){var obj=editor.config.customSelects["DynamicCSS-class"];var classesUrl=obj["classesUrl"];if(classesUrl&&typeof(HTMLArea.classesLabels)=="undefined"){var classesData=HTMLArea._getScript(0,false,classesUrl);if(classesData)eval(classesData);}if(obj.loaded)this.updateValue(editor,obj);else this.getCSSArray(editor);};DynamicCSS.prototype.getCSSArray=function(editor){var obj=editor.config.customSelects["DynamicCSS-class"];obj.cssArray=DynamicCSS.parseStyleSheet(editor);if(!obj.loaded&&obj.parseCount<17){var getCSSArrayLaterFunctRef=DynamicCSS.getCSSArrayLater(editor,this);obj.timeout=editor._iframe.contentWindow?editor._iframe.contentWindow.setTimeout(getCSSArrayLaterFunctRef,200):window.setTimeout(getCSSArrayLaterFunctRef,200);obj.parseCount++;}else{obj.timeout=null;obj.loaded=true;this.updateValue(editor,obj);}};DynamicCSS.getCSSArrayLater=function(editor,instance){return(function(){instance.getCSSArray(editor);});};DynamicCSS.prototype.onMode=function(mode){var editor=this.editor;if(mode=='wysiwyg'){var obj=editor.config.customSelects["DynamicCSS-class"];if(obj.loaded){this.updateValue(editor,obj);}else{if(obj.timeout){if(editor._iframe.contentWindow)editor._iframe.contentWindow.clearTimeout(obj.timeout);else window.clearTimeout(obj.timeout);obj.timeout=null;}this.generate(editor);}}};DynamicCSS.prototype.updateValue=function(editor,obj){var cssClass,i;if(!obj.loaded){if(obj.timeout){if(editor._iframe.contentWindow)editor._iframe.contentWindow.clearTimeout(obj.timeout);else window.clearTimeout(obj.timeout);obj.timeout=null;}this.generate(editor);}var cssArray=obj.cssArray;var tagName="body";var className="";var parent=editor.getParentElement();while(parent&&typeof(parent)!="undefined"&&!HTMLArea.isBlockElement(parent)&&parent.nodeName.toLowerCase()!="img")parent=parent.parentNode;if(parent){tagName=parent.nodeName.toLowerCase();className=parent.className;if(HTMLArea.reservedClassNames.test(className)){var cls=className.split(" ");for(var i=cls.length;i>0;)if(!HTMLArea.reservedClassNames.test(cls[--i]))className=cls[i];}}if(obj.lastTag!=tagName||obj.lastClass!=className){obj.lastTag=tagName;obj.lastClass=className;var select=document.getElementById(editor._toolbarObjects[obj.id].elementId);while(select.options.length>0)select.options[select.length-1]=null;select.options[0]=new Option(DynamicCSS.I18N["Default"],'none');if(cssArray){if(tagName!='body'||editor.config.fullPage){if(cssArray[tagName]){for(cssClass in cssArray[tagName]){if(cssClass=='none'){select.options[0]=new Option(cssArray[tagName][cssClass],cssClass);}else{select.options[select.options.length]=new Option(cssArray[tagName][cssClass],cssClass);if(!editor.config.disablePCexamples&&HTMLArea.classesValues&&HTMLArea.classesValues[cssClass]&&!HTMLArea.classesNoShow[cssClass])select.options[select.options.length-1].setAttribute("style",HTMLArea.classesValues[cssClass]);}}}if(cssArray['all']){for(cssClass in cssArray['all']){select.options[select.options.length]=new Option(cssArray['all'][cssClass],cssClass);if(!editor.config.disablePCexamples&&HTMLArea.classesValues&&HTMLArea.classesValues[cssClass]&&!HTMLArea.classesNoShow[cssClass])select.options[select.options.length-1].setAttribute("style",HTMLArea.classesValues[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)&&!HTMLArea.reservedClassNames.test(className)){for(i=select.options.length;--i>=0;){var option=select.options[i];if(className==option.value){select.selectedIndex=i;break;}}if(select.selectedIndex==0){select.options[select.options.length]=new Option(DynamicCSS.I18N["Undefined"],className);select.selectedIndex=select.options.length-1;}}if(select.options.length>1){select.disabled=false;}else select.disabled=true;if(HTMLArea.is_gecko)select.removeAttribute('class');else select.removeAttribute('className');if(select.disabled)HTMLArea._addClass(select,"buttonDisabled");}};
 
index 9c415d2..a0d6c38 100644 (file)
@@ -107,6 +107,7 @@ DynamicCSS.applyCSSRule=function(editor,i18n,cssRules,cssArray){
                tagName, className, rule, k,
                obj = editor.config.customSelects["DynamicCSS-class"];
        newCssArray = cssArray;
+       
        for (rule = 0; rule < cssRules.length; rule++) {
                        // StyleRule
                if (cssRules[rule].selectorText) {
@@ -137,10 +138,15 @@ DynamicCSS.applyCSSRule=function(editor,i18n,cssRules,cssArray){
                                        }
                                }
                        }
-               }
-                       // ImportRule (Mozilla)
-               else if (cssRules[rule].styleSheet){
-                       newCssArray = DynamicCSS.applyCSSRule(editor, i18n, cssRules[rule].styleSheet.cssRules, newCssArray);
+               } else {
+                               // ImportRule (Mozilla)
+                       if (cssRules[rule].styleSheet) {
+                               newCssArray = DynamicCSS.applyCSSRule(editor, i18n, cssRules[rule].styleSheet.cssRules, newCssArray);
+                       }
+                               // MediaRule (Mozilla)
+                       if (cssRules[rule].cssRules) {
+                               newCssArray = DynamicCSS.applyCSSRule(editor, i18n, cssRules[rule].cssRules, newCssArray);
+                       }
                }
        }
        return newCssArray;
index 4d153d8..0b6e88b 100644 (file)
@@ -1,2 +1,2 @@
-InlineCSS=function(editor,args){this.editor=editor;var cfg=editor.config;var toolbar=cfg.toolbar;var editorNumber=editor._editorNumber;var obj={id:"InlineCSS-class",tooltip:InlineCSS_langArray["InlineCSSStyleTooltip"],options:{"":""},action:null,refresh:null,context:"*",cssArray:new Object(),parseCount:1,loaded:false,timeout:null,lastTag:"",lastClass:"",showTagFreeClasses:RTEarea[editorNumber]["showTagFreeClasses"],classesUrl:RTEarea[editorNumber]["classesUrl"],classesCharacter:RTEarea[editorNumber]["classesTag"]["span"]};var actionHandlerFunctRef=InlineCSS.actionHandler(this,obj);obj.action=actionHandlerFunctRef;var refreshHandlerFunctRef=InlineCSS.refreshHandler(this);obj.refresh=refreshHandlerFunctRef;cfg.registerDropdown(obj);};InlineCSS.actionHandler=function(instance,obj){return(function(editor){instance.onSelect(editor,obj);});};InlineCSS.refreshHandler=function(instance){return(function(editor){instance.generate(editor);});};InlineCSS.I18N=InlineCSS_langArray;InlineCSS.parseStyleSheet=function(editor){var obj=editor.config.customSelects["InlineCSS-class"];var iframe=editor._iframe.contentWindow?editor._iframe.contentWindow.document:editor._iframe.contentDocument;var newCssArray=new Object();obj.loaded=true;for(var i=0;i<iframe.styleSheets.length;i++){if(HTMLArea.is_gecko){try{newCssArray=InlineCSS.applyCSSRule(editor,InlineCSS.I18N,iframe.styleSheets[i].cssRules,newCssArray);}catch(e){obj.loaded=false;}}else{try{if(iframe.styleSheets[i].imports){newCssArray=InlineCSS.applyCSSIEImport(editor,InlineCSS.I18N,iframe.styleSheets[i].imports,newCssArray);};if(iframe.styleSheets[i].rules){newCssArray=InlineCSS.applyCSSRule(editor,InlineCSS.I18N,iframe.styleSheets[i].rules,newCssArray);}}catch(e){obj.loaded=false;}}};return newCssArray;};InlineCSS.applyCSSRule=function(editor,i18n,cssRules,cssArray){var cssElements=new Array();var cssElement=new Array();var newCssArray=new Object();var tagName,className,rule,k;var obj=editor.config.customSelects["InlineCSS-class"];newCssArray=cssArray;for(rule=0;rule<cssRules.length;rule++){if(cssRules[rule].selectorText){if(cssRules[rule].selectorText.search(/:+/)==-1){cssElements=cssRules[rule].selectorText.split(",");for(k=0;k<cssElements.length;k++){cssElement=cssElements[k].split(".");tagName=cssElement[0].toLowerCase().trim();if(!tagName)tagName='all';className=cssElement[1];if((!obj["classesCharacter"]&&(tagName=='span'))||((tagName!="all"||obj["showTagFreeClasses"]==true)&&obj["classesCharacter"]&&obj["classesCharacter"].indexOf(className)!=-1)){if(!newCssArray[tagName])newCssArray[tagName]=new Object();if(className){cssName=className;if(HTMLArea.classesLabels)cssName=HTMLArea.classesLabels[className]?HTMLArea.classesLabels[className]:cssName;if(tagName!='all')cssName='<'+cssName+'>';}else{className='none';if(tagName=='all')cssName=i18n["Default"];else cssName='<'+i18n["Default"]+'>';};newCssArray[tagName][className]=cssName;}}}}else if(cssRules[rule].styleSheet){newCssArray=InlineCSS.applyCSSRule(editor,i18n,cssRules[rule].styleSheet.cssRules,newCssArray);}};return newCssArray;};InlineCSS.applyCSSIEImport=function(editor,i18n,cssIEImport,cssArray){var newCssArray=new Object();newCssArray=cssArray;for(var i=0;i<cssIEImport.length;i++){if(cssIEImport[i].imports){newCssArray=InlineCSS.applyCSSIEImport(editor,i18n,cssIEImport[i].imports,newCssArray);};if(cssIEImport[i].rules){newCssArray=InlineCSS.applyCSSRule(editor,i18n,cssIEImport[i].rules,newCssArray);}};return newCssArray;};InlineCSS._pluginInfo={name:"InlineCSS",version:"1.4",developer:"Stanislas Rolland",developer_url:"http://www.fructifor.ca/",c_owner:"Stanislas Rolland",sponsor:"Fructifor Inc.",sponsor_url:"http://www.fructifor.ca/",license:"GPL"};InlineCSS.prototype.onSelect=function(editor,obj){var tbobj=editor._toolbarObjects[obj.id];var index=document.getElementById(tbobj.elementId).selectedIndex;var className=document.getElementById(tbobj.elementId).value;var selTrimmed;editor.focusEditor();var selectedHTML=editor.getSelectedHTMLContents();if(selectedHTML)selTrimmed=selectedHTML.replace(/(<[^>]*>|&nbsp;|\n|\r)/g,"");var parent=editor.getParentElement();if((HTMLArea.is_gecko&&/\w/.test(selTrimmed)==true)||(HTMLArea.is_ie &&/\S/.test(selTrimmed)==true)){var sel=editor._getSelection();var range=editor._createRange(sel);if(className!='none'){obj.lastClass=className;if(parent&&!HTMLArea.isBlockElement(parent)&&selectedHTML.replace(/^\s*|\s*$/g,"")==parent.innerHTML.replace(/^\s*|\s*$/g,"")){parent.className=className;}else{if(HTMLArea.is_gecko){var rangeClone=range.cloneRange();var span=editor._doc.createElement("span");span.className=className;span.appendChild(range.extractContents());range.insertNode(span);if(HTMLArea.is_safari){sel.empty();sel.setBaseAndExtent(rangeClone.startContainer,rangeClone.startOffset,rangeClone.endContainer,rangeClone.endOffset);}else{sel.removeRange(range);sel.addRange(rangeClone);};range.detach();}else{var tagopen='<span class="'+className+'">';var tagclose="</span>";editor.surroundHTML(tagopen,tagclose);}}}else{if(parent&&!HTMLArea.isBlockElement(parent)){if(HTMLArea.is_gecko){parent.removeAttribute('class');}else{parent.removeAttribute('className');};if(parent.tagName.toLowerCase()=="span"){p=parent.parentNode;while(parent.firstChild)p.insertBefore(parent.firstChild,parent);p.removeChild(parent);}}}editor.updateToolbar();}else{editor.updateToolbar();alert(InlineCSS.I18N['You have to select some text']);}};InlineCSS.prototype.onGenerate=function(){var editor=this.editor;var obj=editor.config.customSelects["InlineCSS-class"];if(HTMLArea.is_gecko)this.generate(editor);};InlineCSS.prototype.onUpdateToolbar=function(){var editor=this.editor;var obj=editor.config.customSelects["InlineCSS-class"];if(HTMLArea.is_gecko&&editor._editMode!="textmode"){if(obj.loaded){this.updateValue(editor,obj);}else{if(obj.timeout){if(editor._iframe.contentWindow){editor._iframe.contentWindow.clearTimeout(obj.timeout);}else{window.clearTimeout(obj.timeout);};obj.timeout=null;};this.generate(editor);}}};InlineCSS.prototype.generate=function(editor){var obj=editor.config.customSelects["InlineCSS-class"];var classesUrl=obj["classesUrl"];if(classesUrl&&typeof(HTMLArea.classesLabels)=="undefined"){var classesData=HTMLArea._getScript(0,false,classesUrl);if(classesData)eval(classesData);};if(obj.loaded)this.updateValue(editor,obj);else this.getCSSArray(editor);};InlineCSS.prototype.getCSSArray=function(editor){var obj=editor.config.customSelects["InlineCSS-class"];obj.cssArray=InlineCSS.parseStyleSheet(editor);if(!obj.loaded&&obj.parseCount<17){var getCSSArrayLaterFunctRef=InlineCSS.getCSSArrayLater(editor,this);obj.timeout=editor._iframe.contentWindow?editor._iframe.contentWindow.setTimeout(getCSSArrayLaterFunctRef,200):window.setTimeout(getCSSArrayLaterFunctRef,200);obj.parseCount++;}else{obj.timeout=null;obj.loaded=true;this.updateValue(editor,obj);}};InlineCSS.getCSSArrayLater=function(editor,instance){return(function(){instance.getCSSArray(editor);});};InlineCSS.prototype.onMode=function(mode){var editor=this.editor;if(mode=='wysiwyg'){var obj=editor.config.customSelects["InlineCSS-class"];if(obj.loaded){this.updateValue(editor,obj);}else{if(obj.timeout){if(editor._iframe.contentWindow){editor._iframe.contentWindow.clearTimeout(obj.timeout);}else{window.clearTimeout(obj.timeout);};obj.timeout=null;};this.generate(editor);}}};InlineCSS.prototype.updateValue=function(editor,obj){var cssClass,i;if(!obj.loaded){if(obj.timeout){if(editor._iframe.contentWindow){editor._iframe.contentWindow.clearTimeout(obj.timeout);}else{window.clearTimeout(obj.timeout);};obj.timeout=null;};this.generate(editor);};var cssArray=obj.cssArray;var tagName="body";var className="";var parent=editor.getParentElement();if(parent){tagName=parent.nodeName.toLowerCase();className=parent.className;};var selTrimmed=editor.getSelectedHTMLContents();if(selTrimmed)selTrimmed=selTrimmed.replace(/(<[^>]*>|&nbsp;|\n|\r)/g,"");var endPointsInSameBlock=false;if((HTMLArea.is_gecko&&/\w/.test(selTrimmed)==true)||(HTMLArea.is_ie &&/\S/.test(selTrimmed)==true)){var sel=editor._getSelection();var range=editor._createRange(sel);if(HTMLArea.is_gecko){if(sel.rangeCount==1||HTMLArea.is_safari){var parentStart=range.startContainer;var parentEnd=range.endContainer;if(!(parentStart.nodeType==1&&parentStart.tagName.toLowerCase()=="tr")){while(parentStart&&!HTMLArea.isBlockElement(parentStart)){parentStart=parentStart.parentNode;};while(parentEnd&&!HTMLArea.isBlockElement(parentEnd)){parentEnd=parentEnd.parentNode;}endPointsInSameBlock=(parentStart==parentEnd)&&(parent.tagName.toLowerCase()!="body")&&(parent.tagName.toLowerCase()!="table")&&(parent.tagName.toLowerCase()!="tbody")&&(parent.tagName.toLowerCase()!="tr");}}}else{if(sel.type!="Control"){var rangeStart=range.duplicate();rangeStart.collapse(true);var rangeEnd=range.duplicate();rangeEnd.collapse(false);var parentStart=rangeStart.parentElement();var parentEnd=rangeEnd.parentElement();while(parentStart&&!HTMLArea.isBlockElement(parentStart)){parentStart=parentStart.parentNode;};while(parentEnd&&!HTMLArea.isBlockElement(parentEnd)){parentEnd=parentEnd.parentNode;}endPointsInSameBlock=(parentStart==parentEnd)&&(parent.tagName.toLowerCase()!="body");}}};var select=document.getElementById(editor._toolbarObjects[obj.id].elementId);select.disabled=!(/\w/.test(selTrimmed))||!(endPointsInSameBlock);obj.lastTag=tagName;obj.lastClass=className;while(select.options.length>0)select.options[select.length-1]=null;select.options[0]=new Option(InlineCSS.I18N["Default"],'none');if(cssArray){if(cssArray['span']){for(cssClass in cssArray['span']){if(cssClass=='none'){select.options[0]=new Option(cssArray['span'][cssClass],cssClass);}else{select.options[select.options.length]=new Option(cssArray['span'][cssClass],cssClass);if(!editor.config.disablePCexamples&&HTMLArea.classesValues&&HTMLArea.classesValues[cssClass]&&!HTMLArea.classesNoShow[cssClass])select.options[select.options.length-1].setAttribute("style",HTMLArea.classesValues[cssClass]);}}};if(cssArray['all']){for(cssClass in cssArray['all']){select.options[select.options.length]=new Option(cssArray['all'][cssClass],cssClass);if(!editor.config.disablePCexamples&&HTMLArea.classesValues&&HTMLArea.classesValues[cssClass]&&!HTMLArea.classesNoShow[cssClass])select.options[select.options.length-1].setAttribute("style",HTMLArea.classesValues[cssClass]);}}};select.selectedIndex=0;if(typeof className!="undefined"&&/\S/.test(className)&&!HTMLArea.reservedClassNames.test(className)){for(i=select.options.length;--i>=0;){var option=select.options[i];if(className==option.value){option.selected=true;select.selectedIndex=i;break;}};if(select.selectedIndex==0){select.options[select.options.length]=new Option(InlineCSS.I18N["Undefined"],className);select.selectedIndex=select.options.length-1;}};select.disabled=!(select.options.length>1)||!endPointsInSameBlock||!((HTMLArea.is_gecko&&/\w/.test(selTrimmed)==true)||(HTMLArea.is_ie &&/\S/.test(selTrimmed)==true));select.className="";if(select.disabled)select.className="buttonDisabled";};
+/**Inline CSS Plugin for TYPO3 htmlArea RTE**TYPO3 CVS ID:$Id:inlinecss.js 1809 2006-11-23 12:04:14Z ingmars $*/InlineCSS=function(editor,args){this.editor=editor;var cfg=editor.config;var toolbar=cfg.toolbar;var editorNumber=editor._editorNumber;var obj={id:"InlineCSS-class",tooltip:InlineCSS_langArray["InlineCSSStyleTooltip"],options:{"":""},action:null,refresh:null,context:"*",cssArray:new Object(),parseCount:1,loaded:false,timeout:null,lastTag:"",lastClass:"",showTagFreeClasses:RTEarea[editorNumber]["showTagFreeClasses"],classesUrl:RTEarea[editorNumber]["classesUrl"],classesCharacter:RTEarea[editorNumber]["classesTag"]["span"]};var actionHandlerFunctRef=InlineCSS.actionHandler(this,obj);obj.action=actionHandlerFunctRef;var refreshHandlerFunctRef=InlineCSS.refreshHandler(this);obj.refresh=refreshHandlerFunctRef;cfg.registerDropdown(obj);};InlineCSS.actionHandler=function(instance,obj){return(function(editor){instance.onSelect(editor,obj);});};InlineCSS.refreshHandler=function(instance){return(function(editor){instance.generate(editor);});};InlineCSS.I18N=InlineCSS_langArray;InlineCSS.parseStyleSheet=function(editor){var obj=editor.config.customSelects["InlineCSS-class"];var iframe=editor._iframe.contentWindow?editor._iframe.contentWindow.document:editor._iframe.contentDocument;var newCssArray=new Object();obj.loaded=true;for(var i=0;i<iframe.styleSheets.length;i++){if(HTMLArea.is_gecko){try{newCssArray=InlineCSS.applyCSSRule(editor,InlineCSS.I18N,iframe.styleSheets[i].cssRules,newCssArray);}catch(e){obj.loaded=false;}}else{try{if(iframe.styleSheets[i].imports){newCssArray=InlineCSS.applyCSSIEImport(editor,InlineCSS.I18N,iframe.styleSheets[i].imports,newCssArray);}if(iframe.styleSheets[i].rules){newCssArray=InlineCSS.applyCSSRule(editor,InlineCSS.I18N,iframe.styleSheets[i].rules,newCssArray);}}catch(e){obj.loaded=false;}}}return newCssArray;};InlineCSS.applyCSSRule=function(editor,i18n,cssRules,cssArray){var cssElements=new Array();var cssElement=new Array();var newCssArray=new Object();var tagName,className,rule,k;var obj=editor.config.customSelects["InlineCSS-class"];newCssArray=cssArray;for(rule=0;rule<cssRules.length;rule++){if(cssRules[rule].selectorText){if(cssRules[rule].selectorText.search(/:+/)==-1){cssElements=cssRules[rule].selectorText.split(",");for(k=0;k<cssElements.length;k++){cssElement=cssElements[k].split(".");tagName=cssElement[0].toLowerCase().trim();if(!tagName)tagName='all';className=cssElement[1];if((!obj["classesCharacter"]&&(tagName=='span'))||((tagName!="all"||obj["showTagFreeClasses"]==true)&&obj["classesCharacter"]&&obj["classesCharacter"].indexOf(className)!=-1)){if(!newCssArray[tagName])newCssArray[tagName]=new Object();if(className){cssName=className;if(HTMLArea.classesLabels)cssName=HTMLArea.classesLabels[className]?HTMLArea.classesLabels[className]:cssName;if(tagName!='all')cssName='<'+cssName+'>';}else{className='none';if(tagName=='all')cssName=i18n["Default"];else cssName='<'+i18n["Default"]+'>';}newCssArray[tagName][className]=cssName;}}}}else{if(cssRules[rule].styleSheet){newCssArray=InlineCSS.applyCSSRule(editor,i18n,cssRules[rule].styleSheet.cssRules,newCssArray);}if(cssRules[rule].cssRules){newCssArray=InlineCSS.applyCSSRule(editor,i18n,cssRules[rule].cssRules,newCssArray);}}}return newCssArray;};InlineCSS.applyCSSIEImport=function(editor,i18n,cssIEImport,cssArray){var newCssArray=new Object();newCssArray=cssArray;for(var i=0;i<cssIEImport.length;i++){if(cssIEImport[i].imports){newCssArray=InlineCSS.applyCSSIEImport(editor,i18n,cssIEImport[i].imports,newCssArray);}if(cssIEImport[i].rules){newCssArray=InlineCSS.applyCSSRule(editor,i18n,cssIEImport[i].rules,newCssArray);}}return newCssArray;};InlineCSS._pluginInfo={name:"InlineCSS",version:"1.4",developer:"Stanislas Rolland",developer_url:"http://www.fructifor.ca/",c_owner:"Stanislas Rolland",sponsor:"Fructifor Inc.",sponsor_url:"http://www.fructifor.ca/",license:"GPL"};InlineCSS.prototype.onSelect=function(editor,obj){var tbobj=editor._toolbarObjects[obj.id];var index=document.getElementById(tbobj.elementId).selectedIndex;var className=document.getElementById(tbobj.elementId).value;var selTrimmed;editor.focusEditor();var selectedHTML=editor.getSelectedHTMLContents();if(selectedHTML)selTrimmed=selectedHTML.replace(/(<[^>]*>|&nbsp;|\n|\r)/g,"");var parent=editor.getParentElement();if((HTMLArea.is_gecko&&/\w/.test(selTrimmed)==true)||(HTMLArea.is_ie &&/\S/.test(selTrimmed)==true)){var sel=editor._getSelection();var range=editor._createRange(sel);if(className!='none'){obj.lastClass=className;if(parent&&!HTMLArea.isBlockElement(parent)&&selectedHTML.replace(/^\s*|\s*$/g,"")==parent.innerHTML.replace(/^\s*|\s*$/g,"")){parent.className=className;}else{if(HTMLArea.is_gecko){var rangeClone=range.cloneRange();var span=editor._doc.createElement("span");span.className=className;span.appendChild(range.extractContents());range.insertNode(span);if(HTMLArea.is_safari){sel.empty();sel.setBaseAndExtent(rangeClone.startContainer,rangeClone.startOffset,rangeClone.endContainer,rangeClone.endOffset);}else{sel.removeRange(range);sel.addRange(rangeClone);}range.detach();}else{var tagopen='<span class="'+className+'">';var tagclose="</span>";editor.surroundHTML(tagopen,tagclose);}}}else{if(parent&&!HTMLArea.isBlockElement(parent)){if(HTMLArea.is_gecko){parent.removeAttribute('class');}else{parent.removeAttribute('className');}if(parent.tagName.toLowerCase()=="span"){p=parent.parentNode;while(parent.firstChild)p.insertBefore(parent.firstChild,parent);p.removeChild(parent);}}}editor.updateToolbar();}else{editor.updateToolbar();alert(InlineCSS.I18N['You have to select some text']);}};InlineCSS.prototype.onGenerate=function(){var editor=this.editor;var obj=editor.config.customSelects["InlineCSS-class"];if(HTMLArea.is_gecko)this.generate(editor);};InlineCSS.prototype.onUpdateToolbar=function(){var editor=this.editor;var obj=editor.config.customSelects["InlineCSS-class"];if(HTMLArea.is_gecko&&editor._editMode!="textmode"){if(obj.loaded){this.updateValue(editor,obj);}else{if(obj.timeout){if(editor._iframe.contentWindow){editor._iframe.contentWindow.clearTimeout(obj.timeout);}else{window.clearTimeout(obj.timeout);}obj.timeout=null;}this.generate(editor);}}};InlineCSS.prototype.generate=function(editor){var obj=editor.config.customSelects["InlineCSS-class"];var classesUrl=obj["classesUrl"];if(classesUrl&&typeof(HTMLArea.classesLabels)=="undefined"){var classesData=HTMLArea._getScript(0,false,classesUrl);if(classesData)eval(classesData);}if(obj.loaded)this.updateValue(editor,obj);else this.getCSSArray(editor);};InlineCSS.prototype.getCSSArray=function(editor){var obj=editor.config.customSelects["InlineCSS-class"];obj.cssArray=InlineCSS.parseStyleSheet(editor);if(!obj.loaded&&obj.parseCount<17){var getCSSArrayLaterFunctRef=InlineCSS.getCSSArrayLater(editor,this);obj.timeout=editor._iframe.contentWindow?editor._iframe.contentWindow.setTimeout(getCSSArrayLaterFunctRef,200):window.setTimeout(getCSSArrayLaterFunctRef,200);obj.parseCount++;}else{obj.timeout=null;obj.loaded=true;this.updateValue(editor,obj);}};InlineCSS.getCSSArrayLater=function(editor,instance){return(function(){instance.getCSSArray(editor);});};InlineCSS.prototype.onMode=function(mode){var editor=this.editor;if(mode=='wysiwyg'){var obj=editor.config.customSelects["InlineCSS-class"];if(obj.loaded){this.updateValue(editor,obj);}else{if(obj.timeout){if(editor._iframe.contentWindow){editor._iframe.contentWindow.clearTimeout(obj.timeout);}else{window.clearTimeout(obj.timeout);}obj.timeout=null;}this.generate(editor);}}};InlineCSS.prototype.updateValue=function(editor,obj){var cssClass,i;if(!obj.loaded){if(obj.timeout){if(editor._iframe.contentWindow){editor._iframe.contentWindow.clearTimeout(obj.timeout);}else{window.clearTimeout(obj.timeout);}obj.timeout=null;}this.generate(editor);}var cssArray=obj.cssArray;var tagName="body";var className="";var parent=editor.getParentElement();if(parent){tagName=parent.nodeName.toLowerCase();className=parent.className;}var selTrimmed=editor.getSelectedHTMLContents();if(selTrimmed)selTrimmed=selTrimmed.replace(/(<[^>]*>|&nbsp;|\n|\r)/g,"");var endPointsInSameBlock=false;if((HTMLArea.is_gecko&&/\w/.test(selTrimmed)==true)||(HTMLArea.is_ie &&/\S/.test(selTrimmed)==true)){var sel=editor._getSelection();var range=editor._createRange(sel);if(HTMLArea.is_gecko){if(sel.rangeCount==1||HTMLArea.is_safari){var parentStart=range.startContainer;var parentEnd=range.endContainer;if(!(parentStart.nodeType==1&&parentStart.tagName.toLowerCase()=="tr")){while(parentStart&&!HTMLArea.isBlockElement(parentStart)){parentStart=parentStart.parentNode;}while(parentEnd&&!HTMLArea.isBlockElement(parentEnd)){parentEnd=parentEnd.parentNode;}endPointsInSameBlock=(parentStart==parentEnd)&&(parent.tagName.toLowerCase()!="body")&&(parent.tagName.toLowerCase()!="table")&&(parent.tagName.toLowerCase()!="tbody")&&(parent.tagName.toLowerCase()!="tr");}}}else{if(sel.type!="Control"){var rangeStart=range.duplicate();rangeStart.collapse(true);var rangeEnd=range.duplicate();rangeEnd.collapse(false);var parentStart=rangeStart.parentElement();var parentEnd=rangeEnd.parentElement();while(parentStart&&!HTMLArea.isBlockElement(parentStart)){parentStart=parentStart.parentNode;}while(parentEnd&&!HTMLArea.isBlockElement(parentEnd)){parentEnd=parentEnd.parentNode;}endPointsInSameBlock=(parentStart==parentEnd)&&(parent.tagName.toLowerCase()!="body");}}}var select=document.getElementById(editor._toolbarObjects[obj.id].elementId);select.disabled=!(/\w/.test(selTrimmed))||!(endPointsInSameBlock);obj.lastTag=tagName;obj.lastClass=className;while(select.options.length>0)select.options[select.length-1]=null;select.options[0]=new Option(InlineCSS.I18N["Default"],'none');if(cssArray){if(cssArray['span']){for(cssClass in cssArray['span']){if(cssClass=='none'){select.options[0]=new Option(cssArray['span'][cssClass],cssClass);}else{select.options[select.options.length]=new Option(cssArray['span'][cssClass],cssClass);if(!editor.config.disablePCexamples&&HTMLArea.classesValues&&HTMLArea.classesValues[cssClass]&&!HTMLArea.classesNoShow[cssClass])select.options[select.options.length-1].setAttribute("style",HTMLArea.classesValues[cssClass]);}}}if(cssArray['all']){for(cssClass in cssArray['all']){select.options[select.options.length]=new Option(cssArray['all'][cssClass],cssClass);if(!editor.config.disablePCexamples&&HTMLArea.classesValues&&HTMLArea.classesValues[cssClass]&&!HTMLArea.classesNoShow[cssClass])select.options[select.options.length-1].setAttribute("style",HTMLArea.classesValues[cssClass]);}}}select.selectedIndex=0;if(typeof className!="undefined"&&/\S/.test(className)&&!HTMLArea.reservedClassNames.test(className)){for(i=select.options.length;--i>=0;){var option=select.options[i];if(className==option.value){option.selected=true;select.selectedIndex=i;break;}}if(select.selectedIndex==0){select.options[select.options.length]=new Option(InlineCSS.I18N["Undefined"],className);select.selectedIndex=select.options.length-1;}}select.disabled=!(select.options.length>1)||!endPointsInSameBlock||!((HTMLArea.is_gecko&&/\w/.test(selTrimmed)==true)||(HTMLArea.is_ie &&/\S/.test(selTrimmed)==true));select.className="";if(select.disabled)select.className="buttonDisabled";};
 
index 5db883e..8c3f583 100644 (file)
@@ -134,10 +134,15 @@ InlineCSS.applyCSSRule = function(editor,i18n,cssRules,cssArray){
                                        }
                                }
                        }
-               }
-                       // ImportRule (Mozilla)
-               else if(cssRules[rule].styleSheet){
-                       newCssArray = InlineCSS.applyCSSRule(editor,i18n,cssRules[rule].styleSheet.cssRules,newCssArray);
+               } else {
+                               // ImportRule (Mozilla)
+                       if (cssRules[rule].styleSheet) {
+                               newCssArray = InlineCSS.applyCSSRule(editor, i18n, cssRules[rule].styleSheet.cssRules, newCssArray);
+                       }
+                               // MediaRule (Mozilla)
+                       if (cssRules[rule].cssRules) {
+                               newCssArray = InlineCSS.applyCSSRule(editor, i18n, cssRules[rule].cssRules, newCssArray);
+                       }
                }
        }
        return newCssArray;