Index: typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php =================================================================== --- typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (révision 9193) +++ typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (copie de travail) @@ -734,10 +734,8 @@ } $this->buildJSMainLangFile($RTEcounter); // Avoid re-initialization on AJax call when RTEarea object was already initialized - $loadJavascriptCode = ' - - '. LF; + $loadJavascriptCode .= t3lib_div::wrapJS(' if (typeof(RTEarea) == "undefined") { RTEarea = new Object(); RTEarea[0] = new Object(); @@ -763,9 +761,8 @@ HTMLArea.initEditor(editorNumber); } }; - } - /*]]>*/ - '; + }' + ); return $loadJavascriptCode; } @@ -777,11 +774,7 @@ * @return string the Javascript code for initializing the RTE */ function loadJScode($RTEcounter) { - return (!$this->is_FE() ? '' : ' - ' . '/*is_FE() ? '' : ' - /*]]>*/ - '); + return TAB . 'RTEarea.init();'; } /** @@ -795,9 +788,7 @@ * @return string the Javascript code for configuring the RTE */ function registerRTEinJS($RTEcounter, $table='', $uid='', $field='', $textAreaId = '') { - - $configureRTEInJavascriptString = (!$this->is_FE() ? '' : ' - ' . '/*is_FE() ? '' : ' - /*]]>*/'); + configureEditorInstance["' . $textAreaId . '"]();'; return $configureRTEInJavascriptString; } Index: typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php =================================================================== --- typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php (révision 9193) +++ typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php (copie de travail) @@ -221,7 +221,7 @@ $pageRenderer->addJsFile($this->siteURL . 't3lib/js/extjs/ux/ext.resizable.js'); $pageRenderer->addJsFile($this->siteURL . '/t3lib/js/extjs/notifications.js'); if ($this->TCEform->RTEcounter == 1) { - $this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter); + $this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->wrapCDATA($this->loadJScode($this->TCEform->RTEcounter)); } $this->TCEform->additionalJS_initial = $this->loadJSfiles($this->TCEform->RTEcounter); $resizableSettings = array( @@ -252,7 +252,7 @@ $textAreaId = htmlspecialchars(preg_replace('/^[^a-zA-Z]/', 'x', $textAreaId)) . '_' . strval($this->TCEform->RTEcounter); // Register RTE in JS: - $this->TCEform->additionalJS_post[] = $this->registerRTEinJS($this->TCEform->RTEcounter, '', '', '',$textAreaId); + $this->TCEform->additionalJS_post[] = $this->wrapCDATA($this->registerRTEinJS($this->TCEform->RTEcounter, '', '', '',$textAreaId)); // Set the save option for the RTE: $this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId); @@ -318,6 +318,23 @@ } return $this->pageRenderer; } + /** + * Wrap input string in CDATA enclosure + * + * @param string $string: input to be wrapped + * + * @return string wrapped string + */ + public function wrapCDATA ($string) { + return implode(LF, + array( + '', + '/**/' + ) + ); + } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php']);