loleaflet/src/control/Control.Toolbar.js |   39 +++++++++++++++----------------
 1 file changed, 20 insertions(+), 19 deletions(-)

New commits:
commit fa6e1e36688c0df4c64db84d55e7227ff9c701ad
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Fri Mar 20 12:43:02 2020 +0100
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Fri Mar 20 12:58:19 2020 +0100

    Revert "loleaflet: move the code about initialization of the style combobox"
    
    Breaks mobile view in Impress.
    TypeError: Cannot read property 'length' of undefined
    
    This reverts commit 9db6f855a016891f5c0d59cab014f246752cd907.
    
    Change-Id: I839cde8bb683fc0b933da806f4a4771114eb32f5
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90785
    Tested-by: Tamás Zolnai <tamas.zol...@collabora.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index 84b76d957..13e8e369c 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -1010,6 +1010,25 @@ function initNormalToolbar() {
                        hideTooltip(this, e.target);
                },
                onRefresh: function(event) {
+                       if (event.target === 'editbar' && map.getDocType() === 
'presentation') {
+                               // Fill the style select box if not yet filled
+                               if ($('.styles-select')[0] && 
$('.styles-select')[0].length === 1) {
+                                       var data = [''];
+                                       // Inserts a separator element
+                                       data = data.concat({text: 
'\u2500\u2500\u2500\u2500\u2500\u2500', disabled: true});
+
+                                       
L.Styles.impressLayout.forEach(function(layout) {
+                                               data = data.concat({id: 
layout.id, text: _(layout.text)});
+                                       }, this);
+
+                                       $('.styles-select').select2({
+                                               data: data,
+                                               placeholder: 
_UNO('.uno:LayoutStatus', 'presentation')
+                                       });
+                                       
$('.styles-select').on('select2:select', onStyleSelect);
+                               }
+                       }
+
                        if ((event.target === 'styles' || event.target === 
'fonts' || event.target === 'fontsizes') && event.item) {
                                var toolItem = $(this.box).find('#tb_'+ 
this.name +'_item_'+ w2utils.escapeId(event.item.id));
                                if ((_inDesktopMode() && event.item.desktop == 
false)
@@ -1575,7 +1594,6 @@ function onDocLayerInit() {
        var toolbarUp = w2ui['editbar'];
        var statusbar = w2ui['actionbar'];
        var docType = map.getDocType();
-       var data;
 
        switch (docType) {
        case 'spreadsheet':
@@ -1679,23 +1697,6 @@ function onDocLayerInit() {
 
                break;
        case 'presentation':
-               if ($('.styles-select')[0].length === 1) {
-                       // Fill the style select box if not yet filled
-                       data = [''];
-                       // Inserts a separator element
-                       data = data.concat({text: 
'\u2500\u2500\u2500\u2500\u2500\u2500', disabled: true});
-
-                       L.Styles.impressLayout.forEach(function(layout) {
-                               data = data.concat({id: layout.id, text: 
_(layout.text)});
-                       }, this);
-
-                       $('.styles-select').select2({
-                               data: data,
-                               placeholder: _UNO('.uno:LayoutStatus', 
'presentation')
-                       });
-                       $('.styles-select').on('select2:select', onStyleSelect);
-               }
-
                if (toolbarUp) {
                        toolbarUp.show('breaksidebar', 'modifypage');
                }
@@ -1793,7 +1794,7 @@ function onDocLayerInit() {
                        el.resize();
        }
 
-       data = [6, 7, 8, 9, 10, 10.5, 11, 12, 13, 14, 15, 16, 18, 20,
+       var data = [6, 7, 8, 9, 10, 10.5, 11, 12, 13, 14, 15, 16, 18, 20,
                22, 24, 26, 28, 32, 36, 40, 44, 48, 54, 60, 66, 72, 80, 88, 96];
        $('.fontsizes-select').select2({
                data: data,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to