A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: copying 1 nested list item shouldn't copy list meta
Abdullah Atta9936bee8e070
diff --git a/packages/editor/src/extensions/clipboard-text-serializer/index.ts b/packages/editor/src/extensions/clipboard-text-serializer/index.tsindex 4bb6fdecf..7bb108db4 100644--- a/packages/editor/src/extensions/clipboard-text-serializer/index.ts+++ b/packages/editor/src/extensions/clipboard-text-serializer/index.ts@@ -91,7 +91,7 @@ export function transformCopied(slice: Slice) {maybeList.childCount === 1 &&maybeList.firstChild) {- return new Slice(maybeList.firstChild.content, 0, 0);+ return transformCopied(new Slice(maybeList.firstChild.content, 0, 0));}return slice;}diff --git a/packages/editor/src/extensions/clipboard-text-serializer/tests/__snapshots__/clipboard-text-serializer.test.ts.snap b/packages/editor/src/extensions/clipboard-text-serializer/tests/__snapshots__/clipboard-text-serializer.test.ts.snapindex add52d2b6..9ea6f8c48 100644--- a/packages/editor/src/extensions/clipboard-text-serializer/tests/__snapshots__/clipboard-text-serializer.test.ts.snap+++ b/packages/editor/src/extensions/clipboard-text-serializer/tests/__snapshots__/clipboard-text-serializer.test.ts.snap@@ -15,3 +15,19 @@ exports[`copying a single list item shouldn't copy the list metadata 1`] = `],}`;++exports[`copying a single nested list item shouldn't copy the list metadata 1`] = `+{+ "content": [+ {+ "content": [+ {+ "text": "Nested list item",+ "type": "text",+ },+ ],+ "type": "paragraph",+ },+ ],+}+`;diff --git a/packages/editor/src/extensions/clipboard-text-serializer/tests/clipboard-text-serializer.test.ts b/packages/editor/src/extensions/clipboard-text-serializer/tests/clipboard-text-serializer.test.tsindex 07302b33a..674700eaa 100644--- a/packages/editor/src/extensions/clipboard-text-serializer/tests/clipboard-text-serializer.test.ts+++ b/packages/editor/src/extensions/clipboard-text-serializer/tests/clipboard-text-serializer.test.ts@@ -84,6 +84,29 @@ test("copying a single list item shouldn't copy the list metadata", (t) => {).toMatchSnapshot();});+test("copying a single nested list item shouldn't copy the list metadata", (t) => {+ const { editor } = createEditor({+ initialContent: h("div", [+ h("ol", [+ h("li", [+ h("p", ["Hello"]),+ h("ol", [h("li", [h("p", ["Nested list item"])])])+ ])+ ])+ ]).innerHTML,+ extensions: {+ orderedList: OrderedList,+ listItem: ListItem+ }+ });++ t.expect(+ transformCopied(+ editor.state.doc.slice(12, editor.state.doc.nodeSize - 2)+ ).toJSON()+ ).toMatchSnapshot();+});+const createParagraphs = (spacing: "double" | "single") => [h("p", ["I am paragraph 1."], { "data-spacing": spacing }),h("p", ["I am paragraph 2."], { "data-spacing": spacing }),