loleaflet/src/control/Control.JSDialogBuilder.js |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 88a75e9a34b000b88c98c872a4ac84374fef0c8b
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Nov 22 18:32:14 2019 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Mon Nov 25 14:33:20 2019 +0100

    loleaflet: accept images encoded base64 for 'valueset' control
    
    Now the LO Core server will send an image list encoded in base64,
    these images are special because they were created by a function
    in memory. I am referring to images of the "Table Design" panel.
    
    Change-Id: Ia8660620729bb7f862505833ba197a6f3b68f184
    Reviewed-on: https://gerrit.libreoffice.org/83539
    Reviewed-by: Henry Castro <hcas...@collabora.com>
    Tested-by: Henry Castro <hcas...@collabora.com>

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index 378f6ac17..61befb59a 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -829,6 +829,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
        _valuesetControl: function (parentContainer, data, builder) {
                var elem;
                var image;
+               var image64;
 
                if (!data.entries || data.entries.length === 0) {
                        return false;
@@ -836,16 +837,25 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
                for (var index in data.entries) {
                        image = data.entries[index].image;
-                       image = image.substr(0, image.lastIndexOf('.'));
-                       image = image.substr(image.lastIndexOf('/') + 1);
+                       image64 = data.entries[index].image64;
+                       if (image) {
+                               image = image.substr(0, image.lastIndexOf('.'));
+                               image = image.substr(image.lastIndexOf('/') + 
1);
+                               image = 'url("images/' + image + '.svg")';
+                       }
+
+                       if (image64) {
+                               image = 'url("' + image64 + '")';
+                       }
+
                        elem = L.DomUtil.create('div', 'layout ' +
                                (data.entries[index].selected ? ' 
loleaflet-context-down' : ''), parentContainer);
                        $(elem).data('id', data.entries[index].id);
                        $(elem).click(function () {
                                builder.callback('valueset', 'selected', { id: 
data.id }, $(this).data('id'), builder);
                        });
-                       elem.style.setProperty('background', 'url("images/' + 
image +
-                               '.svg") no-repeat center', 'important');
+
+                       elem.style.setProperty('background', image + ' 
no-repeat center', 'important');
                }
 
                return false;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to