Skip to content

WIP: On paste, read content from internal clipboard via paste registry#148

Closed
thibaudcolas wants to merge 1 commit intomasterfrom
bug/copy-paste-idempotency
Closed

WIP: On paste, read content from internal clipboard via paste registry#148
thibaudcolas wants to merge 1 commit intomasterfrom
bug/copy-paste-idempotency

Conversation

@thibaudcolas
Copy link
Copy Markdown
Collaborator

@thibaudcolas thibaudcolas commented Apr 18, 2018

Partly addresses #147, facebookarchive/draft-js#787.

This is a hack – we leverage the internal Draft.js clipboard (containing a BlockMap ready to be inserted with Modifier.insertFragment) for pastes between different editors on the same page.

This only works for editors within a single page, and won't work either if the page is reloaded between "copy" and "paste" (because of the editor refs registry at window.editorRefs).

It also doesn't de-register editor refs – ideally those operations should be in the componentDidMount / componentWillUnmount hooks, rather than in the ref callback.


This is testable on http://localhost:4000/examples/, by copying the content of the "Custom formats" editor (which has a DOCUMENT entity, and also an EMBED) into the "Wagtail features" editor. This is also demonstrable with the HORIZONTAL_RULE in the "All" editor.

@thibaudcolas
Copy link
Copy Markdown
Collaborator Author

Superseded by thibaudcolas/draftjs-conductor#2.

@thibaudcolas thibaudcolas deleted the bug/copy-paste-idempotency branch May 20, 2018 20:04
thibaudcolas added a commit to thibaudcolas/draftjs-conductor that referenced this pull request Jun 3, 2018
hirunatan pushed a commit to kaleidos/draftail that referenced this pull request Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant