[BUGFIX] RTE: Incorrect text in language combo of abbreviation dialogue 82/34282/2
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 17 Nov 2014 19:49:44 +0000 (14:49 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 17 Nov 2014 19:50:50 +0000 (20:50 +0100)
The language combo of the RTE abbreviation dialogue is not correctly
initialized when no language is selected. ExtJs bug?..
Solution: Change the way the language store is loaded.

Releases: master, 6.2
Resolves: #63038
Change-Id: Icba6441f2a708254eb6f7f7f1a592ab42da59e55
Reviewed-on: http://review.typo3.org/34282
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
typo3/sysext/rtehtmlarea/htmlarea/plugins/Acronym/acronym.js

index 339fb7e..2a5b19d 100644 (file)
@@ -281,29 +281,6 @@ HTMLArea.Acronym = Ext.extend(HTMLArea.Plugin, {
                var languageObject = this.getPluginInstance('Language');
                if (this.getButton('Language')) {
                        var selectedLanguage = !Ext.isEmpty(element) ? languageObject.getLanguageAttribute(element) : 'none';
-                       function initLanguageStore (store) {
-                               if (selectedLanguage !== 'none') {
-                                       store.removeAt(0);
-                                       store.insert(0, new store.recordType({
-                                               text: languageObject.localize('Remove language mark'),
-                                               value: 'none'
-                                       }));
-                               }
-                               this.getButton('Language').setValue('none');
-                       }
-                       var languageStore = new Ext.data.JsonStore({
-                               autoDestroy:  true,
-                               autoLoad: true,
-                               root: 'options',
-                               fields: [ { name: 'text'}, { name: 'value'} ],
-                               url: this.getDropDownConfiguration('Language').dataUrl,
-                               listeners: {
-                                       load: {
-                                               fn: initLanguageStore,
-                                               scope: this
-                                       }
-                               }
-                       });
                        itemsConfig.push(Ext.apply({
                                xtype: 'combo',
                                fieldLabel: this.getHelpTip('language', 'Language'),
@@ -311,13 +288,31 @@ HTMLArea.Acronym = Ext.extend(HTMLArea.Plugin, {
                                valueField: 'value',
                                displayField: 'text',
                                tpl: '<tpl for="."><div ext:qtip="{value}" style="text-align:left;font-size:11px;" class="x-combo-list-item">{text}</div></tpl>',
-                               store: languageStore,
+                               store: new Ext.data.JsonStore({
+                                       autoDestroy:  true,
+                                       root: 'options',
+                                       fields: [ { name: 'text'}, { name: 'value'} ],
+                                       url: this.getDropDownConfiguration('Language').dataUrl,
+                                       listeners: {
+                                               load: {
+                                                       fn: function (store) {
+                                                               if (selectedLanguage !== 'none') {
+                                                                       store.removeAt(0);
+                                                                       store.insert(0, new store.recordType({
+                                                                               text: languageObject.localize('Remove language mark'),
+                                                                               value: 'none'
+                                                                       }));
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }),
                                width: 200,
                                value: selectedLanguage,
                                listeners: {
-                                       render: {
+                                       beforerender: {
                                                fn: function (combo) {
-                                                               // Load the language dropdown
+                                                       // Ensure the store is loaded
                                                        combo.getStore().load({
                                                                callback: function () { combo.setValue(selectedLanguage); }
                                                        });