Non editable node can not be styled when stand alone

0 Answers 30 Views
Editor
Nguyen
Top achievements
Rank 1
Nguyen asked on 02 Feb 2024, 08:45 AM

I have found a perfection for my requirements

- A dropdown of selection insert none-editable peace of text

- The text should not be change

- The text should be style able

But there is a problem, when select the uneditable span when stand alone in a line. It cannot be styled. I think it's because of  the contenteditable dissmiss with user-selection:none dismiss any style change.

Here  is thee related question. You can scroll down at the end to find the solution.

Custom dropdownlist in toolbar of Kendo React Editor in KendoReact | Telerik Forums

Filip
Telerik team
commented on 05 Feb 2024, 07:24 PM

Hi, Nguyen,

We are currently investigating the issue with the span selection and not being able to style it, however we will need more time to investigate for a possible solution and I will get back to you once I have more information.

Regards,
Filip
Filip
Telerik team
commented on 07 Feb 2024, 08:44 PM

Hi, Nguyen,

I went through the entire thread, however, can you please share more information on your scenario in order to provide a more accurate solution? Does the inserted text that must not be editable have to be styled by default or do you need to be styled after the user performs some action?

If the requirement is to have it styled by default this can be achieved by setting the style directly in the toDom function:
  toDOM: () => [
    'span',
    {
      contenteditable: false,
      class: 'uneditable',
      style: 'user-select: none; opacity: 0.5; color: red',
    },
    0,
  ],
};
Regards,
Filip

No answers yet. Maybe you can help?

Tags
Editor
Asked by
Nguyen
Top achievements
Rank 1
Share this question
or