Feature #19455 ยป rtehtmlarea_feature_9546.patch
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (copie de travail) | ||
---|---|---|
}
|
||
RTEarea = new Array();
|
||
RTEarea[0] = new Object();
|
||
RTEarea[0]["version"] = "' . $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['version'] . '";'
|
||
RTEarea[0].version = "' . $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['version'] . '";
|
||
RTEarea[0].htmlarea = "' . $this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea.js', "htmlarea") . '";'
|
||
. (($this->client['BROWSER'] == 'msie') ? ('
|
||
RTEarea[0]["htmlarea-ie"] = "' . $this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea-ie.js', "htmlarea-ie") . '";')
|
||
: ('
|
||
RTEarea[0]["htmlarea-gecko"] = "' . $this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea-gecko.js', "htmlarea-gecko") . '";')) . '
|
||
RTEarea[0].localization = "' . $this->buildJSMainLangFile($RTEcounter) . '";
|
||
_editor_url = "' . $this->extHttpPath . 'htmlarea";
|
||
_editor_lang = "' . $this->language . '";
|
||
_editor_CSS = "' . $this->editorCSS . '";
|
||
... | ... | |
_editor_edited_content_CSS = "' . $this->editedContentCSS . '";
|
||
_typo3_host_url = "' . $this->hostURL . '";
|
||
_editor_debug_mode = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? 'true' : 'false') . ';
|
||
_editor_compressed_scripts = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? 'true' : 'false') . ';'
|
||
_editor_compressed_scripts = ' . ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['minifyScripts'] ? 'true' : 'false') . ';'
|
||
. (($this->client['BROWSER'] == 'gecko') ? ('
|
||
_editor_mozAllowClipboard_url = "' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] ? $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] : '') . '";')
|
||
: '') . '
|
||
/*]]>*/
|
||
</script>';
|
||
$loadJavascriptCode .= '
|
||
<script type="text/javascript" src="' . $this->buildJSMainLangFile($RTEcounter) . '"></script>
|
||
<script type="text/javascript" src="' . $this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea.js', "htmlarea") . '"></script>
|
||
<script type="text/javascript" src="' . $this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/init.js', 'init') . '"></script>
|
||
';
|
||
return $loadJavascriptCode;
|
||
}
|
||
... | ... | |
* @return string JS classes arrays
|
||
*/
|
||
function buildJSClassesArray() {
|
||
global $TSFE, $LANG, $TYPO3_CONF_VARS;
|
||
global $TSFE;
|
||
|
||
if ($this->is_FE()) {
|
||
$RTEProperties = $this->RTEsetup;
|
||
... | ... | |
$RTEProperties = $this->RTEsetup['properties'];
|
||
}
|
||
|
||
$linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : chr(10);
|
||
$linebreak = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['minifyScripts'] ? '' : chr(10);
|
||
$index = 0;
|
||
$indexNoShow = 0;
|
||
$indexAlternating = 0;
|
||
... | ... | |
* @return string Javascript localization array
|
||
*/
|
||
function buildJSMainLangArray() {
|
||
global $TSFE, $LANG, $TYPO3_CONF_VARS;
|
||
global $TSFE, $LANG;
|
||
|
||
$linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : chr(10);
|
||
$JSLanguageArray .= 'var HTMLArea_langArray = new Object();' . $linebreak;
|
||
$linebreak = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['minifyScripts'] ? '' : chr(10);
|
||
$JSLanguageArray .= 'HTMLArea_langArray = new Object();' . $linebreak;
|
||
$JSLanguageArray .= 'HTMLArea_langArray = { ' . $linebreak;
|
||
$subArrays = array( 'tooltips', 'msg' , 'dialogs');
|
||
$subArraysIndex = 0;
|
||
... | ... | |
* @return string The name of the file writtten to typo3temp/rtehtmlarea
|
||
*/
|
||
public function writeTemporaryFile($sourceFileName='', $label, $fileExtension='js', $contents='') {
|
||
global $TYPO3_CONF_VARS;
|
||
|
||
if ($sourceFileName) {
|
||
$output = '';
|
||
... | ... | |
} else {
|
||
$output = $contents;
|
||
}
|
||
$compress = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] && ($fileExtension == 'js') && ($output != '');
|
||
$relativeFilename = 'typo3temp/' . $this->ID . '/' . str_replace('-','_',$label) . '_' . t3lib_div::shortMD5(($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['version'] . ($sourceFileName?$sourceFileName:$output)), 20) . ($compress ? '_compressed' : '') . '.' . $fileExtension;
|
||
$compress = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['minifyScripts'] && ($fileExtension == 'js') && ($output != '');
|
||
$relativeFilename = 'typo3temp/' . $this->ID . '/' . str_replace('-','_',$label) . '_' . t3lib_div::shortMD5(($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['version'] . ($sourceFileName?$sourceFileName:$output)), 20) . ($compress ? '_compressed' : '') . '.' . $fileExtension;
|
||
$destination = PATH_site . $relativeFilename;
|
||
if(!file_exists($destination)) {
|
||
if (!file_exists($destination)) {
|
||
$compressedJavaScript = '';
|
||
if ($compress) {
|
||
$compressedJavaScript = t3lib_div::minifyJavaScript($output);
|
||
... | ... | |
die($failure);
|
||
}
|
||
}
|
||
if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['gzipScripts'] && $fileExtension == 'js' && $label != 'init') {
|
||
$relativeFilename = rawurldecode(htmlspecialchars_decode(tx_gzip::url($destination), ENT_QUOTES));
|
||
}
|
||
return ($this->thisConfig['forceHTTPS']?$this->siteURL:$this->httpTypo3Path) . $relativeFilename;
|
||
}
|
||
|
||
... | ... | |
*/
|
||
|
||
function buildJSLangArray($plugin) {
|
||
global $LANG, $TYPO3_CONF_VARS;
|
||
global $LANG;
|
||
$extensionKey = is_object($this->registeredPlugins[$plugin]) ? $this->registeredPlugins[$plugin]->getExtensionKey() : $this->ID;
|
||
$linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : chr(10);
|
||
$linebreak = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['minifyScripts'] ? '' : chr(10);
|
||
if($this->is_FE()) {
|
||
$LOCAL_LANG = t3lib_div::readLLfile('EXT:' . $extensionKey . '/htmlarea/plugins/' . $plugin . '/locallang.xml', $this->language, $this->OutputCharset);
|
||
} else {
|
typo3/sysext/rtehtmlarea/ext_conf_template.txt (copie de travail) | ||
---|---|---|
# cat=basic/enable/190; type=boolean; label=Enable troubleshooting mode: If set, a troubleshooting log will be displayed below the editing area.
|
||
enableDebugMode = 0
|
||
# cat=basic/enable/180; type=boolean; label=Enable compressed scripts: If set, the compressed version of the editor scripts will be used.
|
||
enableCompressedScripts = 1
|
||
# cat=basic/enable/180; type=options[No compression,Minify only,GZip only,Minify and GZip]; label=Script compression: Extension gzip must be installed for GZip compression to take effect.
|
||
enableScriptCompression = Minify and GZip
|
||
# cat=basic; type=string; label=Url of AllowClipboard Helper: Full absolute Url of the AllowClipboard Helper extension for Mozilla and Firefox.
|
||
mozAllowClipboardURL =
|
typo3/sysext/rtehtmlarea/ext_localconf.php (copie de travail) | ||
---|---|---|
// Troubleshooting and experimentation
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['enableDebugMode'] = $_EXTCONF['enableDebugMode'] ? $_EXTCONF['enableDebugMode'] : 0;
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['enableCompressedScripts'] = $_EXTCONF['enableCompressedScripts'] ? $_EXTCONF['enableCompressedScripts'] : 0;
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['minifyScripts'] = strstr($_EXTCONF['enableScriptCompression'],'Minify') ? 1 : 0;
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['gzipScripts'] = (strstr($_EXTCONF['enableScriptCompression'],'GZip') && in_array('zlib', get_loaded_extensions()) && t3lib_extMgm::isLoaded('gzip')) ? 1 : 0;
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['enableInOpera9'] = $_EXTCONF['enableInOpera9'] ? $_EXTCONF['enableInOpera9'] : 0;
|
||
// Integrating with DAM
|
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (copie de travail) | ||
---|---|---|
***************************************************/
|
||
/*
|
||
* Set some basic paths
|
||
*/
|
||
if (typeof(_editor_url) == "string") {
|
||
// Leave exactly one backslash at the end of _editor_url
|
||
_editor_url = _editor_url.replace(/\x2f*$/, '/');
|
||
} else {
|
||
alert("WARNING: _editor_url is not set!");
|
||
var _editor_url = '';
|
||
}
|
||
if (typeof(_editor_skin) == "string") _editor_skin = _editor_skin.replace(/\x2f*$/, '/');
|
||
else var _editor_skin = _editor_url + "skins/default/";
|
||
if (typeof(_editor_CSS) != "string") var _editor_CSS = _editor_url + "skins/default/htmlarea.css";
|
||
if (typeof(_editor_edited_content_CSS) != "string") var _editor_edited_content_CSS = _editor_skin + "htmlarea-edited-content.css";
|
||
if (typeof(_editor_lang) == "string") _editor_lang = _editor_lang ? _editor_lang.toLowerCase() : "en";
|
||
/*
|
||
* HTMLArea object constructor.
|
||
*/
|
||
var HTMLArea = function(textarea, config) {
|
||
if (HTMLArea.checkSupportedBrowser()) {
|
||
if (typeof(config) == "undefined") this.config = new HTMLArea.Config();
|
||
else this.config = config;
|
||
this._htmlArea = null;
|
||
this._textArea = textarea;
|
||
this._editMode = "wysiwyg";
|
||
this.plugins = {};
|
||
this._timerToolbar = null;
|
||
this.doctype = '';
|
||
this.eventHandlers = {};
|
||
}
|
||
};
|
||
HTMLArea.editorCSS = _editor_CSS;
|
||
/*
|
||
* Browser identification
|
||
*/
|
||
HTMLArea.agt = navigator.userAgent.toLowerCase();
|
||
HTMLArea.is_opera = (HTMLArea.agt.indexOf("opera") != -1);
|
||
HTMLArea.is_ie = (HTMLArea.agt.indexOf("msie") != -1) && !HTMLArea.is_opera;
|
||
HTMLArea.is_safari = (HTMLArea.agt.indexOf("webkit") != -1);
|
||
HTMLArea.is_gecko = (navigator.product == "Gecko") || HTMLArea.is_opera;
|
||
HTMLArea.is_ff2 = (HTMLArea.agt.indexOf("firefox/2") != -1);
|
||
HTMLArea.is_chrome = HTMLArea.is_safari && (HTMLArea.agt.indexOf("chrome") != -1);
|
||
// Check on MacOS Wamcom version 1.3 but exclude Firefox rv 1.8.1.3
|
||
HTMLArea.is_wamcom = (HTMLArea.agt.indexOf("wamcom") != -1) || (HTMLArea.is_gecko && HTMLArea.agt.indexOf("1.3") != -1 && HTMLArea.agt.indexOf(".1.3") == -1);
|
||
/*
|
||
* A log for troubleshooting
|
||
*/
|
||
HTMLArea._debugMode = false;
|
||
if (typeof(_editor_debug_mode) != "undefined") HTMLArea._debugMode = _editor_debug_mode;
|
||
HTMLArea._appendToLog = function(str){
|
||
if(HTMLArea._debugMode) {
|
||
var log = document.getElementById("HTMLAreaLog");
|
||
if(log) {
|
||
log.appendChild(document.createTextNode(str));
|
||
log.appendChild(document.createElement("br"));
|
||
}
|
||
}
|
||
};
|
||
/*
|
||
* Using compressed scripts
|
||
*/
|
||
HTMLArea._compressedScripts = false;
|
||
if (typeof(_editor_compressed_scripts) != "undefined") HTMLArea._compressedScripts = _editor_compressed_scripts;
|
||
/*
|
||
* Localization of core script
|
||
*/
|
||
HTMLArea.I18N = HTMLArea_langArray;
|
||
/*
|
||
* Build array of scripts to be loaded
|
||
*/
|
||
HTMLArea.is_loaded = false;
|
||
HTMLArea.onload = function(){
|
||
HTMLArea.is_loaded = true;
|
||
HTMLArea._appendToLog("All scripts successfully loaded.");
|
||
};
|
||
HTMLArea.loadTimer;
|
||
HTMLArea._scripts = [];
|
||
HTMLArea._scriptLoaded = [];
|
||
HTMLArea._request = [];
|
||
HTMLArea.loadScript = function(url, pluginName, asynchronous) {
|
||
if (typeof(pluginName) == "undefined") {
|
||
var pluginName = "";
|
||
}
|
||
if (typeof(asynchronous) == "undefined") {
|
||
var asynchronous = true;
|
||
}
|
||
if (HTMLArea.is_opera) url = _typo3_host_url + url;
|
||
if (HTMLArea._compressedScripts && url.indexOf("compressed") == -1) url = url.replace(/\.js$/gi, "_compressed.js");
|
||
var scriptInfo = {
|
||
pluginName : pluginName,
|
||
url : url,
|
||
asynchronous : asynchronous
|
||
};
|
||
HTMLArea._scripts.push(scriptInfo);
|
||
};
|
||
if(HTMLArea.is_gecko) HTMLArea.loadScript(RTEarea[0]["htmlarea-gecko"] ? RTEarea[0]["htmlarea-gecko"] : _editor_url + "htmlarea-gecko.js");
|
||
if(HTMLArea.is_ie) HTMLArea.loadScript(RTEarea[0]["htmlarea-ie"] ? RTEarea[0]["htmlarea-ie"] : _editor_url + "htmlarea-ie.js");
|
||
/*
|
||
* Get a script using asynchronous XMLHttpRequest
|
||
*/
|
||
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].url;
|
||
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].url;
|
||
if (typeof(asynchronous) == "undefined") var asynchronous = HTMLArea._scripts[i].asynchronous;
|
||
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];
|
||
}
|
||
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);
|
||
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;
|
||
}
|
||
};
|
||
/*
|
||
* Get all the scripts
|
||
*/
|
||
HTMLArea.init = function() {
|
||
HTMLArea._eventCache = HTMLArea._eventCacheConstructor();
|
||
if (window.XMLHttpRequest || window.ActiveXObject) {
|
||
try {
|
||
var success = true;
|
||
for (var i = 0, n = HTMLArea._scripts.length; i < n && success; i++) {
|
||
if (HTMLArea._scripts[i].asynchronous) {
|
||
success = success && HTMLArea._getScript(i);
|
||
} else {
|
||
try {
|
||
eval(HTMLArea._getScript(i));
|
||
HTMLArea._scriptLoaded[i] = true;
|
||
} catch (e) {
|
||
HTMLArea._appendToLog("ERROR [HTMLArea::getScript]: Unable to get script " + url + ": " + e);
|
||
}
|
||
}
|
||
}
|
||
} 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"]);
|
||
}
|
||
};
|
||
/*
|
||
* Compile some regular expressions
|
||
*/
|
||
HTMLArea.RE_tagName = /(<\/|<)\s*([^ \t\n>]+)/ig;
|
||
... | ... | |
};
|
||
/*
|
||
* Load the required plugin script
|
||
*/
|
||
HTMLArea.loadPlugin = function (pluginName, url, asynchronous) {
|
||
if (typeof(asynchronous) == "undefined") {
|
||
var asynchronous = true;
|
||
}
|
||
HTMLArea.loadScript(url, pluginName, asynchronous);
|
||
};
|
||
/*
|
||
* Load a stylesheet file
|
||
*/
|
||
HTMLArea.loadStyle = function(style, plugin, url) {
|
||
... | ... | |
HTMLArea._object = null;
|
||
/*
|
||
* Check if the client agent is supported
|
||
*/
|
||
HTMLArea.checkSupportedBrowser = function() {
|
||
if(HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) {
|
||
if(navigator.productSub < 20030210) return false;
|
||
}
|
||
return HTMLArea.is_gecko || HTMLArea.is_ie;
|
||
};
|
||
/* EventCache Version 1.0
|
||
* Copyright 2005 Mark Wubben
|
||
* Adaptation by Stanislas Rolland
|
||
* Provides a way for automatically removing events from nodes and thus preventing memory leakage.
|
||
* See <http://novemberborn.net/javascript/event-cache> for more information.
|
||
* This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
|
||
* Event Cache uses an anonymous function to create a hidden scope chain. This is to prevent scoping issues.
|
||
*/
|
||
HTMLArea._eventCacheConstructor = function() {
|
||
var listEvents = [];
|
||
return ({
|
||
listEvents : listEvents,
|
||
add : function(node, sEventName, fHandler) {
|
||
listEvents.push(arguments);
|
||
},
|
||
flush : function() {
|
||
var item;
|
||
for (var i = listEvents.length; --i >= 0;) {
|
||
item = listEvents[i];
|
||
try {
|
||
HTMLArea._removeEvent(item[0], item[1], item[2]);
|
||
item[0][item[1]] = null;
|
||
item[0] = null;
|
||
item[2] = null;
|
||
} catch(e) { }
|
||
}
|
||
listEvents.length = 0;
|
||
}
|
||
});
|
||
};
|
||
/*
|
||
* Register an event
|
||
*/
|
||
HTMLArea._addEvent = function(el,evname,func,useCapture) {
|
||
if (typeof(useCapture) == "undefined") {
|
||
var useCapture = false;
|
||
}
|
||
if (HTMLArea.is_gecko) {
|
||
el.addEventListener(evname, func, !HTMLArea.is_opera || useCapture);
|
||
} else {
|
||
el.attachEvent("on" + evname, func);
|
||
}
|
||
HTMLArea._eventCache.add(el, evname, func);
|
||
};
|
||
/*
|
||
* Register a list of events
|
||
*/
|
||
HTMLArea._addEvents = function(el,evs,func,useCapture) {
|
||
if (typeof(useCapture) == "undefined") {
|
||
var useCapture = false;
|
||
}
|
||
for (var i = evs.length; --i >= 0;) {
|
||
HTMLArea._addEvent(el,evs[i], func, useCapture);
|
||
}
|
||
};
|
||
/*
|
||
* Remove an event listener
|
||
*/
|
||
HTMLArea._removeEvent = function(el,evname,func) {
|
||
if (HTMLArea.is_gecko) {
|
||
// Avoid Safari crash when removing events on some orphan documents
|
||
if (!HTMLArea.is_safari || HTMLArea.is_chrome) {
|
||
try {
|
||
el.removeEventListener(evname, func, true);
|
||
el.removeEventListener(evname, func, false);
|
||
} catch(e) { }
|
||
} else if (el.nodeType != 9 || el.defaultView) {
|
||
try {
|
||
el.removeEventListener(evname, func, true);
|
||
el.removeEventListener(evname, func, false);
|
||
} catch(e) { }
|
||
}
|
||
} else {
|
||
try {
|
||
el.detachEvent("on" + evname, func);
|
||
} catch(e) { }
|
||
}
|
||
};
|
||
/*
|
||
* Remove a list of events
|
||
*/
|
||
HTMLArea._removeEvents = function(el,evs,func) {
|
||
for (var i = evs.length; --i >= 0;) { HTMLArea._removeEvent(el, evs[i], func); }
|
||
};
|
||
/*
|
||
* Stop event propagation
|
||
*/
|
||
HTMLArea._stopEvent = function(ev) {
|
||
if(HTMLArea.is_gecko) {
|
||
ev.stopPropagation();
|
||
ev.preventDefault();
|
||
} else {
|
||
ev.cancelBubble = true;
|
||
ev.returnValue = false;
|
||
}
|
||
};
|
||
/*
|
||
* Remove a class name from the class attribute of an element
|
||
*
|
||
* @param object el: the element
|
||
... | ... | |
* TYPO3-SPECIFIC FUNCTIONS
|
||
***************************************************/
|
||
/*
|
||
* Set the size of textarea with the RTE. It's called, if we are in fullscreen-mode.
|
||
*/
|
||
var setRTEsizeByJS = function(divId, height, width) {
|
||
if (HTMLArea.is_gecko) height = height - 25;
|
||
else height = height - 60;
|
||
if (height > 0) document.getElementById(divId).style.height = height + "px";
|
||
if (HTMLArea.is_gecko) width = "99%";
|
||
else width = "97%";
|
||
document.getElementById(divId).style.width = width;
|
||
};
|
||
/*
|
||
* Extending the TYPO3 Lorem Ipsum extension
|
||
*/
|
||
var lorem_ipsum = function(element,text) {
|
||
... | ... | |
}
|
||
};
|
||
/*
|
||
* Initialize the editor, configure the toolbar, setup the plugins, etc.
|
||
*/
|
||
HTMLArea.initTimer = [];
|
||
HTMLArea.onGenerateHandler = function(editorNumber) {
|
||
return (function() {
|
||
document.getElementById('pleasewait' + editorNumber).style.display = 'none';
|
||
document.getElementById('editorWrap' + editorNumber).style.visibility = 'visible';
|
||
editorNumber = null;
|
||
});
|
||
};
|
||
HTMLArea.initEditor = function(editorNumber) {
|
||
if(HTMLArea.checkSupportedBrowser()) {
|
||
document.getElementById('pleasewait' + editorNumber).style.display = 'block';
|
||
document.getElementById('editorWrap' + editorNumber).style.visibility = 'hidden';
|
||
if(HTMLArea.initTimer[editorNumber]) window.clearTimeout(HTMLArea.initTimer[editorNumber]);
|
||
if(!HTMLArea.is_loaded) {
|
||
HTMLArea.initTimer[editorNumber] = window.setTimeout( "HTMLArea.initEditor(" + editorNumber + ");", 150);
|
||
} else {
|
||
var RTE = RTEarea[editorNumber];
|
||
// Get the configuration properties
|
||
var config = new HTMLArea.Config();
|
||
for (var property in RTE) {
|
||
if (RTE.hasOwnProperty(property)) {
|
||
config[property] = RTE[property] ? RTE[property] : false;
|
||
}
|
||
}
|
||
// Create an editor for the textarea
|
||
var editor = new HTMLArea(RTE.id, config);
|
||
RTE.editor = editor;
|
||
// Save the editornumber in the object
|
||
editor._typo3EditerNumber = editorNumber;
|
||
editor._editorNumber = editorNumber;
|
||
// Override these settings if they were ever modified
|
||
editor.config.width = "auto";
|
||
editor.config.height = "auto";
|
||
editor.config.sizeIncludesToolbar = true;
|
||
editor.config.fullPage = false;
|
||
// Register the plugins included in the configuration
|
||
for (var plugin in editor.config.plugin) {
|
||
if (editor.config.plugin.hasOwnProperty(plugin) && editor.config.plugin[plugin]) {
|
||
editor.registerPlugin(plugin);
|
||
}
|
||
}
|
||
editor.onGenerate = HTMLArea.onGenerateHandler(editorNumber);
|
||
editor.generate();
|
||
return false;
|
||
}
|
||
} else {
|
||
document.getElementById('pleasewait' + editorNumber).style.display = 'none';
|
||
document.getElementById('editorWrap' + editorNumber).style.visibility = 'visible';
|
||
}
|
||
};
|
||
HTMLArea.allElementsAreDisplayed = function(elements) {
|
||
for (var i=0, length=elements.length; i < length; i++) {
|
||
if (document.getElementById(elements[i]).style.display == "none") {
|
typo3/sysext/rtehtmlarea/htmlarea/init.js (r?vision 0) | ||
---|---|---|
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2002-2004, interactivetools.com, inc.
|
||
* (c) 2003-2004 dynarch.com
|
||
* (c) 2004-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
* A copy is found in the textfile GPL.txt and important notices to the license
|
||
* from the author is found in LICENSE.txt distributed with these scripts.
|
||
*
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* This script is a modified version of a script published under the htmlArea License.
|
||
* A copy of the htmlArea License may be found in the textfile HTMLAREA_LICENSE.txt.
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
/*
|
||
* Initialization script of TYPO3 htmlArea RTE
|
||
*
|
||
* TYPO3 SVN ID: $Id: init.js 4306 2008-10-10 16:33:43Z stan $
|
||
*/
|
||
/***************************************************
|
||
* LOADING THE SCRIPTS
|
||
***************************************************/
|
||
/*
|
||
* Set some basic paths
|
||
*/
|
||
if (typeof(_editor_url) == "string") {
|
||
// Leave exactly one backslash at the end of _editor_url
|
||
_editor_url = _editor_url.replace(/\x2f*$/, '/');
|
||
} else {
|
||
alert("WARNING: _editor_url is not set!");
|
||
var _editor_url = '';
|
||
}
|
||
if (typeof(_editor_skin) == "string") _editor_skin = _editor_skin.replace(/\x2f*$/, '/');
|
||
else var _editor_skin = _editor_url + "skins/default/";
|
||
if (typeof(_editor_CSS) != "string") var _editor_CSS = _editor_url + "skins/default/htmlarea.css";
|
||
if (typeof(_editor_edited_content_CSS) != "string") var _editor_edited_content_CSS = _editor_skin + "htmlarea-edited-content.css";
|
||
if (typeof(_editor_lang) == "string") _editor_lang = _editor_lang ? _editor_lang.toLowerCase() : "en";
|
||
/*
|
||
* HTMLArea object constructor.
|
||
*/
|
||
var HTMLArea = function(textarea, config) {
|
||
if (HTMLArea.checkSupportedBrowser()) {
|
||
if (typeof(config) == "undefined") this.config = new HTMLArea.Config();
|
||
else this.config = config;
|
||
this._htmlArea = null;
|
||
this._textArea = textarea;
|
||
this._editMode = "wysiwyg";
|
||
this.plugins = {};
|
||
this._timerToolbar = null;
|
||
this.doctype = '';
|
||
this.eventHandlers = {};
|
||
}
|
||
};
|
||
HTMLArea.editorCSS = _editor_CSS;
|
||
/*
|
||
* Browser identification
|
||
*/
|
||
HTMLArea.agt = navigator.userAgent.toLowerCase();
|
||
HTMLArea.is_opera = (HTMLArea.agt.indexOf("opera") != -1);
|
||
HTMLArea.is_ie = (HTMLArea.agt.indexOf("msie") != -1) && !HTMLArea.is_opera;
|
||
HTMLArea.is_safari = (HTMLArea.agt.indexOf("webkit") != -1);
|
||
HTMLArea.is_gecko = (navigator.product == "Gecko") || HTMLArea.is_opera;
|
||
HTMLArea.is_ff2 = (HTMLArea.agt.indexOf("firefox/2") != -1);
|
||
HTMLArea.is_chrome = HTMLArea.is_safari && (HTMLArea.agt.indexOf("chrome") != -1);
|
||
// Check on MacOS Wamcom version 1.3 but exclude Firefox rv 1.8.1.3
|
||
HTMLArea.is_wamcom = (HTMLArea.agt.indexOf("wamcom") != -1) || (HTMLArea.is_gecko && HTMLArea.agt.indexOf("1.3") != -1 && HTMLArea.agt.indexOf(".1.3") == -1);
|
||
/*
|
||
* Check if the client agent is supported
|
||
*/
|
||
HTMLArea.checkSupportedBrowser = function() {
|
||
if(HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) {
|
||
if(navigator.productSub < 20030210) return false;
|
||
}
|
||
return HTMLArea.is_gecko || HTMLArea.is_ie;
|
||
};
|
||
/*
|
||
* A log for troubleshooting
|
||
*/
|
||
HTMLArea._debugMode = false;
|
||
if (typeof(_editor_debug_mode) != "undefined") HTMLArea._debugMode = _editor_debug_mode;
|
||
HTMLArea._appendToLog = function(str){
|
||
if(HTMLArea._debugMode) {
|
||
var log = document.getElementById("HTMLAreaLog");
|
||
if(log) {
|
||
log.appendChild(document.createTextNode(str));
|
||
log.appendChild(document.createElement("br"));
|
||
}
|
||
}
|
||
};
|
||
/*
|
||
* Using compressed scripts
|
||
*/
|
||
HTMLArea._compressedScripts = false;
|
||
if (typeof(_editor_compressed_scripts) != "undefined") HTMLArea._compressedScripts = _editor_compressed_scripts;
|
||
/*
|
||
* Build array of scripts to be loaded
|
||
*/
|
||
HTMLArea.is_loaded = false;
|
||
HTMLArea.onload = function(){
|
||
HTMLArea.is_loaded = true;
|
||
HTMLArea._appendToLog("All scripts successfully loaded.");
|
||
};
|
||
HTMLArea.loadTimer;
|
||
HTMLArea._scripts = [];
|
||
HTMLArea._scriptLoaded = [];
|
||
HTMLArea._request = [];
|
||
HTMLArea.loadScript = function(url, pluginName, asynchronous) {
|
||
if (typeof(pluginName) == "undefined") {
|
||
var pluginName = "";
|
||
}
|
||
if (typeof(asynchronous) == "undefined") {
|
||
var asynchronous = true;
|
||
}
|
||
if (HTMLArea.is_opera) url = _typo3_host_url + url;
|
||
if (HTMLArea._compressedScripts && url.indexOf("compressed") == -1) url = url.replace(/\.js$/gi, "_compressed.js");
|
||
var scriptInfo = {
|
||
pluginName : pluginName,
|
||
url : url,
|
||
asynchronous : asynchronous
|
||
};
|
||
HTMLArea._scripts.push(scriptInfo);
|
||
};
|
||
HTMLArea.loadScript(RTEarea[0].htmlarea ? RTEarea[0].htmlarea : _editor_url + "htmlarea.js", null, false);
|
||
HTMLArea.loadScript(RTEarea[0].localization, null, false);
|
||
if(HTMLArea.is_gecko) HTMLArea.loadScript(RTEarea[0]["htmlarea-gecko"] ? RTEarea[0]["htmlarea-gecko"] : _editor_url + "htmlarea-gecko.js");
|
||
if(HTMLArea.is_ie) HTMLArea.loadScript(RTEarea[0]["htmlarea-ie"] ? RTEarea[0]["htmlarea-ie"] : _editor_url + "htmlarea-ie.js");
|
||
/*
|
||
* Get a script using asynchronous XMLHttpRequest
|
||
*/
|
||
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].url;
|
||
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].url;
|
||
if (typeof(asynchronous) == "undefined") var asynchronous = HTMLArea._scripts[i].asynchronous;
|
||
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];
|
||
}
|
||
if(HTMLArea.loadTimer) window.clearTimeout(HTMLArea.loadTimer);
|
||
if (scriptsLoaded) {
|
||
HTMLArea.is_loaded = true;
|
||
HTMLArea.I18N = HTMLArea_langArray;
|
||
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);
|
||
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;
|
||
}
|
||
};
|
||
/*
|
||
* Get all the scripts
|
||
*/
|
||
HTMLArea.init = function() {
|
||
HTMLArea._eventCache = HTMLArea.eventCacheConstructor();
|
||
if (window.XMLHttpRequest || window.ActiveXObject) {
|
||
try {
|
||
var success = true;
|
||
for (var i = 0, n = HTMLArea._scripts.length; i < n && success; i++) {
|
||
if (HTMLArea._scripts[i].asynchronous) {
|
||
success = success && HTMLArea._getScript(i);
|
||
} else {
|
||
try {
|
||
eval(HTMLArea._getScript(i));
|
||
HTMLArea._scriptLoaded[i] = true;
|
||
} catch (e) {
|
||
HTMLArea._appendToLog("ERROR [HTMLArea::getScript]: Unable to get script " + url + ": " + e);
|
||
}
|
||
}
|
||
}
|
||
} 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"]);
|
||
}
|
||
};
|
||
/*
|
||
* Load the required plugin script
|
||
*/
|
||
HTMLArea.loadPlugin = function (pluginName, url, asynchronous) {
|
||
if (typeof(asynchronous) == "undefined") {
|
||
var asynchronous = true;
|
||
}
|
||
HTMLArea.loadScript(url, pluginName, asynchronous);
|
||
};
|
||
/***************************************************
|
||
* EVENT LISTENERS FUNCTIONS
|
||
***************************************************/
|
||
/* EventCache Version 1.0
|
||
* Copyright 2005 Mark Wubben
|
||
* Adaptation by Stanislas Rolland
|
||
* Provides a way for automatically removing events from nodes and thus preventing memory leakage.
|
||
* See <http://novemberborn.net/javascript/event-cache> for more information.
|
||
* This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
|
||
* Event Cache uses an anonymous function to create a hidden scope chain. This is to prevent scoping issues.
|
||
*/
|
||
HTMLArea.eventCacheConstructor = function() {
|
||
var listEvents = [];
|
||
return ({
|
||
listEvents : listEvents,
|
||
add : function(node, sEventName, fHandler) {
|
||
listEvents.push(arguments);
|
||
},
|
||
flush : function() {
|
||
var item;
|
||
for (var i = listEvents.length; --i >= 0;) {
|
||
item = listEvents[i];
|
||
try {
|
||
HTMLArea._removeEvent(item[0], item[1], item[2]);
|
||
item[0][item[1]] = null;
|
||
item[0] = null;
|
||
item[2] = null;
|
||
} catch(e) { }
|
||
}
|
||
listEvents.length = 0;
|
||
}
|
||
});
|
||
};
|
||
/*
|
||
* Register an event
|
||
*/
|
||
HTMLArea._addEvent = function(el,evname,func,useCapture) {
|
||
if (typeof(useCapture) == "undefined") {
|
||
var useCapture = false;
|
||
}
|
||
if (HTMLArea.is_gecko) {
|
||
el.addEventListener(evname, func, !HTMLArea.is_opera || useCapture);
|
||
} else {
|
||
el.attachEvent("on" + evname, func);
|
||
}
|
||
HTMLArea._eventCache.add(el, evname, func);
|
||
};
|
||
/*
|
||
* Register a list of events
|
||
*/
|
||
HTMLArea._addEvents = function(el,evs,func,useCapture) {
|
||
if (typeof(useCapture) == "undefined") {
|
||
var useCapture = false;
|
||
}
|
||
for (var i = evs.length; --i >= 0;) {
|
||
HTMLArea._addEvent(el,evs[i], func, useCapture);
|
||
}
|
||
};
|
||
/*
|
||
* Remove an event listener
|
||
*/
|
||
HTMLArea._removeEvent = function(el,evname,func) {
|
||
if (HTMLArea.is_gecko) {
|
||
// Avoid Safari crash when removing events on some orphan documents
|
||
if (!HTMLArea.is_safari || HTMLArea.is_chrome) {
|
||
try {
|
||
el.removeEventListener(evname, func, true);
|
||
el.removeEventListener(evname, func, false);
|
||
} catch(e) { }
|
||
} else if (el.nodeType != 9 || el.defaultView) {
|
||
try {
|
||
el.removeEventListener(evname, func, true);
|
||
el.removeEventListener(evname, func, false);
|
||
} catch(e) { }
|
||
}
|
||
} else {
|
||
try {
|
||
el.detachEvent("on" + evname, func);
|
||
} catch(e) { }
|
||
}
|
||
};
|
||
/*
|
||
* Remove a list of events
|
||
*/
|
||
HTMLArea._removeEvents = function(el,evs,func) {
|
||
for (var i = evs.length; --i >= 0;) { HTMLArea._removeEvent(el, evs[i], func); }
|
||
};
|
||
/*
|
||
* Stop event propagation
|
||
*/
|
||
HTMLArea._stopEvent = function(ev) {
|
||
if(HTMLArea.is_gecko) {
|
||
ev.stopPropagation();
|
||
ev.preventDefault();
|
||
} else {
|
||
ev.cancelBubble = true;
|
||
ev.returnValue = false;
|
||
}
|
||
};
|
||
/***************************************************
|
||
* EDITOR INITIALIZATION
|
||
***************************************************/
|
||
/*
|
||
* Initialize the editor, configure the toolbar, setup the plugins, etc.
|
||
*/
|
||
HTMLArea.initTimer = [];
|
||
HTMLArea.onGenerateHandler = function(editorNumber) {
|
||
return (function() {
|
||
document.getElementById('pleasewait' + editorNumber).style.display = 'none';
|
||
document.getElementById('editorWrap' + editorNumber).style.visibility = 'visible';
|
||
editorNumber = null;
|
||
});
|
||
};
|
||
HTMLArea.initEditor = function(editorNumber) {
|
||
if(HTMLArea.checkSupportedBrowser()) {
|
||
document.getElementById('pleasewait' + editorNumber).style.display = 'block';
|
||
document.getElementById('editorWrap' + editorNumber).style.visibility = 'hidden';
|
||
if(HTMLArea.initTimer[editorNumber]) window.clearTimeout(HTMLArea.initTimer[editorNumber]);
|
||
if(!HTMLArea.is_loaded) {
|
||
HTMLArea.initTimer[editorNumber] = window.setTimeout( "HTMLArea.initEditor(" + editorNumber + ");", 150);
|
||
} else {
|
||
var RTE = RTEarea[editorNumber];
|
||
// Get the configuration properties
|
||
var config = new HTMLArea.Config();
|
||
for (var property in RTE) {
|
||
if (RTE.hasOwnProperty(property)) {
|
||
config[property] = RTE[property] ? RTE[property] : false;
|
||
}
|
||
}
|
||
// Create an editor for the textarea
|
||
var editor = new HTMLArea(RTE.id, config);
|
||
RTE.editor = editor;
|
||
// Save the editornumber in the object
|
||
editor._typo3EditerNumber = editorNumber;
|
||
editor._editorNumber = editorNumber;
|
||
// Override these settings if they were ever modified
|
||
editor.config.width = "auto";
|
||
editor.config.height = "auto";
|
||
editor.config.sizeIncludesToolbar = true;
|
||
editor.config.fullPage = false;
|
||
// Register the plugins included in the configuration
|
||
for (var plugin in editor.config.plugin) {
|
||
if (editor.config.plugin.hasOwnProperty(plugin) && editor.config.plugin[plugin]) {
|
||
editor.registerPlugin(plugin);
|
||
}
|
||
}
|
||
editor.onGenerate = HTMLArea.onGenerateHandler(editorNumber);
|
||
editor.generate();
|
||
return false;
|
||
}
|
||
} else {
|
||
document.getElementById('pleasewait' + editorNumber).style.display = 'none';
|
||
document.getElementById('editorWrap' + editorNumber).style.visibility = 'visible';
|
||
}
|
||
};
|
||
/*
|
||
* Set the size of textarea with the RTE. It's called, if we are in fullscreen-mode.
|
||
*/
|
||
var setRTEsizeByJS = function(divId, height, width) {
|
||
if (HTMLArea.is_gecko) height = height - 25;
|
||
else height = height - 60;
|
||
if (height > 0) document.getElementById(divId).style.height = height + "px";
|
||
if (HTMLArea.is_gecko) width = "99%";
|
||
else width = "97%";
|
||
document.getElementById(divId).style.width = width;
|
||
};
|