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
While copying & pasting in BlockNote works for the majority of content, there are 2 cases in which it breaks:
When pasting two elements, e.g.:
<p>Foo</p>
<p>Bar<p>
Here, both elements are parsed as blockContent` and the editor doesn't know if they should be interpreted as two separate blocks or a single, nested, block. It always chooses the latter, meaning that the example is parsed as:
In this scenario, the type of the first element is also lost, so it's always interpreted as textContent.
When pasting nested elements, e.g.:
<ul>
<li>Foo
<ul>
<li>Bar</li>
</ul>
</li>
</ul>
Here, the nesting information is lost. This is mainly applicable to list items, since paragraph and heading elements can't be nested as per the HTML spec. When pasting list items into BlockNote, they too are parsed as blockContent, which can't have nested items. Therefore, the text of each nested item is concatenated to the end of the text of the parent item and the example gets parsed as:
{
block: {
listItemContent: "Foo Bar",
}
}
I've already attempted to fix these issues on the copy-paste-new-architecture branch if it's of any help, though I haven't had much success.
Once this is working we'll also need additional tests for it.
The text was updated successfully, but these errors were encountered:
matthewlipski
changed the title
Bug: Elements copied from outside the editor sometimes aren't parsed correctly
Bug: Content copied from outside the editor sometimes isn't parsed correctly
Dec 7, 2022
While copying & pasting in BlockNote works for the majority of content, there are 2 cases in which it breaks:
Here, both elements are parsed as blockContent` and the editor doesn't know if they should be interpreted as two separate blocks or a single, nested, block. It always chooses the latter, meaning that the example is parsed as:
In this scenario, the type of the first element is also lost, so it's always interpreted as
textContent
.Here, the nesting information is lost. This is mainly applicable to list items, since paragraph and heading elements can't be nested as per the HTML spec. When pasting list items into BlockNote, they too are parsed as blockContent, which can't have nested items. Therefore, the text of each nested item is concatenated to the end of the text of the parent item and the example gets parsed as:
I've already attempted to fix these issues on the
copy-paste-new-architecture
branch if it's of any help, though I haven't had much success.Once this is working we'll also need additional tests for it.
The text was updated successfully, but these errors were encountered: