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

Pasting HTML embed widget does not paste it's content #8789

Closed
niegowski opened this issue Jan 9, 2021 · 5 comments · Fixed by #8812
Closed

Pasting HTML embed widget does not paste it's content #8789

niegowski opened this issue Jan 9, 2021 · 5 comments · Fixed by #8812
Assignees
Labels
package:html-embed squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior. type:regression This issue reports a bug that was not present in the previous releases.

Comments

@niegowski
Copy link
Contributor

📝 Provide detailed reproduction steps (if any)

  1. https://ckeditor.com/docs/ckeditor5/latest/features/html-embed.html
  2. Copy HTML widget
  3. Paste HTML widget

✔️ Expected result

Widget is pasted with its content.

❌ Actual result

Content of HTML widget is empty.

📃 Other details

  • Browser: …
  • OS: …
  • First affected CKEditor version: …
  • Installed CKEditor plugins: …

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

@niegowski niegowski added type:bug This issue reports a buggy (incorrect) behavior. squad:core Issue to be handled by the Core team. package:html-embed labels Jan 9, 2021
@niegowski
Copy link
Contributor Author

This is because HTML embed feature is registering rawContentMatcher on the editor.data.processor

editor.data.processor.registerRawContentMatcher( {
but Clipboard plugin is using a separate instance of HTMLProcessor
this._htmlDataProcessor = new HtmlDataProcessor( viewDocument );

@oleq oleq added the type:regression This issue reports a bug that was not present in the previous releases. label Jan 11, 2021
@oleq oleq added this to the nice-to-have milestone Jan 11, 2021
@maxbarnas
Copy link
Contributor

I see that in both cases `HTMLDataProcessor` is initialized with the same Document view. Seems reasonable to use HTMLDataProcessor from the editor instance. Am I missing something? Surely, this fixes the problem when tested locally.

@niegowski
Copy link
Contributor Author

Unfortunately, the editor.data.processor could be sth different than HTMLProcessor - i.e. it could be a markdown processor but for clipboard we need HTML processor. I was thinking about integrating it in a way that clipboard feature would be able to automatically use same matchers as those registered in data pipeline processor.

@maxbarnas
Copy link
Contributor

maxbarnas commented Jan 12, 2021

Gotcha! To be clear, editor.data.processor can be something different, depending on the contents the editor wants to handle, but the clipboard, in its current form, always expects HTML or plain text, right? That's why we need those two processors decoupled?

@niegowski
Copy link
Contributor Author

Gotcha! To be clear, editor.data.processor can be something different, depending on the contents the editor wants to handle, but the clipboard, in its current form, always expects HTML or plain text, right? That's why we need those two processors decoupled?

That's correct

@maxbarnas maxbarnas modified the milestones: nice-to-have, iteration 39 Jan 12, 2021
@maxbarnas maxbarnas self-assigned this Jan 12, 2021
niegowski added a commit that referenced this issue Jan 13, 2021
Fix (html-embed): Pasting HTML embed widget from the clipboard will not clear its content anymore. Closes #8789.

Feature (engine): New property `DataController#htmlProcessor` is initialized with `HtmlDataProcessor` and assigned to `DataController#processor` by default.

Internal (clipboard): Plugin now uses `HtmlDataProcessor` instance from the `DataController`.

Internal (editor-balloon, editor-classic, editor-inline, editor-decoupled): The `editor.processor` property is automatically initialized with `HtmlDataProcessor` now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:html-embed squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior. type:regression This issue reports a bug that was not present in the previous releases.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants