-
Notifications
You must be signed in to change notification settings - Fork 552
[fix]: code evaluator code editor issues #4715
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
base: release/v0.104.1
Are you sure you want to change the base?
Changes from all commits
47f113d
fd8210d
3388329
36fbc91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,8 +117,13 @@ export function $insertLinesWithSelectionAndIndent({ | |
| } | ||
| } | ||
|
|
||
| // Clone trailing lines before removal | ||
| const clonedTrailingLines = linesAfter.map((l) => $copyNode(l)) | ||
| // Capture trailing-line TEXT before removal, then rebuild fresh nodes after | ||
| // insertion (see re-insertion below). We can't element-clone these lines: | ||
| // `$copyNode` assigns the clone a fresh key, and Lexical's ElementNode only | ||
| // carries child pointers when the key is unchanged — so a cloned CodeLineNode | ||
| // comes back EMPTY, wiping every line below the paste point. Rebuilding from | ||
| // text mirrors the large-paste fast path and preserves the content faithfully. | ||
| const trailingLineTexts = linesAfter.map((l) => l.getTextContent()) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a user pastes above an already folded code section, Useful? React with 👍 / 👎. |
||
| linesAfter.forEach((l) => l.remove()) | ||
| // Remove current line | ||
| currentLine.remove() | ||
|
|
@@ -174,11 +179,12 @@ export function $insertLinesWithSelectionAndIndent({ | |
| insertIdx++ | ||
| } | ||
|
|
||
| // Add trailing lines (use clones) | ||
| clonedTrailingLines.forEach((l, i) => { | ||
| // Add trailing lines (rebuilt from captured text — see note above) | ||
| const trailingLanguage = parentBlock.getLanguage() | ||
| trailingLineTexts.forEach((text, i) => { | ||
| const prevChild = $getLineAtIndex(parentBlock, insertIdx - 1 + i) | ||
| if (prevChild) { | ||
| prevChild.insertAfter(l) | ||
| prevChild.insertAfter($createNodeForLineWithTabs(text, trailingLanguage)) | ||
| } | ||
| }) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.