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

Paste from Google docs #835

Closed
mark-wade opened this issue Aug 29, 2017 · 23 comments · Fixed by #3257
Closed

Paste from Google docs #835

mark-wade opened this issue Aug 29, 2017 · 23 comments · Fixed by #3257
Assignees
Labels
plugin:clipboard The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. target:major Any docs related issue that should be merged into a major branch. type:feature A feature request.
Milestone

Comments

@mark-wade
Copy link
Contributor

mark-wade commented Aug 29, 2017

Are you reporting a feature request or a bug?

New feature

Check if the issue is already reported

https://dev.ckeditor.com/ticket/13877

Provide detailed reproduction steps (if any)

  1. Open this Google doc
  2. Highlight all content
  3. Paste into a CKEditor instance

Expected result

The content is pasted with formatting resembling the original

Actual result

The content is entirely bold

Other details

  • Browser: Safari 10.1.2 (12603.3.8)
  • OS: macOS 10.12.6 (16G29)
  • CKEditor version: 4.7.2
  • Installed CKEditor plugins: Basic preset
@Comandeer
Copy link
Member

There is an old issue on our tracker for this (I've updated this ticket to include the reference).

@Comandeer Comandeer added plugin:clipboard The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:bug A bug. labels Aug 29, 2017
@mlewand
Copy link
Contributor

mlewand commented Aug 29, 2017

We need to check what's produced by gdocs, if it's putting some garbage markup (don't have the time to check the history now) then this is a feature request rather than bug.

@msamsel
Copy link
Contributor

msamsel commented Aug 31, 2017

Unfortunately Google produces some garbage markup. :(
I've made test for simple "Hello world" text.
Webkits are surrounded with some kind of <b> tag.

Safari:

<meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-02e80b59-3772-4a14-1d46-472ecba47538"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">Hello world.</span></p></b><br class="Apple-interchange-newline">

Chrome:

<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-864f78f7-375f-e1b4-0491-fcf5da1d9a1c"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">Hello world.</span></p></b><br class="Apple-interchange-newline">

Firefox - no visible problems (there is no <b> tag)

<meta charset="utf-8"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" id="docs-internal-guid-722791a9-3773-3755-c587-cf39a76aa97f"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;">Hello world.</span></p>

Edge 15

Version:1.0
StartHTML:000000174
EndHTML:000000848
StartFragment:000000432
EndFragment:000000816
StartSelection:000000432
EndSelection:000000816
SourceURL:about:blank
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD></HEAD><BODY role="textbox" style="background-color: transparent;" contenteditable="true" spellcheck="false" aria-label="Treść dokumentu" aria-multiline="true"><!--StartFragment--><B style="font-weight:normal"><P id="docs-internal-guid-41ef99cb-377b-156f-8619-7da7f2003f16" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" dir="ltr"><SPAN style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;">Hello world.</SPAN></P><BR></B><!--EndFragment--></BODY></HTML>

IE11

<b style="font-weight: normal;"><p id="docs-internal-guid-a3025ab9-377d-4708-ce9d-c9d945370da4" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;" dir="ltr"><span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; background-color: transparent;">Hello world.</span></p><br></b>

@mlewand
Copy link
Contributor

mlewand commented Aug 31, 2017

So that makes it a feature request, I'll update report accordingly.

Now the question is if we filter out this garbage outer bold, does it fix pasting?

@mlewand mlewand added type:feature A feature request. and removed type:bug A bug. labels Aug 31, 2017
@mlewand
Copy link
Contributor

mlewand commented Aug 31, 2017

When adding handling for gdocs, I believe we should do it in a dedicated plugin. I can see that it would be beneficial, so I'm for putting it in full and standard preset by default.

@mlewand mlewand added the target:major Any docs related issue that should be merged into a major branch. label Aug 31, 2017
@mlewand mlewand added this to the Backlog milestone Aug 31, 2017
@Comandeer
Copy link
Member

Now the question is if we filter out this garbage outer bold, does it fix pasting?

Yes, it fixes it. The partial solution is available in https://github.com/cksource/ckeditor-dev/tree/t/13877 – it could be a good base for the new, dedicated plugin.

@msamsel
Copy link
Contributor

msamsel commented Aug 31, 2017

Yep it fixes it.
But processing this markup will require some work, similar to PFW plugin. So dedicated plugin sounds nice for it.
Example of markup when I add some inline styles to it.
<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-864f78f7-37a9-3d62-841f-a0a2513dcb2e"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">H</span><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">e</span><span style="font-size:11pt;font-family:Arial;color:#ff0000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">ll</span><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">o w</span><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;">o</span><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;">rl</span><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">d.</span></p><ul style="margin-top:0pt;margin-bottom:0pt;"><li dir="ltr" style="list-style-type:disc;font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;">123</span></p></li></ul></b>

From curiosity I added some bold to text to check how it behave in such case, google add style font-weight:700; instead of using strong or b tags

@nabilzhafri
Copy link

wondering if there's already a dedicated plugin for this? how would i solve this without switching to the specific branch?

@LiamDawe
Copy link

LiamDawe commented Jun 13, 2018

Any movement on this? It's such a hassle :(

@nabilzhafri
Copy link

@LiamDawe just sharing my solution, I ended up using the plugin from here: https://ckeditor.com/cke4/addon/pasteFromGoogleDoc, where I believe they extract the code and moved it to a plugin.

@LiamDawe
Copy link

Thanks, that does seem to make it a little more bearable.

@LiamDawe
Copy link

In fact, sadly, that plugin seems to mess with others. In particular, it seems to stop the Youtube plugin from loading somehow?

@frob
Copy link

frob commented Dec 5, 2018

I don't understand how this is a feature request. Pasting from Google Docs in the most popular browser is broken. This should be a bug.

@remigasas
Copy link

remigasas commented Apr 5, 2019

It is not working with ckeditor version "4.11.1".
Text pasted from GoogleDocs is displayed in bold. User cannot change font-weight using controls.
Can this be prioritized ? And converted from feature request to bug ?

@f1ames f1ames modified the milestones: Backlog, 4.12.0 May 16, 2019
@f1ames f1ames modified the milestones: 4.12.0, 4.13.0 Jun 12, 2019
@wimleers
Copy link
Contributor

Reproduced.

This is probably caused by Google Docs' weird markup but … it is a very widely used text editor, and it is very often where collaboration happens prior to content being moved into a CMS. It seems that the simplicity of the fix plus the far-reaching impact together should make this a high priority?

In any case, it is marked as a major bug in Drupal 8, and we rely on CKEditor to fix it: https://www.drupal.org/project/drupal/issues/2948171

@f1ames
Copy link
Contributor

f1ames commented Jun 26, 2019

Paste from Google docs support is targeted for the next major release and we are determined to ship it so stay tuned ;)

The fix for bold is rather easy, but still there is more markup which needs explicit support and proper transformations. Additionally, we are doing a significant refactor to reuse some common content filters introduced for pasting from Word.

@nkgokul
Copy link

nkgokul commented Jun 26, 2019

Confirm that the issue still exists.

@f1ames thanks for the update and all your work.

@LiamDawe
Copy link

@f1ames glad to know it's really being looked into, we use it for article/review/interview collaboration and then pasting it into CKEditor only causes frustration.

When you say the next "major" release, I assume we're still talking CKEditor 4 right?

@f1ames
Copy link
Contributor

f1ames commented Jun 26, 2019

When you say the next "major" release, I assume we're still talking CKEditor 4 right?

@LiamDawe, yes it will be CKEditor 4 4.13 version.

@mechanicals
Copy link

mechanicals commented Aug 13, 2019

I think this is a really bad bug.
This should definitely be prioritized.
Our team gets really irritated by this behavior and they have to update the styling every time they paste from google docs which is actually all the time.
Any date for the release of version 4.13
Would be really helpful.

@knu
Copy link

knu commented Aug 13, 2019

Use the pasteFromGoogleDoc plugin mentioned above for the moment. That's what I do and working fine.

@jacekbogdanski
Copy link
Member

We are aware of the importance of the issue and already working on it. Take a look at #3257 for more information.

@AnnaTomanek
Copy link
Contributor

@mechanicals: CKEditor 4.13 is scheduled for the end of September. You can see the milestone here: https://github.com/ckeditor/ckeditor-dev/milestone/23

Sorry about any inconvenience caused - we're doing our best to have a proper solution for all Google Docs pasting issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin:clipboard The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. target:major Any docs related issue that should be merged into a major branch. type:feature A feature request.
Projects
None yet