Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text styles not kept when being converted #8921

Closed
LangQian opened this issue Jan 25, 2021 · 7 comments · Fixed by #9249
Closed

Text styles not kept when being converted #8921

LangQian opened this issue Jan 25, 2021 · 7 comments · Fixed by #9249
Assignees
Labels
domain:v4-compatibility This issue reports a CKEditor 4 feature/option that's missing in CKEditor 5. package:engine type:bug This issue reports a buggy (incorrect) behavior.

Comments

@LangQian
Copy link

📝 Provide detailed reproduction steps (if any)

  1. Load the following HTML into CK Editor
    <span style="font-family:'helvetica';"> <span style="color:#0000ff;"> <span style="font-size:16px;font-family:'arial';color:#000000;"> aaa </span> </span> </span>

  2. After CK Editor's processing, the above one was converted to the following one:
    <span style="color:#0000ff">aaa&nbsp;</span>

✔️ Expected result

Styles should be kept after conversion.

❌ Actual result

Most styles were lost in the above scenario.


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@LangQian LangQian added the type:bug This issue reports a buggy (incorrect) behavior. label Jan 25, 2021
@LangQian
Copy link
Author

This is an issue our customers are facing, so it is very urgent for us but we couldn't solve it on our end. If any workaround can be provided, we would really appreciate it!

@Mgsy
Copy link
Member

Mgsy commented Jan 28, 2021

Hi! Could you please tell us what is your expected result? Do you expect to keep styles define in this span:

<span style="font-size:16px;font-family:'arial';color:#000000;">

... and convert it to a single span or keep the structure of nested spans?

@Mgsy Mgsy added the pending:feedback This issue is blocked by necessary feedback. label Jan 28, 2021
@LangQian
Copy link
Author

@Mgsy Both would work for us, as long as the styles can be kept. In the above example, our customers were seeing black text, but it now becomes blue, which makes them vey confused (since they don't know the underlying HTML looks like).

@LangQian
Copy link
Author

Hi @Mgsy , do you need more information on this one? I see the 'pending: feedback' label is still there.

@Mgsy
Copy link
Member

Mgsy commented Feb 26, 2021

Hi @LangQian, I'm sorry for the late response, we had a busy period. I'll look at your case soon and get back to you.

@Mgsy
Copy link
Member

Mgsy commented Mar 8, 2021

@LangQian, thanks for bringing it to our attention. There's an issue with our converters - in the case of nested elements, styles from the deepest one should be applied, while now, those are ignored.

Note: CKEditor 4 handles such case properly and applies styles from the deepest nested element.

@Mgsy Mgsy added domain:v4-compatibilty package:engine and removed pending:feedback This issue is blocked by necessary feedback. labels Mar 8, 2021
@Reinmar Reinmar added domain:v4-compatibility This issue reports a CKEditor 4 feature/option that's missing in CKEditor 5. and removed domain:v4-compatibilty labels Mar 9, 2021
@Reinmar Reinmar added this to the nice-to-have milestone Mar 9, 2021
@Mgsy Mgsy modified the milestones: nice-to-have, iteration 41 Mar 11, 2021
@jacekbogdanski
Copy link
Member

jacekbogdanski commented Mar 16, 2021

A related issue in text part language feature - #9074 (comment), #9074 (comment)

@Mgsy Mgsy modified the milestones: iteration 41, iteration 42 Mar 17, 2021
jacekbogdanski added a commit that referenced this issue Apr 9, 2021
Fix (engine): While setting attributes upon upcast conversion, don't override attributes that were already set. The correct behavior is to keep the "information" applied by the deepest nodes in the view tree as, in most cases, the deepest node will have precedence (e.g. inline style applied by the deepest node). Closes #8921.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:v4-compatibility This issue reports a CKEditor 4 feature/option that's missing in CKEditor 5. package:engine type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
5 participants