[TASK] RTE: Use own user agent identification 20/33720/3
authorStanislas Rolland <typo3@sjbr.ca>
Sun, 2 Nov 2014 17:41:25 +0000 (12:41 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 3 Nov 2014 15:03:14 +0000 (16:03 +0100)
Replace ExjJs outdated user agent identification.

Releases: master
Resolves: #62630
Change-Id: Ib057fd1ea2c2fc78b0bfdf1e275c69e98331c1c2
Reviewed-on: http://review.typo3.org/33720
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
42 files changed:
typo3/sysext/rtehtmlarea/Classes/RteHtmlAreaBase.php
typo3/sysext/rtehtmlarea/htmlarea/CSS/HTMLArea.CSS.Parser.js
typo3/sysext/rtehtmlarea/htmlarea/Configuration/HTMLArea.Config.js
typo3/sysext/rtehtmlarea/htmlarea/DOM/HTMLArea.DOM.BookMark.js
typo3/sysext/rtehtmlarea/htmlarea/DOM/HTMLArea.DOM.Node.js
typo3/sysext/rtehtmlarea/htmlarea/DOM/HTMLArea.DOM.Selection.js
typo3/sysext/rtehtmlarea/htmlarea/DOM/HTMLArea.DOM.Walker.js
typo3/sysext/rtehtmlarea/htmlarea/DOM/HTMLArea.DOM.js
typo3/sysext/rtehtmlarea/htmlarea/Editor/HTMLArea.Editor.js
typo3/sysext/rtehtmlarea/htmlarea/Editor/HTMLArea.Iframe.js
typo3/sysext/rtehtmlarea/htmlarea/Editor/HTMLArea.StatusBar.js
typo3/sysext/rtehtmlarea/htmlarea/Extjs/ux/Ext.ux.HTMLAreaButton.js
typo3/sysext/rtehtmlarea/htmlarea/Extjs/ux/Ext.ux.form.HTMLAreaCombo.js
typo3/sysext/rtehtmlarea/htmlarea/HTMLArea.js
typo3/sysext/rtehtmlarea/htmlarea/NameSpace/NameSpace.js [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/UserAgent/UserAgent.js [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/Util/HTMLArea.util.TYPO3.js
typo3/sysext/rtehtmlarea/htmlarea/Util/HTMLArea.util.Tips.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultClean/default-clean.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/default-image.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultLink/default-link.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefinitionList/definition-list.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineElements/inline-elements.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/InsertSmiley/insert-smiley.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/Language/language.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/MicrodataSchema/microdata-schema.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/PlainText/plain-text.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/Plugin.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/SelectFont/select-font.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-checker.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Color/typo3color.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/typo3image.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TableOperations/table-operations.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TextIndicator/text-indicator.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TextStyle/text-style.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/UndoRedo/undo-redo.js

index 14ee29d..4139b30 100644 (file)
@@ -805,6 +805,8 @@ class RteHtmlAreaBase extends \TYPO3\CMS\Backend\Rte\AbstractRte {
                // Component files. Order is important.
                $components = array(
                        'Util/Wrap.open',
+                       'NameSpace/NameSpace',
+                       'UserAgent/UserAgent',
                        'HTMLArea',
                        'Configuration/HTMLArea.Config',
                        'Extjs/ux/Ext.ux.HTMLAreaButton',
index 3d752d0..da3ee27 100644 (file)
@@ -119,13 +119,13 @@ HTMLArea.CSS.Parser = Ext.extend(Ext.util.Observable, {
                this.cssLoaded = true;
                this.error = null;
                        // Test if the styleSheets array is at all accessible
-               if (Ext.isOpera) {
+               if (HTMLArea.UserAgent.isOpera) {
                        if (this.editor.document.readyState !== 'complete') {
                                this.cssLoaded = false;
                                this.error = 'Document.readyState not complete';
                        }
                } else {
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                try {
                                        var rules = this.editor.document.styleSheets[0].rules;
                                        var imports = this.editor.document.styleSheets[0].imports;
@@ -153,7 +153,7 @@ HTMLArea.CSS.Parser = Ext.extend(Ext.util.Observable, {
                                for (var index = 0, n = styleSheets.length; index < n; index++) {
                                        try {
                                                var styleSheet = styleSheets[index];
-                                               if (HTMLArea.isIEBeforeIE9) {
+                                               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                                        var rules = styleSheet.rules;
                                                        var imports = styleSheet.imports;
                                                        if (!rules.length && !imports.length) {
index 436318c..907e7ff 100644 (file)
@@ -65,15 +65,15 @@ HTMLArea.Config = function (editorId) {
                        cls: 'button',
                        overCls: 'buttonHover',
                                // Erratic behaviour of click event in WebKit and IE browsers
-                       clickEvent: (Ext.isWebKit || Ext.isIE) ? 'mousedown' : 'click'
+                       clickEvent: (HTMLArea.UserAgent.isWebKit || HTMLArea.UserAgent.isIE) ? 'mousedown' : 'click'
                },
                htmlareacombo: {
                        cls: 'select',
                        typeAhead: true,
                        lastQuery: '',
                        triggerAction: 'all',
-                       editable: !Ext.isIE,
-                       selectOnFocus: !Ext.isIE,
+                       editable: !HTMLArea.UserAgent.isIE,
+                       selectOnFocus: !HTMLArea.UserAgent.isIE,
                        validationEvent: false,
                        validateOnBlur: false,
                        submitValue: false,
@@ -135,7 +135,7 @@ HTMLArea.Config = Ext.extend(HTMLArea.Config, {
                                                url: config.storeUrl
                                        });
                                }
-                               config.hideLabel = typeof config.fieldLabel !== 'string' || !config.fieldLabel.length || Ext.isIE6;
+                               config.hideLabel = typeof config.fieldLabel !== 'string' || !config.fieldLabel.length || HTMLArea.UserAgent.isIE6;
                                config.helpTitle = config.tooltip;
                                break;
                        default:
index 6816298..78ae093 100644 (file)
@@ -36,7 +36,7 @@ HTMLArea.DOM.BookMark = Ext.extend(HTMLArea.DOM.BookMark, {
         */
        get: function (range, nonIntrusive) {
                var bookMark;
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        // Bookmarking will not work on control ranges
                        try {
                                bookMark = range.getBookmark();
@@ -224,7 +224,7 @@ HTMLArea.DOM.BookMark = Ext.extend(HTMLArea.DOM.BookMark, {
         */
        moveTo: function (bookMark) {
                var range = this.selection.createRange();
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        if (bookMark) {
                                range.moveToBookmark(bookMark);
                        }
index a598ce7..44fdf66 100644 (file)
@@ -56,7 +56,7 @@ HTMLArea.DOM.Node = Ext.extend(HTMLArea.DOM.Node, {
         * @return      void
         */
        wrapWithInlineElement: function (element, range) {
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        var nodeName = element.nodeName;
                        var bookMark = this.bookMark.get(range);
                        if (range.parentElement) {
@@ -171,7 +171,7 @@ HTMLArea.DOM.Node = Ext.extend(HTMLArea.DOM.Node, {
         * @return      void
         */
        cleanAppleStyleSpans: function (node) {
-               if (Ext.isWebKit || Ext.isOpera) {
+               if (HTMLArea.UserAgent.isWebKit || HTMLArea.UserAgent.isOpera) {
                        if (node.getElementsByClassName) {
                                var spans = node.getElementsByClassName('Apple-style-span');
                                for (var i = spans.length; --i >= 0;) {
index a84ab3f..f738152 100644 (file)
@@ -90,7 +90,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                                        // IE8, IE7 or old version of WebKit
                                this.selection.empty();
                        }
-                       if (Ext.isOpera) {
+                       if (HTMLArea.UserAgent.isOpera) {
                                this.editor.focus();
                        }
                }
@@ -105,7 +105,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                var isEmpty = true;
                this.get();
                if (typeof this.selection === 'object' && this.selection !== null) {
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                switch (this.selection.type) {
                                        case 'None':
                                                isEmpty = true;
@@ -131,14 +131,14 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
        createRange: function () {
                var range;
                this.get();
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        range = this.selection.createRange();
                } else {
                        if (typeof this.selection !== 'object' || this.selection === null) {
                                range = this.document.createRange();
                        } else {
                                        // Older versions of WebKit did not support getRangeAt
-                               if (Ext.isWebKit && typeof this.selection.getRangeAt !== 'function') {
+                               if (HTMLArea.UserAgent.isWebKit && typeof this.selection.getRangeAt !== 'function') {
                                        range = this.document.createRange();
                                        if (this.selection.baseNode == null) {
                                                range.setStart(this.document.body, 0);
@@ -192,7 +192,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                if (typeof this.selection === 'object' && this.selection !== null) {
                        if (typeof this.selection.addRange === 'function') {
                                this.selection.addRange(range);
-                       } else if (Ext.isWebKit) {
+                       } else if (HTMLArea.UserAgent.isWebKit) {
                                this.selection.setBaseAndExtent(range.startContainer, range.startOffset, range.endContainer, range.endOffset);
                        }
                }
@@ -243,15 +243,15 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
        selectNode: function (node, endPoint) {
                this.get();
                if (typeof this.selection === 'object' && this.selection !== null) {
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                        // IE8/7/6 cannot set this type of selection
                                this.selectNodeContents(node, endPoint);
-                       } else if (Ext.isWebKit && /^(img)$/i.test(node.nodeName)) {
+                       } else if (HTMLArea.UserAgent.isWebKit && /^(img)$/i.test(node.nodeName)) {
                                this.selection.setBaseAndExtent(node, 0, node, 1);
                        } else {
                                var range = this.document.createRange();
                                if (node.nodeType === HTMLArea.DOM.ELEMENT_NODE && /^(body)$/i.test(node.nodeName)) {
-                                       if (Ext.isWebKit) {
+                                       if (HTMLArea.UserAgent.isWebKit) {
                                                range.setStart(node, 0);
                                                range.setEnd(node, node.childNodes.length);
                                        } else {
@@ -280,12 +280,12 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                var range;
                this.get();
                if (typeof this.selection === 'object' && this.selection !== null) {
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                range = this.document.body.createTextRange();
                                range.moveToElementText(node);
                        } else {
                                range = this.document.createRange();
-                               if (Ext.isWebKit) {
+                               if (HTMLArea.UserAgent.isWebKit) {
                                        range.setStart(node, 0);
                                        if (node.nodeType === HTMLArea.DOM.TEXT_NODE || node.nodeType === HTMLArea.DOM.COMMENT_NODE || node.nodeType === HTMLArea.DOM.CDATA_SECTION_NODE) {
                                                range.setEnd(node, node.textContent.length);
@@ -312,7 +312,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                var parentElement,
                        range;
                this.get();
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        range = this.createRange();
                        switch (this.selection.type) {
                                case 'Text':
@@ -442,7 +442,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                        var ancestors = this.getAllAncestors();
                        for (var i = 0, n = ancestors.length; i < n; i++) {
                                var ancestor = ancestors[i];
-                               if (HTMLArea.isIEBeforeIE9) {
+                               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                        isFullySelected = (type !== 'Control' && ancestor.innerText == range.text) || (type === 'Control' && ancestor.innerText == range.item(0).text);
                                } else {
                                        isFullySelected = (ancestor.textContent == range.toString());
@@ -453,7 +453,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                                }
                        }
                                // Working around bug with WebKit selection
-                       if (Ext.isWebKit && !isFullySelected) {
+                       if (HTMLArea.UserAgent.isWebKit && !isFullySelected) {
                                var statusBarSelection = this.editor.statusBar ? this.editor.statusBar.getSelection() : null;
                                if (statusBarSelection && statusBarSelection.textContent == range.toString()) {
                                        isFullySelected = true;
@@ -472,7 +472,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                var range = this.createRange(),
                        parentStart,
                        parentEnd;
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        if (this.getType() === 'Control') {
                                parentStart = range.item(0);
                                parentEnd = parentStart;
@@ -527,7 +527,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
        getHtml: function () {
                var range = this.createRange(),
                        html = '';
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        if (this.getType() === 'Control') {
                                        // We have a controlRange collection
                                var bodyRange = this.document.body.createTextRange();
@@ -555,7 +555,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
         * @return      object          this
         */
        insertNode: function (toBeInserted) {
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        this.insertHtml(toBeInserted.outerHTML);
                } else {
                        var range = this.createRange();
@@ -575,7 +575,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
         * @return      object          this
         */
        insertHtml: function (html) {
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        this.get();
                        if (this.getType() === 'Control') {
                                this.selection.clear();
@@ -635,7 +635,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
         */
        handleBackSpace: function () {
                var range = this.createRange();
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        if (this.getType() === 'Control') {
                                        // Deleting or backspacing on a control selection : delete the element
                                var element = this.getParentElement();
@@ -945,7 +945,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                                        block.removeChild(first);
                                }
                                right = doc.createElement('p');
-                               if (Ext.isWebKit || Ext.isOpera) {
+                               if (HTMLArea.UserAgent.isWebKit || HTMLArea.UserAgent.isOpera) {
                                        right.innerHTML = '<br />';
                                }
                                right = block.appendChild(right);
@@ -955,7 +955,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                        range.setEndAfter(block);
                        var df = range.extractContents(), left_empty = false;
                        if (!/\S/.test(block.innerHTML) || (!/\S/.test(block.textContent) && !/<(img|hr|table)/i.test(block.innerHTML))) {
-                               if (!Ext.isOpera) {
+                               if (!HTMLArea.UserAgent.isOpera) {
                                        block.innerHTML = '<br />';
                                }
                                left_empty = true;
@@ -969,7 +969,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                                        if (/^(dt|dd)$/i.test(p.nodeName)) {
                                                 p = HTMLArea.DOM.convertNode(p, /^(dt)$/i.test(p.nodeName) ? 'dd' : 'dt');
                                        }
-                                       if (!Ext.isOpera) {
+                                       if (!HTMLArea.UserAgent.isOpera) {
                                                p.innerHTML = '<br />';
                                        }
                                        if (/^li$/i.test(p.nodeName) && left_empty && (!block.nextSibling || !/^li$/i.test(block.nextSibling.nodeName))) {
@@ -1009,7 +1009,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                                } else {
                                        p = doc.createElement('p');
                                }
-                               if (!Ext.isOpera) {
+                               if (!HTMLArea.UserAgent.isOpera) {
                                        p.innerHTML = '<br />';
                                }
                                if (block.nextSibling) {
index ac658da..99dca95 100644 (file)
@@ -129,10 +129,10 @@ HTMLArea.DOM.Walker = Ext.extend(HTMLArea.DOM.Walker, {
                        if (!attribute.specified && attributeName !== 'value') {
                                continue;
                        }
-                       if (Ext.isIE) {
+                       if (HTMLArea.UserAgent.isIE) {
                                        // IE before I9 fails to put style in attributes list.
                                if (attributeName === 'style') {
-                                       if (HTMLArea.isIEBeforeIE9) {
+                                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                                attributeValue = node.style.cssText;
                                        }
                                        // May need to strip the base url
@@ -142,7 +142,7 @@ HTMLArea.DOM.Walker = Ext.extend(HTMLArea.DOM.Walker, {
                                } else if (attributeName === 'value' && /^li$/i.test(node.nodeName) && attributeValue == 0) {
                                        continue;
                                }
-                       } else if (Ext.isGecko) {
+                       } else if (HTMLArea.UserAgent.isGecko) {
                                        // Ignore special values reported by Mozilla
                                if (/(_moz|^$)/.test(attributeValue)) {
                                        continue;
@@ -160,7 +160,7 @@ HTMLArea.DOM.Walker = Ext.extend(HTMLArea.DOM.Walker, {
                                attributeValue: attributeValue
                        });
                }
-               return (Ext.isWebKit || Ext.isOpera) ? filterededAttributes.reverse() : filterededAttributes;
+               return (HTMLArea.UserAgent.isWebKit || HTMLArea.UserAgent.isOpera) ? filterededAttributes.reverse() : filterededAttributes;
        },
        /*
         * Set opening tag for a node
@@ -173,7 +173,7 @@ HTMLArea.DOM.Walker = Ext.extend(HTMLArea.DOM.Walker, {
                        // Handle br oddities
                if (/^br$/i.test(node.nodeName)) {
                                // Remove Mozilla special br node
-                       if (Ext.isGecko && node.hasAttribute('_moz_editor_bogus_node')) {
+                       if (HTMLArea.UserAgent.isGecko && node.hasAttribute('_moz_editor_bogus_node')) {
                                return html;
                                // In Gecko, whenever some text is entered in an empty block, a trailing br tag is added by the browser.
                                // If the br element is a trailing br in a block element with no other content or with content other than a br, it may be configured to be removed
index 2e7303b..bf805ac 100644 (file)
@@ -140,9 +140,9 @@ HTMLArea.DOM = function () {
                                if (newClasses.length) {
                                        node.className = newClasses.join(' ');
                                } else {
-                                       if (!Ext.isOpera) {
+                                       if (!HTMLArea.UserAgent.isOpera) {
                                                node.removeAttribute('class');
-                                               if (HTMLArea.isIEBeforeIE9) {
+                                               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                                        node.removeAttribute('className');
                                                }
                                        } else {
@@ -159,7 +159,7 @@ HTMLArea.DOM = function () {
                 * @return      string          the text inside the node
                 */
                getInnerText: function (node) {
-                       return HTMLArea.isIEBeforeIE9 ? node.innerText : node.textContent;;
+                       return HTMLArea.UserAgent.isIEBeforeIE9 ? node.innerText : node.textContent;;
                },
                /*
                 * Get the block ancestors of a node within a given block
@@ -310,7 +310,7 @@ HTMLArea.DOM = function () {
                        var rangeIntersectsNode = false,
                                ownerDocument = node.ownerDocument;
                        if (ownerDocument) {
-                               if (HTMLArea.isIEBeforeIE9) {
+                               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                        var nodeRange = ownerDocument.body.createTextRange();
                                        nodeRange.moveToElementText(node);
                                        rangeIntersectsNode = (range.compareEndPoints('EndToStart', nodeRange) == -1 && range.compareEndPoints('StartToEnd', nodeRange) == 1) ||
@@ -320,7 +320,7 @@ HTMLArea.DOM = function () {
                                        try {
                                                nodeRange.selectNode(node);
                                        } catch (e) {
-                                               if (Ext.isWebKit) {
+                                               if (HTMLArea.UserAgent.isWebKit) {
                                                        nodeRange.setStart(node, 0);
                                                        if (node.nodeType === HTMLArea.DOM.TEXT_NODE || node.nodeType === HTMLArea.DOM.COMMENT_NODE || node.nodeType === HTMLArea.DOM.CDATA_SECTION_NODE) {
                                                                nodeRange.setEnd(node, node.textContent.length);
index 7fe5f60..ba96cc4 100644 (file)
@@ -82,7 +82,7 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
         * @return      boolean         true, if the document is contentEditable
         */
        isEditable: function () {
-               return Ext.isIE ? this.document.body.contentEditable : (this.document.designMode === 'on');
+               return HTMLArea.UserAgent.isIE ? this.document.body.contentEditable : (this.document.designMode === 'on');
        },
        /*
         * The selection object
@@ -157,7 +157,7 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
                                                id: this.editorId + '-iframe',
                                                tag: 'iframe',
                                                cls: 'editorIframe',
-                                               src: Ext.isGecko ? 'javascript:void(0);' : (Ext.isWebKit ? 'javascript: \'' + HTMLArea.util.htmlEncode(this.config.documentType + this.config.blankDocument) + '\'' : HTMLArea.editorUrl + 'popups/blank.html')
+                                               src: HTMLArea.UserAgent.isGecko ? 'javascript:void(0);' : (HTMLArea.UserAgent.isWebKit ? 'javascript: \'' + HTMLArea.util.htmlEncode(this.config.documentType + this.config.blankDocument) + '\'' : HTMLArea.editorUrl + 'popups/blank.html')
                                        },
                                        isNested: this.isNested,
                                        nestedParentElements: this.nestedParentElements,
@@ -453,7 +453,7 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
         * Scroll the editor window to the current caret position
         */
        scrollToCaret: function () {
-               if (!Ext.isIE) {
+               if (!HTMLArea.UserAgent.isIE) {
                        var e = this.getSelection().getParentElement(),
                                w = this.iframe.getEl().dom.contentWindow ? this.iframe.getEl().dom.contentWindow : window,
                                h = w.innerHeight || w.height,
@@ -468,7 +468,7 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
         * Add listeners
         */
        initEventsListening: function () {
-               if (Ext.isOpera) {
+               if (HTMLArea.UserAgent.isOpera) {
                        this.iframe.startListening();
                }
                        // Add unload handler
index 6bfe911..fc156de 100644 (file)
@@ -45,7 +45,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         */
        initEventListeners: function () {
                this.initStyleChangeEventListener();
-               if (Ext.isOpera) {
+               if (HTMLArea.UserAgent.isOpera) {
                        this.mon(this.getEl(), 'load', this.initializeIframe , this, {single: true});
                } else {
                        this.initializeIframe();
@@ -57,7 +57,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         * In all browsers, it breaks the evaluation of the framework dimensions
         */
        initStyleChangeEventListener: function () {
-               if (this.isNested && Ext.isGecko) {
+               if (this.isNested && HTMLArea.UserAgent.isGecko) {
                        var options = {
                                stopEvent: true,
                                delay: 50
@@ -66,14 +66,14 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                var nestedElement = Ext.get(this.nestedParentElements.sorted[i]);
                                this.mon(
                                        nestedElement,
-                                       Ext.isIE ? 'propertychange' : 'DOMAttrModified',
+                                       HTMLArea.UserAgent.isIE ? 'propertychange' : 'DOMAttrModified',
                                        this.onNestedShow,
                                        this,
                                        options
                                );
                                this.mon(
                                        nestedElement.parent(),
-                                       Ext.isIE ? 'propertychange' : 'DOMAttrModified',
+                                       HTMLArea.UserAgent.isIE ? 'propertychange' : 'DOMAttrModified',
                                        this.onNestedShow,
                                        this,
                                        options
@@ -146,10 +146,10 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                if (!iframe || (!iframe.contentWindow && !iframe.contentDocument)) {
                        this.initializeIframe.defer(50, this);
                        // All except WebKit
-               } else if (iframe.contentWindow && !Ext.isWebKit && (!iframe.contentWindow.document || !iframe.contentWindow.document.documentElement)) {
+               } else if (iframe.contentWindow && !HTMLArea.UserAgent.isWebKit && (!iframe.contentWindow.document || !iframe.contentWindow.document.documentElement)) {
                        this.initializeIframe.defer(50, this);
                        // WebKit
-               } else if (Ext.isWebKit && (!iframe.contentDocument.documentElement || !iframe.contentDocument.body)) {
+               } else if (HTMLArea.UserAgent.isWebKit && (!iframe.contentDocument.documentElement || !iframe.contentDocument.body)) {
                        this.initializeIframe.defer(50, this);
                } else {
                        this.document = iframe.contentWindow ? iframe.contentWindow.document : iframe.contentDocument;
@@ -160,7 +160,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                        Ext.get(this.document.body).addClass('htmlarea-content-body');
                                // Start listening to things happening in the iframe
                                // For some unknown reason, this is too early for Opera
-                       if (!Ext.isOpera) {
+                       if (!HTMLArea.UserAgent.isOpera) {
                                this.startListening();
                        }
                                // Hide the iframe
@@ -177,7 +177,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         * @return      void
         */
        initializeCustomTags: function () {
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        for (var i = this.config.customTags.length; --i >= 0;) {
                                this.document.createElement(this.config.customTags[i]);
                        }
@@ -208,7 +208,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                        link0.type = 'text/css';
                                // Firefox 3.0.1 does not apply the base URL while Firefox 3.6.8 does so. Do not know in what version this was fixed.
                                // Therefore, for versions before 3.6.8, we prepend the url with the base, if the url is not absolute
-                       link0.href = ((Ext.isGecko && navigator.productSub < 2010072200 && !/^http(s?):\/{2}/.test(this.config.editedContentStyle)) ? this.config.baseURL : '') + this.config.editedContentStyle;
+                       link0.href = ((HTMLArea.UserAgent.isGecko && navigator.productSub < 2010072200 && !/^http(s?):\/{2}/.test(this.config.editedContentStyle)) ? this.config.baseURL : '') + this.config.editedContentStyle;
                        head.appendChild(link0);
                        this.getEditor().appendToLog('HTMLArea.Iframe', 'createHead', 'Skin CSS set to: ' + link0.href, 'info');
                }
@@ -218,7 +218,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                        var link = this.document.createElement('link');
                        link.rel = 'stylesheet';
                        link.type = 'text/css';
-                       link.href = ((Ext.isGecko && navigator.productSub < 2010072200 && !/^https?:\/{2}/.test(pageStyle)) ? this.config.baseURL : '') + pageStyle;
+                       link.href = ((HTMLArea.UserAgent.isGecko && navigator.productSub < 2010072200 && !/^https?:\/{2}/.test(pageStyle)) ? this.config.baseURL : '') + pageStyle;
                        head.appendChild(link);
                        this.getEditor().appendToLog('HTMLArea.Iframe', 'createHead', 'Content CSS set to: ' + link.href, 'info');
                }
@@ -228,7 +228,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         */
        focus: function () {
                try {
-                       if (Ext.isWebKit) {
+                       if (HTMLArea.UserAgent.isWebKit) {
                                this.getEl().dom.focus();
                        } else {
                                this.getEl().dom.contentWindow.focus();
@@ -254,8 +254,8 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         */
        setDesignMode: function (on) {
                if (on) {
-                       if (!Ext.isIE) {
-                               if (Ext.isGecko) {
+                       if (!HTMLArea.UserAgent.isIE) {
+                               if (HTMLArea.UserAgent.isGecko) {
                                                // In Firefox, we can't set designMode when we are in a hidden TYPO3 tab or inline element
                                        if (!this.isNested || HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)) {
                                                this.document.designMode = 'on';
@@ -266,14 +266,14 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                        this.setOptions();
                                }
                        }
-                       if (Ext.isIE || Ext.isWebKit) {
+                       if (HTMLArea.UserAgent.isIE || HTMLArea.UserAgent.isWebKit) {
                                this.document.body.contentEditable = true;
                        }
                } else {
-                       if (!Ext.isIE) {
+                       if (!HTMLArea.UserAgent.isIE) {
                                this.document.designMode = 'off';
                        }
-                       if (Ext.isIE || Ext.isWebKit) {
+                       if (HTMLArea.UserAgent.isIE || HTMLArea.UserAgent.isWebKit) {
                                this.document.body.contentEditable = false;
                        }
                }
@@ -284,17 +284,17 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         * @return      void
         */
        setOptions: function () {
-               if (!Ext.isIE) {
+               if (!HTMLArea.UserAgent.isIE) {
                        try {
                                if (this.document.queryCommandEnabled('insertBrOnReturn')) {
                                        this.document.execCommand('insertBrOnReturn', false, this.config.disableEnterParagraphs);
                                }
                                if (this.document.queryCommandEnabled('styleWithCSS')) {
                                        this.document.execCommand('styleWithCSS', false, this.config.useCSS);
-                               } else if (Ext.isGecko && this.document.queryCommandEnabled('useCSS')) {
+                               } else if (HTMLArea.UserAgent.isGecko && this.document.queryCommandEnabled('useCSS')) {
                                        this.document.execCommand('useCSS', false, !this.config.useCSS);
                                }
-                               if (Ext.isGecko) {
+                               if (HTMLArea.UserAgent.isGecko) {
                                        if (this.document.queryCommandEnabled('enableObjectResizing')) {
                                                this.document.execCommand('enableObjectResizing', false, !this.config.disableObjectResizing);
                                        }
@@ -311,16 +311,16 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
        onNestedShow: function (event, target) {
                var styleEvent = true;
                        // In older versions of Gecko attrName is not set and refering to it causes a non-catchable crash
-               if ((Ext.isGecko && navigator.productSub > 2007112700) || Ext.isOpera) {
+               if ((HTMLArea.UserAgent.isGecko && navigator.productSub > 2007112700) || HTMLArea.UserAgent.isOpera) {
                        styleEvent = (event.browserEvent.attrName == 'style') || (event.browserEvent.attrName == 'className');
-               } else if (Ext.isIE) {
+               } else if (HTMLArea.UserAgent.isIE) {
                        styleEvent = (event.browserEvent.propertyName == 'style.display');
                }
                if (styleEvent && (this.nestedParentElements.sorted.indexOf(target.id) != -1 || this.nestedParentElements.sorted.indexOf(target.id.replace('_div', '_fields')) != -1)) {
                                // Check if all container nested elements are displayed
                        if (HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)) {
                                if (this.getEditor().getMode() === 'wysiwyg') {
-                                       if (Ext.isGecko) {
+                                       if (HTMLArea.UserAgent.isGecko) {
                                                this.setDesignMode(true);
                                        }
                                        this.fireEvent('show');
@@ -347,7 +347,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         */
        startListening: function () {
                        // Create keyMap so that plugins may bind key handlers
-               this.keyMap = new Ext.KeyMap(Ext.get(this.document.documentElement), [], (Ext.isIE || Ext.isWebKit) ? 'keydown' : 'keypress');
+               this.keyMap = new Ext.KeyMap(Ext.get(this.document.documentElement), [], (HTMLArea.UserAgent.isIE || HTMLArea.UserAgent.isWebKit) ? 'keydown' : 'keypress');
                        // Special keys map
                this.keyMap.addBinding([
                        {
@@ -372,7 +372,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                scope: this
                        }
                ]);
-               if (Ext.isGecko || Ext.isIE) {
+               if (HTMLArea.UserAgent.isGecko || HTMLArea.UserAgent.isIE) {
                        this.keyMap.addBinding(
                        {
                                key: [Ext.EventObject.BACKSPACE, Ext.EventObject.DELETE],
@@ -381,7 +381,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                scope: this
                        });
                }
-               if (!Ext.isIE && !this.config.disableEnterParagraphs) {
+               if (!HTMLArea.UserAgent.isIE && !this.config.disableEnterParagraphs) {
                        this.keyMap.addBinding(
                        {
                                key: Ext.EventObject.ENTER,
@@ -390,7 +390,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                scope: this
                        });
                }
-               if (Ext.isWebKit) {
+               if (HTMLArea.UserAgent.isWebKit) {
                        this.keyMap.addBinding(
                        {
                                key: Ext.EventObject.ENTER,
@@ -418,14 +418,14 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                scope: this
                        });
                }
-               this.mon(Ext.get(this.document.documentElement), (Ext.isIE || Ext.isWebKit) ? 'keydown' : 'keypress', this.onAnyKey, this);
+               this.mon(Ext.get(this.document.documentElement), (HTMLArea.UserAgent.isIE || HTMLArea.UserAgent.isWebKit) ? 'keydown' : 'keypress', this.onAnyKey, this);
                this.mon(Ext.get(this.document.documentElement), 'mouseup', this.onMouse, this);
                this.mon(Ext.get(this.document.documentElement), 'click', this.onMouse, this);
-               if (Ext.isGecko) {
+               if (HTMLArea.UserAgent.isGecko) {
                        this.mon(Ext.get(this.document.documentElement), 'paste', this.onPaste, this);
                }
                this.mon(Ext.get(this.document.documentElement), 'drop', this.onDrop, this);
-               if (Ext.isWebKit) {
+               if (HTMLArea.UserAgent.isWebKit) {
                        this.mon(Ext.get(this.document.body), 'dragend', this.onDrop, this);
                }
        },
@@ -439,11 +439,11 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                this.fireEvent('HTMLAreaEventWordCountChange', 100);
                if (!event.altKey && !event.ctrlKey) {
                                // Detect URL in non-IE browsers
-                       if (!Ext.isIE && (event.getKey() != Ext.EventObject.ENTER || (event.shiftKey && !Ext.isWebKit))) {
+                       if (!HTMLArea.UserAgent.isIE && (event.getKey() != Ext.EventObject.ENTER || (event.shiftKey && !HTMLArea.UserAgent.isWebKit))) {
                                this.getEditor().getSelection().detectURL(event);
                        }
                                // Handle option+SPACE for Mac users
-                       if (Ext.isMac && event.browserEvent.charCode == 160) {
+                       if (HTMLArea.UserAgent.isMac && event.browserEvent.charCode == 160) {
                                return this.onOptionSpace(event.browserEvent.charCode, event);
                        }
                }
@@ -466,7 +466,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         */
        onMouse: function (event, target) {
                        // In WebKit, select the image when it is clicked
-               if (Ext.isWebKit && /^(img)$/i.test(target.nodeName) && event.browserEvent.type == 'click') {
+               if (HTMLArea.UserAgent.isWebKit && /^(img)$/i.test(target.nodeName) && event.browserEvent.type == 'click') {
                        this.getEditor().getSelection().selectNode(target);
                }
                this.getToolbar().updateLater.delay(100);
@@ -477,7 +477,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         */
        onPaste: function (event) {
                        // Make src and href urls absolute
-               if (Ext.isGecko) {
+               if (HTMLArea.UserAgent.isGecko) {
                        HTMLArea.DOM.makeUrlsAbsolute.defer(50, this, [this.getEditor().document.body, this.config.baseURL, this.htmlRenderer]);
                }
        },
@@ -486,11 +486,11 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         */
        onDrop: function (event, target) {
                        // Clean up span elements added by WebKit
-               if (Ext.isWebKit) {
+               if (HTMLArea.UserAgent.isWebKit) {
                        this.getEditor().getDomNode().cleanAppleStyleSpans.defer(50, this.getEditor(), [this.getEditor().document.body]);
                }
                        // Make src url absolute in Firefox
-               if (Ext.isGecko) {
+               if (HTMLArea.UserAgent.isGecko) {
                        HTMLArea.DOM.makeUrlsAbsolute.defer(50, this, [target, this.config.baseURL, this.htmlRenderer]);
                }
                this.getToolbar().updateLater.delay(100);
@@ -530,7 +530,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                if (this.inhibitKeyboardInput(event)) {
                        return false;
                }
-               if ((!Ext.isIE && !event.shiftKey) || Ext.isIE) {
+               if ((!HTMLArea.UserAgent.isIE && !event.shiftKey) || HTMLArea.UserAgent.isIE) {
                        if (this.getEditor().getSelection().handleBackSpace()) {
                                event.stopEvent();
                        }
@@ -564,7 +564,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                if (event.shiftKey || this.config.disableEnterParagraphs) {
                        var editor = this.getEditor();
                        editor.getSelection().detectURL(event);
-                       if (Ext.isSafari) {
+                       if (HTMLArea.UserAgent.isSafari) {
                                var brNode = editor.document.createElement('br');
                                editor.getSelection().insertNode(brNode);
                                brNode.parentNode.normalize();
index 43970c3..c33da65 100644 (file)
@@ -143,7 +143,7 @@ HTMLArea.StatusBar = Ext.extend(Ext.Container, {
                                element.dom.ancestor = ancestor;
                                element.on('click', this.onClick, this);
                                element.on('mousedown', this.onClick, this);
-                               if (!Ext.isOpera) {
+                               if (!HTMLArea.UserAgent.isOpera) {
                                        element.on('contextmenu', this.onContextMenu, this);
                                }
                                if (index) {
@@ -227,7 +227,7 @@ HTMLArea.StatusBar = Ext.extend(Ext.Container, {
        selectElement: function (element) {
                var editor = this.getEditor();
                element.blur();
-               if (!HTMLArea.isIEBeforeIE9) {
+               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                        if (/^(img|table)$/i.test(element.ancestor.nodeName)) {
                                editor.getSelection().selectNode(element.ancestor);
                        } else {
index 2fb1704..711a6e8 100644 (file)
@@ -107,7 +107,7 @@ Ext.ux.HTMLAreaButton = Ext.extend(Ext.Button, {
                        if (!this.plugins[this.action](this.getEditor(), key || this.itemId) && event) {
                                event.stopEvent();
                        }
-                       if (Ext.isOpera) {
+                       if (HTMLArea.UserAgent.isOpera) {
                                this.getEditor().focus();
                        }
                        if (this.dialog) {
index 48546d2..620ba88 100644 (file)
@@ -64,7 +64,7 @@ Ext.ux.form.HTMLAreaCombo = Ext.extend(Ext.form.ComboBox, {
                if (!combo.disabled) {
                        var editor = this.getEditor();
                                // In IE, reclaim lost focus on the editor iframe and restore the bookmarked selection
-                       if (Ext.isIE) {
+                       if (HTMLArea.UserAgent.isIE) {
                                if (typeof this.savedRange === 'object' && this.savedRange !== null) {
                                        editor.getSelection().selectRange(this.savedRange);
                                        this.savedRange = null;
@@ -73,11 +73,11 @@ Ext.ux.form.HTMLAreaCombo = Ext.extend(Ext.form.ComboBox, {
                                // Invoke the plugin onChange handler
                        this.plugins[this.action](editor, combo, record, index);
                                // In IE, bookmark the updated selection as the editor will be loosing focus
-                       if (Ext.isIE) {
+                       if (HTMLArea.UserAgent.isIE) {
                                this.savedRange = editor.getSelection().createRange();
                                this.triggered = true;
                        }
-                       if (Ext.isOpera) {
+                       if (HTMLArea.UserAgent.isOpera) {
                                editor.focus();
                        }
                        this.getToolbar().update();
@@ -91,7 +91,7 @@ Ext.ux.form.HTMLAreaCombo = Ext.extend(Ext.form.ComboBox, {
        onTriggerClick: function () {
                Ext.ux.form.HTMLAreaCombo.superclass.onTriggerClick.call(this);
                        // In IE, avoid focus being stolen and selection being lost
-               if (Ext.isIE) {
+               if (HTMLArea.UserAgent.isIE) {
                        this.triggered = true;
                        this.getEditor().focus();
                }
@@ -136,7 +136,7 @@ Ext.ux.form.HTMLAreaCombo = Ext.extend(Ext.form.ComboBox, {
        onHotKey: function (key) {
                if (!this.disabled) {
                        this.plugins.onHotKey(this.getEditor(), key);
-                       if (Ext.isOpera) {
+                       if (HTMLArea.UserAgent.isOpera) {
                                this.getEditor().focus();
                        }
                        this.getToolbar().update();
@@ -161,7 +161,7 @@ Ext.ux.form.HTMLAreaCombo = Ext.extend(Ext.form.ComboBox, {
                        // Note: ExtJS is monitoring events only on the parent window
                this.mon(Ext.get(iframe.document.documentElement), 'click', this.collapse, this);
                        // Special handling for combo stealing focus in IE
-               if (Ext.isIE) {
+               if (HTMLArea.UserAgent.isIE) {
                                // Take a bookmark in case the editor looses focus by activation of this combo
                        this.mon(iframe.getEl(), 'mouseleave', this.saveSelection, this);
                                // Restore the selection if combo was triggered
index c7b4830..361971e 100644 (file)
@@ -13,7 +13,6 @@
 /**
  * Main script of TYPO3 htmlArea RTE
  */
-Ext.namespace('HTMLArea.CSS', 'HTMLArea.util.TYPO3', 'HTMLArea.util.Tips', 'HTMLArea.util.Color', 'Ext.ux.form', 'Ext.ux.menu', 'Ext.ux.Toolbar');
 Ext.apply(HTMLArea, {
        /***************************************************
         * COMPILED REGULAR EXPRESSIONS                    *
@@ -27,21 +26,6 @@ Ext.apply(HTMLArea, {
        RE_url                  : /(([^:/?#]+):\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_-]{2,}(\.[a-z0-9_-]{2,})+\.[a-z]{2,5}(:[0-9]+)?(\/\S+)*\/?)/i,
        RE_numberOrPunctuation  : /[0-9.(),;:!¡?¿%#$'"_+=\\\/-]*/g,
        /***************************************************
-        * BROWSER IDENTIFICATION                          *
-        ***************************************************/
-       isIEBeforeIE9: Ext.isIE6 || Ext.isIE7 || Ext.isIE8 || (Ext.isIE && typeof(document.documentMode) !== 'undefined' && document.documentMode < 9),
-       /***************************************************
-        * LOCALIZATION                                    *
-        ***************************************************/
-       localize: function (label, plural) {
-               var i = plural || 0;
-               var localized = HTMLArea.I18N.dialogs[label] || HTMLArea.I18N.tooltips[label] || HTMLArea.I18N.msg[label] || '';
-               if (typeof localized === 'object' && localized !== null && typeof localized[i] !== 'undefined') {
-                       localized = localized[i]['target'];
-               }
-               return localized;
-       },
-       /***************************************************
         * INITIALIZATION                                  *
         ***************************************************/
        init: function () {
@@ -88,14 +72,31 @@ Ext.apply(HTMLArea, {
                }
                return true;
        },
+       /***************************************************
+        * USER AGENT CHECK                                *
+        ***************************************************/
        /*
         * Check if the client agent is supported
         *
         * @return      boolean         true if the client is supported
         */
        checkSupportedBrowser: function () {
-               return Ext.isGecko || Ext.isWebKit || Ext.isOpera || Ext.isIE;
+               return HTMLArea.UserAgent.isGecko || HTMLArea.UserAgent.isWebKit || HTMLArea.UserAgent.isOpera || HTMLArea.UserAgent.isIE;
+       },
+       /***************************************************
+        * LOCALIZATION                                    *
+        ***************************************************/
+       localize: function (label, plural) {
+               var i = plural || 0;
+               var localized = HTMLArea.I18N.dialogs[label] || HTMLArea.I18N.tooltips[label] || HTMLArea.I18N.msg[label] || '';
+               if (typeof localized === 'object' && localized !== null && typeof localized[i] !== 'undefined') {
+                       localized = localized[i]['target'];
+               }
+               return localized;
        },
+       /***************************************************
+        * LOGGING                                         *
+        ***************************************************/
        /*
         * Write message to JavaScript console
         *
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/NameSpace/NameSpace.js b/typo3/sysext/rtehtmlarea/htmlarea/NameSpace/NameSpace.js
new file mode 100644 (file)
index 0000000..2ee9562
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+/**
+ * Establish namespace
+ */
+window.HTMLArea = {
+       CSS: {},
+       util: {}
+};
+Ext.ux.form = {};
+Ext.ux.menu = {};
+Ext.ux.Toolbar = {};
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/UserAgent/UserAgent.js b/typo3/sysext/rtehtmlarea/htmlarea/UserAgent/UserAgent.js
new file mode 100644 (file)
index 0000000..9e1c141
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+/**
+ * Identify the current user agent
+ */
+HTMLArea.UserAgent = function () {
+       var userAgent = navigator.userAgent.toLowerCase();
+       var documentMode = document.documentMode,
+               isOpera = /opera/i.test(userAgent),
+               isChrome = /\bchrome\b/i.test(userAgent),
+               isWebKit = /webkit/i.test(userAgent),
+               isIE = !isOpera && /msie/i.test(userAgent),
+               isIE6 = isIE && /msie 6/i.test(userAgent),
+               isIE7 = isIE && (/msie 7/i.test(userAgent) || documentMode == 7),
+               isIE8 = isIE && ((/msie 8/i.test(userAgent) && documentMode != 7) || documentMode == 8),
+               isGecko = !isWebKit && /gecko/i.test(userAgent),
+               isiPhone = /iphone/i.test(userAgent),
+               isiPad = /ipad/i.test(userAgent);
+       return {
+               isOpera: isOpera,
+               isChrome: isChrome,
+               isWebKit: isWebKit,
+               isSafari: !isChrome && /safari/i.test(userAgent),
+               isIE: isIE,
+               isIE6: isIE6,
+               isIE7: isIE7,
+               isIE8: isIE8,
+               isIEBeforeIE9: isIE6 || isIE7 || isIE8 || (isIE && typeof documentMode !== 'undefined' && documentMode < 9),
+               isGecko: isGecko,
+               isGecko2: isGecko && /rv:1\.8/i.test(userAgent),
+               isGecko3: isGecko && /rv:1\.9/i.test(userAgent),
+               isWindows: /windows|win32/i.test(userAgent),
+               isMac: /macintosh|mac os x/i.test(userAgent),
+               isAir: /adobeair/i.test(userAgent),
+               isLinux: /linux/i.test(userAgent),
+               isAndroid: /android/i.test(userAgent),
+               isiPhone: isiPhone,
+               isiPad: isiPad,
+               isiOS: isiPhone || isiPad
+       };
+}();
index 403b789..02575d8 100644 (file)
@@ -97,7 +97,7 @@ HTMLArea.util.TYPO3 = function () {
                 * @return      object          width and height of window
                 */
                getWindowSize: function () {
-                       if (Ext.isIE) {
+                       if (HTMLArea.UserAgent.isIE) {
                                var size = Ext.getBody().getSize();
                        } else {
                                var size = {
index fa18162..182c919 100644 (file)
@@ -14,7 +14,7 @@ HTMLArea.util.Tips = function () {
                                }
                                var label = this.label;
                                        // IE has problems with img inside label tag
-                               if (label && this.helpIcon && !Ext.isIE) {
+                               if (label && this.helpIcon && !HTMLArea.UserAgent.isIE) {
                                        var helpImage = label.insertFirst({
                                                tag: 'img',
                                                src: HTMLArea.editorSkin + 'images/system-help-open.png',
index 74d5595..dac3a8b 100644 (file)
@@ -48,7 +48,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                        }
                }
                this.allowedAttributes = new Array('id', 'title', 'lang', 'xml:lang', 'dir', 'class', 'itemscope', 'itemtype', 'itemprop');
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        this.addAllowedAttribute('className');
                }
                this.indentedList = null;
@@ -250,11 +250,11 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                                        break;
                                default :
                                        var element = tagName;
-                                       if (Ext.isIE) {
+                                       if (HTMLArea.UserAgent.isIE) {
                                                element = '<' + element + '>';
                                        }
                                        this.editor.focus();
-                                       if (Ext.isWebKit) {
+                                       if (HTMLArea.UserAgent.isWebKit) {
                                                if (!this.editor.document.body.hasChildNodes()) {
                                                        this.editor.document.body.appendChild((this.editor.document.createElement('br')));
                                                }
@@ -303,11 +303,11 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                                }
                        }
                }
-               var fullNodeTextSelected = (!HTMLArea.isIEBeforeIE9 && parentElement.textContent === range.toString()) || (HTMLArea.isIEBeforeIE9 && parentElement.innerText === range.text);
+               var fullNodeTextSelected = (!HTMLArea.UserAgent.isIEBeforeIE9 && parentElement.textContent === range.toString()) || (HTMLArea.UserAgent.isIEBeforeIE9 && parentElement.innerText === range.text);
                switch (buttonId) {
                        case "Indent" :
                                if (/^(ol|ul)$/i.test(parentElement.nodeName) && !(fullNodeTextSelected && !/^(li)$/i.test(parentElement.parentNode.nodeName))) {
-                                       if (Ext.isOpera) {
+                                       if (HTMLArea.UserAgent.isOpera) {
                                                try {
                                                        this.editor.getSelection().execCommand(buttonId, false, null);
                                                } catch(e) {
@@ -345,7 +345,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                                                }
                                        }
                                        if (nextCell) {
-                                               if (Ext.isOpera && !nextCell.hasChildNodes()) {
+                                               if (HTMLArea.UserAgent.isOpera && !nextCell.hasChildNodes()) {
                                                        nextCell.appendChild(this.editor.document.createElement('br'));
                                                }
                                                this.editor.getSelection().selectNodeContents(nextCell, true);
@@ -373,7 +373,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                        case "Outdent" :
                                if (/^(ol|ul)$/i.test(parentElement.nodeName) && !HTMLArea.DOM.hasClass(parentElement, this.useClass.Indent)) {
                                        if (/^(li)$/i.test(parentElement.parentNode.nodeName)) {
-                                               if (Ext.isOpera) {
+                                               if (HTMLArea.UserAgent.isOpera) {
                                                        try {
                                                                this.editor.getSelection().execCommand(buttonId, false, null);
                                                        } catch(e) {
@@ -404,7 +404,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                                                }
                                        }
                                        if (previousCell) {
-                                               if (Ext.isOpera && !previousCell.hasChildNodes()) {
+                                               if (HTMLArea.UserAgent.isOpera && !previousCell.hasChildNodes()) {
                                                        previousCell.appendChild(this.editor.document.createElement('br'));
                                                }
                                                this.editor.getSelection().selectNodeContents(previousCell, true);
@@ -514,7 +514,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                                var bookmark = this.editor.getBookMark().get(range);
                                var newBlock = this.wrapSelectionInBlockElement(buttonId, className, null, true);
                                this.editor.getSelection().selectRange(this.editor.getBookMark().moveTo(bookmark));
-                               if (Ext.isWebKit || Ext.isOpera) {
+                               if (HTMLArea.UserAgent.isWebKit || HTMLArea.UserAgent.isOpera) {
                                        this.editor.getDomNode().cleanAppleStyleSpans(newBlock);
                                }
                                break;
@@ -614,7 +614,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                        blockElement = contextElement.appendChild(blockElement);
                }
                        // Things go wrong in some browsers when the node is empty
-               if (Ext.isWebKit && !blockElement.hasChildNodes()) {
+               if (HTMLArea.UserAgent.isWebKit && !blockElement.hasChildNodes()) {
                        blockElement = blockElement.appendChild(this.editor.document.createElement('br'));
                }
                return blockElement;
@@ -701,7 +701,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                        } catch(e) {
                                this.appendToLog('onButtonPress', e + '\n\nby execCommand(' + buttonId + ');', 'error');
                        }
-                       if (Ext.isWebKit || Ext.isOpera) {
+                       if (HTMLArea.UserAgent.isWebKit || HTMLArea.UserAgent.isOpera) {
                                // Webkit and Opera may wrap the list inside a paragraph
                                if (parentElement && /^(p)$/i.test(parentElement.nodeName) && parentElement.firstChild && /^(ol|ul)$/i.test(parentElement.firstChild.nodeName)) {
                                        // Probably Chrome
@@ -868,7 +868,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                if (endElement) {
                        var parent = endElement.parentNode;
                        var paragraph = this.editor.document.createElement('p');
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                paragraph.innerHTML = '&nbsp';
                        } else {
                                paragraph.appendChild(this.editor.document.createElement('br'));
@@ -887,7 +887,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
        insertHorizontalRule: function () {
                this.editor.getSelection().execCommand('InsertHorizontalRule');
                        // Apply enterParagraphs rule
-               if (!Ext.isIE && !Ext.isOpera && !this.editor.config.disableEnterParagraphs) {
+               if (!HTMLArea.UserAgent.isIE && !HTMLArea.UserAgent.isOpera && !this.editor.config.disableEnterParagraphs) {
                        var range = this.editor.getSelection().createRange();
                        var startContainer = range.startContainer;
                        if (/^body$/i.test(startContainer.nodeName)) {
@@ -915,7 +915,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                                        }
                                } else {
                                        var paragraph = this.editor.document.createElement('p');
-                                       if (Ext.isWebKit) {
+                                       if (HTMLArea.UserAgent.isWebKit) {
                                                paragraph.innerHTML = '<br />';
                                        }
                                        paragraph = startContainer.appendChild(paragraph);
@@ -929,7 +929,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
         */
        onGenerate: function () {
                        // Register the enter key handler for IE when the cursor is at the end of a dt or a dd element
-               if (Ext.isIE) {
+               if (HTMLArea.UserAgent.isIE) {
                        this.editor.iframe.keyMap.addBinding({
                                key: Ext.EventObject.ENTER,
                                shift: false,
index 179633e..bf6bacd 100644 (file)
@@ -459,11 +459,11 @@ HTMLArea.CharacterMap = Ext.extend(HTMLArea.Plugin, {
         * @return      void
         */
        insertEntity: function (entity) {
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        this.editor.getSelection().insertHtml(entity);
                } else {
                                // Firefox, WebKit and IE convert '&nbsp;' to '&amp;nbsp;'
-                       var node = this.editor.document.createTextNode(((Ext.isGecko || Ext.isWebKit || Ext.isIE) && entity == '&nbsp;') ? '\xA0' : entity);
+                       var node = this.editor.document.createTextNode(((HTMLArea.UserAgent.isGecko || HTMLArea.UserAgent.isWebKit || HTMLArea.UserAgent.isIE) && entity == '&nbsp;') ? '\xA0' : entity);
                        this.editor.getSelection().insertNode(node);
                        this.editor.getSelection().selectNode(node, false);
                }
index 3b12886..6b5f59e 100644 (file)
@@ -161,7 +161,7 @@ HTMLArea.ContextMenu = Ext.extend(HTMLArea.Plugin, {
         */
        showMenu: function (target) {
                this.showContextItems(target);
-               if (!HTMLArea.isIEBeforeIE9) {
+               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                        this.ranges = this.editor.getSelection().getRanges();
                }
                var iframeEl = this.editor.iframe.getEl();
@@ -220,7 +220,7 @@ HTMLArea.ContextMenu = Ext.extend(HTMLArea.Plugin, {
         * Handler invoked when a menu item is clicked on
         */
        onItemClick: function (item, event) {
-               if (!HTMLArea.isIEBeforeIE9) {
+               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                        this.editor.getSelection().setRanges(this.ranges);
                }
                var button = this.getButton(item.getItemId());
@@ -230,7 +230,7 @@ HTMLArea.ContextMenu = Ext.extend(HTMLArea.Plugin, {
                                // Do not leave a non-ie table cell empty
                        var parent = this.deleteTarget.parentNode;
                        parent.normalize();
-                       if (!Ext.isIE && /^(td|th)$/i.test(parent.nodeName) && parent.childNodes.length == 1) {
+                       if (!HTMLArea.UserAgent.isIE && /^(td|th)$/i.test(parent.nodeName) && parent.childNodes.length == 1) {
                                        // Do not leave a non-ie table cell empty
                                parent.appendChild(this.editor.document.createElement('br'));
                        }
index 008ca2c..12bf21c 100644 (file)
@@ -65,13 +65,13 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
         * This function gets called when the editor is generated
         */
        onGenerate: function () {
-               this.editor.iframe.mon(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'cut', this.cutHandler, this);
+               this.editor.iframe.mon(Ext.get(HTMLArea.UserAgent.isIE ? this.editor.document.body : this.editor.document.documentElement), 'cut', this.cutHandler, this);
                for (var buttonId in this.buttonList) {
                        var button = this.buttonList[buttonId];
                                // Remove button from toolbar, if command is not supported
                                // Starting with Safari 5 and Chrome 6, cut and copy commands are not supported anymore by WebKit
                                // Starting with Firefox 29, cut, copy and paste commands are not supported anymore by Firefox
-                       if (Ext.isGecko || !this.editor.document.queryCommandSupported(buttonId)) {
+                       if (HTMLArea.UserAgent.isGecko || !this.editor.document.queryCommandSupported(buttonId)) {
                                this.editor.toolbar.remove(buttonId);
                        }
                                // Add hot key handling if the button is not enabled in the toolbar
@@ -120,7 +120,7 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                                                this.applyBrowserCommand(buttonId);
                                        }
                                                // Opera will not trigger the onCut event
-                                       if (Ext.isOpera) {
+                                       if (HTMLArea.UserAgent.isOpera) {
                                                this.cutHandler();
                                        }
                                        break;
@@ -130,7 +130,7 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                                                this.applyBrowserCommand(buttonId);
                                        }
                                                // In FF3, the paste operation will indeed trigger the onPaste event not in FF2; nor in Opera
-                                       if (Ext.isOpera || Ext.isGecko2) {
+                                       if (HTMLArea.UserAgent.isOpera || HTMLArea.UserAgent.isGecko2) {
                                                var cleaner = this.getButton('CleanWord');
                                                if (cleaner) {
                                                        cleaner.fireEvent.defer(250, cleaner, ['click', cleaner]);
@@ -147,7 +147,7 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                                // No cleaning required as the pasted cells are copied from the editor.
                                // However paste by Opera cannot be stopped.
                                // Revert Opera's operation as it produces invalid html anyways
-                       if (Ext.isOpera) {
+                       if (HTMLArea.UserAgent.isOpera) {
                                this.editor.inhibitKeyboardInput = true;
                                var bookmark = this.editor.getBookMark().get(this.editor.getSelection().createRange());
                                var html = this.editor.getInnerHTML();
@@ -199,11 +199,11 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                if (/^(a)$/i.test(parent.nodeName)) {
                        parent.normalize();
                        if (!parent.innerHTML || (parent.childNodes.length == 1 && /^(br)$/i.test(parent.firstChild.nodeName))) {
-                               if (!HTMLArea.isIEBeforeIE9) {
+                               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                        var container = parent.parentNode;
                                        this.editor.getDomNode().removeMarkup(parent);
                                                // Opera does not render empty list items
-                                       if (Ext.isOpera && /^(li)$/i.test(container.nodeName) && !container.firstChild) {
+                                       if (HTMLArea.UserAgent.isOpera && /^(li)$/i.test(container.nodeName) && !container.firstChild) {
                                                container.innerHTML = '<br />';
                                                this.editor.getSelection().selectNodeContents(container, true);
                                        }
@@ -212,11 +212,11 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                                }
                        }
                }
-               if (Ext.isWebKit || Ext.isOpera) {
+               if (HTMLArea.UserAgent.isWebKit || HTMLArea.UserAgent.isOpera) {
                        // Remove Apple's span and font tags
                        this.editor.getDomNode().cleanAppleStyleSpans(this.editor.document.body);
                }
-               if (Ext.isWebKit) {
+               if (HTMLArea.UserAgent.isWebKit) {
                        // Reset Safari selection in order to prevent insertion of span and/or font tags on next text input
                        var bookmark = this.editor.getBookMark().get(this.editor.getSelection().createRange());
                        this.editor.getSelection().selectRange(this.editor.getBookMark().moveTo(bookmark));
@@ -235,7 +235,7 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                        case 'Copy':
                        case 'Cut' :
                                HTMLArea.copiedCells = null;
-                               if ((/^(tr)$/i.test(parent.nodeName) && !Ext.isIE) || (/^(td|th)$/i.test(endBlocks.start.nodeName) && /^(td|th)$/i.test(endBlocks.end.nodeName) && !Ext.isGecko && endBlocks.start != endBlocks.end)) {
+                               if ((/^(tr)$/i.test(parent.nodeName) && !HTMLArea.UserAgent.isIE) || (/^(td|th)$/i.test(endBlocks.start.nodeName) && /^(td|th)$/i.test(endBlocks.end.nodeName) && !HTMLArea.UserAgent.isGecko && endBlocks.start != endBlocks.end)) {
                                        HTMLArea.copiedCells = this.collectCells(buttonId, endBlocks);
                                }
                                break;
@@ -254,7 +254,7 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
         */
        pasteCells: function (endBlocks) {
                var cell = null;
-               if (Ext.isGecko) {
+               if (HTMLArea.UserAgent.isGecko) {
                        var range = this.editor.getSelection().createRange();
                        cell = range.startContainer.childNodes[range.startOffset];
                        while (cell && !HTMLArea.DOM.isBlockElement(cell)) {
@@ -314,7 +314,7 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                }
                var row = null;
                var cutRows = [];
-               if (Ext.isGecko) {
+               if (HTMLArea.UserAgent.isGecko) {
                        if (selection.rangeCount == 1) { // Collect the cells in the selected row
                                cells = [];
                                for (var i = 0, n = endBlocks.start.cells.length; i < n; ++i) {
index 50e24d3..a328475 100644 (file)
@@ -64,7 +64,7 @@ HTMLArea.DefaultClean = Ext.extend(HTMLArea.Plugin, {
         * This function gets called when the editor is generated
         */
        onGenerate: function () {
-               this.editor.iframe.mon(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'paste', this.wordCleanHandler, this);
+               this.editor.iframe.mon(Ext.get(HTMLArea.UserAgent.isIE ? this.editor.document.body : this.editor.document.documentElement), 'paste', this.wordCleanHandler, this);
        },
        /*
         * This function cleans all nodes in the node tree below the input node
@@ -79,9 +79,9 @@ HTMLArea.DefaultClean = Ext.extend(HTMLArea.Plugin, {
                        if (newc != node.className) {
                                node.className = newc;
                                if (!/\S/.test(node.className)) {
-                                       if (!Ext.isOpera) {
+                                       if (!HTMLArea.UserAgent.isOpera) {
                                                node.removeAttribute('class');
-                                               if (HTMLArea.isIEBeforeIE9) {
+                                               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                                        node.removeAttribute('className');
                                                }
                                        } else {
@@ -91,7 +91,7 @@ HTMLArea.DefaultClean = Ext.extend(HTMLArea.Plugin, {
                        }
                }
                function clearStyle(node) {
-                       var style = HTMLArea.isIEBeforeIE9 ? node.style.cssText : node.getAttribute('style');
+                       var style = HTMLArea.UserAgent.isIEBeforeIE9 ? node.style.cssText : node.getAttribute('style');
                        if (style) {
                                var declarations = style.split(/\s*;\s*/);
                                for (var i = declarations.length; --i >= 0;) {
@@ -103,7 +103,7 @@ HTMLArea.DefaultClean = Ext.extend(HTMLArea.Plugin, {
                        }
                }
                function stripTag(el) {
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                el.outerHTML = HTMLArea.util.htmlEncode(el.innerText);
                        } else {
                                var txt = document.createTextNode(HTMLArea.DOM.getInnerText(el));
@@ -128,7 +128,7 @@ HTMLArea.DefaultClean = Ext.extend(HTMLArea.Plugin, {
                                case HTMLArea.DOM.TEXT_NODE:
                                case HTMLArea.DOM.DOCUMENT_NODE:
                                case HTMLArea.DOM.DOCUMENT_FRAGMENT_NODE:
-                                       if ((HTMLArea.isIEBeforeIE9 && root.scopeName != 'HTML') || (!HTMLArea.isIEBeforeIE9 && /:/.test(tag)) || /o:p/.test(tag)) {
+                                       if ((HTMLArea.UserAgent.isIEBeforeIE9 && root.scopeName != 'HTML') || (!HTMLArea.UserAgent.isIEBeforeIE9 && /:/.test(tag)) || /o:p/.test(tag)) {
                                                stripTag(root);
                                                return false;
                                        } else {
@@ -150,7 +150,7 @@ HTMLArea.DefaultClean = Ext.extend(HTMLArea.Plugin, {
                        }
                }
                parseTree(this.editor.document.body);
-               if (Ext.isWebKit) {
+               if (HTMLArea.UserAgent.isWebKit) {
                        this.editor.getDomNode().cleanAppleStyleSpans(this.editor.document.body);
                }
        },
index 5539f75..7b7aab6 100644 (file)
@@ -115,7 +115,7 @@ HTMLArea.DefaultImage = Ext.extend(HTMLArea.Plugin, {
                                paddingRight:   isNaN(parseInt(this.image.style.paddingRight)) ? '' : parseInt(this.image.style.paddingRight),
                                paddingBottom:  isNaN(parseInt(this.image.style.paddingBottom)) ? '' : parseInt(this.image.style.paddingBottom),
                                paddingLeft:    isNaN(parseInt(this.image.style.paddingLeft)) ? '' : parseInt(this.image.style.paddingLeft),
-                               cssFloat:       HTMLArea.isIEBeforeIE9 ? this.image.style.styleFloat : this.image.style.cssFloat
+                               cssFloat:       HTMLArea.UserAgent.isIEBeforeIE9 ? this.image.style.styleFloat : this.image.style.cssFloat
                        };
                } else {
                        this.parameters = {
@@ -432,10 +432,10 @@ HTMLArea.DefaultImage = Ext.extend(HTMLArea.Plugin, {
                if (!image) {
                        var range = this.editor.getSelection().createRange();
                        this.editor.getSelection().execCommand('InsertImage', false, this.parameters.url);
-                       if (Ext.isWebKit) {
+                       if (HTMLArea.UserAgent.isWebKit) {
                                this.editor.getDomNode().cleanAppleStyleSpans(this.editor.document.body);
                        }
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                image = range.parentElement();
                                if (!/^img$/i.test(image.nodeName)) {
                                        image = image.previousSibling;
@@ -483,7 +483,7 @@ HTMLArea.DefaultImage = Ext.extend(HTMLArea.Plugin, {
                                                }
                                                break;
                                        case 'cssFloat':
-                                               if (HTMLArea.isIEBeforeIE9) {
+                                               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                                        image.style.styleFloat = value;
                                                } else {
                                                        image.style.cssFloat = value;
index da63092..aeded54 100644 (file)
@@ -84,7 +84,7 @@ HTMLArea.DefaultLink = Ext.extend(HTMLArea.Plugin, {
         * This function gets called when the editor is generated
         */
        onGenerate: function () {
-               if (Ext.isIE) {
+               if (HTMLArea.UserAgent.isIE) {
                        this.editor.iframe.htmlRenderer.stripBaseUrl = this.stripBaseUrl;
                }
        },
@@ -122,7 +122,7 @@ HTMLArea.DefaultLink = Ext.extend(HTMLArea.Plugin, {
                                        };
                                } else {
                                        this.parameters = {
-                                               href:   (Ext.isIE && this.stripBaseUrl) ? this.stripBaseURL(this.link.href) : this.link.getAttribute('href'),
+                                               href:   (HTMLArea.UserAgent.isIE && this.stripBaseUrl) ? this.stripBaseURL(this.link.href) : this.link.getAttribute('href'),
                                                title:  this.link.title,
                                                target: this.link.target
                                        };
@@ -304,7 +304,7 @@ HTMLArea.DefaultLink = Ext.extend(HTMLArea.Plugin, {
                        this.restoreSelection();
                        this.editor.getSelection().execCommand('CreateLink', false, href);
                        a = this.editor.getSelection().getParentElement();
-                       if (!HTMLArea.isIEBeforeIE9 && !/^a$/i.test(a.nodeName)) {
+                       if (!HTMLArea.UserAgent.isIEBeforeIE9 && !/^a$/i.test(a.nodeName)) {
                                var range = this.editor.getSelection().createRange();
                                if (range.startContainer.nodeType !== HTMLArea.DOM.TEXT_NODE) {
                                        a = range.startContainer.childNodes[range.startOffset];
@@ -323,7 +323,7 @@ HTMLArea.DefaultLink = Ext.extend(HTMLArea.Plugin, {
                if (a && /^a$/i.test(a.nodeName)) {
                        a.title = title;
                        a.target = target;
-                       if (Ext.isOpera) {
+                       if (HTMLArea.UserAgent.isOpera) {
                                this.editor.getSelection().selectNodeContents(a, false);
                        } else {
                                this.editor.getSelection().selectNodeContents(a);
@@ -382,7 +382,7 @@ HTMLArea.DefaultLink = Ext.extend(HTMLArea.Plugin, {
                                case 'UnLink':
                                        var link = false;
                                                // Let's see if a link was double-clicked in Firefox
-                                       if (Ext.isGecko && !selectionEmpty) {
+                                       if (HTMLArea.UserAgent.isGecko && !selectionEmpty) {
                                                var range = this.editor.getSelection().createRange();
                                                if (range.startContainer.nodeType === HTMLArea.DOM.ELEMENT_NODE && range.startContainer == range.endContainer && (range.endOffset - range.startOffset == 1)) {
                                                        var node = range.startContainer.childNodes[range.startOffset];
index d5c2c6d..fa562c7 100644 (file)
@@ -145,7 +145,7 @@ HTMLArea.DefinitionList = Ext.extend(HTMLArea.BlockElements, {
                        if (attributeValue) newNode.setAttribute(attributeName, attributeValue);
                }
                        // In IE, the above fails to update the classname and style attributes.
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        if (node.style.cssText) {
                                newNode.style.cssText = node.style.cssText;
                        }
@@ -214,8 +214,8 @@ HTMLArea.DefinitionList = Ext.extend(HTMLArea.BlockElements, {
                if (this.editor.getSelection().isEmpty() && /^dd$/i.test(parentElement.nodeName)) {
                        var list = parentElement.appendChild(this.editor.document.createElement('dl'));
                        var term = list.appendChild(this.editor.document.createElement('dt'));
-                       if (!HTMLArea.isIEBeforeIE9) {
-                               if (Ext.isWebKit) {
+                       if (!HTMLArea.UserAgent.isIEBeforeIE9) {
+                               if (HTMLArea.UserAgent.isWebKit) {
                                        term.innerHTML = '<br />';
                                } else {
                                        term.appendChild(this.editor.document.createTextNode(''));
index cf2526b..28ad54b 100644 (file)
@@ -26,7 +26,7 @@ HTMLArea.InlineElements = Ext.extend(HTMLArea.Plugin, {
                        this.allowedAttributes = this.getPluginInstance('TextStyle').allowedAttributes;
                } else {
                        this.allowedAttributes = new Array('id', 'title', 'lang', 'xml:lang', 'dir', 'class', 'itemscope', 'itemtype', 'itemprop');
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.addAllowedAttribute('className');
                        }
                }
@@ -200,7 +200,7 @@ HTMLArea.InlineElements = Ext.extend(HTMLArea.Plugin, {
                var ancestors = editor.getSelection().getAllAncestors();
                var elementIsAncestor = false;
                var fullNodeSelected = false;
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        var bookmark = editor.getBookMark().get(range);
                }
                        // Check if the chosen element is among the ancestors
@@ -224,9 +224,9 @@ HTMLArea.InlineElements = Ext.extend(HTMLArea.Plugin, {
                                if (element === "bdo") {
                                        newElement.setAttribute("dir", "rtl");
                                }
-                               if (!HTMLArea.isIEBeforeIE9) {
+                               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                        if (fullNodeSelected && statusBarSelection) {
-                                               if (Ext.isWebKit) {
+                                               if (HTMLArea.UserAgent.isWebKit) {
                                                        newElement = parent.parentNode.insertBefore(newElement, statusBarSelection);
                                                        newElement.appendChild(statusBarSelection);
                                                        newElement.normalize();
@@ -267,7 +267,7 @@ HTMLArea.InlineElements = Ext.extend(HTMLArea.Plugin, {
                                        }
                                        var parentElement = parent.parentNode;
                                        editor.getDomNode().removeMarkup(parent);
-                                       if (Ext.isWebKit && this.isInlineElement(parentElement)) {
+                                       if (HTMLArea.UserAgent.isWebKit && this.isInlineElement(parentElement)) {
                                                editor.getSelection().selectNodeContents(parentElement, false);
                                        }
                                }
@@ -303,7 +303,7 @@ HTMLArea.InlineElements = Ext.extend(HTMLArea.Plugin, {
                        }
                }
                        // In IE before IE9, the above fails to update the class and style attributes.
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        if (element.style.cssText) {
                                newElement.style.cssText = element.style.cssText;
                        }
index e0c9bc6..3220404 100644 (file)
@@ -137,7 +137,7 @@ HTMLArea.InsertSmiley = Ext.extend(HTMLArea.Plugin, {
                imgTag.setAttribute('alt', target.getAttribute('ext:qtitle'));
                imgTag.setAttribute('title', target.getAttribute('ext:qtip'));
                this.editor.getSelection().insertNode(imgTag);
-               if (!HTMLArea.isIEBeforeIE9) {
+               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                        this.editor.getSelection().selectNode(imgTag, false);
                }
                this.close();
index 27d53fa..edcf959 100644 (file)
@@ -41,7 +41,7 @@ HTMLArea.Language = Ext.extend(HTMLArea.Plugin, {
                }
                if (!this.allowedAttributes) {
                        this.allowedAttributes = new Array('id', 'title', 'lang', 'xml:lang', 'dir', 'class');
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.allowedAttributes.push('className');
                        }
                }
@@ -140,7 +140,7 @@ HTMLArea.Language = Ext.extend(HTMLArea.Plugin, {
                                var selector = 'body.htmlarea-show-language-marks *[' + 'lang="' + option.get('value') + '"]:before';
                                var style = 'content: "' + option.get('value') + ': ";';
                                var rule = selector + ' { ' + style + ' }';
-                               if (!HTMLArea.isIEBeforeIE9) {
+                               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                        try {
                                                styleSheet.insertRule(rule, styleSheet.cssRules.length);
                                        } catch (e) {
@@ -233,15 +233,15 @@ HTMLArea.Language = Ext.extend(HTMLArea.Plugin, {
                        if (endPointsInSameBlock) {
                                var ancestors = this.editor.getSelection().getAllAncestors();
                                for (var i = 0; i < ancestors.length; ++i) {
-                                       fullNodeSelected =  (!HTMLArea.isIEBeforeIE9 && ((statusBarSelection === ancestors[i] && ancestors[i].textContent === range.toString()) || (!statusBarSelection && ancestors[i].textContent === range.toString())))
-                                               || (HTMLArea.isIEBeforeIE9 && statusBarSelection === ancestors[i] && ((this.editor.getSelection().getType() !== 'Control' && ancestors[i].innerText === range.text) || (this.editor.getSelection().getType() === 'Control' && ancestors[i].innerText === range.item(0).text)));
+                                       fullNodeSelected =  (!HTMLArea.UserAgent.isIEBeforeIE9 && ((statusBarSelection === ancestors[i] && ancestors[i].textContent === range.toString()) || (!statusBarSelection && ancestors[i].textContent === range.toString())))
+                                               || (HTMLArea.UserAgent.isIEBeforeIE9 && statusBarSelection === ancestors[i] && ((this.editor.getSelection().getType() !== 'Control' && ancestors[i].innerText === range.text) || (this.editor.getSelection().getType() === 'Control' && ancestors[i].innerText === range.item(0).text)));
                                        if (fullNodeSelected) {
                                                parent = ancestors[i];
                                                break;
                                        }
                                }
                                        // Working around bug in Safari selectNodeContents
-                               if (!fullNodeSelected && Ext.isWebKit && statusBarSelection && statusBarSelection.textContent === range.toString()) {
+                               if (!fullNodeSelected && HTMLArea.UserAgent.isWebKit && statusBarSelection && statusBarSelection.textContent === range.toString()) {
                                        fullNodeSelected = true;
                                        parent = statusBarSelection;
                                }
@@ -260,7 +260,7 @@ HTMLArea.Language = Ext.extend(HTMLArea.Plugin, {
                                var newElement = this.editor.document.createElement('span');
                                this.setLanguageAttributes(newElement, language);
                                this.editor.getDomNode().wrapWithInlineElement(newElement, range);
-                               if (!HTMLArea.isIEBeforeIE9) {
+                               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                        range.detach();
                                }
                        }
@@ -401,15 +401,15 @@ HTMLArea.Language = Ext.extend(HTMLArea.Plugin, {
                                        if (!selectionEmpty) {
                                                if (endPointsInSameBlock) {
                                                        for (var i = 0; i < ancestors.length; ++i) {
-                                                               fullNodeSelected =  (!HTMLArea.isIEBeforeIE9 && ((statusBarSelection === ancestors[i] && ancestors[i].textContent === range.toString()) || (!statusBarSelection && ancestors[i].textContent === range.toString())))
-                                                                       || (HTMLArea.isIEBeforeIE9 && statusBarSelection === ancestors[i] && ((this.editor.getSelection().getType() !== 'Control' && ancestors[i].innerText === range.text) || (this.editor.getSelection().getType() === 'Control' && ancestors[i].innerText === range.item(0).text)));
+                                                               fullNodeSelected =  (!HTMLArea.UserAgent.isIEBeforeIE9 && ((statusBarSelection === ancestors[i] && ancestors[i].textContent === range.toString()) || (!statusBarSelection && ancestors[i].textContent === range.toString())))
+                                                                       || (HTMLArea.UserAgent.isIEBeforeIE9 && statusBarSelection === ancestors[i] && ((this.editor.getSelection().getType() !== 'Control' && ancestors[i].innerText === range.text) || (this.editor.getSelection().getType() === 'Control' && ancestors[i].innerText === range.item(0).text)));
                                                                if (fullNodeSelected) {
                                                                        parent = ancestors[i];
                                                                        break;
                                                                }
                                                        }
                                                                // Working around bug in Safari selectNodeContents
-                                                       if (!fullNodeSelected && Ext.isWebKit && statusBarSelection && statusBarSelection.textContent === range.toString()) {
+                                                       if (!fullNodeSelected && HTMLArea.UserAgent.isWebKit && statusBarSelection && statusBarSelection.textContent === range.toString()) {
                                                                fullNodeSelected = true;
                                                                parent = statusBarSelection;
                                                        }
index 012514f..78b23c6 100644 (file)
@@ -124,7 +124,7 @@ HTMLArea.MicrodataSchema = Ext.extend(HTMLArea.Plugin, {
                        var selector = 'body.htmlarea-show-microdata *[' + store.storeId + '="' + option.get('name') + '"]:before';
                        var style = 'content: "' + option.get('label') + ': "; font-variant: small-caps;';
                        var rule = selector + ' { ' + style + ' }';
-                       if (!HTMLArea.isIEBeforeIE9) {
+                       if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                try {
                                        styleSheet.insertRule(rule, styleSheet.cssRules.length);
                                } catch (e) {
index e47904f..7992ac4 100644 (file)
@@ -105,7 +105,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                        this.toggleButton('PasteToggle');
                }
                        // Start monitoring paste events
-               this.editor.iframe.mon(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'paste', this.onPaste, this);
+               this.editor.iframe.mon(Ext.get(HTMLArea.UserAgent.isIE ? this.editor.document.body : this.editor.document.documentElement), 'paste', this.onPaste, this);
        },
        /*
         * This function toggles the state of a button
@@ -238,7 +238,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                        switch (this.currentBehaviour) {
                                case 'plainText':
                                        // Only IE before IE9 and Chrome will allow access to the clipboard content by default, in plain text only however
-                                       if (HTMLArea.isIEBeforeIE9 || Ext.isChrome) {
+                                       if (HTMLArea.UserAgent.isIEBeforeIE9 || HTMLArea.UserAgent.isChrome) {
                                                var clipboardText = this.grabClipboardText(event);
                                                if (clipboardText) {
                                                        this.editor.getSelection().insertHtml(clipboardText);
@@ -247,7 +247,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                                        }
                                case 'pasteStructure':
                                case 'pasteFormat':
-                                       if (Ext.isIE) {
+                                       if (HTMLArea.UserAgent.isIE) {
                                                        // Show the pasting pad
                                                this.openPastingPad(
                                                        'PasteToggle',
@@ -260,7 +260,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                                                                'PasteToggle'
                                                        )
                                                );
-                                               if (HTMLArea.isIEBeforeIE9) {
+                                               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                                        event.browserEvent.returnValue = false;
                                                } else {
                                                        event.stopEvent();
@@ -271,7 +271,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                                                this.redirectPaste();
                                                        // Process the content of the hidden section after the paste operation is completed
                                                        // WebKit seems to be pondering a very long time over what is happenning here...
-                                               this.processPastedContent.defer(Ext.isWebKit ? 500 : 50, this);
+                                               this.processPastedContent.defer(HTMLArea.UserAgent.isWebKit ? 500 : 50, this);
                                        }
                                        break;
                                default:
@@ -319,7 +319,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                HTMLArea.DOM.addClass(hiddenSection, 'htmlarea-paste-hidden-section');
                hiddenSection.setAttribute('style', 'position: absolute; left: -10000px; top: ' + this.editor.document.body.scrollTop + 'px; overflow: hidden;');
                hiddenSection = this.editor.document.body.appendChild(hiddenSection);
-               if (Ext.isWebKit) {
+               if (HTMLArea.UserAgent.isWebKit) {
                        hiddenSection.innerHTML = '&nbsp;';
                }
                        // Move the selection to the hidden section and let the browser paste into the hidden section
@@ -404,7 +404,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                                                name: 'contentframe',
                                                tag: 'iframe',
                                                cls: 'contentframe',
-                                               src: Ext.isGecko ? 'javascript:void(0);' : HTMLArea.editorUrl + 'popups/blank.html'
+                                               src: HTMLArea.UserAgent.isGecko ? 'javascript:void(0);' : HTMLArea.editorUrl + 'popups/blank.html'
                                        }
                                }
                        ],
index 644c8cc..3b5bbd2 100644 (file)
@@ -570,7 +570,7 @@ HTMLArea.Plugin = Ext.extend(HTMLArea.Plugin, {
         */
        saveSelection: function () {
                        // If IE, save the current selection
-               if (Ext.isIE) {
+               if (HTMLArea.UserAgent.isIE) {
                        this.savedRange = this.editor.getSelection().createRange();
                }
        },
@@ -580,7 +580,7 @@ HTMLArea.Plugin = Ext.extend(HTMLArea.Plugin, {
         */
        restoreSelection: function () {
                        // If IE, restore the selection saved when the window was shown
-               if (Ext.isIE && this.savedRange) {
+               if (HTMLArea.UserAgent.isIE && this.savedRange) {
                                // Restoring the selection will not work if the inner html was replaced by the plugin
                        try {
                                this.editor.getSelection().selectRange(this.savedRange);
index eb2611b..3278ba4 100644 (file)
@@ -36,7 +36,7 @@ HTMLArea.SelectFont = Ext.extend(HTMLArea.Plugin, {
                }
                if (!this.allowedAttributes) {
                        this.allowedAttributes = new Array('id', 'title', 'lang', 'xml:lang', 'dir', 'class', 'style');
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.allowedAttributes.push('className');
                        }
                }
@@ -165,7 +165,7 @@ HTMLArea.SelectFont = Ext.extend(HTMLArea.Plugin, {
                        this.setStyle(element, combo.itemId, param);
                                // Wrap the selection with span tag with the style attribute
                        editor.getDomNode().wrapWithInlineElement(element, range);
-                       if (!HTMLArea.isIEBeforeIE9) {
+                       if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                range.detach();
                        }
                }
@@ -183,10 +183,10 @@ HTMLArea.SelectFont = Ext.extend(HTMLArea.Plugin, {
        setStyle: function (element, buttonId, value) {
                element.style[this.styleProperty[buttonId]] = (value && value !== 'none') ? value : '';
                        // In IE, we need to remove the empty attribute in order to unset it
-               if (Ext.isIE && (!value || value == 'none')) {
+               if (HTMLArea.UserAgent.isIE && (!value || value == 'none')) {
                        element.style.removeAttribute(this.styleProperty[buttonId], false);
                }
-               if (Ext.isOpera) {
+               if (HTMLArea.UserAgent.isOpera) {
                                // Opera 9.60 replaces single quotes with double quotes
                        element.style.cssText = element.style.cssText.replace(/\"/g, "\'");
                                // Opera 9.60 removes from the list of fonts any fonts that are not installed on the client system
@@ -207,7 +207,7 @@ HTMLArea.SelectFont = Ext.extend(HTMLArea.Plugin, {
                        var parentElement = statusBarSelection ? statusBarSelection : editor.getSelection().getParentElement();
                        var value = parentElement.style[this.styleProperty[select.itemId]];
                        if (!value) {
-                               if (!HTMLArea.isIEBeforeIE9) {
+                               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                        if (editor.document.defaultView && editor.document.defaultView.getComputedStyle(parentElement, null)) {
                                                value = editor.document.defaultView.getComputedStyle(parentElement, null).getPropertyValue(this.cssProperty[select.itemId]);
                                        }
index 31ab908..adc12dc 100644 (file)
@@ -180,7 +180,7 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                                                name: 'contentframe',
                                                tag: 'iframe',
                                                cls: 'contentframe',
-                                               src: Ext.isGecko ? 'javascript:void(0);' : HTMLArea.editorUrl + 'popups/blank.html'
+                                               src: HTMLArea.UserAgent.isGecko ? 'javascript:void(0);' : HTMLArea.editorUrl + 'popups/blank.html'
                                        }
                                },{
                                                // The original word
index 1b17896..7dcde24 100644 (file)
@@ -37,7 +37,7 @@ HTMLArea.TYPO3Color = Ext.extend(HTMLArea.Plugin, {
                }
                if (!this.allowedAttributes) {
                        this.allowedAttributes = new Array('id', 'title', 'lang', 'xml:lang', 'dir', 'class', 'style');
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.allowedAttributes.push('className');
                        }
                }
index 4612481..b40c6db 100644 (file)
@@ -65,12 +65,12 @@ HTMLArea.TYPO3HtmlParser = Ext.extend(HTMLArea.Plugin, {
         * This function gets called when the editor is generated
         */
        onGenerate: function () {
-               this.editor.iframe.mon(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'paste', this.wordCleanHandler, this);
+               this.editor.iframe.mon(Ext.get(HTMLArea.UserAgent.isIE ? this.editor.document.body : this.editor.document.documentElement), 'paste', this.wordCleanHandler, this);
        },
        clean: function() {
                this.editor.inhibitKeyboardInput = true;
                var editor = this.editor;
-               if (Ext.isWebKit) {
+               if (HTMLArea.UserAgent.isWebKit) {
                        editor.getDomNode().cleanAppleStyleSpans(editor.document.body);
                }
                var bookmark = editor.getBookMark().get(editor.getSelection().createRange());
index 44fa0ce..bd2ede1 100644 (file)
@@ -80,7 +80,7 @@ HTMLArea.TYPO3Image = Ext.extend(HTMLArea.Plugin, {
                        ),
                        this.makeUrlFromModulePath(this.imageModulePath, additionalParameter)
                );
-               this.dialog.mon(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'drop', this.onDrop, this, {single: true});
+               this.dialog.mon(Ext.get(HTMLArea.UserAgent.isIE ? this.editor.document.body : this.editor.document.documentElement), 'drop', this.onDrop, this, {single: true});
                return false;
        },
        /*
@@ -96,7 +96,7 @@ HTMLArea.TYPO3Image = Ext.extend(HTMLArea.Plugin, {
         * Handlers for drag and drop operations
         */
        onDrop: function (event) {
-               if (Ext.isWebKit) {
+               if (HTMLArea.UserAgent.isWebKit) {
                        this.editor.iframe.onDrop();
                }
                this.close();
index 75b6d3e..7029adb 100644 (file)
@@ -201,11 +201,11 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
                        }
                                // Update link href
                                // In IE, setting href may update the content of the element. We don't want this feature.
-                       if (Ext.isIE) {
+                       if (HTMLArea.UserAgent.isIE) {
                                var content = node.innerHTML;
                        }
-                       node.href = Ext.isGecko ? encodeURI(theLink) : theLink;
-                       if (Ext.isIE) {
+                       node.href = HTMLArea.UserAgent.isGecko ? encodeURI(theLink) : theLink;
+                       if (HTMLArea.UserAgent.isIE) {
                                node.innerHTML = content;
                        }
                                // Update link attributes
@@ -215,7 +215,7 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
                                // Cleanup selected range
                        range = this.editor.getSelection().createRange();
                                // Clean existing anchors otherwise Mozilla may create nested anchors while IE may update existing link
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.cleanAllLinks(node, range, true);
                                this.editor.getSelection().execCommand('UnLink', false, null);
                        } else {
@@ -226,7 +226,7 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
                                range = this.editor.getBookMark().moveTo(bookMark);
                                this.editor.getSelection().selectRange(range);
                        }
-                       if (Ext.isGecko) {
+                       if (HTMLArea.UserAgent.isGecko) {
                                this.editor.getSelection().execCommand('CreateLink', false, encodeURI(theLink));
                        } else {
                                this.editor.getSelection().execCommand('CreateLink', false, theLink);
@@ -237,7 +237,7 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
                        range = this.editor.getSelection().createRange();
                        if (node) {
                                        // Export trailing br that IE may include in the link
-                               if (Ext.isIE) {
+                               if (HTMLArea.UserAgent.isIE) {
                                        if (node.lastChild && /^br$/i.test(node.lastChild.nodeName)) {
                                                HTMLArea.DOM.removeFromParent(node.lastChild);
                                                node.parentNode.insertBefore(this.editor.document.createElement('br'), node.nextSibling);
@@ -273,7 +273,7 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
                }
                if (HTMLArea.classesAnchorSetup) {
                        var range = this.editor.getSelection().createRange();
-                       if (!HTMLArea.isIEBeforeIE9) {
+                       if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.cleanAllLinks(node, range, false);
                        } else {
                                this.cleanAllLinks(node, range, true);
@@ -304,7 +304,7 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
        setLinkAttributes: function(node, range, cur_target, cur_class, cur_title, imageNode, addIconAfterLink, additionalValues) {
                if (/^a$/i.test(node.nodeName)) {
                        var nodeInRange = false;
-                       if (!HTMLArea.isIEBeforeIE9) {
+                       if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.editor.focus();
                                nodeInRange = HTMLArea.DOM.rangeIntersectsNode(range, node);
                        } else {
@@ -325,7 +325,7 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
                                                node.insertBefore(imageNode.cloneNode(false), node.firstChild);
                                        }
                                }
-                               if (Ext.isGecko) {
+                               if (HTMLArea.UserAgent.isGecko) {
                                        node.href = decodeURI(node.href);
                                }
                                if (cur_target.trim()) node.target = cur_target.trim();
@@ -333,9 +333,9 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
                                if (cur_class.trim()) {
                                        node.className = cur_class.trim();
                                } else {
-                                       if (!Ext.isOpera) {
+                                       if (!HTMLArea.UserAgent.isOpera) {
                                                node.removeAttribute('class');
-                                               if (HTMLArea.isIEBeforeIE9) {
+                                               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                                        node.removeAttribute('className');
                                                }
                                        } else {
@@ -399,7 +399,7 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
        cleanAllLinks: function(node, range, keepLinks) {
                if (/^a$/i.test(node.nodeName)) {
                        var intersection = false;
-                       if (!HTMLArea.isIEBeforeIE9) {
+                       if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.editor.focus();
                                intersection = HTMLArea.DOM.rangeIntersectsNode(range, node);
                        } else {
@@ -458,7 +458,7 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
                                case 'UnLink':
                                        var link = false;
                                                // Let's see if a link was double-clicked in Firefox
-                                       if (Ext.isGecko && !selectionEmpty) {
+                                       if (HTMLArea.UserAgent.isGecko && !selectionEmpty) {
                                                var range = this.editor.getSelection().createRange();
                                                if (range.startContainer.nodeType === HTMLArea.DOM.ELEMENT_NODE && range.startContainer == range.endContainer && (range.endOffset - range.startOffset == 1)) {
                                                        var node = range.startContainer.childNodes[range.startOffset];
index 631381d..8c26791 100644 (file)
@@ -103,7 +103,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                ['cell-insert-before',  'td,th',                        'cellinsertbefore', false, 'cell-insert-before'],
                ['cell-insert-after',   'td,th',                        'cellinsertafter', false, 'cell-insert-after'],
                ['cell-delete',         'td,th',                        'celldelete', false, 'cell-delete'],
-               ['cell-merge',          Ext.isGecko? 'tr' : 'td,th',    'cellmerge', false, 'cell-merge'],
+               ['cell-merge',          HTMLArea.UserAgent.isGecko? 'tr' : 'td,th',     'cellmerge', false, 'cell-merge'],
                ['cell-split',          'td,th[colSpan!=1,rowSpan!=1]', 'cellsplit', false, 'cell-split']
        ],
        /*
@@ -414,7 +414,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                                tbody.appendChild(tr);
                                for (var j = params.f_cols; --j >= 0;) {
                                        var td = doc.createElement('td');
-                                       if (!HTMLArea.isIEBeforeIE9) {
+                                       if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                                td.innerHTML = '<br />';
                                        }
                                        tr.appendChild(td);
@@ -518,7 +518,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                        }
                }
                if (this.dialog.arguments.buttonId === "InsertTable") {
-                       if (!HTMLArea.isIEBeforeIE9) {
+                       if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.editor.getSelection().insertNode(table);
                        } else {
                                table.id = "htmlarea_table_insert";
@@ -625,7 +625,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                        this.toggleBorders(true);
                }
                        // Register handler for the enter key for IE and Opera when buttons.table.disableEnterParagraphs is set in the editor configuration
-               if ((Ext.isIE || Ext.isOpera) && this.disableEnterParagraphs) {
+               if ((HTMLArea.UserAgent.isIE || HTMLArea.UserAgent.isOpera) && this.disableEnterParagraphs) {
                        this.editor.iframe.keyMap.addBinding({
                                key: Ext.EventObject.ENTER,
                                shift: false,
@@ -644,7 +644,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                                        button.setInactive(!HTMLArea.DOM.hasClass(this.editor.document.body, 'htmlarea-showtableborders'));
                                        break;
                                case 'TO-cell-merge':
-                                       if (Ext.isGecko) {
+                                       if (HTMLArea.UserAgent.isGecko) {
                                                var selection = this.editor.getSelection().get().selection;
                                                button.setDisabled(button.disabled || selection.rangeCount < 2);
                                        }
@@ -665,7 +665,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                var buttonId = this.translateHotKey(id);
                buttonId = buttonId ? buttonId : id;
 
-               var mozbr = !HTMLArea.isIEBeforeIE9 ? "<br />" : "";
+               var mozbr = !HTMLArea.UserAgent.isIEBeforeIE9 ? "<br />" : "";
                var tableParts = ["tfoot", "thead", "tbody"];
                var tablePartsIndex = { tfoot : 0, thead : 1, tbody : 2 };
 
@@ -845,7 +845,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                        var cell = this.editor.getSelection().getFirstAncestorOfType(['td', 'th']);
                        if (!cell) break;
                        var sel = editor.getSelection().get().selection;
-                       if (Ext.isGecko && !sel.isCollapsed) {
+                       if (HTMLArea.UserAgent.isGecko && !sel.isCollapsed) {
                                var cells = getSelectedCells(sel);
                                for (i = 0; i < cells.length; ++i) {
                                        splitRow(cells[i]);
@@ -887,7 +887,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                        var cell = this.editor.getSelection().getFirstAncestorOfType(['td', 'th']);
                        if (!cell) break;
                        var sel = this.editor.getSelection().get().selection;
-                       if (Ext.isGecko && !sel.isCollapsed) {
+                       if (HTMLArea.UserAgent.isGecko && !sel.isCollapsed) {
                                var cells = getSelectedCells(sel);
                                for (i = 0; i < cells.length; ++i) {
                                        splitCol(cells[i]);
@@ -941,7 +941,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                        var cell = this.editor.getSelection().getFirstAncestorOfType(['td', 'th']);
                        if (!cell) break;
                        var sel = this.editor.getSelection().get().selection;
-                       if (Ext.isGecko && !sel.isCollapsed) {
+                       if (HTMLArea.UserAgent.isGecko && !sel.isCollapsed) {
                                var cells = getSelectedCells(sel);
                                for (i = 0; i < cells.length; ++i) {
                                        splitCell(cells[i]);
@@ -990,7 +990,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                        for (var k = tableParts.length; --k >= 0;) rows[k] = [];
                        var row = null;
                        var cells = null;
-                       if (Ext.isGecko) {
+                       if (HTMLArea.UserAgent.isGecko) {
                                try {
                                        while (range = sel.getRangeAt(i++)) {
                                                var td = range.startContainer.childNodes[range.startOffset];
@@ -1549,7 +1549,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                        }
                }
                        // In IE before IE9, the above fails to update the classname and style attributes.
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        if (element.style.cssText) {
                                newCell.style.cssText = element.style.cssText;
                        }
@@ -1609,7 +1609,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
         */
        processStyle: function (element, params) {
                var style = element.style;
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        style.styleFloat = "";
                } else {
                        style.cssFloat = "";
@@ -2590,7 +2590,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                        parentElement = parentElement.parentNode;
                }
                if (/^(td|th)$/i.test(parentElement.nodeName)) {
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                range.pasteHTML('<br />');
                                range.select();
                        } else {
index f61efbc..84c2388 100644 (file)
@@ -87,12 +87,12 @@ HTMLArea.TextIndicator = Ext.extend(HTMLArea.Plugin, {
                        };
                        try {
                                        //  Note: IE always reports FFFFFF as background color
-                               style.backgroundColor = HTMLArea.util.Color.colorToRgb(doc.queryCommandValue((Ext.isIE || Ext.isWebKit) ? 'BackColor' : 'HiliteColor'));
+                               style.backgroundColor = HTMLArea.util.Color.colorToRgb(doc.queryCommandValue((HTMLArea.UserAgent.isIE || HTMLArea.UserAgent.isWebKit) ? 'BackColor' : 'HiliteColor'));
                                style.color = HTMLArea.util.Color.colorToRgb(doc.queryCommandValue('ForeColor'));
                                style.fontFamily = doc.queryCommandValue('FontName');
                        } catch (e) { }
                                // queryCommandValue does not work in Gecko
-                       if (Ext.isGecko) {
+                       if (HTMLArea.UserAgent.isGecko) {
                                var computedStyle = editor.iframe.getEl().dom.contentWindow.getComputedStyle(editor.getSelection().getParentElement(), null);
                                style.color = computedStyle.getPropertyValue('color');
                                style.backgroundColor = computedStyle.getPropertyValue('background-color');
index c0b9b88..ee99a77 100644 (file)
@@ -49,7 +49,7 @@ HTMLArea.TextStyle = Ext.extend(HTMLArea.Plugin, {
 
                        // Allowed attributes on inline elements
                this.allowedAttributes = new Array('id', 'title', 'lang', 'xml:lang', 'dir', 'class', 'itemscope', 'itemtype', 'itemprop');
-               if (HTMLArea.isIEBeforeIE9) {
+               if (HTMLArea.UserAgent.isIEBeforeIE9) {
                        this.addAllowedAttribute('className');
                }
                /*
@@ -125,8 +125,8 @@ HTMLArea.TextStyle = Ext.extend(HTMLArea.Plugin, {
                if (!selectionEmpty) {
                                // The selection is not empty
                        for (var i = 0; i < ancestors.length; ++i) {
-                               fullNodeSelected = (HTMLArea.isIEBeforeIE9 && ((statusBarSelection === ancestors[i] && ancestors[i].innerText === range.text) || (!statusBarSelection && ancestors[i].innerText === range.text)))
-                                                       || (!HTMLArea.isIEBeforeIE9 && ((statusBarSelection === ancestors[i] && ancestors[i].textContent === range.toString()) || (!statusBarSelection && ancestors[i].textContent === range.toString())));
+                               fullNodeSelected = (HTMLArea.UserAgent.isIEBeforeIE9 && ((statusBarSelection === ancestors[i] && ancestors[i].innerText === range.text) || (!statusBarSelection && ancestors[i].innerText === range.text)))
+                                                       || (!HTMLArea.UserAgent.isIEBeforeIE9 && ((statusBarSelection === ancestors[i] && ancestors[i].textContent === range.toString()) || (!statusBarSelection && ancestors[i].textContent === range.toString())));
                                if (fullNodeSelected) {
                                        if (this.isInlineElement(ancestors[i])) {
                                                parent = ancestors[i];
@@ -135,7 +135,7 @@ HTMLArea.TextStyle = Ext.extend(HTMLArea.Plugin, {
                                }
                        }
                                // Working around bug in Safari selectNodeContents
-                       if (!fullNodeSelected && Ext.isWebKit && statusBarSelection && this.isInlineElement(statusBarSelection) && statusBarSelection.textContent === range.toString()) {
+                       if (!fullNodeSelected && HTMLArea.UserAgent.isWebKit && statusBarSelection && this.isInlineElement(statusBarSelection) && statusBarSelection.textContent === range.toString()) {
                                fullNodeSelected = true;
                                parent = statusBarSelection;
                        }
@@ -147,7 +147,7 @@ HTMLArea.TextStyle = Ext.extend(HTMLArea.Plugin, {
                                var newElement = editor.document.createElement('span');
                                HTMLArea.DOM.addClass(newElement, className);
                                editor.getDomNode().wrapWithInlineElement(newElement, range);
-                               if (!HTMLArea.isIEBeforeIE9) {
+                               if (!HTMLArea.UserAgent.isIEBeforeIE9) {
                                        range.detach();
                                }
                        }
@@ -252,7 +252,7 @@ HTMLArea.TextStyle = Ext.extend(HTMLArea.Plugin, {
                        if (!selectionEmpty) {
                                for (var i = 0; i < ancestors.length; ++i) {
                                        fullNodeSelected = (statusBarSelection === ancestors[i])
-                                               && ((!HTMLArea.isIEBeforeIE9 && ancestors[i].textContent === range.toString()) || (HTMLArea.isIEBeforeIE9 && ancestors[i].innerText === range.text));
+                                               && ((!HTMLArea.UserAgent.isIEBeforeIE9 && ancestors[i].textContent === range.toString()) || (HTMLArea.UserAgent.isIEBeforeIE9 && ancestors[i].innerText === range.text));
                                        if (fullNodeSelected) {
                                                if (!HTMLArea.DOM.isBlockElement(ancestors[i])) {
                                                        tagName = ancestors[i].nodeName.toLowerCase();
@@ -264,7 +264,7 @@ HTMLArea.TextStyle = Ext.extend(HTMLArea.Plugin, {
                                        }
                                }
                                        // Working around bug in Safari selectNodeContents
-                               if (!fullNodeSelected && Ext.isWebKit && statusBarSelection && this.isInlineElement(statusBarSelection) && statusBarSelection.textContent === range.toString()) {
+                               if (!fullNodeSelected && HTMLArea.UserAgent.isWebKit && statusBarSelection && this.isInlineElement(statusBarSelection) && statusBarSelection.textContent === range.toString()) {
                                        fullNodeSelected = true;
                                        tagName = statusBarSelection.nodeName.toLowerCase();
                                        if (statusBarSelection.className && /\S/.test(statusBarSelection.className)) {
index 9dc77be..0e4eb11 100644 (file)
@@ -146,7 +146,7 @@ HTMLArea.UndoRedo = Ext.extend(HTMLArea.Plugin, {
                var bookmark = null, bookmarkedText = null;
                        // Insert a bookmark
                if (this.getEditorMode() === 'wysiwyg' && this.editor.isEditable()) {
-                       if ((!HTMLArea.isIEBeforeIE9 && !(Ext.isOpera && navigator.userAgent.toLowerCase().indexOf('presto/2.1') != -1)) || (HTMLArea.isIEBeforeIE9 && this.editor.getSelection().getType() !== 'Control')) {
+                       if ((!HTMLArea.UserAgent.isIEBeforeIE9 && !(HTMLArea.UserAgent.isOpera && navigator.userAgent.toLowerCase().indexOf('presto/2.1') != -1)) || (HTMLArea.UserAgent.isIEBeforeIE9 && this.editor.getSelection().getType() !== 'Control')) {
                                        // Catch error in FF when the selection contains no usable range
                                try {
                                        var range = this.editor.getSelection().createRange();
@@ -156,7 +156,7 @@ HTMLArea.UndoRedo = Ext.extend(HTMLArea.Plugin, {
                                }
                        }
                                // Get the bookmarked html text and remove the bookmark
-                       if (HTMLArea.isIEBeforeIE9 && bookmark) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9 && bookmark) {
                                bookmarkedText = this.editor.getInnerHTML();
                                this.editor.getBookMark().moveTo(bookmark);
                        }
@@ -198,7 +198,7 @@ HTMLArea.UndoRedo = Ext.extend(HTMLArea.Plugin, {
        setContent: function (undoPosition) {
                var bookmark = this.undoQueue[undoPosition].bookmark;
                if (bookmark) {
-                       if (HTMLArea.isIEBeforeIE9) {
+                       if (HTMLArea.UserAgent.isIEBeforeIE9) {
                                this.editor.setHTML(this.undoQueue[undoPosition].bookmarkedText);
                        } else {
                                this.editor.setHTML(this.undoQueue[undoPosition].text);