From 53b2ba08234fb5bb8edaba5ef71ed8721ef01744 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Wed, 20 Sep 2017 13:18:29 +0200 Subject: [PATCH] Updates on color input --- src/domain_abstract/ui/InputColor.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/domain_abstract/ui/InputColor.js b/src/domain_abstract/ui/InputColor.js index e89a7463f8..ba32895845 100644 --- a/src/domain_abstract/ui/InputColor.js +++ b/src/domain_abstract/ui/InputColor.js @@ -25,7 +25,7 @@ module.exports = Input.extend({ /** * Updates the view when the model is changed * */ - handleModelChange() { + handleModelChange(mdl, vl, opts = {}) { Input.prototype.handleModelChange.apply(this, arguments); var value = this.model.get('value'); @@ -34,6 +34,12 @@ module.exports = Input.extend({ // If no color selected I will set white for the picker value = value === 'none' ? '#fff' : value; colorEl.get(0).style.backgroundColor = value; + + // Prevent usuless palette updating + if (!opts.avoidStore) { + console.log('COlor to set', value, mdl, vl, opts); + colorEl.spectrum('set', value); + } }, /** @@ -59,6 +65,7 @@ module.exports = Input.extend({ let changed = 0; let previousСolor; colorEl.spectrum({ + //color: "#f00" appendTo: elToAppend || 'body', maxSelectionSize: 8, showPalette: true,