Feature #17714 » rtehtmlarea_feature_6579_prototype.patch
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (working copy) | ||
---|---|---|
<link rel="stylesheet" type="text/css" href="' . $this->editorCSS . '" />';
|
||
|
||
// Loading JavaScript files and code
|
||
//$this->TCEform->loadJavascriptLib('prototype');
|
||
$this->TCEform->additionalCode_pre['loadJSfiles'] = $this->loadJSfiles($this->TCEform->RTEcounter);
|
||
$this->TCEform->additionalJS_pre['loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
|
||
... | ... | |
</script>';
|
||
$loadJavascriptCode .= '
|
||
<script type="text/javascript" src="' . $this->buildJSMainLangFile($RTEcounter) . '"></script>
|
||
<script type="text/javascript" src="'. ($this->is_FE()?'/typo3/':'') . 'contrib/prototype/prototype.js"></script>
|
||
<script type="text/javascript" src="' . $this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea.js', "htmlarea") . '"></script>
|
||
';
|
||
return $loadJavascriptCode;
|
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (working copy) | ||
---|---|---|
};
|
||
HTMLArea.loadTimer;
|
||
HTMLArea._scripts = [];
|
||
HTMLArea.scriptLoaded = [];
|
||
HTMLArea._scriptLoaded = [];
|
||
HTMLArea._request = [];
|
||
HTMLArea.loadScript = function(url, plugin) {
|
||
if (plugin) url = _editor_url + "/plugins/" + plugin + '/' + url;
|
||
if (HTMLArea.is_opera) url = _typo3_host_url + url;
|
||
... | ... | |
if(HTMLArea.is_ie) HTMLArea.loadScript(RTEarea[0]["htmlarea-ie"] ? RTEarea[0]["htmlarea-ie"] : _editor_url + "htmlarea-ie.js");
|
||
/*
|
||
* Get a script using an asynchronous request
|
||
* Get a script using asynchronous XMLHttpRequest
|
||
*/
|
||
HTMLArea._getScript = function (i, asynchronous, url) {
|
||
if (typeof(url) === "undefined") {
|
||
HTMLArea.MSXML_XMLHTTP_PROGIDS = new Array("Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP");
|
||
HTMLArea.XMLHTTPResponseHandler = function (i) {
|
||
return (function() {
|
||
var url = HTMLArea._scripts[i];
|
||
}
|
||
if (typeof(asynchronous) === "undefined") {
|
||
var asynchronous = true;
|
||
}
|
||
new Ajax.Request(url, {
|
||
asynchronous : asynchronous,
|
||
method : "get",
|
||
onSuccess : function(transport) {
|
||
HTMLArea.scriptLoaded[i] = true;
|
||
return true;
|
||
},
|
||
onException : function(transport) {
|
||
HTMLArea._appendToLog("ERROR [HTMLArea::getScript]: Unable to get " + url + " . Exception raised: " + transport.statusText);
|
||
return false;
|
||
},
|
||
onFailure : function(transport) {
|
||
HTMLArea._appendToLog("ERROR [HTMLArea::getScript]: Unable to get " + url + " . Server reported " + transport.statusText);
|
||
return false;
|
||
if (HTMLArea._request[i].readyState != 4) return;
|
||
if (HTMLArea._request[i].status == 200) {
|
||
try {
|
||
eval(HTMLArea._request[i].responseText);
|
||
HTMLArea._scriptLoaded[i] = true;
|
||
i = null;
|
||
} catch (e) {
|
||
HTMLArea._appendToLog("ERROR [HTMLArea::getScript]: Unable to get script " + url + ": " + e);
|
||
}
|
||
} else {
|
||
HTMLArea._appendToLog("ERROR [HTMLArea::getScript]: Unable to get " + url + " . Server reported " + HTMLArea._request[i].status);
|
||
}
|
||
});
|
||
};
|
||
HTMLArea._getScript = function (i,asynchronous,url) {
|
||
if (typeof(url) == "undefined") var url = HTMLArea._scripts[i];
|
||
if (typeof(asynchronous) == "undefined") var asynchronous = true;
|
||
if (window.XMLHttpRequest) HTMLArea._request[i] = new XMLHttpRequest();
|
||
else if (window.ActiveXObject) {
|
||
var success = false;
|
||
for (var k = 0; k < HTMLArea.MSXML_XMLHTTP_PROGIDS.length && !success; k++) {
|
||
try {
|
||
HTMLArea._request[i] = new ActiveXObject(HTMLArea.MSXML_XMLHTTP_PROGIDS[k]);
|
||
success = true;
|
||
} catch (e) { }
|
||
}
|
||
if (!success) return false;
|
||
}
|
||
var request = HTMLArea._request[i];
|
||
if (request) {
|
||
request.open("GET", url, asynchronous);
|
||
if (asynchronous) request.onreadystatechange = HTMLArea.XMLHTTPResponseHandler(i);
|
||
if (window.XMLHttpRequest) request.send(null);
|
||
else if (window.ActiveXObject) request.send();
|
||
if (!asynchronous) {
|
||
if (request.status == 200) return request.responseText;
|
||
else return '';
|
||
}
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
};
|
||
/*
|
||
* Wait for the loading process to complete
|
||
... | ... | |
HTMLArea.checkInitialLoad = function() {
|
||
var scriptsLoaded = true;
|
||
for (var i = HTMLArea._scripts.length; --i >= 0;) {
|
||
scriptsLoaded = scriptsLoaded && HTMLArea.scriptLoaded[i];
|
||
scriptsLoaded = scriptsLoaded && HTMLArea._scriptLoaded[i];
|
||
}
|
||
if (HTMLArea.loadTimer) window.clearTimeout(HTMLArea.loadTimer);
|
||
if(HTMLArea.loadTimer) window.clearTimeout(HTMLArea.loadTimer);
|
||
if (scriptsLoaded) {
|
||
HTMLArea.is_loaded = true;
|
||
HTMLArea._appendToLog("[HTMLArea::init]: All scripts successfully loaded.");
|
||
HTMLArea._appendToLog("[HTMLArea::init]: Editor url set to: " + _editor_url);
|
||
HTMLArea._appendToLog("[HTMLArea::init]: Editor skin CSS set to: " + _editor_CSS);
|
||
HTMLArea._appendToLog("[HTMLArea::init]: Editor content skin CSS set to: " + _editor_edited_content_CSS);
|
||
return true;
|
||
if (window.ActiveXObject) {
|
||
for (var i = HTMLArea._scripts.length; --i >= 0;) {
|
||
HTMLArea._request[i].onreadystatechange = new Function();
|
||
HTMLArea._request[i] = null;
|
||
}
|
||
}
|
||
} else {
|
||
HTMLArea.loadTimer = window.setTimeout("HTMLArea.checkInitialLoad();", 200);
|
||
return false;
|
||
... | ... | |
*/
|
||
HTMLArea.init = function() {
|
||
HTMLArea._eventCache = HTMLArea._eventCacheConstructor();
|
||
for (var i = HTMLArea._scripts.length; --i >= 0;) {
|
||
HTMLArea._getScript(i);
|
||
if (window.XMLHttpRequest || window.ActiveXObject) {
|
||
try {
|
||
var success = true;
|
||
for (var i = HTMLArea._scripts.length; --i >= 0 && success;) success = success && HTMLArea._getScript(i);
|
||
} catch (e) {
|
||
HTMLArea._appendToLog("ERROR [HTMLArea::init]: Unable to use XMLHttpRequest: "+ e);
|
||
}
|
||
if (success) {
|
||
HTMLArea.checkInitialLoad();
|
||
} else {
|
||
if (HTMLArea.is_ie) window.setTimeout('if (window.document.getElementById("pleasewait1")) { window.document.getElementById("pleasewait1").innerHTML = HTMLArea.I18N.msg["ActiveX-required"]; } else { alert(HTMLArea.I18N.msg["ActiveX-required"]); };', 200);
|
||
}
|
||
} else {
|
||
if (HTMLArea.is_ie) alert(HTMLArea.I18N.msg["ActiveX-required"]);
|
||
}
|
||
HTMLArea.checkInitialLoad();
|
||
};
|
||
/*
|
||
... | ... | |
};
|
||
/**
|
||
* htmlArea plugin class using the Prototype JavaScript framework
|
||
* Base, version 1.0.2
|
||
* Copyright 2006, Dean Edwards
|
||
* License: http://creativecommons.org/licenses/LGPL/2.1/
|
||
*/
|
||
HTMLArea.plugin = Class.create( {
|
||
|
||
/**
|
||
* Class constructor
|
||
*
|
||
* @param object editor: instance of RTE
|
||
* @param string pluginName: name of the plugin
|
||
*
|
||
* @return boolean true if the plugin was configured
|
||
*/
|
||
initialize : function(editor, pluginName) {
|
||
HTMLArea.Base = function() {
|
||
if (arguments.length) {
|
||
if (this == window) { // cast an object to this class
|
||
HTMLArea.Base.prototype.extend.call(arguments[0], arguments.callee.prototype);
|
||
} else {
|
||
this.extend(arguments[0]);
|
||
}
|
||
}
|
||
};
|
||
HTMLArea.Base.version = "1.0.2";
|
||
HTMLArea.Base.prototype = {
|
||
extend: function(source, value) {
|
||
var extend = HTMLArea.Base.prototype.extend;
|
||
if (arguments.length == 2) {
|
||
var ancestor = this[source];
|
||
// overriding?
|
||
if ((ancestor instanceof Function) && (value instanceof Function) &&
|
||
ancestor.valueOf() != value.valueOf() && /\bbase\b/.test(value)) {
|
||
var method = value;
|
||
// var _prototype = this.constructor.prototype;
|
||
// var fromPrototype = !Base._prototyping && _prototype[source] == ancestor;
|
||
value = function() {
|
||
var previous = this.base;
|
||
// this.base = fromPrototype ? _prototype[source] : ancestor;
|
||
this.base = ancestor;
|
||
var returnValue = method.apply(this, arguments);
|
||
this.base = previous;
|
||
return returnValue;
|
||
};
|
||
// point to the underlying method
|
||
value.valueOf = function() {
|
||
return method;
|
||
};
|
||
value.toString = function() {
|
||
return String(method);
|
||
};
|
||
}
|
||
return this[source] = value;
|
||
} else if (source) {
|
||
var _prototype = {toSource: null};
|
||
// do the "toString" and other methods manually
|
||
var _protected = ["toString", "valueOf"];
|
||
// if we are prototyping then include the constructor
|
||
if (HTMLArea.Base._prototyping) _protected[2] = "constructor";
|
||
for (var i = 0; (name = _protected[i]); i++) {
|
||
if (source[name] != _prototype[name]) {
|
||
extend.call(this, name, source[name]);
|
||
}
|
||
}
|
||
// copy each of the source object's properties to this object
|
||
for (var name in source) {
|
||
if (!_prototype[name]) {
|
||
extend.call(this, name, source[name]);
|
||
}
|
||
}
|
||
}
|
||
return this;
|
||
},
|
||
base: function() {
|
||
// call this method from any other method to invoke that method's ancestor
|
||
}
|
||
};
|
||
HTMLArea.Base.extend = function(_instance, _static) {
|
||
var extend = HTMLArea.Base.prototype.extend;
|
||
if (!_instance) _instance = {};
|
||
// build the prototype
|
||
HTMLArea.Base._prototyping = true;
|
||
var _prototype = new this;
|
||
extend.call(_prototype, _instance);
|
||
var constructor = _prototype.constructor;
|
||
_prototype.constructor = this;
|
||
delete HTMLArea.Base._prototyping;
|
||
// create the wrapper for the constructor function
|
||
var klass = function() {
|
||
if (!HTMLArea.Base._prototyping) constructor.apply(this, arguments);
|
||
this.constructor = klass;
|
||
};
|
||
klass.prototype = _prototype;
|
||
// build the class interface
|
||
klass.extend = this.extend;
|
||
klass.implement = this.implement;
|
||
klass.toString = function() {
|
||
return String(constructor);
|
||
};
|
||
extend.call(klass, _static);
|
||
// single instance
|
||
var object = constructor ? klass : _prototype;
|
||
// class initialisation
|
||
if (object.init instanceof Function) object.init();
|
||
return object;
|
||
};
|
||
HTMLArea.Base.implement = function(_interface) {
|
||
if (_interface instanceof Function) _interface = _interface.prototype;
|
||
this.prototype.extend(_interface);
|
||
};
|
||
/**
|
||
* HTMLArea. plugin constructor
|
||
*
|
||
* @param object editor: instance of RTE
|
||
* @param string pluginName: name of the plugin
|
||
*
|
||
* @return boolean true if the plugin was configured
|
||
*/
|
||
HTMLArea.plugin = HTMLArea.Base.extend({
|
||
constructor : function(editor, pluginName) {
|
||
this.editor = editor;
|
||
this.editorNumber = editor._editorNumber;
|
||
this.editorConfiguration = editor.config;
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultInline/default-inline.js (working copy) | ||
---|---|---|
*
|
||
* TYPO3 SVN ID: $Id$
|
||
*/
|
||
DefaultInline = Class.create(HTMLArea.plugin, {
|
||
DefaultInline = HTMLArea.plugin.extend({
|
||
|
||
constructor : function(editor, pluginName) {
|
||
this.base(editor, pluginName);
|
||
},
|
||
|
||
/*
|
||
* This function gets called by the class constructor
|
||
... | ... | |
this.registerButton(buttonConfiguration);
|
||
}
|
||
return true;
|
||
}
|
||
});
|
||
/* The list of buttons added by this plugin */
|
||
DefaultInline.buttonList = [
|
||
["Bold", null],
|
||
["Italic", null],
|
||
["StrikeThrough", null],
|
||
["Subscript", null],
|
||
["Superscript", null],
|
||
["Underline", null]
|
||
];
|
||
/* The list of hotkeys handled by this plugin */
|
||
DefaultInline.hotKeyList = {
|
||
b : "Bold",
|
||
i : "Italic",
|
||
s : "StrikeThrough",
|
||
u : "Underline"
|
||
};
|
||
/*
|
||
* Definition of additional methods
|
||
*/
|
||
DefaultInline.addMethods({
|
||
},
|
||
|
||
/*
|
||
* This function gets called when some inline element button was pressed.
|
||
*/
|
||
... | ... | |
button.state("active", commandState);
|
||
}
|
||
}
|
||
});
|
||
});
|
||
/* The list of buttons added by this plugin */
|
||
DefaultInline.buttonList = [
|
||
["Bold", null],
|
||
["Italic", null],
|
||
["StrikeThrough", null],
|
||
["Subscript", null],
|
||
["Superscript", null],
|
||
["Underline", null]
|
||
];
|
||
/* The list of hotkeys handled by this plugin */
|
||
DefaultInline.hotKeyList = {
|
||
b : "Bold",
|
||
i : "Italic",
|
||
s : "StrikeThrough",
|
||
u : "Underline"
|
||
};
|
||
typo3/sysext/rtehtmlarea/htmlarea/plugins/DynamicCSS/dynamiccss.js (working copy) | ||
---|---|---|
DynamicCSS.applyCSSIEImport = function(editor,i18n,cssIEImport,cssArray){
|
||
var newCssArray = new Object();
|
||
newCssArray = cssArray;
|
||
for(var i=0;i<cssIEImport.length;i++){
|
||
for (var i=0;i<cssIEImport.length;i++){
|
||
if(cssIEImport[i].imports){
|
||
newCssArray = DynamicCSS.applyCSSIEImport(editor,i18n,cssIEImport[i].imports,newCssArray);
|
||
}
|
||
... | ... | |
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];
|
||
for (var i = cls.length; i > 0;) if(!HTMLArea.reservedClassNames.test(cls[--i])) className = cls[i];
|
||
}
|
||
}
|
||
if(obj.lastTag != tagName || obj.lastClass != className){
|
||
... | ... | |
// 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]){
|
||
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]);
|
||
for (cssClass in cssArray[tagName]){
|
||
if (cssArray[tagName].hasOwnProperty(cssClass)) {
|
||
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]);
|
||
if (cssArray['all']){
|
||
for (cssClass in cssArray['all']){
|
||
if (cssArray['all'].hasOwnProperty(cssClass)) {
|
||
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 {
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineCSS/inlinecss.js (working copy) | ||
---|---|---|
*
|
||
* TYPO3 SVN ID: $Id$
|
||
*/
|
||
InlineCSS = Class.create(HTMLArea.plugin, {
|
||
InlineCSS = HTMLArea.plugin.extend({
|
||
|
||
constructor : function(editor, pluginName) {
|
||
this.base(editor, pluginName);
|
||
},
|
||
|
||
/*
|
||
* This function gets called by the class constructor
|
||
... | ... | |
this.registerDropDown(dropDownConfiguration);
|
||
|
||
return true;
|
||
}
|
||
});
|
||
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++){
|
||
// Mozilla
|
||
if(HTMLArea.is_gecko){
|
||
try{ newCssArray = InlineCSS.applyCSSRule(editor,HTMLArea.I18N.InlineCSS,iframe.styleSheets[i].cssRules,newCssArray); }
|
||
catch(e){ obj.loaded = false; }
|
||
} else {
|
||
try{
|
||
// @import StyleSheets (IE)
|
||
if(iframe.styleSheets[i].imports){
|
||
newCssArray = InlineCSS.applyCSSIEImport(editor,HTMLArea.I18N.InlineCSS,iframe.styleSheets[i].imports,newCssArray);
|
||
}
|
||
if(iframe.styleSheets[i].rules){
|
||
newCssArray = InlineCSS.applyCSSRule(editor,HTMLArea.I18N.InlineCSS,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++){
|
||
// StyleRule
|
||
if(cssRules[rule].selectorText){
|
||
if(cssRules[rule].selectorText.search(/:+/)==-1){
|
||
// split equal Styles (Mozilla-specific) e.q. head, body {border:0px}
|
||
// for ie not relevant. returns allways one element
|
||
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 {
|
||
// 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;
|
||
};
|
||
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.getCSSArrayLater = function(editor,instance) {
|
||
return (function() {
|
||
instance.getCSSArray(editor);
|
||
});
|
||
};
|
||
/*
|
||
* Definition of additional methods
|
||
*/
|
||
InlineCSS.addMethods({
|
||
},
|
||
|
||
onSelect : function(editor, buttonId) {
|
||
var obj = this.editorConfiguration.customSelects[buttonId];
|
||
var tbobj = editor._toolbarObjects[buttonId];
|
||
... | ... | |
}
|
||
}
|
||
});
|
||
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++){
|
||
// Mozilla
|
||
if(HTMLArea.is_gecko){
|
||
try{ newCssArray = InlineCSS.applyCSSRule(editor,HTMLArea.I18N.InlineCSS,iframe.styleSheets[i].cssRules,newCssArray); }
|
||
catch(e){ obj.loaded = false; }
|
||
} else {
|
||
try{
|
||
// @import StyleSheets (IE)
|
||
if(iframe.styleSheets[i].imports){
|
||
newCssArray = InlineCSS.applyCSSIEImport(editor,HTMLArea.I18N.InlineCSS,iframe.styleSheets[i].imports,newCssArray);
|
||
}
|
||
if(iframe.styleSheets[i].rules){
|
||
newCssArray = InlineCSS.applyCSSRule(editor,HTMLArea.I18N.InlineCSS,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++){
|
||
// StyleRule
|
||
if(cssRules[rule].selectorText){
|
||
if(cssRules[rule].selectorText.search(/:+/)==-1){
|
||
// split equal Styles (Mozilla-specific) e.q. head, body {border:0px}
|
||
// for ie not relevant. returns allways one element
|
||
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 {
|
||
// 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;
|
||
};
|
||
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.getCSSArrayLater = function(editor,instance) {
|
||
return (function() {
|
||
instance.getCSSArray(editor);
|
||
});
|
||
};
|
||
typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php (working copy) | ||
---|---|---|
|
||
// Loading CSS, JavaScript files and code
|
||
$TSFE->additionalHeaderData['htmlArea'] = $additionalCode_loadCSS;
|
||
//$this->TCEform->loadJavascriptLib('prototype');
|
||
$this->TCEform->additionalJS_initial = $this->loadJSfiles($this->TCEform->RTEcounter);
|
||
$this->TCEform->additionalJS_pre[] = $this->loadJScode($this->TCEform->RTEcounter);
|
||