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
Transforms.setNodes currently takes Partial<Node> as its second parameter for props. This means you can only override the props on the nodes you are setting and, for example, you cannot base the new properties on the nodes you are setting off of the already-existing properties on those nodes.
Additionally, Transforms.setNodes has a split option, but the split doesn't occur in a couple edge cases that should likely be considered a bug.
The split bug occurs due to these lines in Transforms.setNodes. Basically, if you look at Transforms.splitNodes, it will NOT split the relevant node if the split point is "at an edge" of the node. This makes sense for single splits, but not for an expanded range. For an expanded range, you always want to split if the start point is not at the start of its relevant node, and if the end point is not at the end of its relevant node. If the start point of the expanded range is at the start of its relevant node, no split is needed since you already capture the full node anyways. Same for if the end point is at the end of its relevant node.
Transforms.setNodes will not split an expanded range if the start/end points are at ANY edge of their respective nodes, which is not correct and results in setting props on nodes that was not intended.
Slate: 0.58.4
Browser: Chrome
OS: Mac
What's the expected behavior?
Transforms.setNodes props parameter should accept a set of props as Partial<Node> OR a function that takes the existing props for the relevant node and returns a new set of props to attach to the node.
Also, the splitting bug should be fixed.
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
Both.
What's the current behavior?
Transforms.setNodes currently takes
Partial<Node>
as its second parameter forprops
. This means you can only override the props on the nodes you are setting and, for example, you cannot base the new properties on the nodes you are setting off of the already-existing properties on those nodes.Additionally, Transforms.setNodes has a
split
option, but thesplit
doesn't occur in a couple edge cases that should likely be considered a bug.The split bug occurs due to these lines in Transforms.setNodes. Basically, if you look at Transforms.splitNodes, it will NOT split the relevant node if the split point is "at an edge" of the node. This makes sense for single splits, but not for an expanded range. For an expanded range, you always want to split if the start point is not at the start of its relevant node, and if the end point is not at the end of its relevant node. If the start point of the expanded range is at the start of its relevant node, no split is needed since you already capture the full node anyways. Same for if the end point is at the end of its relevant node.
Transforms.setNodes will not split an expanded range if the start/end points are at ANY edge of their respective nodes, which is not correct and results in setting props on nodes that was not intended.
Slate: 0.58.4
Browser: Chrome
OS: Mac
What's the expected behavior?
Transforms.setNodes
props
parameter should accept a set of props asPartial<Node>
OR a function that takes the existing props for the relevant node and returns a new set of props to attach to the node.Also, the splitting bug should be fixed.
The text was updated successfully, but these errors were encountered: