Added feature 10181: htmlArea RTE: Move status bar to plugin
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 19 Jan 2009 06:51:12 +0000 (06:51 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 19 Jan 2009 06:51:12 +0000 (06:51 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4747 709f56b5-9817-0410-a4d7-c38de5d9e867

18 files changed:
ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/rtehtmlarea/ext_localconf.php
typo3/sysext/rtehtmlarea/extensions/StatusBar/class.tx_rtehtmlarea_statusbar.php [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/BlockElements/block-elements.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockStyle/block-style.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefinitionList/definition-list.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineElements/inline-elements.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/SelectFont/select-font.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/StatusBar/locallang.xml [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/plugins/StatusBar/status-bar.js [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Color/typo3color.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TextStyle/text-style.js

index b0d4903..b4a31bc 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-01-19  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature 10181: htmlArea RTE: Move status bar to plugin
+
 2009-01-18  Francois Suter  <francois@typo3.org>
 
        * Cleanup #10125: Replace deprecated function calls in sysext indexed_search
index 2fb41f8..99f0b98 100644 (file)
@@ -1,3 +1,7 @@
+2009-01-19  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature 10181: htmlArea RTE: Move status bar to plugin
+
 2009-01-14  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Added feature #10138: htmlArea RTE: add Clear RTE cache option to BE Clear cache menu
index faaf461..5d964c3 100644 (file)
@@ -4,7 +4,7 @@
 *
 *  (c) 2004 Kasper Skaarhoj (kasper@typo3.com)
 *  (c) 2004 Philipp Borgmann <philipp.borgmann@gmx.de>
-*  (c) 2004-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
+*  (c) 2004-2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -884,7 +884,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                        RTEarea[editornumber]["useCSS"] = ' . (trim($this->thisConfig['useCSS'])?'true':'false') . ';
                        RTEarea[editornumber]["keepButtonGroupTogether"] = ' . (trim($this->thisConfig['keepButtonGroupTogether'])?'true':'false') . ';
                        RTEarea[editornumber]["disablePCexamples"] = ' . (trim($this->thisConfig['disablePCexamples'])?'true':'false') . ';
-                       RTEarea[editornumber]["statusBar"] = ' . (trim($this->thisConfig['showStatusBar'])?'true':'false') . ';
                        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') . ';
index b7302a7..1f70616 100644 (file)
@@ -97,6 +97,10 @@ if (t3lib_extMgm::isLoaded('lorem_ipsum') && (TYPO3_MODE == 'BE')) {
        // Initialize plugin registration array
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins'] = array();
 
+       // Status Bar configuration
+$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['StatusBar'] = array();
+$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['StatusBar']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/StatusBar/class.tx_rtehtmlarea_statusbar.php:&tx_rtehtmlarea_statusbar';
+
        // Inline Elements configuration
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['DefaultInline'] = array();
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['DefaultInline']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php:&tx_rtehtmlarea_defaultinline';
diff --git a/typo3/sysext/rtehtmlarea/extensions/StatusBar/class.tx_rtehtmlarea_statusbar.php b/typo3/sysext/rtehtmlarea/extensions/StatusBar/class.tx_rtehtmlarea_statusbar.php
new file mode 100644 (file)
index 0000000..d27623d
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Stanislas Rolland <typo3(arobas)sjbr.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.
+*
+*  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!
+***************************************************************/
+/**
+ * EditorMode plugin for htmlArea RTE
+ *
+ * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *
+ * TYPO3 SVN ID: $Id: class.tx_rtehtmlarea_editormode.php $
+ *
+ */
+
+require_once(t3lib_extMgm::extPath('rtehtmlarea').'class.tx_rtehtmlareaapi.php');
+
+class tx_rtehtmlarea_statusbar extends tx_rtehtmlareaapi {
+
+       protected $extensionKey = 'rtehtmlarea';        // The key of the extension that is extending htmlArea RTE
+       protected $pluginName = 'EditorMode';           // The name of the plugin registered by the extension
+       protected $relativePathToLocallangFile = '';    // Path to this main locallang file of the extension relative to the extension dir.
+       protected $relativePathToSkin = 'extensions/EditorMode/skin/htmlarea.css';              // Path to the skin (css) file relative to the extension dir.
+       protected $htmlAreaRTE;                         // Reference to the invoking object
+       protected $thisConfig;                          // Reference to RTE PageTSConfig
+       protected $toolbar;                             // Reference to RTE toolbar array
+       protected $LOCAL_LANG;                          // Frontend language array
+
+       public function main($parentObject) {
+               return parent::main($parentObject) && trim($this->thisConfig['showStatusBar']);
+       }
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/HTMLEditor/class.tx_rtehtmlarea_statusbar.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/HTMLEditor/class.tx_rtehtmlarea_statusbar.php']);
+}
+?>
\ No newline at end of file
index 28d7920..6c80e72 100644 (file)
@@ -535,27 +535,6 @@ HTMLArea.NestedHandler = function(ev,editor,nestedObj,noOpenCloseAction) {
 };
 
 /*
- * Handle statusbar element events
- */
-HTMLArea.statusBarHandler = function (ev) {
-       if(!ev) var ev = window.event;
-       var target = (ev.target) ? ev.target : ev.srcElement;
-       var editor = target.editor;
-       target.blur();
-       editor.selectNodeContents(target.el);
-       editor._statusBarTree.selected = target.el;
-       editor.updateToolbar(true);
-       switch (ev.type) {
-               case "click" :
-               case "mousedown" :
-                       HTMLArea._stopEvent(ev);
-                       return false;
-               case "contextmenu" :
-                       return editor.plugins["ContextMenu"] ? editor.plugins["ContextMenu"].instance.popupMenu(ev,target.el) : false;
-       }
-};
-
-/*
  * Paste exception handler
  */
 HTMLArea.prototype._mozillaPasteException = function(cmdID, UI, param) {
index 90a75d5..89ccd0e 100644 (file)
@@ -301,33 +301,6 @@ HTMLArea.prototype.wrapWithInlineElement = function(element, selection, range) {
  ***************************************************/
 
 /*
- * Handle statusbar element events
- */
-HTMLArea.statusBarHandler = function (ev) {
-       if(!ev) var ev = window.event;
-       var target = (ev.target) ? ev.target : ev.srcElement;
-       var editor = target.editor;
-       target.blur();
-       var tagname = target.el.tagName.toLowerCase();
-       if(tagname == "table" || tagname == "img") {
-               var range = editor._doc.body.createControlRange();
-               range.addElement(target.el);
-               range.select();
-       } else {
-               editor.selectNode(target.el);
-       }
-       editor._statusBarTree.selected = target.el;
-       editor.updateToolbar(true);
-       switch (ev.type) {
-               case "click" :
-                       HTMLArea._stopEvent(ev);
-                       return false;
-               case "contextmenu" :
-                       return editor.plugins["ContextMenu"] ? editor.plugins["ContextMenu"].instance.popupMenu(ev,target.el) : false;
-       }
-};
-
-/*
  * Handle the backspace event in IE browsers
  */
 HTMLArea.prototype._checkBackspace = function() {
index 25aae22..a82442e 100644 (file)
@@ -268,8 +268,6 @@ HTMLArea.RE_url      = /(https?:\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_-]{2,}(\
 HTMLArea.Config = function () {
        this.width = "auto";
        this.height = "auto";
-               // enable creation of a status bar?
-       this.statusBar = true;
                // whether the toolbar should be included in the size or not.
        this.sizeIncludesToolbar = true;
                // if true then HTMLArea will retrieve the full HTML, starting with the <HTML> tag.
@@ -788,22 +786,6 @@ HTMLArea.toolBarButtonHandler = function(ev) {
 };
 
 /*
- * Create the status bar
- */
-HTMLArea.prototype._createStatusBar = function() {
-       var statusBar = document.createElement("div");
-       this._statusBar = statusBar;
-       statusBar.className = "statusBar";
-       if (!this.config.statusBar) statusBar.style.display = "none";
-       var statusBarTree = document.createElement("span");
-       this._statusBarTree = statusBarTree;
-       statusBarTree.className = "statusBarTree";
-       statusBar.appendChild(statusBarTree);
-       statusBarTree.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));
-       this._htmlArea.appendChild(statusBar);
-};
-
-/*
  * Create the htmlArea iframe and replace the textarea with it.
  */
 HTMLArea.prototype.generate = function () {
@@ -847,16 +829,11 @@ HTMLArea.prototype.generate = function () {
                iframe.setAttribute("src", (HTMLArea.is_opera?_typo3_host_url:"") + _editor_url + "popups/blank.html");
        }
        iframe.className = "editorIframe";
-       if (!this.config.statusBar) iframe.className += " noStatusBar";
+       if (!this.getPluginInstance("StatusBar")) {
+               iframe.className += " noStatusBar";
+       }
        htmlarea.appendChild(iframe);
        this._iframe = iframe;
-
-               // create & append the status bar
-       this._createStatusBar();
-
-               // size the iframe
-       this.sizeIframe(2);
-
        HTMLArea._appendToLog("[HTMLArea::generate]: Editor iframe successfully created.");
        this.initIframe();
        return this;
@@ -868,11 +845,7 @@ HTMLArea.prototype.generate = function () {
 HTMLArea.prototype.sizeIframe = function(diff) {
        var height = (this.config.height == "auto" ? (this._textArea.style.height) : this.config.height);
        var textareaHeight = height;
-               // All nested tabs and inline levels in the sorting order they were applied:
-       this.nested = {};
-       this.nested.all = RTEarea[this._editorNumber].tceformsNested;
-       this.nested.sorted = HTMLArea.simplifyNested(this.nested.all);
-               // Clone the array instead of using a reference (this.accessParentElements will change the array):
+               // Clone the array of nested tabs and inline levels instead of using a reference (this.accessParentElements will change the array):
        var parentElements = (this.nested.sorted && this.nested.sorted.length ? [].concat(this.nested.sorted) : []);
                // Walk through all nested tabs and inline levels to make a correct positioning:
        var dimensions = this.accessParentElements(parentElements, 'this.getDimensions()');
@@ -914,7 +887,7 @@ HTMLArea.prototype.sizeIframe = function(diff) {
 HTMLArea.prototype.getDimensions = function() {
        return {
                toolbar: {width: this._toolbar.offsetWidth, height: this._toolbar.offsetHeight},
-               statusbar: {width: this._statusBar.offsetWidth, height: this._statusBar.offsetHeight}
+               statusbar: {width: (this.getPluginInstance("StatusBar") ? this.getPluginInstance("StatusBar").statusBar.offsetWidth : 0), height: (this.getPluginInstance("StatusBar") ? this.getPluginInstance("StatusBar").statusBar.offsetHeight : 0)}
        };
 };
 
@@ -1173,6 +1146,8 @@ HTMLArea.generatePlugins = function(editorNumber) {
                editor.onGenerate = null;
        }
        HTMLArea._appendToLog("[HTMLArea::initIframe]: All plugins successfully generated.");
+               // size the iframe
+       editor.sizeIframe(2);
        editor.focusEditor();
        editor.updateToolbar();
 };
@@ -1280,21 +1255,8 @@ HTMLArea.cleanup = function (editor) {
                        editor._toolbarObjects[txt] = null;
                }
        }
-
-               // cleaning the statusbar elements
-       if (editor._statusBarTree.hasChildNodes()) {
-               for (var i = editor._statusBarTree.firstChild; i; i = i.nextSibling) {
-                       if (i.nodeName.toLowerCase() == "a") {
-                               HTMLArea._removeEvents(i, ["click", "contextmenu"], HTMLArea.statusBarHandler);
-                               i.el = null;
-                               i.editor = null;
-                       }
-               }
-       }
                // final cleanup
        editor._toolbar = null;
-       editor._statusBar = null;
-       editor._statusBarTree =  null;
        editor._htmlArea = null;
        editor._iframe = null;
 };
@@ -1311,13 +1273,6 @@ HTMLArea.prototype.setMode = function(mode) {
                        this._textArea.value = this.getHTML();
                        this._iframe.style.display = "none";
                        this._textArea.style.display = "block";
-                       if(this.config.statusBar) {
-                               var statusBarTextMode = document.createElement("span");
-                               statusBarTextMode.className = "statusBarTextMode";
-                               statusBarTextMode.appendChild(document.createTextNode(HTMLArea.I18N.msg["TEXT_MODE"]));
-                               this._statusBar.innerHTML = '';
-                               this._statusBar.appendChild(statusBarTextMode);
-                       }
                        this._editMode = "textmode";
                        break;
                case "wysiwyg":
@@ -1332,10 +1287,6 @@ HTMLArea.prototype.setMode = function(mode) {
                        this._textArea.style.display = "none";
                        this._iframe.style.display = "block";
                        if (HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) this._doc.designMode = "on";
-                       if(this.config.statusBar) {
-                               this._statusBar.innerHTML = "";
-                               this._statusBar.appendChild(this._statusBarTree);
-                       }
                        this._editMode = "wysiwyg";
                                //set gecko options (if we can... raises exception in Firefox 3)
                        if (HTMLArea.is_gecko) {
@@ -1436,6 +1387,16 @@ HTMLArea.prototype.registerPlugin = function(plugin) {
 };
 
 /*
+ * Get the instance of the specified plugin, if it exists
+ *
+ * @param      string          pluginName: the name of the plugin
+ * @return     object          the plugin instance or null
+ */
+HTMLArea.prototype.getPluginInstance = function(pluginName) {
+       return (this.plugins[pluginName] ? this.plugins[pluginName].instance : null);
+};
+
+/*
  * Load the required plugin script
  */
 HTMLArea.loadPlugin = function (pluginName, url, asynchronous) {
@@ -1545,62 +1506,17 @@ HTMLArea.updateToolbar = function(editorNumber) {
 
 HTMLArea.prototype.updateToolbar = function(noStatus) {
        var doc = this._doc,
-               text = (this._editMode == "textmode"),
+               text = (this.getMode() == "textmode"),
                selection = false,
-               ancestors = null, cls = new Array(),
-               txt, txtClass, i, inContext, match, matchAny, k, j, n, commandState;
-       if(!text) {
+               ancestors = null,
+               inContext, match, matchAny, k, j, n, commandState;
+       if (!text) {
                selection = !this._selectionEmpty(this._getSelection());
                ancestors = this.getAllAncestors();
-               if(this.config.statusBar && !noStatus) {
-                               // Unhook previous events handlers
-                       if(this._statusBarTree.hasChildNodes()) {
-                               for (i = this._statusBarTree.firstChild; i; i = i.nextSibling) {
-                                       if(i.nodeName.toLowerCase() == "a") {
-                                               HTMLArea._removeEvents(i,["click", "contextmenu, mousedown"], HTMLArea.statusBarHandler);
-                                               i.el = null;
-                                               i.editor = null;
-                                       }
-                               }
-                       }
-                       this._statusBarTree.selected = null;
-                       this._statusBarTree.innerHTML = '';
-                       this._statusBarTree.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": ")); // clear
-                       for (i = ancestors.length; --i >= 0;) {
-                               var el = ancestors[i];
-                               if(!el) continue;
-                               var a = document.createElement("a");
-                               a.href = "#";
-                               a.el = el;
-                               a.editor = this;
-                               if (!HTMLArea.is_opera) {
-                                       HTMLArea._addEvents(a, ["click", "contextmenu"], HTMLArea.statusBarHandler);
-                               } else {
-                                       HTMLArea._addEvents(a, ["mousedown", "click"], HTMLArea.statusBarHandler);
-                               }
-                               txt = el.tagName.toLowerCase();
-                               a.title = el.style.cssText;
-                               if (el.id) { txt += "#" + el.id; }
-                               if (el.className) {
-                                       txtClass = "";
-                                       cls = el.className.trim().split(" ");
-                                       for (j = 0; j < cls.length; ++j) {
-                                               if (!HTMLArea.reservedClassNames.test(cls[j])) {
-                                                       txtClass += "." + cls[j];
-                                               }
-                                       }
-                                       txt += txtClass;
-                               }
-                               a.appendChild(document.createTextNode(txt));
-                               this._statusBarTree.appendChild(a);
-                               if (i != 0) this._statusBarTree.appendChild(document.createTextNode(String.fromCharCode(0xbb)));
-                       }
-               }
        }
        for (var cmd in this._toolbarObjects) {
                if (this._toolbarObjects.hasOwnProperty(cmd)) {
                        var btn = this._toolbarObjects[cmd];
-
                                // Determine if the button should be enabled
                        inContext = true;
                        if (btn.context && !text) {
@@ -1780,6 +1696,22 @@ HTMLArea.prototype.getAllAncestors = function() {
 };
 
 /*
+ * Get the block ancestors of an element within a given block
+ */
+HTMLArea.prototype.getBlockAncestors = function(element, withinBlock) {
+       var ancestors = new Array();
+       var ancestor = element;
+       while (ancestor && (ancestor.nodeType === 1) && !/^(body)$/i.test(ancestor.nodeName) && ancestor != withinBlock) {
+               if (HTMLArea.isBlockElement(ancestor)) {
+                       ancestors.unshift(ancestor);
+               }
+               ancestor = ancestor.parentNode;
+       }
+       ancestors.unshift(ancestor);
+       return ancestors;
+};
+
+/*
  * Get the block elements containing the start and the end points of the selection
  */
 HTMLArea.prototype.getEndBlocks = function(selection) {
@@ -2622,6 +2554,11 @@ HTMLArea.initEditor = function(editorNumber) {
                        editor.config.sizeIncludesToolbar = true;
                        editor.config.fullPage = false;
 
+                               // All nested tabs and inline levels in the sorting order they were applied
+                       editor.nested = {};
+                       editor.nested.all = RTEarea[editorNumber].tceformsNested;
+                       editor.nested.sorted = HTMLArea.simplifyNested(editor.nested.all);
+
                                // Register the plugins included in the configuration
                        for (var plugin in editor.config.plugin) {
                                if (editor.config.plugin.hasOwnProperty(plugin) && editor.config.plugin[plugin]) {
index efba1c9..2dd90a3 100644 (file)
@@ -253,7 +253,8 @@ BlockElements = HTMLArea.Plugin.extend({
                this.editor.focusEditor();
                var selection = editor._getSelection();
                var range = editor._createRange(selection);
-               var parentElement = this.editor._statusBarTree.selected ? this.editor._statusBarTree.selected : this.editor.getParentElement(selection, range);
+               var statusBarSelection = this.editor.getPluginInstance("StatusBar") ? this.editor.getPluginInstance("StatusBar").getSelection() : null;
+               var parentElement = statusBarSelection ? statusBarSelection : this.editor.getParentElement(selection, range);
                if (target) {
                        parentElement = target;
                }
@@ -923,7 +924,8 @@ BlockElements = HTMLArea.Plugin.extend({
                if (this.editor.getMode() === "textmode" || !this.editor.isEditable()) {
                        return false;
                }
-               var parentElement = this.editor._statusBarTree.selected ? this.editor._statusBarTree.selected : this.editor.getParentElement();
+               var statusBarSelection = this.editor.getPluginInstance("StatusBar") ? this.editor.getPluginInstance("StatusBar").getSelection() : null;
+               var parentElement = statusBarSelection ? statusBarSelection : this.editor.getParentElement();
                if (parentElement.nodeName.toLowerCase() === "body") return false;
                while (parentElement && !HTMLArea.isBlockElement(parentElement) || /^li$/i.test(parentElement.nodeName)) {
                        parentElement = parentElement.parentNode;
index 48404c5..5be4bf3 100644 (file)
@@ -191,18 +191,19 @@ BlockStyle = HTMLArea.Plugin.extend({
         */
        getSelectedBlocks : function() {
                var block, range, i = 0, blocks = [];
+               var statusBarSelection = this.editor.getPluginInstance("StatusBar") ? this.editor.getPluginInstance("StatusBar").getSelection() : null;
                if (HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) {
                        var selection = this.editor._getSelection();
                        try {
                                while ((range = selection.getRangeAt(i++))) {
                                        block = this.editor.getParentElement(selection, range);
-                                       blocks.push(this.editor._statusBarTree.selected ? this.editor._statusBarTree.selected : block);
+                                       blocks.push(statusBarSelection ? statusBarSelection : block);
                                }
                        } catch(e) {
                                /* finished walking through selection */
                        }
                } else {
-                       blocks.push(this.editor._statusBarTree.selected ? this.editor._statusBarTree.selected : this.editor.getParentElement());
+                       blocks.push(statusBarSelection ? statusBarSelection : this.editor.getParentElement());
                }
                return blocks;
        },
@@ -266,7 +267,8 @@ BlockStyle = HTMLArea.Plugin.extend({
                
                var classNames = new Array();
                var tagName = null;
-               var parent = this.editor._statusBarTree.selected ? this.editor._statusBarTree.selected : this.editor.getParentElement();
+               var statusBarSelection = this.editor.getPluginInstance("StatusBar") ? this.editor.getPluginInstance("StatusBar").getSelection() : null;
+               var parent = statusBarSelection ? statusBarSelection : this.editor.getParentElement();
                while (parent && !HTMLArea.isBlockElement(parent) && parent.nodeName.toLowerCase() != "img") {
                        parent = parent.parentNode;
                }
index 64393bb..e5f7e1b 100644 (file)
@@ -513,7 +513,9 @@ ContextMenu.blockElementsHandler = function(editor, currentTarget, buttonId) {
 ContextMenu.mouseOverHandler = function(editor,item) {
        return (function() {
                item.className += " hover";
-               editor._statusBarTree.innerHTML = item.__msh.tooltip || '&nbsp;';
+               if (editor.getPluginInstance("StatusBar")) {
+                       editor.getPluginInstance("StatusBar").setText(item.__msh.tooltip || "&nbsp;");
+               }
        });
 };
 
index e730645..ed2a469 100644 (file)
@@ -112,7 +112,8 @@ DefinitionList = BlockElements.extend({
                this.editor.focusEditor();\r
                var selection = editor._getSelection();\r
                var range = editor._createRange(selection);\r
-               var parentElement = this.editor._statusBarTree.selected ? this.editor._statusBarTree.selected : this.editor.getParentElement(selection, range);\r
+               var statusBarSelection = editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null;\r
+               var parentElement = statusBarSelection ? statusBarSelection : this.editor.getParentElement(selection, range);\r
                if (target) {\r
                        parentElement = target;\r
                }\r
@@ -306,7 +307,8 @@ DefinitionList = BlockElements.extend({
                if (this.editor.getMode() === "textmode" || !this.editor.isEditable()) {\r
                        return false;\r
                }\r
-               var parentElement = this.editor._statusBarTree.selected ? this.editor._statusBarTree.selected : this.editor.getParentElement();\r
+               var statusBarSelection = this.editor.getPluginInstance("StatusBar") ? this.editor.getPluginInstance("StatusBar").getSelection() : null;\r
+               var parentElement = statusBarSelection ? statusBarSelection : this.editor.getParentElement();\r
                if (parentElement.nodeName.toLowerCase() === "body") return false;\r
                while (parentElement && (!HTMLArea.isBlockElement(parentElement) || /^(li)$/i.test(parentElement.nodeName))) {\r
                        parentElement = parentElement.parentNode;\r
index 8dc0040..0b84be1 100644 (file)
@@ -232,10 +232,11 @@ InlineElements = HTMLArea.Plugin.extend({
                        }
                }
                if (!selectionEmpty) {
+                       var statusBarSelection = (editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null);
                                // The selection is not empty.
                        for (var i = 0; i < ancestors.length; ++i) {
                                fullNodeSelected = (HTMLArea.is_ie && ((selection.type !== "Control" && ancestors[i].innerText === range.text) || (selection.type === "Control" && ancestors[i].innerText === range.item(0).text)))
-                                                       || (HTMLArea.is_gecko && ((editor._statusBarTree.selected === ancestors[i] && ancestors[i].textContent === range.toString()) || (!editor._statusBarTree.selected && ancestors[i].textContent === range.toString())));
+                                                       || (HTMLArea.is_gecko && ((statusBarSelection === ancestors[i] && ancestors[i].textContent === range.toString()) || (!statusBarSelection && ancestors[i].textContent === range.toString())));
                                if (fullNodeSelected) {
                                        if (!HTMLArea.isBlockElement(ancestors[i])) {
                                                parent = ancestors[i];
@@ -244,9 +245,9 @@ InlineElements = HTMLArea.Plugin.extend({
                                }
                        }
                                // Working around bug in Safari selectNodeContents
-                       if (!fullNodeSelected && HTMLArea.is_safari && this.editor._statusBarTree.selected && this.isInlineElement(this.editor._statusBarTree.selected) && this.editor._statusBarTree.selected.textContent === range.toString()) {
+                       if (!fullNodeSelected && HTMLArea.is_safari && statusBarSelection && this.isInlineElement(statusBarSelection) && statusBarSelection.textContent === range.toString()) {
                                fullNodeSelected = true;
-                               parent = this.editor._statusBarTree.selected;
+                               parent = statusBarSelection;
                        }
                        
                        var fullNodeTextSelected = (HTMLArea.is_gecko && parent.textContent === range.toString())
@@ -261,7 +262,7 @@ InlineElements = HTMLArea.Plugin.extend({
                                        newElement.setAttribute("dir", "rtl");
                                }
                                if (HTMLArea.is_gecko) {
-                                       if (fullNodeSelected && editor._statusBarTree.selected) {
+                                       if (fullNodeSelected && statusBarSelection) {
                                                if (HTMLArea.is_safari) {
                                                        editor.selectNode(parent);
                                                        selection = editor._getSelection();
@@ -271,7 +272,7 @@ InlineElements = HTMLArea.Plugin.extend({
                                                }
                                        }
                                        editor.wrapWithInlineElement(newElement, selection, range);
-                                       if (fullNodeSelected && editor._statusBarTree.selected && !HTMLArea.is_safari) {
+                                       if (fullNodeSelected && statusBarSelection && !HTMLArea.is_safari) {
                                                editor.selectNodeContents(newElement.lastChild, false);
                                        }
                                        range.detach();
@@ -279,7 +280,7 @@ InlineElements = HTMLArea.Plugin.extend({
                                        var tagopen = "<" + element + ">";
                                        var tagclose = "</" + element + ">";
                                        if (fullNodeSelected) {
-                                               if (!editor._statusBarTree.selected) {
+                                               if (!statusBarSelection) {
                                                        parent.innerHTML = tagopen + parent.innerHTML + tagclose;
                                                        if (element === "bdo") {
                                                                parent.firstChild.setAttribute("dir", "rtl");
@@ -366,9 +367,10 @@ InlineElements = HTMLArea.Plugin.extend({
                        }
                        var selectionEmpty = editor._selectionEmpty(sel);
                        if (!selectionEmpty) {
+                               var statusBarSelection = editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null;
                                var ancestors = editor.getAllAncestors();
                                for (var i = 0; i < ancestors.length; ++i) {
-                                       fullNodeSelected = (editor._statusBarTree.selected === ancestors[i])
+                                       fullNodeSelected = (statusBarSelection === ancestors[i])
                                                && ((HTMLArea.is_gecko && ancestors[i].textContent === range.toString()) || (HTMLArea.is_ie && ((sel.type !== "Control" && ancestors[i].innerText === range.text) || (sel.type === "Control" && ancestors[i].innerText === range.item(0).text))));
                                        if (fullNodeSelected) {
                                                if (!HTMLArea.isBlockElement(ancestors[i])) {
@@ -378,9 +380,9 @@ InlineElements = HTMLArea.Plugin.extend({
                                        }
                                }
                                        // Working around bug in Safari selectNodeContents
-                               if (!fullNodeSelected && HTMLArea.is_safari && this.editor._statusBarTree.selected && this.isInlineElement(this.editor._statusBarTree.selected) && this.editor._statusBarTree.selected.textContent === range.toString()) {
+                               if (!fullNodeSelected && HTMLArea.is_safari && statusBarSelection && this.isInlineElement(statusBarSelection) && statusBarSelection.textContent === range.toString()) {
                                        fullNodeSelected = true;
-                                       tagName = this.editor._statusBarTree.selected.nodeName.toLowerCase();
+                                       tagName = statusBarSelection.nodeName.toLowerCase();
                                }
                        }
                        var selectionInInlineElement = tagName && this.REInlineElements.test(tagName);
index d0641e4..cb7c646 100644 (file)
@@ -124,6 +124,7 @@ SelectFont = HTMLArea.Plugin.extend({
                editor.focusEditor();
                var selection = editor._getSelection(),
                        range = editor._createRange(selection),
+                       statusBarSelection = editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null;
                        element;
                if (editor._selectionEmpty(selection)) {
                        element = editor.getParentElement(selection, range);
@@ -133,8 +134,8 @@ SelectFont = HTMLArea.Plugin.extend({
                        if ((element.nodeName.toLowerCase() === "span") && !HTMLArea.hasAllowedAttributes(element, this.allowedAttributes)) {
                                editor.removeMarkup(element);
                        }
-               } else if (editor._statusBarTree.selected) {
-                       element = editor._statusBarTree.selected;
+               } else if (statusBarSelection) {
+                       element = statusBarSelection;
                                // Set the style attribute
                        this.setStyle(element, buttonId, param);
                                // Remove the span tag if it has no more attribute
@@ -187,7 +188,8 @@ SelectFont = HTMLArea.Plugin.extend({
        onUpdateToolbar : function () {
                var editor = this.editor;
                if (editor.getMode() === "wysiwyg" && this.editor.isEditable()) {
-                       var parentElement = editor._statusBarTree.selected ? editor._statusBarTree.selected : editor.getParentElement(),
+                       var statusBarSelection = editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null;
+                       var parentElement = statusBarSelection ? statusBarSelection : editor.getParentElement(),
                                enabled = editor.endPointsInSameBlock() && !(editor._selectionEmpty(editor._getSelection()) && parentElement.nodeName.toLowerCase() == "body"),
                                buttonId, value, k;
                        for (var i = this.dropDownList.length; --i >= 0;) {
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/StatusBar/locallang.xml b/typo3/sysext/rtehtmlarea/htmlarea/plugins/StatusBar/locallang.xml
new file mode 100644 (file)
index 0000000..e60707a
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Labels for StatusBar 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/htmlarea/plugins/StatusBar/status-bar.js b/typo3/sysext/rtehtmlarea/htmlarea/plugins/StatusBar/status-bar.js
new file mode 100644 (file)
index 0000000..625bdd9
--- /dev/null
@@ -0,0 +1,252 @@
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Stanislas Rolland <typo3(arobas)sjbr.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!
+***************************************************************/
+/*
+ * StatusBar Plugin for TYPO3 htmlArea RTE
+ *
+ * TYPO3 SVN ID: $Id: editor-mode.js $
+ */
+StatusBar = HTMLArea.Plugin.extend({
+
+       constructor : function(editor, pluginName) {
+               this.base(editor, pluginName);
+       },
+
+       /*
+        * This function gets called by the class constructor
+        */
+       configurePlugin : function (editor) {
+
+               /*
+                * Registering plugin "About" information
+                */
+               var pluginInformation = {
+                       version         : "0.1",
+                       developer       : "Stanislas Rolland",
+                       developerUrl    : "http://www.sjbr.ca/",
+                       copyrightOwner  : "Stanislas Rolland",
+                       sponsor         : "SJBR",
+                       sponsorUrl      : "http://www.sjbr.ca/",
+                       license         : "GPL"
+               };
+               this.registerPluginInformation(pluginInformation);
+
+               /*
+                * Making function refernce to status bar handler
+                */
+               this.statusBarHandlerFunctRef = this.makeFunctionReference("statusBarHandler");
+
+               return true;
+        },
+
+       /*
+        * Create the status bar
+        */
+       onGenerate : function () {
+               var statusBar = document.createElement("div");
+               this.statusBar = statusBar;
+               statusBar.className = "statusBar";
+               var statusBarTree = document.createElement("span");
+               this.statusBarTree = statusBarTree;
+               statusBarTree.className = "statusBarTree";
+               statusBar.appendChild(statusBarTree);
+               statusBarTree.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));
+               this.editor._htmlArea.appendChild(this.statusBar);
+               this.setSelection(null);
+               this.noUpdate = false;
+       },
+
+       /*
+        * Adapt status bar to current editor mode
+        *
+        * @param       string  mode: the mode to which the editor got switched to
+        */
+       onMode : function (mode) {
+               switch (mode) {
+                       case "wysiwyg":
+                               this.statusBar.innerHTML = "";
+                               this.statusBar.appendChild(this.statusBarTree);
+                               break;
+                       case "textmode":
+                       default:
+                               var statusBarTextMode = document.createElement("span");
+                               statusBarTextMode.className = "statusBarTextMode";
+                               statusBarTextMode.appendChild(document.createTextNode(HTMLArea.I18N.msg["TEXT_MODE"]));
+                               this.statusBar.innerHTML = "";
+                               this.statusBar.appendChild(statusBarTextMode);
+                               break;
+               }
+       },
+
+       /*
+        * Replace the contents of the staus bar with a text string
+        *
+        * @param       string  text: the text string to be inserted in the status bar
+        */
+       setText : function(text) {
+               this.statusBarTree.innerHTML = text;
+       },
+
+       /*
+        * Clear the status bar
+        */
+       clear : function() {
+                       // Unhook events handlers
+               if (this.statusBarTree.hasChildNodes()) {
+                       for (var element = this.statusBarTree.firstChild; element; element = element.nextSibling) {
+                               if (element.nodeName.toLowerCase() == "a") {
+                                       HTMLArea._removeEvents(element, ["click", "contextmenu", "mousedown"], this.statusBarHandlerFunctRef);
+                                       element.ancestor = null;
+                                       element.editor = null;
+                               }
+                       }
+               }
+               this.setSelection(null);
+               this.statusBarTree.innerHTML = "";
+       },
+
+       /*
+        * Cleanup the status bar when the editor closes
+        */
+       onClose : function() {
+                this.clear();
+                this.statusBarHandlerFunctRef = null;
+                this.statusBar = null;
+                this.statusBarTree =  null;
+        },
+
+       /*
+        * Get the status bar selection
+        */
+       getSelection : function() {
+               return this.selected;
+       },
+
+       /*
+        * Set the status bar selection
+        *
+        * @param       object  element: set the status bar selection to the given element
+        */
+       setSelection : function(element) {
+               this.selected = element ? element : null;
+       },
+
+       /*
+        * Update the status bar
+        */
+       onUpdateToolbar : function() {
+               if (this.editor.getMode() == "wysiwyg" && !this.noUpdate) {
+                       var text,
+                               language,
+                               languageObject = this.editor.getPluginInstance("Language"),
+                               classes = new Array(),
+                               classText,
+                               ancestors = this.editor.getAllAncestors();
+                       this.clear();
+                       this.statusBarTree.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));
+                       for (var i = ancestors.length; --i >= 0;) {
+                               var ancestor = ancestors[i];
+                               if (!ancestor) {
+                                       continue;
+                               }
+                               var element = document.createElement("a");
+                               element.href = "#";
+                               element.ancestor = ancestor;
+                               element.editor = this.editor;
+                               if (!HTMLArea.is_opera) {
+                                       HTMLArea._addEvents(element, ["click", "contextmenu"], this.statusBarHandlerFunctRef);
+                               } else {
+                                       HTMLArea._addEvents(element, ["mousedown", "click"], this.statusBarHandlerFunctRef);
+                               }
+                               element.title = ancestor.style.cssText;
+                               text = ancestor.nodeName.toLowerCase();
+                               if (ancestor.id) {
+                                       text += "#" + ancestor.id;
+                               }
+                               if (languageObject && languageObject.getLanguageAttribute) {
+                                       language = languageObject.getLanguageAttribute(ancestor);
+                                       if (language != "none") {
+                                               text += "[" + language + "]";
+                                       }
+                               }
+                               if (ancestor.className) {
+                                       classText = "";
+                                       classes = ancestor.className.trim().split(" ");
+                                       for (var j = 0, n = classes.length; j < n; ++j) {
+                                               if (!HTMLArea.reservedClassNames.test(classes[j])) {
+                                                       classText += "." + classes[j];
+                                               }
+                                       }
+                                       text += classText;
+                               }
+                               element.appendChild(document.createTextNode(text));
+                               this.statusBarTree.appendChild(element);
+                               if (i) {
+                                       this.statusBarTree.appendChild(document.createTextNode(String.fromCharCode(0xbb)));
+                               }
+                       }
+               }
+               this.noUpdate = false;
+       },
+
+       /*
+        * Handle statusbar element events
+        */
+       statusBarHandler : function (ev) {
+               if (!ev) {
+                       var ev = window.event;
+               }
+               var target = (ev.target) ? ev.target : ev.srcElement;
+               var editor = target.editor;
+               target.blur();
+               if (HTMLArea.is_gecko) {
+                       editor.selectNodeContents(target.ancestor);
+               } else {
+                       var nodeName = target.ancestor.nodeName.toLowerCase();
+                       if (nodeName == "table" || nodeName == "img") {
+                               var range = editor._doc.body.createControlRange();
+                               range.addElement(target.ancestor);
+                               range.select();
+                       } else {
+                               editor.selectNode(target.ancestor);
+                       }
+               }
+               this.setSelection(target.ancestor);
+               this.noUpdate = true;
+               editor.updateToolbar();
+               switch (ev.type) {
+                       case "mousedown" :
+                               if (HTMLArea.is_ie) {
+                                       return true;
+                               }
+                       case "click" :
+                               HTMLArea._stopEvent(ev);
+                               return false;
+                       case "contextmenu" :
+                               return editor.getPluginInstance("ContextMenu") ? editor.getPluginInstance("ContextMenu").popupMenu(ev, target.ancestor) : false;
+               }
+       }
+});
index cabcc85..df81e43 100644 (file)
@@ -200,6 +200,7 @@ TYPO3Color = HTMLArea.Plugin.extend({
                        case "ForeColor":
                        case "HiliteColor":
                                var selection = editor._getSelection();
+                               var statusBarSelection = editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null;
                                var range = editor._createRange(selection);
                                if (editor._selectionEmpty(selection)) {
                                        element = editor.getParentElement(selection, range);
@@ -209,8 +210,8 @@ TYPO3Color = HTMLArea.Plugin.extend({
                                        if ((element.nodeName.toLowerCase() === "span") && !HTMLArea.hasAllowedAttributes(element, this.allowedAttributes)) {
                                                editor.removeMarkup(element);
                                        }
-                               } else if (editor._statusBarTree.selected) {
-                                       element = editor._statusBarTree.selected;
+                               } else if (statusBarSelection) {
+                                       element = statusBarSelection;
                                                // Set the color in the style attribute
                                        this.processStyle(dialog, params, element, dialog.arguments.field);
                                                // Remove the span tag if it has no more attribute
@@ -377,7 +378,8 @@ TYPO3Color = HTMLArea.Plugin.extend({
                var editor = this.editor;
                if (editor.getMode() === "wysiwyg" && editor.isEditable()) {
                        var buttonId;
-                       var parentElement = editor._statusBarTree.selected ? editor._statusBarTree.selected : editor.getParentElement();
+                       var statusBarSelection = editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null;
+                       var parentElement = statusBarSelection ? statusBarSelection : editor.getParentElement();
                        var enabled = editor.endPointsInSameBlock() && !(editor._selectionEmpty(editor._getSelection()) && parentElement.nodeName.toLowerCase() == "body");
                        for (var i = 0, n = this.buttonList.length; i < n; ++i) {
                                buttonId = this.buttonList[i][0];
index 1ebeee7..5db90fd 100644 (file)
@@ -150,6 +150,7 @@ TextStyle = HTMLArea.Plugin.extend({
                
                this.editor.focusEditor();
                var selection = this.editor._getSelection();
+               var statusBarSelection = this.editor.getPluginInstance("StatusBar") ? this.editor.getPluginInstance("StatusBar").getSelection() : null;
                var range = this.editor._createRange(selection);
                var parent = this.editor.getParentElement();
                var selectionEmpty = this.editor._selectionEmpty(selection);
@@ -161,8 +162,8 @@ TextStyle = HTMLArea.Plugin.extend({
                if (!selectionEmpty) {
                                // The selection is not empty
                        for (var i = 0; i < ancestors.length; ++i) {
-                               fullNodeSelected = (HTMLArea.is_ie && ((this.editor._statusBarTree.selected === ancestors[i] && ancestors[i].innerText === range.text) || (!this.editor._statusBarTree.selected && ancestors[i].innerText === range.text)))
-                                                       || (HTMLArea.is_gecko && ((this.editor._statusBarTree.selected === ancestors[i] && ancestors[i].textContent === range.toString()) || (!this.editor._statusBarTree.selected && ancestors[i].textContent === range.toString())));
+                               fullNodeSelected = (HTMLArea.is_ie && ((statusBarSelection === ancestors[i] && ancestors[i].innerText === range.text) || (!statusBarSelection && ancestors[i].innerText === range.text)))
+                                                       || (HTMLArea.is_gecko && ((statusBarSelection === ancestors[i] && ancestors[i].textContent === range.toString()) || (!statusBarSelection && ancestors[i].textContent === range.toString())));
                                if (fullNodeSelected) {
                                        if (this.isInlineElement(ancestors[i])) {
                                                parent = ancestors[i];
@@ -171,9 +172,9 @@ TextStyle = HTMLArea.Plugin.extend({
                                }
                        }
                                // Working around bug in Safari selectNodeContents
-                       if (!fullNodeSelected && HTMLArea.is_safari && this.editor._statusBarTree.selected && this.isInlineElement(this.editor._statusBarTree.selected) && this.editor._statusBarTree.selected.textContent === range.toString()) {
+                       if (!fullNodeSelected && HTMLArea.is_safari && statusBarSelection && this.isInlineElement(statusBarSelection) && statusBarSelection.textContent === range.toString()) {
                                fullNodeSelected = true;
-                               parent = this.editor._statusBarTree.selected;
+                               parent = statusBarSelection;
                        }
                }
                if (!selectionEmpty && !fullNodeSelected) {
@@ -403,6 +404,7 @@ TextStyle = HTMLArea.Plugin.extend({
                if (this.editor.getMode() === "wysiwyg" && this.editor.isEditable()) {
                        var tagName = false, classNames = Array(), fullNodeSelected = false;
                        var selection = editor._getSelection();
+                       var statusBarSelection = editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null;
                        var range = editor._createRange(selection);
                        var parent = editor.getParentElement(selection);
                        var ancestors = editor.getAllAncestors();
@@ -415,7 +417,7 @@ TextStyle = HTMLArea.Plugin.extend({
                        var selectionEmpty = editor._selectionEmpty(selection);
                        if (!selectionEmpty) {
                                for (var i = 0; i < ancestors.length; ++i) {
-                                       fullNodeSelected = (editor._statusBarTree.selected === ancestors[i])
+                                       fullNodeSelected = (statusBarSelection === ancestors[i])
                                                && ((HTMLArea.is_gecko && ancestors[i].textContent === range.toString()) || (HTMLArea.is_ie && ancestors[i].innerText === range.text));
                                        if (fullNodeSelected) {
                                                if (!HTMLArea.isBlockElement(ancestors[i])) {
@@ -428,11 +430,11 @@ TextStyle = HTMLArea.Plugin.extend({
                                        }
                                }
                                        // Working around bug in Safari selectNodeContents
-                               if (!fullNodeSelected && HTMLArea.is_safari && this.editor._statusBarTree.selected && this.isInlineElement(this.editor._statusBarTree.selected) && this.editor._statusBarTree.selected.textContent === range.toString()) {
+                               if (!fullNodeSelected && HTMLArea.is_safari && statusBarSelection && this.isInlineElement(statusBarSelection) && statusBarSelection.textContent === range.toString()) {
                                        fullNodeSelected = true;
-                                       tagName = this.editor._statusBarTree.selected.nodeName.toLowerCase();
-                                       if (this.editor._statusBarTree.selected.className && /\S/.test(this.editor._statusBarTree.selected.className)) {
-                                               classNames = this.editor._statusBarTree.selected.className.trim().split(" ");
+                                       tagName = statusBarSelection.nodeName.toLowerCase();
+                                       if (statusBarSelection.className && /\S/.test(statusBarSelection.className)) {
+                                               classNames = statusBarSelection.className.trim().split(" ");
                                        }
                                }
                        }