[BUGFIX] RTE: Some toolbar elements may not be correctly initialized
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 6 Feb 2012 02:23:33 +0000 (21:23 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 6 Feb 2012 02:24:20 +0000 (03:24 +0100)
This change is a follow-up to previous change which could cause JS
error when language dropdown is not configured in the toolbar.

Change-Id: I6c0edf8ba6869aa2f7ff36edb862015de46e57eb
Resolves: #33637
Releases: 4.5
Reviewed-on: http://review.typo3.org/8856
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/htmlarea/plugins/Language/language.js

index 717dc0f..bccc242 100644 (file)
@@ -133,18 +133,20 @@ HTMLArea.Language = HTMLArea.Plugin.extend({
         */
        onGenerate: function () {
                var select = this.getButton('Language');
-               if (select.getStore().getCount() > 1) {
-                       this.addLanguageMarkingRules();
-               } else {
-                               // Monitor the language combo's store being loaded
-                       select.mon(select.getStore(), 'load', function () {
+               if (select) {
+                       if (select.getStore().getCount() > 1) {
                                this.addLanguageMarkingRules();
-                               var selection = this.editor._getSelection(),
-                                       selectionEmpty = this.editor._selectionEmpty(selection),
-                                       ancestors = this.editor.getAllAncestors(),
-                                       endPointsInSameBlock = this.editor.endPointsInSameBlock();
-                               this.onUpdateToolbar(select, this.getEditorMode(), selectionEmpty, ancestors, endPointsInSameBlock);
-                       }, this);
+                       } else {
+                                       // Monitor the language combo's store being loaded
+                               select.mon(select.getStore(), 'load', function () {
+                                       this.addLanguageMarkingRules();
+                                       var selection = this.editor._getSelection(),
+                                               selectionEmpty = this.editor._selectionEmpty(selection),
+                                               ancestors = this.editor.getAllAncestors(),
+                                               endPointsInSameBlock = this.editor.endPointsInSameBlock();
+                                       this.onUpdateToolbar(select, this.getEditorMode(), selectionEmpty, ancestors, endPointsInSameBlock);
+                               }, this);
+                       }
                }
        },
        /*