Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Cannot upgrade Slate.js past 0.88.1: Copy-paste not working #229

Open
bradenmacdonald opened this issue Mar 24, 2023 · 0 comments
Open

Cannot upgrade Slate.js past 0.88.1: Copy-paste not working #229

bradenmacdonald opened this issue Mar 24, 2023 · 0 comments

Comments

@bradenmacdonald
Copy link
Owner

bradenmacdonald commented Mar 24, 2023

When using any slate version newer than 0.88.1 (e.g. the next version 0.90.0), copy-paste functionality in our editors (Lookup editor, markdown editor) is broken.

The problem seems to be in editor.insertFragment() this line computes the wrong value for inlinePath. Before, it computes [0, 0] but now it computes [] and as a result, the call to splitNodes() splits the parent paragraph into two paragraphs instead of just splitting the text node into two text nodes.

The diff between those two versions of Slate.js is here though I can't easily tell what the problem is, it seems like it's likely related to the new Element.isElement() calls ?

Simple test case: http://junction.local.neolace.net:5555/lookup?e=abcdef

Editor.children is '[{"type":"paragraph","block":true,"children":[{"type":"text","text":"abcdef"}]}]'
On 0.88.1, just the text node gets split into two. On 0.90.0+, the paragraph node gets split into two paragraphs.

@bradenmacdonald bradenmacdonald changed the title Copy-paste not working in Slate Editors Cannot upgrade Slate.js paste 0.88.1: Copy-paste not working Mar 24, 2023
@bradenmacdonald bradenmacdonald changed the title Cannot upgrade Slate.js paste 0.88.1: Copy-paste not working Cannot upgrade Slate.js past 0.88.1: Copy-paste not working Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant