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: move list node types to a separate file to prevent require loop
Abdullah Atta1d5b0793d0ca
diff --git a/packages/editor/src/extensions/key-map/key-map.ts b/packages/editor/src/extensions/key-map/key-map.tsindex 3c414f3f6..334afa83f 100644--- a/packages/editor/src/extensions/key-map/key-map.ts+++ b/packages/editor/src/extensions/key-map/key-map.ts@@ -19,11 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.import { Editor, Extension } from "@tiptap/core";import { isInTable } from "@tiptap/pm/tables";-import {- isListActive,- LIST_ITEM_NODE_TYPES,- LIST_NODE_TYPES-} from "../../utils/prosemirror";+import { LIST_ITEM_NODE_TYPES, LIST_NODE_TYPES } from "../../utils/node-types";+import { isListActive } from "../../utils/prosemirror";export const KeyMap = Extension.create({name: "key-map",diff --git a/packages/editor/src/utils/node-types.ts b/packages/editor/src/utils/node-types.tsnew file mode 100644index 000000000..852a671a2--- /dev/null+++ b/packages/editor/src/utils/node-types.ts@@ -0,0 +1,39 @@+/*+This file is part of the Notesnook project (https://notesnook.com/)++Copyright (C) 2023 Streetwriters (Private) Limited++This program is free software: you can redistribute it and/or modify+it under the terms of the GNU General Public License as published by+the Free Software Foundation, either version 3 of the License, or+(at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program. If not, see <http://www.gnu.org/licenses/>.+*/++import { TaskList } from "@tiptap/extension-task-list";+import { BulletList } from "@tiptap/extension-bullet-list";+import { ListItem } from "@tiptap/extension-list-item";+import { OrderedList } from "@tiptap/extension-ordered-list";+import { OutlineList } from "../extensions/outline-list";+import { OutlineListItem } from "../extensions/outline-list-item";+import { TaskItem } from "@tiptap/extension-task-item";++export const LIST_NODE_TYPES = [+ TaskList.name,+ OutlineList.name,+ BulletList.name,+ OrderedList.name+];++export const LIST_ITEM_NODE_TYPES = [+ TaskItem.name,+ OutlineListItem.name,+ ListItem.name+];diff --git a/packages/editor/src/utils/prosemirror.ts b/packages/editor/src/utils/prosemirror.tsindex 55f75bf33..c6de71be1 100644--- a/packages/editor/src/utils/prosemirror.ts+++ b/packages/editor/src/utils/prosemirror.ts@@ -39,6 +39,7 @@ import { OutlineList } from "../extensions/outline-list";import { OutlineListItem } from "../extensions/outline-list-item";import { TaskItemNode } from "../extensions/task-item";import { TaskListNode } from "../extensions/task-list";+import { LIST_NODE_TYPES } from "./node-types";export type NodeWithOffset = {node?: ProsemirrorNode;@@ -46,19 +47,6 @@ export type NodeWithOffset = {to: number;};-export const LIST_NODE_TYPES = [- TaskListNode.name,- OutlineList.name,- BulletList.name,- OrderedList.name-];--export const LIST_ITEM_NODE_TYPES = [- TaskItemNode.name,- OutlineListItem.name,- ListItem.name-];-export function hasSameAttributes(prev: Attrs, next: Attrs) {for (const key in prev) {const prevValue = prev[key];