Skip to content

Pasting text with newlines #3094

Closed Answered by eivindw
eivindw asked this question in Q&A
Apr 3, 2024 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Thanks for the pointers. Tested with all deserializers, but that did not fix stuff. Probably something weird in our setup. Found a workaround by just pasting as plain text if selection is in a code block:

      editor.insertData = (data) => {
        const selected = someNode(editor, {
          match: { type: getPluginType(editor, ELEMENT_CODE_BLOCK) }
        });

        if (selected) {
          editor.insertText(data.getData("text/plain"));
        } else {
          insertData(data);
        }
      }

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@eivindw
Comment options

eivindw Apr 3, 2024
Collaborator Author

@zbeyens
Comment options

@eivindw
Comment options

eivindw Apr 3, 2024
Collaborator Author

Answer selected by eivindw
@zbeyens
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants