const paragraph: Paragraph = {
type: "paragraph",
elementId: "uuid-1",
children: [
{
type: "text",
text: "",
},
{
type: "user-mention",
elementId: "uuid-2",
collaborator: {
user: "bob",
type: "user",
},
children: [{ text: "" } as any],
},
{
type: "text",
text: "abc",
},
{
type: "text",
text: "def",
bold: true,
},
],
};
describe("move inline forward", () => {
it("move inline forward", () => {
const { editor1 } = setupTreeTestEnvironment();
editor1.apply({
type: "insert_node",
node: paragraph,
path: [0],
});
editor1.flushLocalChanges();
checkSlateMatchesYjs(editor1, createTreeSlateEditor);
editor1.apply({
type: "move_node",
path: [0, 1],
newPath: [0, 3],
});
editor1.flushLocalChanges();
checkSlateMatchesYjs(editor1, createTreeSlateEditor);
});
});
moveNode.tsdoesn't properly handle the case when the origin and the target of the move operation are under the same parent and the target node is being moved forward to a later position under the parent.Repro: