suneditor icon indicating copy to clipboard operation
suneditor copied to clipboard

"Font color" always wraps text in an additional "span" tag.

Open abvas opened this issue 1 year ago • 0 comments

Describe the bug "Font color" always adds a "span" tag even if the text is already wrapped in a "span" tag by previous operators. And it contains the style for "Font size". Because of this, other operators (for example strike or underline) do not behave correctly (have the wrong color)

To Reproduce Steps to reproduce the behavior:

  1. Type any word (for example "HELLO") - <p>HELLO</p>
  2. Apply, for example, “bold” and set Font size = 36 - <p><span style="font-size: 36px"><strong>HELLO</strong></span></p>
  3. Change Font color (for example #ff0000) - <p><span style="font-size: 36px"><span style="color: rgb(255, 0, 0);"><strong>HELLO</ strong></span></span></p> As you can see, an additional tag "span" has appeared
  4. Due to the additional "span" tag, we get incorrect behavior from other tags. For example, if you now try on strike (or underline), the line will be black and will not match the color selected as “Font color” <p><span style="font-size: 36px"><del><span style="color: rgb(255, 0, 0);"><strong>HELLO</strong></span></ del></span></p>

But if you apply "Font color" first, and then "bold" and "Font size", then everything will be fine ("bold" and "Font size" do not add the tag) <p><span style="color: rgb(255, 0, 0); font-size: 36px;"><del><strong>HELLO</strong></del></span></p>

Expected behavior "Font size" should not wrap the text in an additional "span" tag, but should use existing ones.

Screenshots problem Image 43

correctly Image 44

Desktop (please complete the following information):

  • OS: window 10 (64)
  • Browser chrome
  • Version 117.0.5938.134

Additional context A demonstration can be done and seen directly in your example: http://suneditor.com/sample/index.html

Thank you.

abvas avatar Oct 24 '23 14:10 abvas