ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.59k stars 3.7k forks source link

Support for pasting content from Google Docs #2516

Closed Reinmar closed 5 years ago

Reinmar commented 6 years ago

Is this a bug report or feature request?

🆕 Feature request

💻 Version of CKEditor

CKEditor v5 @ 12.3.1

📋 Steps to reproduce

Like MS Word, Google Docs also produces some non-semantical markup which needs to be normalized before being inserted into CKEditor 5.

With this feature we want to introduce infrastructure to support Google Docs pasting (normalizers API) and a handful of converters, such as:


If you'd like to see this feature implemented, add 👍 to this post.

f1ames commented 6 years ago

I have rechecked (validated some time ago in https://github.com/ckeditor/ckeditor5/issues/1184#issuecomment-409828069) how pasting from GDocs works with the document formatted like:

image

There are basically 3 things broken (comparing to what is supported when pasting from Word):

  1. Entire content is bolded (as entire content is wrapped in special <b> tag interpreted by editor as bold). Broken on Chrome and Safari, works on Firefox (no <b> wrapper).
  2. List are broken due to ul > li > p markup.
  3. Images in tables are not pasted correctly but AFAIR this is not supported by the editor itself.

So to align it with what is supported now when pasting from Word, solving 1 and 2 should do the job.

f1ames commented 6 years ago

The issue with block content inside lists is more general one, related to any pasted or set content inside editor - https://github.com/ckeditor/ckeditor5/issues/1318.

jodator commented 6 years ago

Images in tables are not pasted correctly but AFAIR this is not supported by the editor itself.

As for now no images in table.

Reinmar commented 6 years ago

So to align it with what is supported now when pasting from Word, solving 1 and 2 should do the job.

Fixing 1. and 2. would be cool.

msamsel commented 5 years ago

@jodator as we discussed I create a discussion topic for the normalizers: ckeditor/ckeditor5#2497.

Reinmar commented 5 years ago

Could we have a list here of things which work fine already and a list of tickets for things which don't work yet? Because it'd be good to close this ticket with some sort of summary.

atullasrado commented 5 years ago

List are broken due to ul > li > p markup.

I came across something similar while pasting indented lists from Gmail. The indented content is not pasted at all. Would that come under the scope of this issue or does it require a new one?

jodator commented 5 years ago

@atullasrado - this will be probably fixed by: https://github.com/ckeditor/ckeditor5-list/issues/115. We're hoping to finish this in the current iteration by it might get delayed.

I'll check the Gmail case there.

msamsel commented 5 years ago

Those are my findings. I used this document for testing purpose. @Mgsy if you found something else during your testing of PfGD, then please add it to the list.

Sum up of paste from Google Docs support with features which I was able to match with CKE5 features:

Available features, which might have some small issues:

  1. Regular text is pasted
  2. Headings are pasted. However <h1> and <h2> are recognized as Heading1. More details ckeditor/ckeditor5#2503
  3. Basic styles are working fine except bold which is not upcasted. More details and temporary workaround: ckeditor/ckeditor5#2495.
  4. Links are working fine
  5. Font color and font background color are working. However, there is a transparent color on the document colors list. It might be useful to remove it during paste.
  6. Tables are working with features available in the editor. So nested tables or table styles are not preserved.
  7. Images are working (however there remains link to google docs)
  8. Alignment feature is working fine as well

Broken feature:

  1. Font family and font size.
  2. Indentation

Worth mention issues:

  1. Paste from Google Docs is not recognized for some specific content in Safari browser ckeditor/ckeditor5#2501.
mlewand commented 5 years ago

All right, I have updated this issue to list all the basic features that we wanted to include in this release. Now the most important remaining thing is bold support, which has been extracted to ckeditor/ckeditor5-paste-from-office#74 and will be fixed in future release.