[QUESTION]: Adding colors to built-in RTE
Question
Hi
I'm trying to add color to built-in rte for background and foreground, but after unfocusing an element - style prop resets. Here is an example : https://jsfiddle.net/2s3vhygn/ Looks like i need to update an model and set up styles on it. Trying to update model using this code:
const selectedText = editor.getSelected();
editor.select(selectedText.find('.selected'));
editor.getSelected().setStyle({ color: 'red' });
editor.getSelected().removeClass('selected');
But inserted span isn't selectable.
So i have few questions:
- What im doing wrong?
- How i can attach an default color picker to rte panel?
I'm not using CKeditor because it cause that after saving, element is no more editable.
Answers (1)
@iamDreamcode to make that element selectable you should force the sync of the text component
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1614
[Bug]: adding css variables as style manager property
trying to add css variable to style manager causing error: Uncaught TypeError: Cannot read property 'toUpperCase' of undefined fiddle Am i...
Issue #2882
BUG: Problem with adding caption element block to the canvas
Version: 0.16.18 Are you able to reproduce the bug from the demo? [x ] Yes https://jsfiddle.net/triawarman/tmcoqxhp/ What is the expected b...
Issue #5442
BUG: After applying the text color not able to set the background color
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? chrome Reproducible demo link https://jsfi...
Issue #5334
BUG: Selection of custom component type not working in the canvas
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome, Opera, Edge, etc Reproducible demo...
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.