[Question] Add grapesjs color picker to a new trait type?
See original GitHub issueI’m building a a new trait type, and would like to be able to include the grapesjs color picker inside it - any suggestions on how to do that? Right now I’m including the standard HTML color input in my “inputEl” html (along with a text field and radio button) but I would love to be able to use the one that comes with grapesJS instead, if that’s possible.
Example of where I’d like to put the grapesjs picker.
inputEl = `<div>SOME HTML HERE</div><div><span>Color: </span><span><input type="color" id="colorpicker" value=""></span></div><div>MORE HTML HERE</div>`
Thanks for any suggestions. Great tool, btw, thank you for creating it.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
[Question] Add grapesjs color picker to a new trait type?
I'm building a a new trait type, and would like to be able to include the grapesjs color picker inside it - any...
Read more >Trait Manager - GrapesJS
Add Traits to Components · Built-in trait types. Text; Number; Checkbox; Select; Color; Button · Updating traits at run-time · Define new Trait...
Read more >rte - how can I add colorpicker on the default rich text editor of ...
I'm going to change the font color ...
Read more >grapesjs: Versions - Openbase
Fix default color in ColorPicker https://github.com/artf/grapesjs/pull/3670 ... Added colorPicker option to color trait type, for color picker customization ...
Read more >Third Story: Trait Setting in Grapes JS | by Code Dexterous
And also added one more tab for Trait Setting. You can simply copy below HTML there is nothing difficult here. Now it's time...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nojacko I’ve modified my code a little, here’s basically what I’m doing:
Hope this helps. This is still a work in progress 😃
Note that the getInputEl method of the colorPicker appends a spectrum colorpicker to the body of the canvas each time it’s called, and it appears to be mapped to the element it returns, which is why I’m only calling it if I don’t already have that element as part of my model. I suspect there are probably better ways to handle this, but this is working for my app at the moment.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.