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
I have run into what I think may be a Slate bug, but I'm not sure and thought I'd ask here first. I'm trying to render a table in Slate with a <colgroup> and several <col> sub-elements (there are styles on the <col> sub-elements in what I'm really doing, but not in the code sandboxes cited below as they are not needed for demo purposes). The rendering part works fine. The problem I have run into is that if I place the cursor in the top left cell of the table, and then press the left arrow key repeatedly so as to move the cursor out of the table , the Slate editor crashes and I get the following:
Error
Cannot resolve a DOM node from Slate node: {"text":""}
The same thing occurs if I place the cursor before the table and then press the right arrow key repeatedly so as to move the cursor into the first table cell.
Another table without a colgroup, but otherwise the same structure as the above, does not produce this error.
I'm guessing that Slate is trying to map a text child node from one of the col nodes to an HTML node, doesn't find one, and then crashes. I don't know what else to do with this since all nodes other than text nodes require a children property.
Note that I have also tried defining the col nodes as text nodes, but this creates a DOM structure that looks invalid to me (i.e. <span data-slate-node="text"><col></span> for each col node) and produces the same type of error anyway:
Error
Cannot resolve a DOM point from Slate point: {"path":[2,0,0],"offset":0}
Is this a Slate bug, or am I doing something wrong with how I have attempted to define and render the colgroup and col nodes? Are there any workarounds to prevent Slate from crashing in these scenarios?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello Slate Community,
I have run into what I think may be a Slate bug, but I'm not sure and thought I'd ask here first. I'm trying to render a table in Slate with a
<colgroup>
and several<col>
sub-elements (there are styles on the<col>
sub-elements in what I'm really doing, but not in the code sandboxes cited below as they are not needed for demo purposes). The rendering part works fine. The problem I have run into is that if I place the cursor in the top left cell of the table, and then press the left arrow key repeatedly so as to move the cursor out of the table , the Slate editor crashes and I get the following:The same thing occurs if I place the cursor before the table and then press the right arrow key repeatedly so as to move the cursor into the first table cell.
Another table without a colgroup, but otherwise the same structure as the above, does not produce this error.
I'm guessing that Slate is trying to map a text child node from one of the col nodes to an HTML node, doesn't find one, and then crashes. I don't know what else to do with this since all nodes other than text nodes require a children property.
A demo of the above can is available here: https://codesandbox.io/s/silly-ptolemy-5ho3uz
Note that I have also tried defining the col nodes as text nodes, but this creates a DOM structure that looks invalid to me (i.e.
<span data-slate-node="text"><col></span>
for each col node) and produces the same type of error anyway:A demo with the col nodes defined as text nodes can be found here: https://codesandbox.io/s/muddy-cdn-b098mm
Is this a Slate bug, or am I doing something wrong with how I have attempted to define and render the colgroup and col nodes? Are there any workarounds to prevent Slate from crashing in these scenarios?
Beta Was this translation helpful? Give feedback.
All reactions