Closed tes735 closed 3 months ago
I think I, at least, found WHERE the issue might be, and it doesn't appear to be related to your code. The Slate docs have the following snippit. Note my comment. Closing.
export const resetNodes =
if (options.nodes) { const nodes = Node.isNode(options.nodes) ? [options.nodes] : options.nodes; /**
might have arrays in them. editor.apply is not getting everything from those arrays, only some things. */ nodes.forEach((node, i) => { editor.apply({ type: 'insert_node', path: [i], node: node }); }); }
const point = options.at && Point.isPoint(options.at) ? options.at : Editor.end(editor, []); if (point) { Transforms.select(editor, point); } };
It could be that I'm doing it wrong, but... here is the scenario:
I'm starting with html like the following:
Then I run htmlToSlate on it before adding it to the data for the slate editor. When I convert this htmlToSlate, the "text by itself" is lost. I can see when logging that it's not part of the "elements" after conversion unless I wrap that line in a div or something. Is there a trick to get this to work, or is it a bug? Thanks!
P. S. This is for a project where there are many instances of this so I don't have control over the data to fix it there.