[Libreoffice-commits] online.git: loleaflet/js

Andras Timar andras.timar at collabora.com
Mon Jul 2 14:53:44 UTC 2018


 loleaflet/js/toolbar.js |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 3f0f2c671cd8e991b1dcbc73ae0e288ce9d73cde
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon Jul 2 16:53:16 2018 +0200

    loleaflet: no fill or automatic color handling in color picker
    
    Change-Id: Iab98aadf54f0c1b041fe46eb2be1a798662d935b

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 387913c67..862bb7964 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -216,10 +216,10 @@ function onClick(e, id, item, subItem) {
 	else if (id === 'insertgraphic') {
 		L.DomUtil.get('insertgraphic').click();
 	}
-	else if (id === 'fontcolor' && e.color) {
+	else if (id === 'fontcolor' && typeof e.color !== 'undefined') {
 		onColorPick(id, e.color);
 	}
-	else if (id === 'backcolor' && e.color) {
+	else if (id === 'backcolor' && typeof e.color !== 'undefined') {
 		onColorPick(id, e.color)
 	}
 	else if (id === 'sum') {
@@ -544,11 +544,17 @@ function insertShapes() {
 }
 
 function onColorPick(id, color) {
-	if (map.getPermission() !== 'edit' || color === undefined) {
+	if (map.getPermission() !== 'edit') {
 		return;
 	}
+    // no fill or automatic color is -1
+	if (color === '') {
+		color = -1;
+	}
 	// transform from #FFFFFF to an Int
-	color = parseInt(color.replace('#', ''), 16);
+	else {
+		color = parseInt(color.replace('#', ''), 16);
+	}
 	var command = {};
 	var fontcolor, backcolor;
 	if (id === 'fontcolor') {


More information about the Libreoffice-commits mailing list