Color input does not update the element on page
Question
when using the color picker everything works fine.
however if you add a hex value to the input and press enter the color preview updates but the color is not applied to the element on the page
Answers (3)
@art i think the issue here is that
colorEl.spectrum('set', valueClr);
inside function setValue(val, opts = {}) of InputColor.js does not call the change event inside spectrum. looks like it needs to be separated out.
@artf i have been looking at this quite a bit and managed to get it working but the way i have done it seems a little hacky.
The issue i found was inside src\domain_abstract\ui\InputColor.js inside setValue(val, opts = {}).
the value opts.targetUpdate is undefined after the second loop.
I added these, just above the IF statement and changed the variable previousСolor so it can be accessed by all the functions.
model.set('value', valueClr);
colorEl.spectrum('set', valueClr);
if (opts.targetUpdate) {
self.previousСolor = valueClr;
this.noneColor = valueClr;
}
again this feels a little hacky im not sure if its the correct approach.
@sonnylloyd actually the real issue is here https://github.com/artf/grapesjs/blob/dev/src/domain_abstract/ui/Input.js#L24-L27
should be instead:
handleChange(e) {
e.stopPropagation();
this.model.set('value', this.getInputEl().value);
this.elementUpdated();
},
I've already made this change in the latest RC, you can see it working here http://grapesjs.com/demo-no-jq.html
Related Questions and Answers
Continue research with similar issue discussions.
Issue #727
Two devices with same width
Hi all, We have an scenario where we need to have two devices with same width. Almost everything works fine, but when we try to change betw...
Issue #1092
[BUG]traits and storage trigger
Hey, maybe it's not bug, i'm not sure. I have traits with changeProp: true field. When I change the value of trait by UI, model is changed...
Issue #1357
[Bug]: Body -> Decorations -> Background-image
Version 0.14.25 | Local copy GrapesJS Tested in: Chrome 68, Firefox 61 Add a background image in "Body (Selected #wrapper) -> Decorations -...
Issue #1104
[Bug] Color trait can't setup property after 0.14.9
After v0.14.9 color trait can't setup component property when user press "OK" on colorpicker form. Live:v0.14.9 https://jsfiddle.net/Lqm7ou...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.