-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 support #2472
Conversation
I rebased this PR into the latest upstream and did some refactoring. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the fact that in the current shape uberpaste
is basically pastefromword
with different name. Actually I was thinking about something different:
uberpaste
is just a mechanism for registering new paste handlers.pastefromword
registers paste handler for pasting from Word.pastefromgdocs
registers paste handler for pasting from GDocs.
Some other configuration like uberpaste
and pastefromoffice
(Word + GDocs) is also possible. The point is: uberpaste
IMO should be very generic and allow creating more specific plugins.
Additionally I don't like the idea of paste handlers that can register themselves. I'd move register
to uberpaste
plugin itself:
editor.plugins.uberpaste.register( {
cleanFn: function() {},
canHandle: function() {}
} );
Also the whole mechanism of handling images – can't it be moved into its own paste handler or into helper in pastefromword
? It doesn't seem to fit generic PasteHandler
class. With this and above changes we can even eliminate it in favour of pure objects.
How you would like to refactor the file structure of the original If I understand you correctly, you would like to see 3 different plugins:
The idea was to avoid loading filter file if paste event cannot be handled by Word or Gdocs handlers. If we move handling verification methods ( Additionally, some filter definition can be shared between google docs and MS Word, like extracted table rules. How would you like to share such rules between plugins? The simplest way seems to extract additional plugin like I also had the same concerns as you when doing this refactoring. Probably we should revisit our decision if we want to implement it "easy way" proposed by this PR or do it correct fixing tech dept of PFW plugin - which also will take much more time. |
@Comandeer @jacekbogdanski From what I understand the PR adds handling GDocs content into PFW logic and moves the whole thing to TBH I don't remember the initial approach which we took while starting implementing pasting from GDocs support, but my first thought was that it will be a separated plugin. Then I thought that in the same manner we will have PasteFromLibreOffice, PasteFromX, PasteFromY which might be quite confusing (however, gives good separation). Adding everything to one plugin makes it easier and simpler (but introduces some additional complexity and tech debt). So we have few options:
I'm not sure TBH, refactoring PFW seems like big, unnecessary task, but having everything in one plugin doesn't seem like a good solution either. We can go with 3rd proposal which is somehow in-between. WDYT? |
Actually I'd be happy even with the first proposal from @f1ames list (single
I don't see why these two things are connected. The whole inner mechanism of paste handler would be the same, the only thing changed is the place of registering the handler.
Every |
@Comandeer Could you elaborate a little bit on your solution? How exactly you would like it to work. The general approach seems reasonable, but I'm not sure if I have the same concept in mind after reading your description. Should the filters by somehow extracted and then reused by code handling Word, GDocs in their paste handler? So you will have main plugin file which enables registering paste handlers, then some common filters and then for each supported app (Word, GDocs) the handler will specific filters should be registered? |
If you move registering handler into the handler file with
And we will end up with two unmanageable (PFW + common tools/filters ) files instead of one :D Nevertheless, it probably will help us to not touch PFW but use it for GDOC purposes. Maybe we could write a bit more advanced file loader for PFW, so it can load files like Actually, we could even end up with some kind of micro plugins which only contain So, instead of single pastetools.register( {
filters: 'pastefromword,common',
canHandle: function( html ) { ... },
// Note shared tools for `clean` function argument, also loaded asynchronously by
// `pastetools`
clean: function( tools ) { ... }
} );
|
I was thinking about moving it into |
@jacekbogdanski It seems reasonable to me. The one thing I would like to avoid is to much refactoring in PFW so just modify what is needed to work with I have only some doubts about |
They share the same So, to sum up we will go with #2472 (comment) proposition about creating a middlemen |
As the whole approach changed it should be safe to close this PR now. We already have new PR for Paste From World / Google docs support - #3257 Please, follow it for updates on the feature state as this PR won't be further developed. Also, see #3258 for more information about changes into Rich Text paste mechanism. (Keeping branch alive for reference for #3257) |
What is the purpose of this pull request?
New feature
Does your PR contain necessary tests?
All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
What changes did you make?
This is the early PR of
pastefromword
plugin refactoring into a single plugin which will handle different paste sources. Currently, except Word this plugin handles pasting from Google Docs. A new plugin has been nameduberpaste
, but be aware that the name may change.This PR will require a lot of additional polishing like deprecating
pastefromword
docs, renaming variables, updating lang files etc. which I'm aware of - however, changes are pretty wide so I think it's good time to start talking about this feature.I also didn't spend much time on testing tables because they are a target to change #2219.
Closes #835