Issue #2789Opened May 19, 2020by iamDreamcode0 reactions

[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:

  1. What im doing wrong?
  2. 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)

artfJune 10, 20200 reactions

@iamDreamcode to make that element selectable you should force the sync of the text component

https://jsfiddle.net/xhp7k1bs/

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.