Project

General

Profile

Bug #19477 » rtehtmlarea_bugfix_9596_trunk_v3.patch

Administrator Admin, 2008-12-18 05:25

View differences:

typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (copie de travail)
$this->addSkin();
// Loading JavaScript files and code
$this->TCEform->additionalCode_pre['rtehtmlarea-loadJSfiles'] = $this->loadJSfiles($this->TCEform->RTEcounter);
$this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
if ($this->TCEform->RTEcounter == 1) {
$this->TCEform->additionalCode_pre['rtehtmlarea-loadJSfiles'] = $this->loadJSfiles($this->TCEform->RTEcounter);
$this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
}
/* =======================================
* DRAW THE EDITOR
......
// Draw the textarea
$visibility = 'hidden';
$unuqid = uniqid('rte');
$item = $this->triggerField($PA['itemFormElName']).'
<div id="pleasewait' . $textAreaId . '" class="pleasewait" style="display: block;" >' . $LANG->getLL('Please wait') . '</div>
<div id="editorWrap' . $textAreaId . '" class="editorWrap" style="visibility: hidden; width:' . $editorWrapWidth . '; height:' . $editorWrapHeight . ';">
......
if ($pathToSkin) {
$this->addStyleSheet(
'rtehtmlarea-plugin-' . $pluginId . '-skin',
$this->httpTypo3Path . t3lib_extMgm::siteRelPath($this->registeredPlugins[$pluginId]->getExtensionKey()) . $pathToSkin,
'htmlArea RTE ' . $pluginId . ' Skin'
$this->httpTypo3Path . t3lib_extMgm::siteRelPath($this->registeredPlugins[$pluginId]->getExtensionKey()) . $pathToSkin
);
}
}
......
* @return void
*/
protected function addStyleSheet($key, $href, $title='', $relation='stylesheet') {
$this->TCEform->addStyleSheet($key, $href, $title, $relation);
// If it was not known that an RTE-enabled would be created when the page was first created, the css would not be added to head
if (is_object($this->TCEform->inline) && $this->TCEform->inline->isAjaxCall) {
$this->TCEform->additionalCode_pre[$key] = '<link rel="' . $relation . '" type="text/css" href="' . $href . '" title="' . $title. '" />';
} else {
$this->TCEform->addStyleSheet($key, $href, $title, $relation);
}
}
/**
......
*/
function loadJSfiles($RTEcounter) {
global $TYPO3_CONF_VARS;
$loadPluginCode = '
HTMLArea_plugins = new Array();';
foreach ($this->pluginEnabledCumulativeArray[$RTEcounter] as $pluginId) {
$extensionKey = is_object($this->registeredPlugins[$pluginId]) ? $this->registeredPlugins[$pluginId]->getExtensionKey() : $this->ID;
$loadPluginCode .= '
HTMLArea_plugins.push({url : "' . $this->writeTemporaryFile('EXT:' . $extensionKey . '/htmlarea/plugins/' . $pluginId . '/' . strtolower(preg_replace('/([a-z])([A-Z])([a-z])/', "$1".'-'."$2"."$3", $pluginId)) . '.js', $pluginId) . '", asynchronous : ' . ($this->registeredPlugins[$pluginId]->requiresSynchronousLoad() ? 'false' : 'true'). ' });';
}
// Avoid re-initialization on AJax call when RTEarea object was already initialized
$loadJavascriptCode = '
<script type="text/javascript">
/*<![CDATA[*/
function rteHtmlAreaGetElementsByClassName(className) {
var allElements = document.getElementsByTagName("*");
var result = new Array();
for (var i = 0; i < allElements.length; i++) {
var c = " " + allElements[i].className + " ";
if (c.indexOf(" " + className + " ") != -1) {
result[result.length] = allElements[i];
if (typeof(RTEarea) == "undefined") {
RTEarea = new Object();
RTEarea.init = function() {
if (typeof(HTMLArea) == "undefined") {
window.setTimeout("RTEarea.init();", 40);
} else {'
. $loadPluginCode . '
HTMLArea.init();
}
}
return result;
};
RTEarea.initEditor = function(editorNumber) {
if (typeof(HTMLArea) == "undefined") {
window.setTimeout("RTEarea.initEditor(\'" + editorNumber + "\');", 40);
} else {
HTMLArea.initEditor(editorNumber);
}
};
RTEarea[0] = new Object();
RTEarea[0].version = "' . $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['version'] . '";'
. (($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") . '";')) . '
_editor_url = "' . $this->extHttpPath . 'htmlarea";
_editor_lang = "' . $this->language . '";
_editor_CSS = "' . $this->editorCSS . '";
_editor_skin = "' . dirname($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') . ';'
. (($this->client['BROWSER'] == 'gecko') ? ('
_editor_mozAllowClipboard_url = "' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] ? $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] : '') . '";')
: '') . '
}
wait_elements = rteHtmlAreaGetElementsByClassName("pleasewait");
wrap_elements = rteHtmlAreaGetElementsByClassName("editorWrap");
for (i = 0; i < wait_elements.length; i++) {
wait_elements[i].style.display = "block";
wrap_elements[i].style.visibility = "hidden";
}
RTEarea = new Array();
RTEarea[0] = new Object();
RTEarea[0]["version"] = "' . $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['version'] . '";'
. (($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") . '";')) . '
_editor_url = "' . $this->extHttpPath . 'htmlarea";
_editor_lang = "' . $this->language . '";
_editor_CSS = "' . $this->editorCSS . '";
_editor_skin = "' . dirname($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') . ';'
. (($this->client['BROWSER'] == 'gecko') ? ('
_editor_mozAllowClipboard_url = "' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] ? $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] : '') . '";')
: '') . '
/*]]>*/
</script>';
$loadJavascriptCode .= '
......
}
/**
* Return the inline Javascript code for initializing the RTE
* Return the Javascript code for initializing the RTE
*
* @param integer $RTEcounter: The index number of the current RTE editing area within the form.
*
* @return string the inline Javascript code for initializing the RTE
* @return string the Javascript code for initializing the RTE
*/
function loadJScode($RTEcounter) {
$loadPluginCode = '';
foreach ($this->pluginEnabledCumulativeArray[$RTEcounter] as $pluginId) {
$extensionKey = is_object($this->registeredPlugins[$pluginId]) ? $this->registeredPlugins[$pluginId]->getExtensionKey() : $this->ID;
$loadPluginCode .= '
HTMLArea.loadPlugin("' . $pluginId . '", "' . $this->writeTemporaryFile('EXT:' . $extensionKey . '/htmlarea/plugins/' . $pluginId . '/' . strtolower(preg_replace('/([a-z])([A-Z])([a-z])/', "$1".'-'."$2"."$3", $pluginId)) . '.js', $pluginId) . '", '. ($this->registeredPlugins[$pluginId]->requiresSynchronousLoad()?'false':'true'). ');';
}
return (!$this->is_FE() ? '' : '
' . '/*<![CDATA[*/') . ($this->is_FE() ? '' : '
RTEarea[0]["RTEtsConfigParams"] = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";')
. $loadPluginCode . '
HTMLArea.init();' . (!$this->is_FE() ? '' : '
' . '/*<![CDATA[*/') . '
RTEarea.init();' . (!$this->is_FE() ? '' : '
/*]]>*/
');
}
......
$configureRTEInJavascriptString = (!$this->is_FE() ? '' : '
' . '/*<![CDATA[*/') . '
editornumber = RTEarea.length;
document.getElementById("pleasewait' . $textAreaId . '").id = "pleasewait" + editornumber;
document.getElementById("editorWrap' . $textAreaId . '").id = "editorWrap" + editornumber;
document.getElementById("RTEarea' . $textAreaId . '").id = "RTEarea" + editornumber;
if (typeof(configureEditorInstance) == "undefined") {
configureEditorInstance = new Object();
}
configureEditorInstance["' . $textAreaId . '"] = function() {
if (typeof(RTEarea) == "undefined" || typeof(HTMLArea) == "undefined") {
window.setTimeout("configureEditorInstance[\'' . $textAreaId . '\']();", 40);
} else {
editornumber = "' . $textAreaId . '";
RTEarea[editornumber] = new Object();
RTEarea[editornumber].RTEtsConfigParams = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";
RTEarea[editornumber].number = editornumber;
......
RTEarea[editornumber]["showTagFreeClasses"] = ' . (trim($this->thisConfig['showTagFreeClasses'])?'true':'false') . ';
RTEarea[editornumber]["useHTTPS"] = ' . ((trim(stristr($this->siteURL, 'https')) || $this->thisConfig['forceHTTPS'])?'true':'false') . ';
RTEarea[editornumber]["enableMozillaExtension"] = ' . (($this->client['BROWSER'] == 'gecko' && $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableMozillaExtension'])?'true':'false') . ';
RTEarea[editornumber]["tceformsNested"] = ' . (is_object($this->TCEform) && method_exists($this->TCEform, 'getDynNestedStack') ? $this->TCEform->getDynNestedStack(true) : '[]') . ';
RTEarea[editornumber].tceformsNested = ' . (is_object($this->TCEform) && method_exists($this->TCEform, 'getDynNestedStack') ? $this->TCEform->getDynNestedStack(true) : '[]') . ';
RTEarea[editornumber].dialogueWindows = new Object();
RTEarea[editornumber].dialogueWindows.defaultPositionFromTop = ' . (isset($this->thisConfig['dialogueWindows.']['defaultPositionFromTop'])? intval($this->thisConfig['dialogueWindows.']['defaultPositionFromTop']) : '100') . ';
RTEarea[editornumber].dialogueWindows.defaultPositionFromLeft = ' . (isset($this->thisConfig['dialogueWindows.']['defaultPositionFromLeft'])? intval($this->thisConfig['dialogueWindows.']['defaultPositionFromLeft']) : '100') . ';
......
$configureRTEInJavascriptString .= $plugin->buildJavascriptConfiguration('editornumber');
}
}
// Avoid premature reference to HTMLArea when being initially loaded by IRRE Ajax call
$configureRTEInJavascriptString .= '
RTEarea[editornumber].toolbar = ' . $this->getJSToolbarArray() . ';
RTEarea[editornumber].convertButtonId = ' . json_encode(array_flip($this->convertToolbarForHtmlAreaArray)) . ';
HTMLArea.initEditor(editornumber);' . (!$this->is_FE() ? '' : '
RTEarea.initEditor(editornumber);
}
};
configureEditorInstance["' . $textAreaId . '"]();'. (!$this->is_FE() ? '' : '
/*]]>*/');
return $configureRTEInJavascriptString;
}
......
* @return string Javascript code
*/
function setSaveRTE($RTEcounter, $formName, $textareaId) {
return '
rteFound = false;
for (editornumber = 1; editornumber < RTEarea.length; editornumber++) {
if (RTEarea[editornumber].textAreaId == "' . $textareaId . '") {
if (!RTEarea[editornumber].deleted) {
document.'.$formName.'["'.$textareaId.'"].value = RTEarea[editornumber]["editor"].getHTML();
}
rteFound = true;
break;
}
}
if (!rteFound) {
OK = 0;
}
';
return 'if (RTEarea[\'' . $textareaId . '\']) { document.' . $formName . '[\'' . $textareaId . '\'].value = RTEarea[\'' . $textareaId . '\'][\'editor\'].getHTML(); } else { OK = 0; };';
}
/**
......
* @return string Javascript code
*/
function setDeleteRTE($RTEcounter, $formName, $textareaId) {
return '
for (editornumber = 1; editornumber < RTEarea.length; editornumber++) {
if (RTEarea[editornumber].textAreaId == "' . $textareaId . '") {
if (RTEarea[editornumber]) {
RTEarea[editornumber].deleted = true;
}
}
break;
}
';
return 'if (RTEarea[\'' . $textareaId . '\']) { RTEarea[\'' . $textareaId . '\'].deleted = true;}';
}
/**
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js (copie de travail)
if (HTMLArea.is_wamcom) {
this._doc.open();
this._doc.close();
this._initIframeTimer = window.setTimeout("HTMLArea.initIframe(" + this._editorNumber + ");", 500);
this._initIframeTimer = window.setTimeout("HTMLArea.initIframe(\'" + this._editorNumber + "\');", 500);
return false;
}
}
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (copie de travail)
/***************************************************
* EDITOR INITIALIZATION AND CONFIGURATION
***************************************************/
// Avoid re-starting on Ajax request
if (typeof(HTMLArea) != "function") {
/*
* 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) {
HTMLArea = function(textarea, config) {
if (HTMLArea.checkSupportedBrowser()) {
if (typeof(config) == "undefined") this.config = new HTMLArea.Config();
else this.config = config;
......
}
};
HTMLArea.editorCSS = _editor_CSS;
/*
* Browser identification
*/
......
/*
* 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");
......
};
/*
* Using compressed scripts
* Build stack of scripts to be loaded
*/
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 = "";
......
};
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
......
}
var request = HTMLArea._request[i];
if (request) {
HTMLArea._appendToLog("[HTMLArea::getScript]: Requesting script " + url);
request.open("GET", url, asynchronous);
if (asynchronous) request.onreadystatechange = HTMLArea.XMLHTTPResponseHandler(i);
if (window.XMLHttpRequest) request.send(null);
......
};
/*
* Get all the scripts
* Initial load
*/
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);
if (typeof(_editor_url) != "string") {
window.setTimeout("HTMLArea.init();", 50);
} else {
// Set some basic paths
// Leave exactly one backslash at the end of _editor_url
_editor_url = _editor_url.replace(/\x2f*$/, '/');
if (typeof(_editor_skin) == "string") _editor_skin = _editor_skin.replace(/\x2f*$/, '/');
else _editor_skin = _editor_url + "skins/default/";
if (typeof(_editor_CSS) != "string") _editor_CSS = _editor_url + "skins/default/htmlarea.css";
if (typeof(_editor_edited_content_CSS) != "string") _editor_edited_content_CSS = _editor_skin + "htmlarea-edited-content.css";
if (typeof(_editor_lang) == "string") _editor_lang = _editor_lang ? _editor_lang.toLowerCase() : "en";
HTMLArea.editorCSS = _editor_CSS;
// Initialize event cache
HTMLArea._eventCache = HTMLArea._eventCacheConstructor();
// Set troubleshooting mode
HTMLArea._debugMode = false;
if (typeof(_editor_debug_mode) != "undefined") HTMLArea._debugMode = _editor_debug_mode;
// 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.loadTimer;
HTMLArea._scripts = [];
HTMLArea._scriptLoaded = [];
HTMLArea._request = [];
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");
for (var i = 0, n = HTMLArea_plugins.length; i < n; i++) {
HTMLArea.loadScript(HTMLArea_plugins[i].url, "", HTMLArea_plugins[i].asynchronous);
}
// Get all the scripts
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);
}
} catch (e) {
HTMLArea._appendToLog("ERROR [HTMLArea::init]: Unable to use XMLHttpRequest: "+ e);
}
if (success) {
HTMLArea.checkInitialLoad();
if (success) {
HTMLArea.checkInitialLoad();
} else {
if (HTMLArea.is_ie) window.setTimeout('alert(HTMLArea.I18N.msg["ActiveX-required"]);', 200);
}
} 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);
if (HTMLArea.is_ie) alert(HTMLArea.I18N.msg["ActiveX-required"]);
}
} else {
if (HTMLArea.is_ie) alert(HTMLArea.I18N.msg["ActiveX-required"]);
}
};
......
HTMLArea.prototype.initIframe = function() {
if (this._initIframeTimer) window.clearTimeout(this._initIframeTimer);
if (!this._iframe || (!this._iframe.contentWindow && !this._iframe.contentDocument)) {
this._initIframeTimer = window.setTimeout("HTMLArea.initIframe(" + this._editorNumber + ");", 50);
this._initIframeTimer = window.setTimeout("HTMLArea.initIframe(\'" + this._editorNumber + "\');", 50);
return false;
} else if (this._iframe.contentWindow && !HTMLArea.is_safari) {
if (!this._iframe.contentWindow.document || !this._iframe.contentWindow.document.documentElement) {
this._initIframeTimer = window.setTimeout("HTMLArea.initIframe(" + this._editorNumber + ");", 50);
this._initIframeTimer = window.setTimeout("HTMLArea.initIframe(\'" + this._editorNumber + "\');", 50);
return false;
}
} else if (!this._iframe.contentDocument.documentElement || !this._iframe.contentDocument.body) {
this._initIframeTimer = window.setTimeout("HTMLArea.initIframe(" + this._editorNumber + ");", 50);
this._initIframeTimer = window.setTimeout("HTMLArea.initIframe(\'" + this._editorNumber + "\');", 50);
return false;
}
var doc = this._iframe.contentWindow ? this._iframe.contentWindow.document : this._iframe.contentDocument;
......
}
if (!stylesAreLoaded && !HTMLArea.is_wamcom) {
HTMLArea._appendToLog("[HTMLArea::initIframe]: Failed attempt at loading stylesheets: " + errorText + " Retrying...");
this._stylesLoadedTimer = window.setTimeout("HTMLArea.stylesLoaded(" + this._editorNumber + ");", 100);
this._stylesLoadedTimer = window.setTimeout("HTMLArea.stylesLoaded(\'" + this._editorNumber + "\');", 100);
return false;
}
HTMLArea._appendToLog("[HTMLArea::initIframe]: Stylesheets successfully loaded.");
......
HTMLArea._addEvent((this._iframe.contentWindow ? this._iframe.contentWindow : this._iframe.contentDocument), "unload", HTMLArea.removeEditorEvents);
}
window.setTimeout("HTMLArea.generatePlugins(" + this._editorNumber + ");", 100);
window.setTimeout("HTMLArea.generatePlugins(\'" + this._editorNumber + "\');", 100);
};
HTMLArea.generatePlugins = function(editorNumber) {
......
if (HTMLArea._eventCache) {
HTMLArea._eventCache.flush();
}
for (var editorNumber = RTEarea.length; --editorNumber > 0 ;) {
var editor = RTEarea[editorNumber].editor;
if (editor) {
RTEarea[editorNumber].editor = null;
// save the HTML content into the original textarea for submit, back/forward, etc.
editor._textArea.value = editor.getHTML();
// do final cleanup
HTMLArea.cleanup(editor);
for (var editorNumber in RTEarea) {
if (RTEarea.hasOwnProperty(editorNumber)) {
var editor = RTEarea[editorNumber].editor;
if (editor) {
RTEarea[editorNumber].editor = null;
// save the HTML content into the original textarea for submit, back/forward, etc.
editor._textArea.value = editor.getHTML();
// do final cleanup
HTMLArea.cleanup(editor);
}
}
}
};
......
var obj = editor._toolbarObjects[txt];
obj.state = null;
obj.cmd = null;
document.getElementById(obj.elementId)._obj = null;
var element = document.getElementById(obj.elementId);
if (element) {
element._obj = null;
}
editor._toolbarObjects[txt] = null;
}
}
......
}
// update the toolbar state after some time
if (editor._timerToolbar) window.clearTimeout(editor._timerToolbar);
editor._timerToolbar = window.setTimeout("HTMLArea.updateToolbar(" + editor._editorNumber + ");", 100);
editor._timerToolbar = window.setTimeout("HTMLArea.updateToolbar(\'" + editor._editorNumber + "\');", 100);
return false;
}
break;
......
}
// update the toolbar state after some time
if (editor._timerToolbar) window.clearTimeout(editor._timerToolbar);
editor._timerToolbar = window.setTimeout("HTMLArea.updateToolbar(" + editor._editorNumber + ");", 50);
editor._timerToolbar = window.setTimeout("HTMLArea.updateToolbar(\'" + editor._editorNumber + "\');", 50);
break;
case 9: // KEY horizontal tab
var newkey = (ev.shiftKey ? "SHIFT-" : "") + "TAB";
......
case 40: // DOWN arrow key
if (HTMLArea.is_ie) {
if (editor._timerToolbar) window.clearTimeout(editor._timerToolbar);
editor._timerToolbar = window.setTimeout("HTMLArea.updateToolbar(" + editor._editorNumber + ");", 10);
editor._timerToolbar = window.setTimeout("HTMLArea.updateToolbar(\'" + editor._editorNumber + "\');", 10);
return true;
}
}
......
// mouse event
if (editor._timerToolbar) window.clearTimeout(editor._timerToolbar);
if (ev.type == "mouseup") editor.updateToolbar();
else editor._timerToolbar = window.setTimeout("HTMLArea.updateToolbar(" + editor._editorNumber + ");", 50);
else editor._timerToolbar = window.setTimeout("HTMLArea.updateToolbar(\'" + editor._editorNumber + "\');", 50);
}
};
......
*/
var lorem_ipsum = function(element,text) {
if (element.tagName.toLowerCase() == "textarea" && element.id && element.id.substr(0,7) == "RTEarea") {
var editor = RTEarea[element.id.substr(7,8)]["editor"];
var editor = RTEarea[element.id.substr(7, element.id.length)]["editor"];
editor.insertHTML(text);
editor.updateToolbar();
}
......
/*
* Initialize the editor, configure the toolbar, setup the plugins, etc.
*/
HTMLArea.initTimer = [];
HTMLArea.initTimer = new Object();
HTMLArea.onGenerateHandler = function(editorNumber) {
return (function() {
......
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);
HTMLArea.initTimer[editorNumber] = window.setTimeout("HTMLArea.initEditor(\'" + editorNumber + "\');", 150);
} else {
var RTE = RTEarea[editorNumber];
HTMLArea._appendToLog("[HTMLArea::initEditor]: Initializing editor with editor Id: " + editorNumber + ".");
// Get the configuration properties
var config = new HTMLArea.Config();
......
}
}
});
};
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js (copie de travail)
if (typeof(HTMLArea.Dialog) != "undefined" && HTMLArea.Dialog.TYPO3Image) {
HTMLArea.Dialog.TYPO3Image.close();
} else {
window.setTimeout("TYPO3HtmlParser.cleanLater(" + editor._editorNumber + ");", 250);
window.setTimeout("TYPO3HtmlParser.cleanLater(\'" + editor._editorNumber + "\');", 250);
}
};
typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php (copie de travail)
$this->addPageStyle();
$this->addSkin();
// Loading JavaScript files and code
$this->TCEform->additionalJS_initial = $this->loadJSfiles($this->TCEform->RTEcounter);
$this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
if ($this->TCEform->RTEcounter == 1) {
$this->TCEform->additionalJS_initial = $this->loadJSfiles($this->TCEform->RTEcounter);
$this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
}
/* =======================================
* DRAW THE EDITOR
......
*
* @param integer $RTEcounter: The index number of the RTE editing area.
* @param string $form: the name of the form
* @param string $textarea: the name of the textarea
* @param string $textareaId: the id of the textarea
*
* @return string the JS-Code
*/
function setSaveRTE($RTEcounter, $form, $textarea) {
function setSaveRTE($RTEcounter, $form, $textareaId) {
return '
rteFound = false;
for (editornumber = 1; editornumber < RTEarea.length; editornumber++) {
if (RTEarea[editornumber].textAreaId == \'' . $textarea . '\') {
if (!RTEarea[editornumber].deleted) {
fields = document.getElementsByName(\'' . $textarea . '\');
if (RTEarea[\'' . $textareaId . '\'] && !RTEarea[\'' . $textareaId . '\'].deleted) {
fields = document.getElementsByName(\'' . $textareaId . '\');
field = fields.item(0);
if(field && field.tagName.toLowerCase() == \'textarea\') field.value = RTEarea[editornumber][\'editor\'].getHTML();
}
rteFound = true;
break;
if (field && field.nodeName.toLowerCase() == \'textarea\') {
field.value = RTEarea[\'' . $textareaId . '\'][\'editor\'].getHTML();
}
}
if (!rteFound) {
} else {
OK = 0;
}
';
}';
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php']) {
(3-3/4)