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

Improve style retention on paste from MS Word #10577

Open
Reinmar opened this issue Sep 22, 2021 · 2 comments
Open

Improve style retention on paste from MS Word #10577

Reinmar opened this issue Sep 22, 2021 · 2 comments
Labels
Epic package:paste-from-office squad:core Issue to be handled by the Core team. support:2 An issue reported by a commercially licensed client. type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@Reinmar
Copy link
Member

Reinmar commented Sep 22, 2021

This epic stems from #9879. While analyzing how we could improve paste from Word by inlining stylesheets carried in the clipboard, we realized that we need to do more than just that to have a real impact on the UX. Most importantly, we need to move text-level styles from block elements to the text, as otherwise features like FontSize or Bold will not pick these styles up.


If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@Reinmar Reinmar added type:improvement This issue reports a possible enhancement of an existing feature. package:paste-from-office squad:core Issue to be handled by the Core team. labels Sep 22, 2021
@Reinmar
Copy link
Member Author

Reinmar commented Sep 22, 2021

Notes from the refinement

  • Possible scope:
    • #9879: Paste from Word should inline stylesheets
      • When inlining we need to filter out all the mso- styles and possibly some stupid defaults like margin:0cm
    • #7964: Apply default styles when pasting from Word
    • Moving text styles from block elements to text
      • Thanks to that GHS will not be necessary to make it all work. If we keep the styles on block elements, they will only be retained by GHS, not by features like FontSize, FontFamily, etc.
      • Also, if they'll be moved to text, they will better work with e.g. the UI of FontSize.
      • This is what CKE4 does.
      • This can be done in particular features (like FontSize) as a conversion from view block element's styles to model attribute.
        • However, it should only be done in the clipboard pipeline (see $clipboardHolder).
        • We need to keep performance in mind. Most likely, we should test how the fix affects it.
    • Improving paste from Excel may be a reasonable followup.
  • First step: Spikes:
    • S1:
      • Analyze the spectrum of cases, so that we can choose these with the highest ROI. Give it max 1MD.
    • S2:
      • Analyze CKE4's solution to that (how the styles are inlined).
      • Implement a PoC of inlining stylesheets.
    • S3:
      • Implement a PoC of converting block styles to text attributes.
      • FontSize, Family, FontColor, basic styles (Bold, Italic, etc)
      • Verify the toll of the new converters on setData() and paste performance

@jswiderski
Copy link

When inlining we need to filter out all the mso- styles and possibly some stupid defaults like margin:0cm
@Reinmar those stupid defaults are source of many complaints from clients about huge line spaces because if you filter margin:0 out then browser will assign default margins.

Please preserve 0 margins if they are assigned because not having them generates numerous complaints.

@CKEditorBot CKEditorBot added the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Jun 14, 2023
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic package:paste-from-office squad:core Issue to be handled by the Core team. support:2 An issue reported by a commercially licensed client. type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

No branches or pull requests

4 participants