+2010-10-22 Stanislas Rolland <typo3@sjbr.ca>
+
+ * Added feature #16114: htmlArea RTE: cleanup some js code generation code
+
2010-10-22 Ernesto Baschny <ernst@cron-it.de>
* Fixed bug #16094: Label "on-click" for formerly "click-enlarge" does not make sense
+2010-10-22 Stanislas Rolland <typo3@sjbr.ca>
+
+ * Added feature #16114: htmlArea RTE: cleanup some js code generation code
+
2010-10-20 Stanislas Rolland <typo3@sjbr.ca>
* Added feature #16079: htmlArea RTE: Register RTE scripts with the autoloader
}
$this->buildJSMainLangFile($RTEcounter);
// Avoid re-initialization on AJax call when RTEarea object was already initialized
- $loadJavascriptCode = '
- <script type="text/javascript" src="' . $this->doConcatenate($RTEcounter) . '"></script>
- <script type="text/javascript">
- /*<![CDATA[*/
+ $loadJavascriptCode = '<script type="text/javascript" src="' . $this->doConcatenate($RTEcounter) . '"></script>'. LF;
+ $loadJavascriptCode .= t3lib_div::wrapJS('
if (typeof(RTEarea) == "undefined") {
RTEarea = new Object();
RTEarea[0] = new Object();
HTMLArea.initEditor(editorNumber);
}
};
- }
- /*]]>*/
- </script>';
+ }'
+ );
return $loadJavascriptCode;
}
* @return string the Javascript code for initializing the RTE
*/
function loadJScode($RTEcounter) {
- return (!$this->is_FE() ? '' : '
- ' . '/*<![CDATA[*/') . '
- RTEarea.init();' . (!$this->is_FE() ? '' : '
- /*]]>*/
- ');
+ return TAB . 'RTEarea.init();';
}
/**
* @return string the Javascript code for configuring the RTE
*/
function registerRTEinJS($RTEcounter, $table='', $uid='', $field='', $textAreaId = '') {
-
- $configureRTEInJavascriptString = (!$this->is_FE() ? '' : '
- ' . '/*<![CDATA[*/') . '
+ $configureRTEInJavascriptString = '
if (typeof(configureEditorInstance) == "undefined") {
configureEditorInstance = new Object();
}
RTEarea.initEditor(editornumber);
}
};
- configureEditorInstance["' . $textAreaId . '"]();'. (!$this->is_FE() ? '' : '
- /*]]>*/');
+ configureEditorInstance["' . $textAreaId . '"]();';
return $configureRTEInJavascriptString;
}
$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(
$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);
}
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(
+ '',
+ '/*<![CDATA[*/',
+ $string,
+ '/*]]>*/'
+ )
+ );
+ }
}
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']);