* Fixed bug #5013: RTE Editor not working in Firefox 3.0 Granparadiso
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 30 Jan 2008 04:23:32 +0000 (04:23 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 30 Jan 2008 04:23:32 +0000 (04:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2977 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.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/DefaultFont/default-font.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TextStyle/text-style.js

index 380158a..e2baa6e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
        * Feature/cleanup: Restructure plugins QuickTag, TableOperations, UserElements
        * Feature/cleanup: Move colors, fonts, text direction, word cleaning and lists to extensions/plugins.
        * Feature #3633: Individual height of inline RTE. Thanks to Ralf Hettinger.
+       * Fixed bug #5013: RTE Editor not working in Firefox 3.0 Granparadiso
 
 2008-01-28  Kasper Sk\8crh¿j <kasper2008@typo3.com>
 
index a130c4b..382328f 100644 (file)
@@ -3,6 +3,7 @@
        * Feature/cleanup: Restructure plugins QuickTag, TableOperations, UserElements
        * Feature/cleanup: Move colors, fonts, text direction, word cleaning and lists to extensions/plugins.
        * Feature #3633: Individual height of inline RTE. Thanks to Ralf Hettinger.
+       * Fixed bug #5013: RTE Editor not working in Firefox 3.0 Granparadiso
 
 2008-01-26  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
index 6c17082..1855c58 100644 (file)
@@ -272,6 +272,8 @@ HTMLArea.prototype.getParentElement = function(selection, range) {
                var range = this._createRange(selection);
        }
        var parentElement = range.commonAncestorContainer;
+               // For some reason, Firefox 3 may report the Document as commonAncestorContainer
+       if (parentElement.nodeType == 9) return this._doc.body;
        while (parentElement && parentElement.nodeType == 3) {
                parentElement = parentElement.parentNode;
        }
index ef0bea9..4890731 100644 (file)
@@ -1244,11 +1244,13 @@ HTMLArea.prototype.setMode = function(mode) {
                                this._statusBar.appendChild(this._statusBarTree);
                        }
                        this._editMode = "wysiwyg";
-                                       //set gecko options
+                               //set gecko options (if we can... raises exception in Firefox 3)
                        if (HTMLArea.is_gecko) {
-                               if (this._doc.queryCommandEnabled("insertbronreturn")) this._doc.execCommand("insertbronreturn", false, this.config.disableEnterParagraphs);
-                               if (this._doc.queryCommandEnabled("styleWithCSS")) this._doc.execCommand("styleWithCSS", false, this.config.useCSS);
-                                       else if (this._doc.queryCommandEnabled("useCSS")) this._doc.execCommand("useCSS", false, !this.config.useCSS);
+                               try {
+                                       if (this._doc.queryCommandEnabled("insertbronreturn")) this._doc.execCommand("insertbronreturn", false, this.config.disableEnterParagraphs);
+                                       if (this._doc.queryCommandEnabled("styleWithCSS")) this._doc.execCommand("styleWithCSS", false, this.config.useCSS);
+                                               else if (this._doc.queryCommandEnabled("useCSS")) this._doc.execCommand("useCSS", false, !this.config.useCSS);
+                               } catch(e) {}
                        }
                        break;
                default:
index fe450d0..9af1c9b 100644 (file)
@@ -671,7 +671,8 @@ BlockElements = HTMLArea.Plugin.extend({
                        return false;
                }
                var parentElement = this.editor._statusBarTree.selected ? this.editor._statusBarTree.selected : this.editor.getParentElement();
-               while (!HTMLArea.isBlockElement(parentElement) || /^li$/i.test(parentElement.nodeName)) {
+               if (parentElement.nodeName.toLowerCase() === "body") return false;
+               while (parentElement && !HTMLArea.isBlockElement(parentElement) || /^li$/i.test(parentElement.nodeName)) {
                        parentElement = parentElement.parentNode;
                }
                var blockAncestors = this.getBlockAncestors(parentElement);
index 590f55e..6d09dac 100644 (file)
@@ -171,7 +171,7 @@ BlockStyle = HTMLArea.Plugin.extend({
         * This function gets called when the toolbar is being updated
         */
        onUpdateToolbar : function() {
-               if (this.editor._editMode === "wysiwyg") {
+               if (this.editor.getMode() === "wysiwyg") {
                        this.generate(this.editor, "BlockStyle");
                }
        },
@@ -180,7 +180,7 @@ BlockStyle = HTMLArea.Plugin.extend({
         * This function gets called when the editor has changed its mode to "wysiwyg"
         */
        onMode : function(mode) {
-               if (mode === "wysiwyg") {
+               if (this.editor.getMode() === "wysiwyg") {
                        this.generate(this.editor, "BlockStyle");
                }
        },
@@ -190,7 +190,7 @@ BlockStyle = HTMLArea.Plugin.extend({
         * Re-initiate the parsing of the style sheets, if not yet completed, and refresh our toolbar components
         */
        generate : function(editor, dropDownId) {
-               if (this.cssLoaded) {
+               if (this.cssLoaded && this.editor.getMode() === "wysiwyg" && this.editor.isEditable()) {
                        this.updateValue(dropDownId);
                } else {
                        if (this.cssTimeout) {
index a6ab288..7667ba2 100644 (file)
@@ -41,8 +41,8 @@ DefaultFont = HTMLArea.Plugin.extend({
        configurePlugin : function (editor) {
                
                this.options = new Object();
-               this.options.FontName= this.editorConfiguration.buttons.fontstyle.options;
-               this.options.FontSize= this.editorConfiguration.buttons.fontsize.options;
+               this.options.FontName = this.editorConfiguration.buttons.fontstyle ? this.editorConfiguration.buttons.fontstyle.options : null;
+               this.options.FontSize = this.editorConfiguration.buttons.fontsize ? this.editorConfiguration.buttons.fontsize.options : null;
                this.disablePCexamples = this.editorConfiguration.disablePCexamples
                
                /*
@@ -130,7 +130,11 @@ DefaultFont = HTMLArea.Plugin.extend({
                                if (this.isButtonInToolbar(buttonId)) {
                                        var select = document.getElementById(editor._toolbarObjects[buttonId].elementId);
                                        select.selectedIndex = 0;
-                                       var value = ("" + editor._doc.queryCommandValue(buttonId)).trim().toLowerCase().replace(/\'/g, "");
+                                       try {
+                                               var value = ("" + editor._doc.queryCommandValue(buttonId)).trim().toLowerCase().replace(/\'/g, "");
+                                       } catch(e) {
+                                               value = null;
+                                       }
                                        if (value) {
                                                var options = this.options[buttonId];
                                                k = 0;
@@ -155,7 +159,7 @@ DefaultFont = HTMLArea.Plugin.extend({
         * This function gets called when the plugin is generated
         */
        onGenerate : function () {
-               if (!this.disablePCexamples) {
+               if (!this.disablePCexamples && this.isButtonInToolbar("FontName")) {
                        var select = document.getElementById(this.editor._toolbarObjects.FontName.elementId);
                        for (var i = select.options.length; --i >= 0;) {
                                if (HTMLArea.is_gecko) select.options[i].setAttribute("style", "font-family:" + select.options[i].value + ";");
index ecfc126..b75b5e4 100644 (file)
@@ -1,7 +1,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2007-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -449,7 +449,7 @@ TextStyle = HTMLArea.Plugin.extend({
         * This function gets called when the toolbar is being updated
         */
        onUpdateToolbar : function() {
-               if (this.editor._editMode !== "textmode") {
+               if (this.editor.getMode() === "wysiwyg" && this.editor.isEditable()) {
                        this.generate(this.editor, "TextStyle");
                }
        },
@@ -459,7 +459,7 @@ TextStyle = HTMLArea.Plugin.extend({
        */
        updateToolbar : function(dropDownId) {
                var editor = this.editor;
-               if (editor.getMode() === "wysiwyg" && editor.isEditable()) {
+               if (this.editor.getMode() === "wysiwyg" && this.editor.isEditable()) {
                        var tagName = false, classNames = Array(), fullNodeSelected = false;
                        var selection = editor._getSelection();
                        var range = editor._createRange(selection);
@@ -628,7 +628,7 @@ TextStyle = HTMLArea.Plugin.extend({
         * This function gets called when the editor has changed its mode to "wysiwyg"
         */
        onMode : function(mode) {
-               if (mode === "wysiwyg" && editor.isEditable()) {
+               if (mode === "wysiwyg" && this.editor.isEditable()) {
                        this.generate(this.editor, "TextStyle");
                }
        }