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
Describe the bug
In a slate block you can add text and you can wrap that text with block or inline elements. An element in slate is a type of node that has a specific renderer. We have default elements but we can also add custom elements. As an example volto-slate-footnote is a custom inline element that allows wrapping some text with a footnote.
For understanding the issue let's say that the slate block render the following text: this is a text and the custom inline element applied over a portion of the text will result in: this is a <CustomInlineElement>text</CustomInlineElement>
Bug 1: when the cursor is at the end of a custom inline element, but not in the element itself, I see the unwrap button in the toolbar. If I want to remove (unwrap) it, pressing the unwrap button, I get the following error:
Uncaught TypeError: link is not iterable
at utils.js:76:1
The error comes from the _unwrapElement function because indeed there is no match for that element when the cursor is at the end however I still see the unwrap button in the toolbar because if the cursor is at the end of a custom inline element SlateEditor behave as if that element is active.
Bug 2: In a slate table when trying to wrap some text with a custom inline element I get the following error:
Uncaught Error: When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: {"anchor":null,"focus":null}
at utils.js:53:1
The error comes from _insertElement function. From my testing it seems like after wrapping the text with the element the new selection is ok but then when applying it to the editor it sees it as if being null so maybe a solution for this would be to set the selection asynchronous, in a setTimeout.
To Reproduce
Bug 1:
Add some text in a slate block
Wrap the last word with a custom inline element
Move the cursor at the end of the word that was wrapped
You will see the context toolbar of that custom inline element allowing you to unwrap the element
Press the unwrap button
Bug 2:
Add some text in a cell in a slate table block
Wrap that text with a custom inline element
The text was updated successfully, but these errors were encountered:
Describe the bug
In a slate block you can add text and you can wrap that text with block or inline elements. An element in slate is a type of node that has a specific renderer. We have default elements but we can also add custom elements. As an example volto-slate-footnote is a custom inline element that allows wrapping some text with a footnote.
For understanding the issue let's say that the slate block render the following text:
this is a text
and the custom inline element applied over a portion of the text will result in:this is a <CustomInlineElement>text</CustomInlineElement>
Bug 1: when the cursor is at the end of a custom inline element, but not in the element itself, I see the unwrap button in the toolbar. If I want to remove (unwrap) it, pressing the unwrap button, I get the following error:
The error comes from the _unwrapElement function because indeed there is no match for that element when the cursor is at the end however I still see the unwrap button in the toolbar because if the cursor is at the end of a custom inline element SlateEditor behave as if that element is active.
Bug 2: In a slate table when trying to wrap some text with a custom inline element I get the following error:
The error comes from _insertElement function. From my testing it seems like after wrapping the text with the element the new selection is ok but then when applying it to the editor it sees it as if being null so maybe a solution for this would be to set the selection asynchronous, in a setTimeout.
To Reproduce
Bug 1:
Bug 2:
The text was updated successfully, but these errors were encountered: