loleaflet/src/control/ColorPicker.js             |    5 ++++-
 loleaflet/src/control/Control.JSDialogBuilder.js |    8 +++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit e048f366ed0000b6c50bc1cbc599bd381295294d
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Oct 25 10:56:45 2019 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri Oct 25 12:30:48 2019 +0200

    jsdialogs: added callback for color picker
    
    Change-Id: I6457917a1e6a451568072f985c85bab021c38b47

diff --git a/loleaflet/src/control/ColorPicker.js 
b/loleaflet/src/control/ColorPicker.js
index a5aae9a9f..26632699b 100644
--- a/loleaflet/src/control/ColorPicker.js
+++ b/loleaflet/src/control/ColorPicker.js
@@ -9,7 +9,8 @@
 L.ColorPicker = L.Class.extend({
        options: {
                selectedColor: '#CC0814',
-               noColorControl: true
+               noColorControl: true,
+               selectionCallback: function () {}
        },
 
        statics: {
@@ -46,6 +47,7 @@ L.ColorPicker = L.Class.extend({
                this._createBasicColorSelectionMark();
                this._selectedColorElement = selectedColorSample;
                this._selectedColor = this.options.selectedColor;
+               this._selectionCallback = this.options.selectionCallback;
                this._initIndexes();
                this._container = this._createControl();
                this._initialized = true;
@@ -233,6 +235,7 @@ L.ColorPicker = L.Class.extend({
                this._selectedColor = '#' + 
this._getColorCode(this._selectedTintIndex, L.ColorPicker.TINT);
                this._updateNoColorControl(false);
                this._updateSelectedColorElement();
+               
this._selectionCallback(this._getColorCode(this._selectedTintIndex, 
L.ColorPicker.TINT));
        },
 
        _updateSelectedSample: function (colorIndex, selectedColorIndex, 
colorType) {
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index bf5a5c853..812102e58 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -732,11 +732,17 @@ L.Control.JSDialogBuilder = L.Control.extend({
                var iconPath = builder._createIconPath(data.command);
                var noColorControl = data.command !== '.uno:FontColor';
 
+               var callback = function(color) {
+                       var command = data.command + '?Color:string=' + color;
+                       builder.map.sendUnoCommand(command);
+               };
+
                var colorPickerControl = new L.ColorPicker(
                        valueNode,
                        {
                                selectedColor: selectedColor,
-                               noColorControl: noColorControl
+                               noColorControl: noColorControl,
+                               selectionCallback: callback
                        });
                builder._colorPickers.push(colorPickerControl);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to