You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FIle attached. To reproduce, copy-paste it into a fresh chapter, look at the editor UI, then refresh.
Note I made this file in Notepad on Windows and I'm assuming it has CRLF line endings TestNewline.txt
The text was updated successfully, but these errors were encountered:
This definitely isn't the expected behavior. Here's a bit of brainstorming about how to address it.
When pasting raw text, BookishEditor.handlePaste() takes a single text node ad inserts it into the lowest part of the document tree, climbing up the parents until it finds a node willing to insert it. But in doing so, it ignores any whitespace in the text node. This works on refresh because when that node is serialized, the whitespace is preserved, and on reload, it's parsed appropriately as separate paragraphs.
There are a few possible solutions here:
Split the raw text into multiple text nodes and insert them as a list. This would require a major revision to the insertion algorithm, since it only accepts a single node at the moment, not a list of nodes. It might also ignore any parsing logic.
Insert the text node as we do now, but then reparse, accounting for the whitespace. This would account for all parsing rules, but just require some careful handling of the caret placement.
On Sat, Jun 10, 2023, 2:14 PM Amy J. Ko ***@***.***> wrote:
This definitely isn't the expected behavior. Here's a bit of brainstorming
about how to address it.
When pasting raw text, it's currently inserted as a single text node in
the lowest part of the document tree, climbing up the parents until it
finds a node willing to handle it. But in doing so, it ignores any
whitespace in the text node. This works on refresh because when that node
is serialized, the whitespace is preserved, and on reload, it's parsed
appropriately as separate paragraphs.
There are a few possible solutions here:
1.
Split the raw text into multiple text nodes and insert them as a
series. This would require a major revision to the insertion algorithm,
since it only accepts a single node at the moment, not a list of nodes.
2.
Insert the text node as we do now, but then reparse, accounting for
the whitespace. This would account for all parsing rules, but just require
some careful handling of the caret placement.
I'm leaning towards #2 <#2>.
—
Reply to this email directly, view it on GitHub
<#341 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAO6WYLTYMVBWG4VWXCRIDLXKS2QDANCNFSM6AAAAAAYRLRIY4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
FIle attached. To reproduce, copy-paste it into a fresh chapter, look at the editor UI, then refresh.
Note I made this file in Notepad on Windows and I'm assuming it has CRLF line endings
TestNewline.txt
The text was updated successfully, but these errors were encountered: