* Added feature #6657: Extract inline buttons from htmlArea RTE main scripts.
authorStanislas Rolland <typo3@sjbr.ca>
Tue, 6 Nov 2007 04:03:10 +0000 (04:03 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 6 Nov 2007 04:03:10 +0000 (04:03 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2666 709f56b5-9817-0410-a4d7-c38de5d9e867

20 files changed:
ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/rtehtmlarea/class.tx_rtehtmlareaapi.php
typo3/sysext/rtehtmlarea/ext_localconf.php
typo3/sysext/rtehtmlarea/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultInline/locallang.xml [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/htmlarea.css [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/bold.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/italic.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/strikethrough.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/subscript.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/superscript.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/underline.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-ie.js
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultInline/default-inline.js [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultInline/locallang.xml [new file with mode: 0644]
typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php

index c072019..3805001 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2007-11-05  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * Feature 6579 continued: Use prototype.js to create a htmlArea plugin class.
+       * Added feature #6657: Extract inline buttons from htmlArea RTE main scripts.
 
 2007-11-05  Ingmar Schlecht  <ingmar@typo3.org>
 
index aed65e3..72b95f1 100644 (file)
@@ -1,6 +1,7 @@
 2007-11-05  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * Feature 6579 continued: Use prototype.js to create a htmlArea plugin class.
+       * Added feature #6657: Extract inline buttons from htmlArea RTE main scripts.
 
 2007-11-02  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
index b3245ca..ef0df40 100644 (file)
@@ -97,9 +97,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                'fontsize'              => 'FontSize',
                'textcolor'             => 'ForeColor',
                'bgcolor'               => 'HiliteColor',
-               'bold'                  => 'Bold',
-               'italic'                => 'Italic',
-               'underline'             => 'Underline',
                'left'                  => 'JustifyLeft',
                'center'                => 'JustifyCenter',
                'right'                 => 'JustifyRight',
@@ -123,9 +120,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                'lefttoright'           => 'LeftToRight',
                'righttoleft'           => 'RightToLeft',
                'justifyfull'           => 'JustifyFull',
-               'strikethrough'         => 'StrikeThrough',
-               'superscript'           => 'Superscript',
-               'subscript'             => 'Subscript',
                'showhelp'              => 'ShowHelp',
                'insertcharacter'       => 'InsertCharacter',
                'findreplace'           => 'FindReplace',
@@ -469,17 +463,27 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                                        if (is_object($plugin)) {
                                                if ($plugin->main($this)) {
                                                        $this->registeredPlugins[$pluginId] = $plugin;
+                                                               // Override buttons from previously registered plugins
+                                                       $pluginButtons = t3lib_div::trimExplode(',', $plugin->getPluginButtons(), 1);
+                                                       foreach ($this->pluginButton as $previousPluginId => $buttonList) {
+                                                               $this->pluginButton[$previousPluginId] = implode(',',array_diff(t3lib_div::trimExplode(',', $this->pluginButton[$previousPluginId], 1), $pluginButtons));
+                                                       }
                                                        $this->pluginButton[$pluginId] = $plugin->getPluginButtons();
                                                        $this->pluginList .= ','.$pluginId;
-                                                       $this->convertToolbarForHtmlAreaArray = array_unique(array_merge($this->convertToolbarForHtmlAreaArray, $plugin->getConvertToolbarForHtmlAreaArray()));
                                                }
                                        }
                                }
                        }
+                               // Process overrides
+                       $hidePlugins = array();
+                       foreach ($this->registeredPlugins as $pluginId => $plugin) {
+                               if (!$this->pluginButton[$pluginId]) {
+                                       $hidePlugins[] = $pluginId;
+                               }
+                       }
                        
                                // htmlArea plugins list
                        $this->pluginEnabledArray = t3lib_div::trimExplode(',', $this->pluginList, 1);
-                       $hidePlugins = array();
                        if(!t3lib_extMgm::isLoaded('static_info_tables') || in_array($this->language, t3lib_div::trimExplode(',', $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['noSpellCheckLanguages']))) $hidePlugins[] = 'SpellChecker';
                        if ($this->client['BROWSER'] == 'msie') $hidePlugins[] = 'Acronym';
                        if ($this->client['BROWSER'] == 'opera') {
@@ -591,7 +595,7 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                <link rel="stylesheet" type="text/css" href="' . $this->editorCSS . '" />';
                        
                                // Loading JavaScript files and code
-                       $this->TCEform->loadJavascriptLib('prototype');
+                       //$this->TCEform->loadJavascriptLib('prototype');
                        $this->TCEform->additionalCode_pre['loadJSfiles'] = $this->loadJSfiles($this->TCEform->RTEcounter);
                        $this->TCEform->additionalJS_pre['loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
 
@@ -789,8 +793,8 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                        // Disabling the plugins if their buttons are not in the toolbar
                $hidePlugins = array();
                foreach ($this->pluginButton as $pluginId => $buttonList) {
-                       $buttonArray = t3lib_div::trimExplode(',', $buttonList, 1);
                        $showPlugin = false;
+                       $buttonArray = t3lib_div::trimExplode(',', $buttonList, 1);
                        foreach ($buttonArray as $button) {
                                if (in_array($button, $this->toolbar)) {
                                        $showPlugin = true;
@@ -815,6 +819,12 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                }
                $this->toolbar = array_diff($this->toolbar, $hideButtons);
                
+                       // Completing the toolbar converion array for htmlArea
+               foreach ($this->registeredPlugins as $pluginId => $plugin) {
+                       if ($this->isPluginEnabled($pluginId)) {
+                               $this->convertToolbarForHtmlAreaArray = array_unique(array_merge($this->convertToolbarForHtmlAreaArray, $plugin->getConvertToolbarForHtmlAreaArray()));
+                       }
+               }
                        // Renaming buttons of replacement plugins
                if( $this->isPluginEnabled('SelectColor') ) {
                        $this->convertToolbarForHtmlAreaArray['textcolor'] = 'CO-forecolor';
@@ -892,6 +902,7 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                </script>';
                $loadJavascriptCode .= '
                <script type="text/javascript" src="' . $this->buildJSMainLangFile($RTEcounter) . '"></script>
+               <script type="text/javascript" src="'. ($this->is_FE()?'/typo3/':'') . 'contrib/prototype/prototype.js"></script>
                <script type="text/javascript" src="' . $this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea.js', "htmlarea") . '"></script>
                ';
                return $loadJavascriptCode;
@@ -1709,11 +1720,8 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
         
        function buildJSMainLangFile($RTEcounter) { 
                $contents = $this->buildJSMainLangArray() . chr(10);
-               $pluginArray = t3lib_div::trimExplode(',', $this->pluginList, 1);
-               foreach ($pluginArray as $plugin) {
-                       if (in_array($plugin, $this->pluginEnabledCumulativeArray[$RTEcounter])) {
-                               $contents .= $this->buildJSLangArray($plugin) . chr(10);
-                       }
+               foreach ($this->pluginEnabledCumulativeArray[$RTEcounter] as $pluginId) {
+                       $contents .= $this->buildJSLangArray($pluginId) . chr(10);
                }
                return $this->writeTemporaryFile('', $this->language.'_'.$this->OutputCharset, 'js', $contents);
        }
index f02ce6a..d8de86f 100644 (file)
@@ -78,7 +78,9 @@ abstract class tx_rtehtmlareaapi {
         * @return      string          a modified tollbar order list
         */
        public function addButtonsToToolbar() {
-               return ('bar,'.$this->pluginButtons.',linebreak,'.$this->htmlAreaRTE->defaultToolbarOrder);
+                       //Add only buttons not yet in the default toolbar order
+               $addButtons = implode(',', array_diff(t3lib_div::trimExplode(',', $this->pluginButtons, 1), t3lib_div::trimExplode(',', $this->htmlAreaRTE->defaultToolbarOrder, 1)));
+               return (($addButtons ? ('bar,'  . $addButtons . ',linebreak,') : '')  . $this->htmlAreaRTE->defaultToolbarOrder);
        }
        
        /**
index 9ce25b7..0974b74 100644 (file)
@@ -46,6 +46,10 @@ $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['version'] = $EM_CONF[$_EXTKEY]['version']
 // Initialize plugin registration array
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins'] = array();
 
+// Registering plugin from "inner" extensions:
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['DefaultInline'] = array();
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['DefaultInline']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php:&tx_rtehtmlarea_defaultinline';
+
 $_EXTCONF = unserialize($_EXTCONF);    // unserializing the configuration so we can use it here:
 
 if (strstr($_EXTCONF['defaultConfiguration'],'Minimal')) {
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php
new file mode 100644 (file)
index 0000000..67d03ed
--- /dev/null
@@ -0,0 +1,79 @@
+<?php\r
+/***************************************************************\r
+*  Copyright notice\r
+*\r
+*  (c) 2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>\r
+*  All rights reserved\r
+*\r
+*  This script is part of the Typo3 project. The Typo3 project is\r
+*  free software; you can redistribute it and/or modify\r
+*  it under the terms of the GNU General Public License as published by\r
+*  the Free Software Foundation; either version 2 of the License, or\r
+*  (at your option) any later version.\r
+*\r
+*  The GNU General Public License can be found at\r
+*  http://www.gnu.org/copyleft/gpl.html.\r
+*\r
+*  This script is distributed in the hope that it will be useful,\r
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+*  GNU General Public License for more details.\r
+*\r
+*  This copyright notice MUST APPEAR in all copies of the script!\r
+***************************************************************/\r
+/**\r
+ * DefaultInline plugin for htmlArea RTE\r
+ *\r
+ * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>\r
+ *\r
+ * TYPO3 CVS ID: $Id: class.tx_rtehtmlarea_pi1.php 2449 2007-08-15 08:12:19Z ingorenner $\r
+ *\r
+ */\r
+\r
+require_once(t3lib_extMgm::extPath('rtehtmlarea').'class.tx_rtehtmlareaapi.php');\r
+\r
+class tx_rtehtmlarea_defaultinline extends tx_rtehtmlareaapi {\r
+\r
+       protected $extensionKey = 'rtehtmlarea';                // The key of the extension that is extending htmlArea RTE\r
+       protected $relativePathToLocallangFile = 'extensions/DefaultInline/locallang.xml';      // Path to this main locallang file of the extension relative to the extension dir.\r
+       protected $relativePathToSkin = 'skin/htmlarea.css';            // Path to the skin (css) file relative to the extension dir.\r
+       protected $htmlAreaRTE;                                         // Reference to the invoking object\r
+       protected $thisConfig;                                          // Reference to RTE PageTSConfig\r
+       protected $toolbar;                                             // Reference to RTE toolbar array\r
+       protected $LOCAL_LANG;                                          // Frontend language array\r
+       \r
+       protected $pluginButtons = 'bold,italic,strikethrough,subscript,superscript,underline';\r
+       protected $convertToolbarForHtmlAreaArray = array (\r
+               'bold'                  => 'Bold',\r
+               'italic'                => 'Italic',\r
+               'underline'             => 'Underline',\r
+               'strikethrough'         => 'StrikeThrough',\r
+               'superscript'           => 'Superscript',\r
+               'subscript'             => 'Subscript',\r
+               );\r
+       \r
+       /**\r
+        * Return JS configuration of the htmlArea plugins registered by the extension\r
+        *\r
+        * @param       integer         Relative id of the RTE editing area in the form\r
+        *\r
+        * @return string               JS configuration for registered plugins\r
+        *\r
+        * The returned string will be a set of JS instructions defining the configuration that will be provided to the plugin(s)\r
+        * Each of the instructions should be of the form:\r
+        *      RTEarea['.$RTEcounter.']["buttons"]["button-id"]["property"] = "value";\r
+        */\r
+       public function buildJavascriptConfiguration($RTEcounter) {\r
+               global $TSFE, $LANG;\r
+               \r
+               $registerRTEinJavascriptString = '';\r
+               return $registerRTEinJavascriptString;\r
+       }\r
+\r
+} // end of class\r
+\r
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php']) {\r
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php']);\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultInline/locallang.xml b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/locallang.xml
new file mode 100644 (file)
index 0000000..a318850
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Labels for Default Inline Elements plugin of htmlArea RTE</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </data>
+       <orig_hash type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_hash>
+       <orig_text type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_text>
+</T3locallang>
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/htmlarea.css b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/htmlarea.css
new file mode 100644 (file)
index 0000000..6b34190
--- /dev/null
@@ -0,0 +1,7 @@
+/* Selectors for the DefaultInline plugin of htmlArea RTE */
+.htmlarea .toolbar .Bold {background-image:url("images/InlineElements/bold.gif");}
+.htmlarea .toolbar .Italic {background-image:url("images/InlineElements/italic.gif");}
+.htmlarea .toolbar .StrikeThrough {background-image:url("images/InlineElements/strikethrough.gif");}
+.htmlarea .toolbar .Subscript {background-image:url("images/InlineElements/subscript.gif");}
+.htmlarea .toolbar .Superscript {background-image:url("images/InlineElements/superscript.gif");}
+.htmlarea .toolbar .Underline {background-image:url("images/InlineElements/underline.gif");}
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/bold.gif b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/bold.gif
new file mode 100644 (file)
index 0000000..99a3abd
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/bold.gif differ
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/italic.gif b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/italic.gif
new file mode 100644 (file)
index 0000000..6b90006
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/italic.gif differ
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/strikethrough.gif b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/strikethrough.gif
new file mode 100644 (file)
index 0000000..48f0ca5
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/strikethrough.gif differ
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/subscript.gif b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/subscript.gif
new file mode 100644 (file)
index 0000000..57fec04
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/subscript.gif differ
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/superscript.gif b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/superscript.gif
new file mode 100644 (file)
index 0000000..8035cfd
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/superscript.gif differ
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/underline.gif b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/underline.gif
new file mode 100644 (file)
index 0000000..964c845
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/DefaultInline/skin/images/DefaultInline/underline.gif differ
index 97c5891..9b56c2c 100644 (file)
@@ -219,12 +219,7 @@ HTMLArea.prototype._activeElement = function(sel) {
  */
 HTMLArea.prototype._selectionEmpty = function(sel) {
        if (!sel) return true;
-       if (typeof(sel.isCollapsed) != 'undefined') {
-               if (HTMLArea.is_opera) this._createRange(sel).collapsed;
-                       else sel.isCollapsed;
-       } else {
-               return true;
-       }
+       return sel.isCollapsed;
 };
 
 /***************************************************
index 6e29957..53b2fa4 100644 (file)
@@ -191,7 +191,7 @@ HTMLArea.prototype._activeElement = function(sel) {
                        // (this happens when a node is clicked in the tree)
                var range = sel.createRange();
                var p_elm = this.getParentElement(sel);
-               if(p_elm.innerHTML == range.htmlText) return p_elm;
+               if(p_elm.outerHTML == range.htmlText) return p_elm;
                return null;
        }
 };
@@ -254,6 +254,7 @@ HTMLArea.statusBarHandler = function (ev) {
        } else {
                editor.selectNode(target.el);
        }
+       editor._statusBarTree.selected = target.el;
        editor.updateToolbar(true);
        switch (ev.type) {
                case "click" :
index 8b2a6d5..c96805f 100644 (file)
@@ -296,12 +296,6 @@ HTMLArea.Config = function () {
        this.popupURL = "popups/";
 
        this.btnList = {
-               Bold:                   ["Bold", "ed_format_bold", false, function(editor) {editor.execCommand("Bold");}],
-               Italic:                 ["Italic", "ed_format_italic", false, function(editor) {editor.execCommand("Italic");}],
-               Underline:              ["Underline", "ed_format_underline", false, function(editor) {editor.execCommand("Underline");}],
-               StrikeThrough:          ["Strikethrough", "ed_format_strike", false, function(editor) {editor.execCommand("StrikeThrough");}],
-               Subscript:              ["Subscript", "ed_format_sub", false, function(editor) {editor.execCommand("Subscript");}],
-               Superscript:            ["Superscript", "ed_format_sup", false, function(editor) {editor.execCommand("Superscript");}],
                JustifyLeft:            ["Justify Left", "ed_align_left.gif", false, function(editor) {editor.execCommand("JustifyLeft");}],
                JustifyCenter:          ["Justify Center", "ed_align_center.gif", false, function(editor) {editor.execCommand("JustifyCenter");}],
                JustifyRight:           ["Justify Right", "ed_align_right.gif", false, function(editor) {editor.execCommand("JustifyRight");}],
@@ -332,10 +326,6 @@ HTMLArea.Config = function () {
                // Default hotkeys
        this.hotKeyList = {
                a:      "SelectAll",
-               b:      "Bold",
-               i:      "Italic",
-               u:      "Underline",
-               s:      "StrikeThrough",
                l:      "JustifyLeft",
                e:      "JustifyCenter",
                r:      "JustifyRight",
@@ -378,30 +368,30 @@ HTMLArea.Config = function () {
  *    });
  */
 HTMLArea.Config.prototype.registerButton = function(id,tooltip,image,textMode,action,context,hide,selection) {
-       var the_id;
+       var buttonId;
        switch (typeof(id)) {
-               case "string": the_id = id; break;
-               case "object": the_id = id.id; break;
-               default: HTMLArea._appendToLog("ERROR [HTMLArea.Config::registerButton]: invalid arguments");
+               case "string": buttonId = id; break;
+               case "object": buttonId = id.id; break;
+               default: HTMLArea._appendToLog("[HTMLArea.Config::registerButton]: invalid arguments");
                         return false;
        }
-       if (typeof(this.customSelects[the_id]) != "undefined") {
-               HTMLArea._appendToLog("WARNING [HTMLArea.Config::registerButton]: A dropdown with the same ID " + id + " already exists.");
+       if (typeof(this.customSelects[buttonId]) !== "undefined") {
+               HTMLArea._appendToLog("[HTMLArea.Config::registerButton]: A dropdown with the same Id: " + buttonId + " already exists.");
                return false;
        }
-       if (typeof(this.btnList[the_id]) != "undefined") {
-               HTMLArea._appendToLog("WARNING [HTMLArea.Config::registerButton]: A button with the same ID " + id + " already exists.");
+       if (typeof(this.btnList[buttonId]) !== "undefined") {
+               HTMLArea._appendToLog("[HTMLArea.Config::registerButton]: A button with the same Id: " + buttonId + " already exists.");
                return false;
        }
        switch (typeof(id)) {
                case "string":
-                       if (typeof(hide) == "undefined") var hide = false;
-                       if (typeof(selection) == "undefined") var selection = false;
+                       if (typeof(hide) === "undefined") var hide = false;
+                       if (typeof(selection) === "undefined") var selection = false;
                        this.btnList[id] = [tooltip, image, textMode, action, context, hide, selection];
                        break;
                case "object":
-                       if (typeof(id.hide) == "undefined") id.hide = false;
-                       if (typeof(id.selection) == "undefined") id.selection = false;
+                       if (typeof(id.hide) === "undefined") id.hide = false;
+                       if (typeof(id.selection) === "undefined") id.selection = false;
                        this.btnList[id.id] = [id.tooltip, id.image, id.textMode, id.action, id.context, id.hide, id.selection];
                        break;
        }
@@ -582,7 +572,6 @@ HTMLArea.prototype.createSelect = function(txt,tb_line,first_cell_on_line,labelO
  */
 HTMLArea.prototype.createButton = function (txt,tb_line,first_cell_on_line,labelObj) {
        var btn = null,
-               btnImg = null,
                newObj = {
                        created : false,
                        el : null,
@@ -652,16 +641,10 @@ HTMLArea.prototype.createButton = function (txt,tb_line,first_cell_on_line,label
                        newObj["labelUsed"] = true;
                }
                HTMLArea._addEvents(newObj["el"],["mouseover", "mouseout", "mousedown", "click"], HTMLArea.toolBarButtonHandler);
-
-               if (typeof(btn[1]) != "string" && HTMLArea.is_ie) {
-                       var btnImgContainer = document.createElement("div");
-                       btnImgContainer.className = "buttonImgContainer";
-                       btnImgContainer.innerHTML = '<img src="' + btn[1][0] + '" style="position: relative; top: -' + (18*(btn[1][1]+1)) + 'px; left: -' + (18*(btn[1][2]+1)) + 'px;" alt="' + btn[0] + '" />';
-                       newObj["el"].appendChild(btnImgContainer);
-               } else {
-                       newObj["el"].className += " " + txt;
-                       if (this.plugins["TYPO3Browsers"] && (txt == "CreateLink" || txt == "InsertImage")) newObj["el"].className += "-TYPO3Browsers";
-               }
+               
+               newObj["el"].className += " " + txt;
+               if (this.plugins["TYPO3Browsers"] && (txt == "CreateLink" || txt == "InsertImage")) newObj["el"].className += "-TYPO3Browsers";
+               
                newObj["created"] = true;
        }
        return newObj;
@@ -1621,6 +1604,7 @@ HTMLArea.prototype.updateToolbar = function(noStatus) {
                                        }
                                }
                        }
+                       this._statusBarTree.selected = null;
                        this._statusBarTree.innerHTML = '';
                        this._statusBarTree.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": ")); // clear
                        for (i = ancestors.length; --i >= 0;) {
@@ -1757,12 +1741,6 @@ HTMLArea.prototype.updateToolbar = function(noStatus) {
                        while (el && !HTMLArea.isBlockElement(el)) { el = el.parentNode; }
                        if (el) btn.state("active",(el.style.direction == ((cmd == "RightToLeft") ? "rtl" : "ltr")));
                        break;
-                   case "Bold":
-                   case "Italic":
-                   case "StrikeThrough":
-                   case "Underline":
-                   case "Subscript":
-                   case "Superscript":
                    case "JustifyLeft":
                    case "JustifyCenter":
                    case "JustifyRight":
@@ -2320,6 +2298,17 @@ HTMLArea._editorEvent = function(ev) {
                                        HTMLArea._stopEvent(ev);
                                        return false;
                                } else {
+                                       for (var i in editor.plugins) {
+                                               var plugin = editor.plugins[i].instance;
+                                               if (typeof(plugin.onHotKey) === "function") {
+                                                       if (plugin.onHotKey(key)) {
+                                                               continue;
+                                                       } else {
+                                                               HTMLArea._stopEvent(ev);
+                                                               return false;
+                                                       }
+                                               }
+                                       }
                                        editor.updateToolbar();
                                }
                        }
@@ -2583,7 +2572,7 @@ HTMLArea._hasClass = function(el, className) {
        return false;
 };
 
-HTMLArea.RE_blockTags = /^(body|p|h1|h2|h3|h4|h5|h6|ul|ol|pre|dl|div|noscript|blockquote|form|hr|table|fieldset|address|td|tr|th|li|tbody|thead|tfoot|iframe|object)$/;
+HTMLArea.RE_blockTags = /^(body|p|h1|h2|h3|h4|h5|h6|ul|ol|pre|dl|dt|dd|div|noscript|blockquote|form|hr|table|caption|fieldset|address|td|tr|th|li|tbody|thead|tfoot|iframe|object)$/;
 HTMLArea.isBlockElement = function(el) { return el && el.nodeType == 1 && HTMLArea.RE_blockTags.test(el.nodeName.toLowerCase()); };
 HTMLArea.RE_closingTags = /^(p|span|a|li|ol|ul|dl|dt|td|th|tr|tbody|thead|tfoot|caption|colgroup|table|div|em|i|strong|b|code|cite|blockquote|q|dfn|abbr|acronym|font|center|object|embed|tt|style|script|title|head|clickenlarge)$/;
 HTMLArea.RE_noClosingTag = /^(img|br|hr|col|input|area|base|link|meta|param)$/;
@@ -3182,7 +3171,6 @@ HTMLArea.plugin = Class.create( {
         * @param       object          buttonConfiguration: the configuration object of the button:
         *                                      id              : unique id for the button
         *                                      tooltip         : tooltip for the button
-        *                                      image           : image to be displayed in the toolbar
         *                                      textMode        : enable in text mode
         *                                      action          : name of the function invoked when the button is pressed
         *                                      context         : will be disabled if not inside one of listed elements
@@ -3260,6 +3248,17 @@ HTMLArea.plugin = Class.create( {
        onKeyPress : null,
        
        /**
+        * The hotKey event handler
+        * This function may be defined by the plugin subclass.
+        * If defined, the function will be invoked whenever a hot key is pressed.
+        *
+        * @param       event           key: the hot key that was pressed
+        *
+        * @return      boolean
+        */
+       onHotKey : null,
+       
+       /**
         * The onMode event handler
         * This function may be defined by the plugin subclass.
         * If defined, the function will invoked whenever the editor changes mode.
@@ -3268,7 +3267,7 @@ HTMLArea.plugin = Class.create( {
         *
         * @return      boolean
         */
-       onMode: null,
+       onMode : null,
        
        /**
         * The onGenerate event handler
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultInline/default-inline.js b/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultInline/default-inline.js
new file mode 100644 (file)
index 0000000..cf97ed6
--- /dev/null
@@ -0,0 +1,143 @@
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.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 copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/*
+ * Default Inline Plugin for TYPO3 htmlArea RTE
+ *
+ * TYPO3 CVS ID: $Id: inline-elements.js 1809 2006-11-23 12:04:14Z ingmars $
+ */
+DefaultInline = Class.create(HTMLArea.plugin, {
+       
+       /*
+        * This function gets called by the class constructor
+        */
+       configurePlugin : function (editor) {
+               
+                       /* Registering plugin "About" information */
+               var pluginInformation = {
+                       version         : "1.0",
+                       developer       : "Stanislas Rolland",
+                       developerUrl    : "http://www.fructifor.ca/",
+                       copyrightOwner  : "Stanislas Rolland",
+                       sponsor         : "Fructifor Inc.",
+                       sponsorUrl      : "http://www.fructifor.ca/",
+                       license         : "GPL"
+               };
+               this.registerPluginInformation(pluginInformation);
+               
+                       /* Registering the buttons */
+               var buttonList = DefaultInline.buttonList;
+               var n = buttonList.length;
+               for (var i = 0; i < n; ++i) {
+                       var button = buttonList[i];
+                       buttonId = button[0];
+                       var buttonConfiguration = {
+                               id              : buttonId,
+                               tooltip         : DefaultInline.I18N[buttonId + "-Tooltip"],
+                               image           : this.editor.imgURL(buttonId.toLowerCase() + ".gif", "DefaultInline"),
+                               textMode        : false,
+                               action          : "onButtonPress",
+                               context         : button[1]
+                       };
+                       this.registerButton(buttonConfiguration);
+               }
+               return true;
+       }
+});
+
+/* The localization array for this plugin */
+DefaultInline.I18N = DefaultInline_langArray;
+
+/* The list of buttons added by this plugin */
+DefaultInline.buttonList = [
+       ["Bold", null],
+       ["Italic", null],
+       ["StrikeThrough", null],
+       ["Subscript", null],
+       ["Superscript", null],
+       ["Underline", null]
+];
+
+/* The list of hotkeys handled by this plugin */
+DefaultInline.hotKeyList = {
+       b : "Bold",
+       i : "Italic",
+       s : "StrikeThrough",
+       u : "Underline"
+};
+
+/*
+ * Definition of additional methods
+ */
+DefaultInline.addMethods({
+       /*
+        * This function gets called when some inline element button was pressed.
+        */
+       onButtonPress : function (editor, buttonId, UI, param) {
+               editor.focusEditor();
+               try {
+                       editor._doc.execCommand(buttonId, UI, param);
+               }
+               catch(e) {
+                       this.appendToLog("onButtonPress", e + "\n\nby execCommand(" + buttonId + ");");
+               }
+               editor.updateToolbar();
+               return false;
+       },
+       
+       /*
+        * This function gets called when some hot key is pressed
+        */
+       onHotKey : function(key) {
+               if (DefaultInline.hotKeyList[key] && this.editor._toolbarObjects[DefaultInline.hotKeyList[key]]) {
+                       return this.onButtonPress(this.editor, DefaultInline.hotKeyList[key]);
+               } else {
+                       return true;
+               }
+       },
+       
+       /*
+        * This function gets called when the toolbar is updated
+        */
+       onUpdateToolbar : function () {
+               var editor = this.editor;
+               var buttonList = DefaultInline.buttonList;
+               var buttonId, button, n = buttonList.length, commandState;
+               for (var i = 0; i < n; ++i) {
+                       buttonId = buttonList[i][0];
+                       button = editor._toolbarObjects[buttonId];
+                       commandState = false;
+                       if ((editor._editMode != "textmode")) {
+                               try {
+                                       commandState = editor._doc.queryCommandState(buttonId);
+                               } catch(e) {
+                                       commandState = false;
+                               }
+                       }
+                       button.state("active", commandState);
+               }
+       }
+});
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultInline/locallang.xml b/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultInline/locallang.xml
new file mode 100644 (file)
index 0000000..6c1832c
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Labels for Default Inline plugin of htmlArea RTE</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="Bold-Tooltip">Bold</label>
+                       <label index="Italic-Tooltip">Italic</label>
+                       <label index="StrikeThrough-Tooltip">Strike-through</label>
+                       <label index="Subscript-Tooltip">Subscript</label>
+                       <label index="Superscript-Tooltip">Superscript</label>
+                       <label index="Underline-Tooltip">Underline</label>
+               </languageKey>
+               <languageKey index="fr" type="array">
+                       <label index="Bold-Tooltip">Gras</label>
+               </languageKey>
+       </data>
+       <orig_hash type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_hash>
+       <orig_text type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_text>
+</T3locallang>
\ No newline at end of file
index d846185..53e6e5f 100644 (file)
@@ -284,7 +284,7 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                
                        // Loading CSS, JavaScript files and code
                $TSFE->additionalHeaderData['htmlArea'] = $additionalCode_loadCSS;
-               $this->TCEform->loadJavascriptLib('prototype');
+               //$this->TCEform->loadJavascriptLib('prototype');
                $this->TCEform->additionalJS_initial = $this->loadJSfiles($this->TCEform->RTEcounter);
                $this->TCEform->additionalJS_pre[] = $this->loadJScode($this->TCEform->RTEcounter);