📄 class.tx_rtehtmlarea_base.php
字号:
$pObj->additionalJS_submit[] = $this->setSaveRTE($pObj->RTEcounter, $pObj->formName, htmlspecialchars($PA['itemFormElName'])); // Draw the textarea $visibility = 'hidden'; $item = $this->triggerField($PA['itemFormElName']).' <div id="pleasewait' . $pObj->RTEcounter . '" class="pleasewait" style="display: none;" >' . $LANG->getLL('Please wait') . '</div> <div id="editorWrap' . $pObj->RTEcounter . '" class="editorWrap" style="width:' . $editorWrapWidth . '; height:' . $editorWrapHeight . ';"> <textarea id="RTEarea'.$pObj->RTEcounter.'" name="'.htmlspecialchars($PA['itemFormElName']).'" style="'.t3lib_div::deHSCentities(htmlspecialchars($this->RTEdivStyle)).'">'.t3lib_div::formatForTextarea($value).'</textarea> </div>' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? '<div id="HTMLAreaLog"></div>' : '') . ' '; } // Return form item: return $item; } /** * Set the toolbar config (only in this PHP-Object, not in JS): * */ function setToolBar() { global $BE_USER; $this->defaultToolbarOrder = 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak, bar, fontstyle, space, fontsize, space, formatblock, bar, bold, italic, underline, strikethrough, subscript, superscript, bar, lefttoright, righttoleft, bar, left, center, right, justifyfull, bar, orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator, bar, emoticon, insertcharacter, line, link, image, table,' . (($this->thisConfig['hideTableOperationsInToolbar'] && is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.']['toggleborders.']) && $this->thisConfig['buttons.']['toggleborders.']['keepInToolbar']) ? ' toggleborders,': '') . ' user, acronym, bar, findreplace, spellcheck, bar, chMode, inserttag, removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak, ' . ($this->thisConfig['hideTableOperationsInToolbar'] ? '': 'bar, toggleborders,') . ' bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar, columninsertbefore, columninsertafter, columndelete, columnsplit, bar, cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge'; // Special toolbar for Mozilla Wamcom on Mac OS 9 if($this->client['BROWSER'] == 'gecko' && $this->client['VERSION'] == '1.3') { $this->defaultToolbarOrder = $this->TCEform->docLarge ? 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak, bar, fontstyle, space, fontsize, space, formatblock, bar, bold, italic, underline, strikethrough, subscript, superscript, lefttoright, righttoleft, bar, left, center, right, justifyfull, linebreak, bar, orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator, bar, emoticon, insertcharacter, line, link, image, table, user, acronym, bar, findreplace, spellcheck, bar, chMode, inserttag, removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak, bar, toggleborders, bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar, columninsertbefore, columninsertafter, columndelete, columnsplit, bar, cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge' : 'bar, blockstylelabel, blockstyle, space, textstylelabel, textstyle, linebreak, bar, fontstyle, space, fontsize, space, formatblock, bar, bold, italic, underline, strikethrough, subscript, superscript, linebreak, bar, lefttoright, righttoleft, bar, left, center, right, justifyfull, orderedlist, unorderedlist, outdent, indent, bar, textcolor, bgcolor, textindicator, bar, emoticon, insertcharacter, line, link, image, table, user, acronym, linebreak, bar, findreplace, spellcheck, bar, chMode, inserttag, removeformat, bar, copy, cut, paste, bar, undo, redo, bar, showhelp, about, linebreak, bar, toggleborders, bar, tableproperties, bar, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit, bar, columninsertbefore, columninsertafter, columndelete, columnsplit, bar, cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge'; } $toolbarOrder = $this->thisConfig['toolbarOrder'] ? $this->thisConfig['toolbarOrder'] : $this->defaultToolbarOrder; // Getting rid of undefined buttons $this->toolbarOrderArray = array_intersect(t3lib_div::trimExplode(',', $toolbarOrder, 1), t3lib_div::trimExplode(',', $this->defaultToolbarOrder, 1)); $toolbarOrder = array_unique(array_values($this->toolbarOrderArray)); // Fetching specConf for field from backend $pList = is_array($this->specConf['richtext']['parameters']) ? implode(',',$this->specConf['richtext']['parameters']) : ''; if ($pList != '*') { // If not all $show = is_array($this->specConf['richtext']['parameters']) ? $this->specConf['richtext']['parameters'] : array(); if ($this->thisConfig['showButtons']) { if (!t3lib_div::inList($this->thisConfig['showButtons'],'*')) { $show = array_unique(array_merge($show,t3lib_div::trimExplode(',',$this->thisConfig['showButtons'],1))); } else { $show = array_unique(array_merge($show, $toolbarOrder)); } } if (is_array($this->thisConfig['showButtons.'])) { reset($this->thisConfig['showButtons.']); while(list($button,$value) = each($this->thisConfig['showButtons.'])) { if ($value) $show[] = $button; } $show = array_unique($show); } } else { $show = $toolbarOrder; } // Resticting to RTEkeyList for backend user if(is_object($BE_USER)) { $RTEkeyList = isset($BE_USER->userTS['options.']['RTEkeyList']) ? $BE_USER->userTS['options.']['RTEkeyList'] : '*'; if ($RTEkeyList != '*') { // If not all $show = array_intersect($show, t3lib_div::trimExplode(',',$RTEkeyList,1)); } } // Hiding buttons of disabled plugins $hideButtons = array('space', 'bar', 'linebreak'); reset($this->pluginButton); while(list($plugin, $buttonList) = each($this->pluginButton) ) { if(!$this->isPluginEnable($plugin)) { $buttonArray = t3lib_div::trimExplode(',',$buttonList,1); foreach($buttonArray as $button) { $hideButtons[] = $button; } } } // Hiding labels of disabled plugins reset($this->pluginLabel); while(list($plugin, $label) = each($this->pluginLabel) ) { if(!$this->isPluginEnable($plugin)) $hideButtons[] = $label; } // Hiding buttons not implemented in Safari if ($this->client['BROWSER'] == 'safari') { reset($this->conf_toolbar_safari_hide); while(list(, $button) = each($this->conf_toolbar_safari_hide) ) { $hideButtons[] = $button; } } // Hiding buttons not implemented in Opera if ($this->client['BROWSER'] == 'opera') { reset($this->conf_toolbar_opera_hide); while(list(, $button) = each($this->conf_toolbar_opera_hide) ) { $hideButtons[] = $button; } } // Hiding the buttons $show = array_diff($show, $this->conf_toolbar_hide, $hideButtons, t3lib_div::trimExplode(',',$this->thisConfig['hideButtons'],1)); // Adding the always show buttons $show = array_unique(array_merge($show, $this->conf_toolbar_show)); $toolbarOrder = array_unique(array_merge($toolbarOrder, $this->conf_toolbar_show)); reset($this->conf_toolbar_show); while(list(,$button) = each($this->conf_toolbar_show)) { if(!in_array($button, $this->toolbarOrderArray)) $this->toolbarOrderArray[] = $button; } // Getting rid of the buttons for which we have no position $show = array_intersect($show, $toolbarOrder); $this->toolBar = $show; } /** * Disable some plugins * */ function setPlugins() { global $TYPO3_CONF_VARS; $hideButtons = array(); // Disabling the plugins if their buttons are not in the toolbar $hidePlugins = array(); reset($this->pluginButton); while(list($plugin, $buttonList) = each($this->pluginButton) ) { $buttonArray = t3lib_div::trimExplode(',',$buttonList,1); if(!in_array($buttonArray[0],$this->toolBar)) { $hidePlugins[] = $plugin; foreach($buttonArray as $button) { $hideButtons[] = $button; } } } if($this->thisConfig['disableContextMenu'] || $this->thisConfig['disableRightClick']) $hidePlugins[] = 'ContextMenu'; if($this->thisConfig['disableSelectColor']) $hidePlugins[] = 'SelectColor'; if($this->thisConfig['disableTYPO3Browsers']) $hidePlugins[] = 'TYPO3Browsers'; if(!$this->thisConfig['enableWordClean'] || !is_array($this->thisConfig['enableWordClean.'])) $hidePlugins[] = 'TYPO3HtmlParser'; if(!t3lib_extMgm::isLoaded('static_info_tables') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker'; $this->pluginEnableArray = array_diff($this->pluginEnableArray, $hidePlugins); // Hiding labels of disabled plugins reset($this->pluginLabel); while(list($plugin, $label) = each($this->pluginLabel) ) { if(!$this->isPluginEnable($plugin)) $hideButtons[] = $label; } $this->toolBar = array_diff($this->toolBar, $hideButtons); // Renaming buttons of replacement plugins if( $this->isPluginEnable('SelectColor') ) { $this->conf_toolbar_convert['textcolor'] = 'CO-forecolor'; $this->conf_toolbar_convert['bgcolor'] = 'CO-hilitecolor'; } } /** * Convert the TYPO3 names of buttons into the names for htmlArea RTE * * @param string buttonname (typo3-name) * @return string buttonname (htmlarea-name) */ function convertToolBarForHTMLArea($button) { return $this->conf_toolbar_convert[$button]; } /** * Return the JS-function for setting the RTE size. * * @param string DivID-Name * @param int the height for the RTE * @param int the width for the RTE * @return string Loader function in JS */ function setRTEsizeByJS($divId, $height, $width) { return ' setRTEsizeByJS(\''.$divId.'\','.$height.', '.$width.'); '; } /** * Return the HTML-Code for loading the Javascript-Files * * @return string the html-code for loading the Javascript-Files */ function loadJSfiles($number) { global $TYPO3_CONF_VARS; return ' <script type="text/javascript"> /*<![CDATA[*/ i=1; while (document.getElementById("pleasewait" + i)) { document.getElementById("pleasewait" + i).style.display = "block"; document.getElementById("editorWrap" + i).style.visibility = "hidden"; i++; }; RTEarea = new Array(); RTEarea[0] = new Object(); RTEarea[0]["version"] = "' . $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['version'] . '"; RTEarea[0]["popupwin"] = "' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/popupwin' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', "popupwin", $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '"; RTEarea[0]["htmlarea-gecko"] = "' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/htmlarea-gecko' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', "htmlarea-gecko", $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '"; RTEarea[0]["htmlarea-ie"] = "' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/htmlarea-ie' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', "htmlarea-ie", $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '"; _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') . '; _editor_mozAllowClipboard_url = "' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] ? $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] : '') . '"; _spellChecker_lang = "' . $this->spellCheckerLanguage . '"; _spellChecker_charset = "' . $this->spellCheckerCharset . '"; _spellChecker_mode = "' . $this->spellCheckerMode . '"; /*]]>*/ </script> <script type="text/javascript" src="' . $this->buildJSMainLangFile($number) . '"></script> <script type="text/javascript" src="' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/htmlarea' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', "htmlarea", $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '"></script> '; } /** * Return the JS-Code to initialize the Editor * * @return string the html-code for loading the Javascript-Files */ function loadJScode($number) { global $TSFE, $TYPO3_CONF_VARS; $loadPluginCode = ''; $pluginArray = t3lib_div::trimExplode(',', $this->pluginList , 1); while( list(,$plugin) = each($pluginArray) ) { if ($this->isPluginEnable($plugin) || (intval($number) > 1 && in_array($plugin, $this->pluginEnableArrayMultiple))) { $loadPluginCode .= ' HTMLArea.loadPlugin("' . $plugin . '", true, "' . $this->writeJSFileToTypo3tempDir('EXT:' . $this->ID . '/htmlarea/plugins/' . $plugin . '/' . strtolower(preg_replace('/([a-z])([A-Z])([a-z])/', "$1".'-'."$2"."$3", $plugin)) . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']?'-compressed':'') .'.js', $plugin, $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts']) . '");'; } } return (!$this->is_FE() ? '' : ' ' . '/*<![CDATA[*/') . ($this->is_FE() ? '' : ' RTEarea[0]["RTEtsConfigParams"] = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '"; RTEarea[0]["pathAcronymModule"] = "../../mod2/acronym.php"; RTEarea[0]["pathLinkModule"] = "../../mod3/browse_links.php"; RTEarea[0]["pathImageModule"] = "../../mod4/select_image.php"; RTEarea[0]["pathUserModule"] = "../../mod5/user.php"; RTEarea[0]["pathParseHtmlModule"] = "' . $this->extHttpPath . 'mod6/parse_html.php";') . $loadPluginCode . ' HTMLArea.init();' . (!$this->is_FE() ? '' : ' /*]]>*/ '); } /** * Return the JS-Code for Register the RTE in JS * * @param integer $number: The index number of the RTE. * @param string $table: The table that includes this RTE (optional, necessary for IRRE). * @param string $uid: The uid of that table that includes this RTE (optional, necessary for IRRE). * @param string $field: The field of that record that includes this RTE (optional). * * @return string the JS-Code for Register the RTE in JS */ function registerRTEinJS($number, $table='', $uid='', $field='') { global $TSFE, $TYPO3_CONF_VARS; $registerRTEinJSString = (!$this->is_FE() ? '' : ' ' . '/*<![CDATA[*/') . ' RTEarea['.$number.'] = new Object(); RTEarea['.$number.']["RTEtsConfigParams"] = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '"; RTEarea['.$number.']["number"] = '.$number.'; RTEarea['.$number.']["id"] = "RTEarea'.$number.'"; RTEarea['.$number.']["enableWordClean"] = ' . (trim($this->thisConfig['enableWordClean'])?'true':'false') . '; RTEarea['.$number.']["htmlRemoveComments"] = ' . (trim($this->thisConfig['removeComments'])?'true':'false') . ';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -