diff --git a/packages/editor/src/components/action-sheet/index.tsx b/packages/editor/src/components/action-sheet/index.tsx
index 65ca4cf6e..ddf6d7a14 100644
--- a/packages/editor/src/components/action-sheet/index.tsx
+++ b/packages/editor/src/components/action-sheet/index.tsx
@@ -26,7 +26,7 @@ import React, {
} from "react";
import { MenuItem, Icon, MenuButton, MenuSeparator } from "@notesnook/ui";
import { Box, Button, Flex, Text } from "@theme-ui/components";
-import { Icons } from "../../toolbar/icons";
+import { Icons } from "../../toolbar/icons.js";
import Modal from "react-modal";
import {
motion,
diff --git a/packages/editor/src/components/popup-presenter/index.tsx b/packages/editor/src/components/popup-presenter/index.tsx
index b82b3d936..5465f15ca 100644
--- a/packages/editor/src/components/popup-presenter/index.tsx
+++ b/packages/editor/src/components/popup-presenter/index.tsx
@@ -28,13 +28,13 @@ import {
getPopupRoot,
getToolbarElement,
unmountPopupRoot
-} from "../../toolbar/utils/dom";
+} from "../../toolbar/utils/dom.js";
import {
useIsMobile,
useToolbarStore
-} from "../../toolbar/stores/toolbar-store";
+} from "../../toolbar/stores/toolbar-store.js";
import React from "react";
-import { ResponsivePresenter, ResponsivePresenterProps } from "../responsive";
+import { ResponsivePresenter, ResponsivePresenterProps } from "../responsive/index.js";
export type PopupWrapperProps = UsePopupHandlerOptions & {
autoCloseOnUnmount?: boolean;
diff --git a/packages/editor/src/components/resizer/index.tsx b/packages/editor/src/components/resizer/index.tsx
index c7d598f0c..4d9a9ea9a 100644
--- a/packages/editor/src/components/resizer/index.tsx
+++ b/packages/editor/src/components/resizer/index.tsx
@@ -20,10 +20,10 @@ along with this program. If not, see .
import { SchemeColors } from "@notesnook/theme";
import { Resizable } from "re-resizable";
import { PropsWithChildren } from "react";
-import { Icons } from "../../toolbar";
+import { Icons } from "../../toolbar/index.js";
import { Icon } from "@notesnook/ui";
import { Flex } from "@theme-ui/components";
-import { getEditorDOM } from "../../toolbar/utils/dom";
+import { getEditorDOM } from "../../toolbar/utils/dom.js";
type ResizerProps = {
enabled: boolean;
diff --git a/packages/editor/src/components/responsive/index.tsx b/packages/editor/src/components/responsive/index.tsx
index 7ca597179..c615f7000 100644
--- a/packages/editor/src/components/responsive/index.tsx
+++ b/packages/editor/src/components/responsive/index.tsx
@@ -18,17 +18,17 @@ along with this program. If not, see .
*/
import { PropsWithChildren } from "react";
-import { useIsMobile } from "../../toolbar/stores/toolbar-store";
+import { useIsMobile } from "../../toolbar/stores/toolbar-store.js";
import {
ActionSheetPresenter,
ActionSheetPresenterProps
-} from "../action-sheet";
+} from "../action-sheet/index.js";
import {
MenuPresenter,
MenuPresenterProps,
PopupPresenter
} from "@notesnook/ui";
-import { getPopupContainer } from "../../toolbar/utils/dom";
+import { getPopupContainer } from "../../toolbar/utils/dom.js";
type ResponsiveContainerProps = {
mobile?: JSX.Element;
diff --git a/packages/editor/src/extension-imports.ts b/packages/editor/src/extension-imports.ts
new file mode 100644
index 000000000..e0b4d0a3f
--- /dev/null
+++ b/packages/editor/src/extension-imports.ts
@@ -0,0 +1,50 @@
+/*
+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 .
+*/
+
+export type * from "@tiptap/extension-history";
+export type * from "@tiptap/extension-character-count";
+export type * from "@tiptap/extension-placeholder";
+export type * from "@tiptap/extension-underline";
+export type * from "@tiptap/starter-kit";
+export type * from "@tiptap/extension-text-align";
+export type * from "@tiptap/extension-subscript";
+export type * from "@tiptap/extension-superscript";
+export type * from "./extensions/font-size/index.js";
+export type * from "./extensions/text-direction/index.js";
+export type * from "@tiptap/extension-text-style";
+export type * from "@tiptap/extension-font-family";
+export type * from "./extensions/bullet-list/index.js";
+export type * from "./extensions/ordered-list/index.js";
+export type * from "@tiptap/extension-color";
+export type * from "@tiptap/extension-table-row";
+export type * from "./extensions/table-cell/index.js";
+export type * from "./extensions/table-header/index.js";
+export type * from "./extensions/image/index.js";
+export type * from "./extensions/attachment/index.js";
+export type * from "./extensions/task-list/index.js";
+export type * from "./extensions/task-item/index.js";
+export type * from "./extensions/search-replace/index.js";
+export type * from "./extensions/embed/index.js";
+export type * from "./extensions/code-block/index.js";
+export type * from "./extensions/list-item/index.js";
+export type * from "./extensions/outline-list/index.js";
+export type * from "./extensions/outline-list-item/index.js";
+export type * from "./extensions/table/index.js";
+export type * from "./extensions/check-list/index.js";
+export type * from "./extensions/check-list-item/index.js";
diff --git a/packages/editor/src/extensions.ts b/packages/editor/src/extensions.ts
deleted file mode 100644
index 96e7f8e20..000000000
--- a/packages/editor/src/extensions.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-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 .
-*/
-
-import "@tiptap/extension-character-count";
-import "@tiptap/extension-placeholder";
-import "@tiptap/extension-underline";
-import "@tiptap/starter-kit";
-import "@tiptap/extension-text-align";
-import "@tiptap/extension-subscript";
-import "@tiptap/extension-superscript";
-import "./extensions/font-size";
-import "./extensions/text-direction";
-import "@tiptap/extension-text-style";
-import "@tiptap/extension-font-family";
-import "./extensions/bullet-list";
-import "./extensions/ordered-list";
-import "@tiptap/extension-color";
-import "@tiptap/extension-table-row";
-import "./extensions/table-cell";
-import "./extensions/table-header";
-import "./extensions/image";
-import "./extensions/attachment";
-import "./extensions/task-list";
-import "./extensions/task-item";
-import "./extensions/search-replace";
-import "./extensions/embed";
-import "./extensions/code-block";
-import "./extensions/list-item";
-import "./extensions/outline-list";
-import "./extensions/outline-list-item";
-import "./extensions/table";
-import "./extensions/check-list";
-import "./extensions/check-list-item";
diff --git a/packages/editor/src/extensions/attachment/attachment.ts b/packages/editor/src/extensions/attachment/attachment.ts
index dc0cb9802..7bd2d31e2 100644
--- a/packages/editor/src/extensions/attachment/attachment.ts
+++ b/packages/editor/src/extensions/attachment/attachment.ts
@@ -19,9 +19,9 @@ along with this program. If not, see .
import { Node, mergeAttributes, findChildren } from "@tiptap/core";
import { Attribute } from "@tiptap/core";
-import { createNodeView } from "../react";
-import { AttachmentComponent } from "./component";
-import { Attachment } from "./types";
+import { createNodeView } from "../react/index.js";
+import { AttachmentComponent } from "./component.js";
+import { Attachment } from "./types.js";
export type AttachmentType = "image" | "file" | "camera";
export interface AttachmentOptions {
diff --git a/packages/editor/src/extensions/attachment/component.tsx b/packages/editor/src/extensions/attachment/component.tsx
index 0da00f668..2d0431bce 100644
--- a/packages/editor/src/extensions/attachment/component.tsx
+++ b/packages/editor/src/extensions/attachment/component.tsx
@@ -18,13 +18,13 @@ along with this program. If not, see .
*/
import { Box, Text } from "@theme-ui/components";
-import { FileAttachment } from "./types";
+import { FileAttachment } from "./types.js";
import { useRef, useState } from "react";
import { Icon } from "@notesnook/ui";
-import { Icons } from "../../toolbar/icons";
-import { ReactNodeViewProps } from "../react";
-import { ToolbarGroup } from "../../toolbar/components/toolbar-group";
-import { DesktopOnly } from "../../components/responsive";
+import { Icons } from "../../toolbar/icons.js";
+import { ReactNodeViewProps } from "../react/index.js";
+import { ToolbarGroup } from "../../toolbar/components/toolbar-group.js";
+import { DesktopOnly } from "../../components/responsive/index.js";
export function AttachmentComponent(props: ReactNodeViewProps) {
const { editor, node, selected } = props;
diff --git a/packages/editor/src/extensions/attachment/index.ts b/packages/editor/src/extensions/attachment/index.ts
index b1a5168f0..50286c8a4 100644
--- a/packages/editor/src/extensions/attachment/index.ts
+++ b/packages/editor/src/extensions/attachment/index.ts
@@ -17,5 +17,5 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./attachment";
-export * from "./types";
+export * from "./attachment.js";
+export * from "./types.js";
diff --git a/packages/editor/src/extensions/block-id/index.ts b/packages/editor/src/extensions/block-id/index.ts
index 002d84a48..3dcb6bcb9 100644
--- a/packages/editor/src/extensions/block-id/index.ts
+++ b/packages/editor/src/extensions/block-id/index.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { BlockId } from "./block-id";
+import { BlockId } from "./block-id.js";
-export * from "./block-id";
+export * from "./block-id.js";
export default BlockId;
diff --git a/packages/editor/src/extensions/blockquote/blockquote.ts b/packages/editor/src/extensions/blockquote/blockquote.ts
index 0d29504f2..ed75662e2 100644
--- a/packages/editor/src/extensions/blockquote/blockquote.ts
+++ b/packages/editor/src/extensions/blockquote/blockquote.ts
@@ -16,7 +16,7 @@ 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 .
*/
-import { getParentAttributes } from "../../utils/prosemirror";
+import { getParentAttributes } from "../../utils/prosemirror.js";
import { wrappingInputRule } from "@tiptap/core";
import TiptapBlockquote, { inputRegex } from "@tiptap/extension-blockquote";
diff --git a/packages/editor/src/extensions/blockquote/index.ts b/packages/editor/src/extensions/blockquote/index.ts
index 1715492ff..07d7f83ca 100644
--- a/packages/editor/src/extensions/blockquote/index.ts
+++ b/packages/editor/src/extensions/blockquote/index.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { Blockquote } from "./blockquote";
+import { Blockquote } from "./blockquote.js";
-export * from "./blockquote";
+export * from "./blockquote.js";
export default Blockquote;
diff --git a/packages/editor/src/extensions/bullet-list/bullet-list.ts b/packages/editor/src/extensions/bullet-list/bullet-list.ts
index dfe9b4952..05029449b 100644
--- a/packages/editor/src/extensions/bullet-list/bullet-list.ts
+++ b/packages/editor/src/extensions/bullet-list/bullet-list.ts
@@ -19,7 +19,7 @@ along with this program. If not, see .
import TiptapBulletList from "@tiptap/extension-bullet-list";
import { wrappingInputRule } from "@tiptap/core";
-import { getParentAttributes } from "../../utils/prosemirror";
+import { getParentAttributes } from "../../utils/prosemirror.js";
export const inputRegex = /^\s*([-+*])\s$/;
export const BulletList = TiptapBulletList.extend({
diff --git a/packages/editor/src/extensions/bullet-list/index.ts b/packages/editor/src/extensions/bullet-list/index.ts
index f9f53ba4c..006c2cb84 100644
--- a/packages/editor/src/extensions/bullet-list/index.ts
+++ b/packages/editor/src/extensions/bullet-list/index.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { BulletList } from "./bullet-list";
+import { BulletList } from "./bullet-list.js";
-export * from "./bullet-list";
+export * from "./bullet-list.js";
export default BulletList;
diff --git a/packages/editor/src/extensions/callout/callout.ts b/packages/editor/src/extensions/callout/callout.ts
index 6793a9275..6eccfc01a 100644
--- a/packages/editor/src/extensions/callout/callout.ts
+++ b/packages/editor/src/extensions/callout/callout.ts
@@ -16,15 +16,15 @@ 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 .
*/
-import { getParentAttributes } from "../../utils/prosemirror";
+import { getParentAttributes } from "../../utils/prosemirror.js";
import {
InputRule,
Node,
findParentNodeClosestToPos,
mergeAttributes
} from "@tiptap/core";
-import { Paragraph } from "../paragraph";
-import { Heading } from "../heading";
+import { Paragraph } from "../paragraph/index.js";
+import { Heading } from "../heading/index.js";
import { TextSelection } from "@tiptap/pm/state";
import { Fragment } from "@tiptap/pm/model";
diff --git a/packages/editor/src/extensions/callout/index.ts b/packages/editor/src/extensions/callout/index.ts
index d287bad29..2df13c96a 100644
--- a/packages/editor/src/extensions/callout/index.ts
+++ b/packages/editor/src/extensions/callout/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./callout";
+export * from "./callout.js";
diff --git a/packages/editor/src/extensions/check-list-item/index.ts b/packages/editor/src/extensions/check-list-item/index.ts
index ddf88e3a9..b55949230 100644
--- a/packages/editor/src/extensions/check-list-item/index.ts
+++ b/packages/editor/src/extensions/check-list-item/index.ts
@@ -16,8 +16,8 @@ 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 .
*/
-import { CheckListItem } from "./check-list-item";
+import { CheckListItem } from "./check-list-item.js";
-export * from "./check-list-item";
+export * from "./check-list-item.js";
export default CheckListItem;
diff --git a/packages/editor/src/extensions/check-list/index.ts b/packages/editor/src/extensions/check-list/index.ts
index 42bab716e..62f5fb9dd 100644
--- a/packages/editor/src/extensions/check-list/index.ts
+++ b/packages/editor/src/extensions/check-list/index.ts
@@ -16,8 +16,8 @@ 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 .
*/
-import { CheckList } from "./check-list";
+import { CheckList } from "./check-list.js";
-export * from "./check-list";
+export * from "./check-list.js";
export default CheckList;
diff --git a/packages/editor/src/extensions/clipboard/clipboard-dom-parser.ts b/packages/editor/src/extensions/clipboard/clipboard-dom-parser.ts
index 49ec2c83e..7cd612267 100644
--- a/packages/editor/src/extensions/clipboard/clipboard-dom-parser.ts
+++ b/packages/editor/src/extensions/clipboard/clipboard-dom-parser.ts
@@ -23,8 +23,8 @@ import {
} from "@tiptap/pm/model";
import { encodeNonAsciiHTML } from "entities";
import { Schema, Slice } from "prosemirror-model";
-import { inferLanguage } from "../code-block";
-import { hasPermission } from "../../types";
+import { inferLanguage } from "../code-block/index.js";
+import { hasPermission } from "../../types.js";
export class ClipboardDOMParser extends ProsemirrorDOMParser {
static fromSchema(schema: Schema): ClipboardDOMParser {
diff --git a/packages/editor/src/extensions/clipboard/clipboard-text-parser.ts b/packages/editor/src/extensions/clipboard/clipboard-text-parser.ts
index d8a62a4f9..8d5cb2bb5 100644
--- a/packages/editor/src/extensions/clipboard/clipboard-text-parser.ts
+++ b/packages/editor/src/extensions/clipboard/clipboard-text-parser.ts
@@ -19,7 +19,7 @@ along with this program. If not, see .
import { ResolvedPos, Slice } from "@tiptap/pm/model";
import { encodeNonAsciiHTML } from "entities";
-import { ClipboardDOMParser } from "./clipboard-dom-parser";
+import { ClipboardDOMParser } from "./clipboard-dom-parser.js";
import { EditorView } from "@tiptap/pm/view";
export function clipboardTextParser(
diff --git a/packages/editor/src/extensions/clipboard/clipboard-text-serializer.ts b/packages/editor/src/extensions/clipboard/clipboard-text-serializer.ts
index 058fc1157..a0017aaf2 100644
--- a/packages/editor/src/extensions/clipboard/clipboard-text-serializer.ts
+++ b/packages/editor/src/extensions/clipboard/clipboard-text-serializer.ts
@@ -19,7 +19,7 @@ along with this program. If not, see .
import { TextSerializer } from "@tiptap/core";
import { Schema, Slice } from "prosemirror-model";
-import { ListItem } from "../list-item";
+import { ListItem } from "../list-item/index.js";
import { EditorView } from "@tiptap/pm/view";
export function clipboardTextSerializer(content: Slice, view: EditorView) {
diff --git a/packages/editor/src/extensions/clipboard/clipboard.ts b/packages/editor/src/extensions/clipboard/clipboard.ts
index 803c7ba37..d9280c65a 100644
--- a/packages/editor/src/extensions/clipboard/clipboard.ts
+++ b/packages/editor/src/extensions/clipboard/clipboard.ts
@@ -20,11 +20,11 @@ along with this program. If not, see .
import { Extension } from "@tiptap/core";
import { Plugin, PluginKey } from "prosemirror-state";
import { Slice } from "prosemirror-model";
-import { LIST_NODE_TYPES } from "../../utils/node-types";
-import { ClipboardDOMParser } from "./clipboard-dom-parser";
-import { ClipboardDOMSerializer } from "./clipboard-dom-serializer";
-import { clipboardTextParser } from "./clipboard-text-parser";
-import { clipboardTextSerializer } from "./clipboard-text-serializer";
+import { LIST_NODE_TYPES } from "../../utils/node-types.js";
+import { ClipboardDOMParser } from "./clipboard-dom-parser.js";
+import { ClipboardDOMSerializer } from "./clipboard-dom-serializer.js";
+import { clipboardTextParser } from "./clipboard-text-parser.js";
+import { clipboardTextSerializer } from "./clipboard-text-serializer.js";
import { EditorView } from "prosemirror-view";
export const Clipboard = Extension.create({
diff --git a/packages/editor/src/extensions/clipboard/index.ts b/packages/editor/src/extensions/clipboard/index.ts
index 72e41804c..8725281d8 100644
--- a/packages/editor/src/extensions/clipboard/index.ts
+++ b/packages/editor/src/extensions/clipboard/index.ts
@@ -17,5 +17,5 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./clipboard";
-export { Clipboard as default } from "./clipboard";
+export * from "./clipboard.js";
+export { Clipboard as default } from "./clipboard.js";
diff --git a/packages/editor/src/extensions/clipboard/tests/clipboard-dom-parser.test.ts b/packages/editor/src/extensions/clipboard/tests/clipboard-dom-parser.test.ts
index f03cbd0be..a84806f81 100644
--- a/packages/editor/src/extensions/clipboard/tests/clipboard-dom-parser.test.ts
+++ b/packages/editor/src/extensions/clipboard/tests/clipboard-dom-parser.test.ts
@@ -22,7 +22,7 @@ import {
formatCodeblocks,
convertBrToSingleSpacedParagraphs,
convertGoogleDocsChecklist
-} from "../clipboard-dom-parser";
+} from "../clipboard-dom-parser.js";
const cases = [
[`line 1
line 2
`],
diff --git a/packages/editor/src/extensions/clipboard/tests/clipboard-text-parser.test.ts b/packages/editor/src/extensions/clipboard/tests/clipboard-text-parser.test.ts
index 0c59370bb..f041b09b5 100644
--- a/packages/editor/src/extensions/clipboard/tests/clipboard-text-parser.test.ts
+++ b/packages/editor/src/extensions/clipboard/tests/clipboard-text-parser.test.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import { test } from "vitest";
-import { convertTextToHTML } from "../clipboard-text-parser";
+import { convertTextToHTML } from "../clipboard-text-parser.js";
const cases = [
`Hello\r\nworld`,
diff --git a/packages/editor/src/extensions/clipboard/tests/clipboard-text-serializer.test.ts b/packages/editor/src/extensions/clipboard/tests/clipboard-text-serializer.test.ts
index 3f4192833..36723d2e4 100644
--- a/packages/editor/src/extensions/clipboard/tests/clipboard-text-serializer.test.ts
+++ b/packages/editor/src/extensions/clipboard/tests/clipboard-text-serializer.test.ts
@@ -18,14 +18,14 @@ along with this program. If not, see .
*/
import { test } from "vitest";
-import { createEditor, h } from "../../../../test-utils";
-import OrderedList from "../../ordered-list";
-import { ListItem } from "../../list-item";
-import { transformCopied } from "../index";
-import { Paragraph } from "../../paragraph";
-import { ClipboardDOMSerializer } from "../clipboard-dom-serializer";
-import { clipboardTextSerializer } from "../clipboard-text-serializer";
-import Link from "../../link";
+import { createEditor, h } from "../../../../test-utils/index.js";
+import OrderedList from "../../ordered-list/index.js";
+import { ListItem } from "../../list-item/index.js";
+import { transformCopied } from "../index.js";
+import { Paragraph } from "../../paragraph/index.js";
+import { ClipboardDOMSerializer } from "../clipboard-dom-serializer.js";
+import { clipboardTextSerializer } from "../clipboard-text-serializer.js";
+import Link from "../../link/index.js";
test("copied list items shouldn't contain extra newlines", (t) => {
const { editor } = createEditor({
diff --git a/packages/editor/src/extensions/code-block/code-block.ts b/packages/editor/src/extensions/code-block/code-block.ts
index be5b483f9..def3d7cb3 100644
--- a/packages/editor/src/extensions/code-block/code-block.ts
+++ b/packages/editor/src/extensions/code-block/code-block.ts
@@ -27,14 +27,15 @@ import {
Selection
} from "prosemirror-state";
import { ResolvedPos, Node as ProsemirrorNode, Slice } from "prosemirror-model";
-import { CodeblockComponent } from "./component";
-import { HighlighterPlugin } from "./highlighter";
-import { createNodeView } from "../react";
+import { CodeblockComponent } from "./component.js";
+import { HighlighterPlugin } from "./highlighter.js";
+import { createNodeView } from "../react/index.js";
import detectIndent from "detect-indent";
import redent from "redent";
import stripIndent from "strip-indent";
import { nanoid } from "nanoid";
import Languages from "./languages.json";
+import { CaretPosition, CodeLine } from "./utils.js";
interface Indent {
type: "tab" | "space";
@@ -558,41 +559,6 @@ export const CodeBlock = Node.create({
}
});
-export type CaretPosition = {
- column: number;
- line: number;
- selected?: number;
- total: number;
- from: number;
-};
-export function toCaretPosition(
- selection: Selection,
- lines?: CodeLine[]
-): CaretPosition | undefined {
- const { $from, $to, $head } = selection;
- if ($from.parent.type.name !== CodeBlock.name) return;
- lines = lines || getLines($from.parent);
-
- for (const line of lines) {
- if ($head.pos >= line.from && $head.pos <= line.to) {
- const lineLength = line.length + 1;
- return {
- line: line.index + 1,
- column: lineLength - (line.to - $head.pos),
- selected: $to.pos - $from.pos,
- total: lines.length,
- from: line.from
- };
- }
- }
- return;
-}
-
-export function getLines(node: ProsemirrorNode) {
- const { lines } = node.attrs as CodeBlockAttributes;
- return lines || [];
-}
-
function exitOnTripleEnter(editor: Editor, $from: ResolvedPos) {
const isAtEnd = $from.parentOffset === $from.parent.nodeSize - 2;
const endsWithDoubleNewline = $from.parent.textContent.endsWith("\n\n");
@@ -639,46 +605,6 @@ function getNewline($from: ResolvedPos, options: Indent) {
};
}
-type CodeLine = {
- index: number;
- from: number;
- to: number;
- length: number;
- text: (length?: number) => string;
-};
-export function toCodeLines(code: string, pos: number): CodeLine[] {
- const positions: CodeLine[] = [];
-
- let start = 0;
- let from = pos + 1;
- let index = 0;
- while (start <= code.length) {
- let end = code.indexOf("\n", start);
- if (end <= -1) end = code.length;
-
- const lineLength = end - start;
- const to = from + lineLength;
- const lineStart = start;
- positions.push({
- index,
- length: lineLength,
- from,
- to,
- text: (length) => {
- return code.slice(
- lineStart,
- length ? lineStart + length : lineStart + lineLength
- );
- }
- });
-
- from = to + 1;
- start = end + 1;
- ++index;
- }
- return positions;
-}
-
function getSelectedLines(lines: CodeLine[], selection: Selection) {
const { $from, $to } = selection;
return lines.filter(
diff --git a/packages/editor/src/extensions/code-block/component.tsx b/packages/editor/src/extensions/code-block/component.tsx
index 42c0051ca..68404b9ad 100644
--- a/packages/editor/src/extensions/code-block/component.tsx
+++ b/packages/editor/src/extensions/code-block/component.tsx
@@ -19,14 +19,14 @@ along with this program. If not, see .
import { Flex, Input, Text } from "@theme-ui/components";
import { useRef, useState } from "react";
-import { Button } from "../../components/button";
-import { ResponsivePresenter } from "../../components/responsive";
-import { useTimer } from "../../hooks/use-timer";
+import { Button } from "../../components/button.js";
+import { ResponsivePresenter } from "../../components/responsive/index.js";
+import { useTimer } from "../../hooks/use-timer.js";
import { Icon } from "@notesnook/ui";
-import { Popup } from "../../toolbar/components/popup";
-import { Icons } from "../../toolbar/icons";
-import { ReactNodeViewProps } from "../react/types";
-import { CodeBlockAttributes } from "./code-block";
+import { Popup } from "../../toolbar/components/popup.js";
+import { Icons } from "../../toolbar/icons.js";
+import { ReactNodeViewProps } from "../react/types.js";
+import { CodeBlockAttributes } from "./code-block.js";
import Languages from "./languages.json";
import { useThemeEngineStore } from "@notesnook/theme";
diff --git a/packages/editor/src/extensions/code-block/highlighter.ts b/packages/editor/src/extensions/code-block/highlighter.ts
index 5b4c2a52a..d6986d8c5 100644
--- a/packages/editor/src/extensions/code-block/highlighter.ts
+++ b/packages/editor/src/extensions/code-block/highlighter.ts
@@ -24,13 +24,13 @@ import {
findParentNodeClosestToPos,
NodeWithPos
} from "@tiptap/core";
-import { Root, refractor } from "refractor/lib/core";
+import { Root, refractor } from "refractor/lib/core.js";
import { RootContent } from "hast";
import { ReplaceAroundStep, ReplaceStep } from "prosemirror-transform";
-import { toCaretPosition, toCodeLines } from "./code-block";
+import { toCaretPosition, toCodeLines } from "./utils.js";
import Languages from "./languages.json";
-import { isLanguageLoaded, loadLanguage } from "./loader";
-import { getChangedNodes } from "../../utils/prosemirror";
+import { isLanguageLoaded, loadLanguage } from "./loader.js";
+import { getChangedNodes } from "../../utils/prosemirror.js";
export type ReplaceMergedStep = ReplaceAroundStep | ReplaceStep;
diff --git a/packages/editor/src/extensions/code-block/index.ts b/packages/editor/src/extensions/code-block/index.ts
index 0237405cb..f5d0014a1 100644
--- a/packages/editor/src/extensions/code-block/index.ts
+++ b/packages/editor/src/extensions/code-block/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./code-block";
+export * from "./code-block.js";
diff --git a/packages/editor/src/extensions/code-block/loader.ts b/packages/editor/src/extensions/code-block/loader.ts
index c04622ecb..77ec39592 100644
--- a/packages/editor/src/extensions/code-block/loader.ts
+++ b/packages/editor/src/extensions/code-block/loader.ts
@@ -17,16 +17,14 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
+import { loadLanguage as _loadLanguage } from "./languages/index.js";
+
const loadedLanguages: Record = {};
export function isLanguageLoaded(name: string) {
return !!loadedLanguages[name];
}
export async function loadLanguage(shortName: string) {
- const { default: language } = await import(
- /* webpackChunkName: 'code-lang-[request]' */
- `../../../languages/${shortName}.js`
- );
-
+ const { default: language } = (await _loadLanguage(shortName)) || {};
loadedLanguages[shortName] = true;
return language;
}
diff --git a/packages/editor/src/extensions/code-block/tests/code-block.test.ts b/packages/editor/src/extensions/code-block/tests/code-block.test.ts
index fe40e64e3..ea640f706 100644
--- a/packages/editor/src/extensions/code-block/tests/code-block.test.ts
+++ b/packages/editor/src/extensions/code-block/tests/code-block.test.ts
@@ -17,11 +17,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { createEditor, h } from "../../../../test-utils";
+import { createEditor, h } from "../../../../test-utils/index.js";
import { expect, test, vi } from "vitest";
-import { CodeBlock, inferLanguage } from "../code-block";
-import { HighlighterPlugin } from "../highlighter";
-import { getChangedNodes } from "../../../utils/prosemirror";
+import { CodeBlock, inferLanguage } from "../code-block.js";
+import { HighlighterPlugin } from "../highlighter.js";
+import { getChangedNodes } from "../../../utils/prosemirror.js";
import { refractor } from "refractor/lib/core";
const CODEBLOCKS_HTML = h("div", [
diff --git a/packages/editor/src/extensions/code-block/utils.ts b/packages/editor/src/extensions/code-block/utils.ts
new file mode 100644
index 000000000..c032e3ce1
--- /dev/null
+++ b/packages/editor/src/extensions/code-block/utils.ts
@@ -0,0 +1,99 @@
+/*
+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 .
+*/
+
+import { Node } from "@tiptap/pm/model";
+import { Selection } from "@tiptap/pm/state";
+import type { CodeBlockAttributes } from "./code-block.js";
+
+export type CodeLine = {
+ index: number;
+ from: number;
+ to: number;
+ length: number;
+ text: (length?: number) => string;
+};
+
+export type CaretPosition = {
+ column: number;
+ line: number;
+ selected?: number;
+ total: number;
+ from: number;
+};
+
+export function toCodeLines(code: string, pos: number): CodeLine[] {
+ const positions: CodeLine[] = [];
+
+ let start = 0;
+ let from = pos + 1;
+ let index = 0;
+ while (start <= code.length) {
+ let end = code.indexOf("\n", start);
+ if (end <= -1) end = code.length;
+
+ const lineLength = end - start;
+ const to = from + lineLength;
+ const lineStart = start;
+ positions.push({
+ index,
+ length: lineLength,
+ from,
+ to,
+ text: (length) => {
+ return code.slice(
+ lineStart,
+ length ? lineStart + length : lineStart + lineLength
+ );
+ }
+ });
+
+ from = to + 1;
+ start = end + 1;
+ ++index;
+ }
+ return positions;
+}
+
+export function toCaretPosition(
+ selection: Selection,
+ lines?: CodeLine[]
+): CaretPosition | undefined {
+ const { $from, $to, $head } = selection;
+ if ($from.parent.type.name !== "codeblock") return;
+ lines = lines || getLines($from.parent);
+
+ for (const line of lines) {
+ if ($head.pos >= line.from && $head.pos <= line.to) {
+ const lineLength = line.length + 1;
+ return {
+ line: line.index + 1,
+ column: lineLength - (line.to - $head.pos),
+ selected: $to.pos - $from.pos,
+ total: lines.length,
+ from: line.from
+ };
+ }
+ }
+ return;
+}
+
+export function getLines(node: Node) {
+ const { lines } = node.attrs as CodeBlockAttributes;
+ return lines || [];
+}
diff --git a/packages/editor/src/extensions/code-mark/index.ts b/packages/editor/src/extensions/code-mark/index.ts
index d55a07a62..1a580aa56 100644
--- a/packages/editor/src/extensions/code-mark/index.ts
+++ b/packages/editor/src/extensions/code-mark/index.ts
@@ -17,5 +17,5 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./code-mark";
-export { Codemark as default } from "./code-mark";
+export * from "./code-mark.js";
+export { Codemark as default } from "./code-mark.js";
diff --git a/packages/editor/src/extensions/date-time/date-time.ts b/packages/editor/src/extensions/date-time/date-time.ts
index 362f1c62e..d200dc91f 100644
--- a/packages/editor/src/extensions/date-time/date-time.ts
+++ b/packages/editor/src/extensions/date-time/date-time.ts
@@ -23,9 +23,7 @@ import {
InputRuleFinder,
ExtendedRegExpMatchArray
} from "@tiptap/core";
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
-import { formatDate } from "@notesnook/core/dist/utils/date";
+import { formatDate } from "@notesnook/common";
declare module "@tiptap/core" {
interface Commands {
diff --git a/packages/editor/src/extensions/date-time/index.ts b/packages/editor/src/extensions/date-time/index.ts
index d4aa59a54..e70a5731a 100644
--- a/packages/editor/src/extensions/date-time/index.ts
+++ b/packages/editor/src/extensions/date-time/index.ts
@@ -17,5 +17,5 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./date-time";
-export { DateTime as default } from "./date-time";
+export * from "./date-time.js";
+export { DateTime as default } from "./date-time.js";
diff --git a/packages/editor/src/extensions/diff-highlighter/index.ts b/packages/editor/src/extensions/diff-highlighter/index.ts
index eb0a576e7..56d6deb11 100644
--- a/packages/editor/src/extensions/diff-highlighter/index.ts
+++ b/packages/editor/src/extensions/diff-highlighter/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./diff-highlighter";
+export * from "./diff-highlighter.js";
diff --git a/packages/editor/src/extensions/embed/component.tsx b/packages/editor/src/extensions/embed/component.tsx
index c06ff094c..8ff008be5 100644
--- a/packages/editor/src/extensions/embed/component.tsx
+++ b/packages/editor/src/extensions/embed/component.tsx
@@ -19,13 +19,13 @@ along with this program. If not, see .
import { Box, Flex, Embed } from "@theme-ui/components";
import { useRef, useState } from "react";
-import { EmbedAlignmentOptions, EmbedAttributes } from "./embed";
-import { ReactNodeViewProps } from "../react";
-import { DesktopOnly } from "../../components/responsive";
-import { ToolbarGroup } from "../../toolbar/components/toolbar-group";
-import { Icons } from "../../toolbar";
+import { EmbedAlignmentOptions, EmbedAttributes } from "./embed.js";
+import { ReactNodeViewProps } from "../react/index.js";
+import { DesktopOnly } from "../../components/responsive/index.js";
+import { ToolbarGroup } from "../../toolbar/components/toolbar-group.js";
+import { Icons } from "../../toolbar/index.js";
import { Icon } from "@notesnook/ui";
-import { Resizer } from "../../components/resizer";
+import { Resizer } from "../../components/resizer/index.js";
export function EmbedComponent(
props: ReactNodeViewProps
diff --git a/packages/editor/src/extensions/embed/embed.ts b/packages/editor/src/extensions/embed/embed.ts
index 436aea4f3..fecb62ea4 100644
--- a/packages/editor/src/extensions/embed/embed.ts
+++ b/packages/editor/src/extensions/embed/embed.ts
@@ -18,10 +18,10 @@ along with this program. If not, see .
*/
import { Node, mergeAttributes } from "@tiptap/core";
-import { hasSameAttributes } from "../../utils/prosemirror";
-import { createNodeView } from "../react";
-import { TextDirections } from "../text-direction";
-import { EmbedComponent } from "./component";
+import { hasSameAttributes } from "../../utils/prosemirror.js";
+import { createNodeView } from "../react/index.js";
+import { TextDirections } from "../text-direction/index.js";
+import { EmbedComponent } from "./component.js";
export interface EmbedOptions {
HTMLAttributes: Record;
diff --git a/packages/editor/src/extensions/embed/index.ts b/packages/editor/src/extensions/embed/index.ts
index 26781da2b..fb0d1f6b0 100644
--- a/packages/editor/src/extensions/embed/index.ts
+++ b/packages/editor/src/extensions/embed/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./embed";
+export * from "./embed.js";
diff --git a/packages/editor/src/extensions/font-family/font-family.ts b/packages/editor/src/extensions/font-family/font-family.ts
index e45aca98e..dbf41a470 100644
--- a/packages/editor/src/extensions/font-family/font-family.ts
+++ b/packages/editor/src/extensions/font-family/font-family.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import "@tiptap/extension-text-style";
import { Extension } from "@tiptap/core";
-import { getFontById } from "../../utils/font";
+import { getFontById } from "../../utils/font.js";
export type FontFamilyOptions = {
types: string[];
diff --git a/packages/editor/src/extensions/font-family/index.ts b/packages/editor/src/extensions/font-family/index.ts
index 41ab5e547..5741d9256 100644
--- a/packages/editor/src/extensions/font-family/index.ts
+++ b/packages/editor/src/extensions/font-family/index.ts
@@ -16,8 +16,8 @@ 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 .
*/
-import { FontFamily } from "./font-family";
+import { FontFamily } from "./font-family.js";
-export * from "./font-family";
+export * from "./font-family.js";
export default FontFamily;
diff --git a/packages/editor/src/extensions/font-size/font-size.ts b/packages/editor/src/extensions/font-size/font-size.ts
index bbf73cbd0..c6ee04163 100644
--- a/packages/editor/src/extensions/font-size/font-size.ts
+++ b/packages/editor/src/extensions/font-size/font-size.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { useToolbarStore } from "../../toolbar/stores/toolbar-store";
+import { useToolbarStore } from "../../toolbar/stores/toolbar-store.js";
import { Editor, Extension } from "@tiptap/core";
type FontSizeOptions = {
diff --git a/packages/editor/src/extensions/font-size/index.ts b/packages/editor/src/extensions/font-size/index.ts
index 29821ac9a..3810a82eb 100644
--- a/packages/editor/src/extensions/font-size/index.ts
+++ b/packages/editor/src/extensions/font-size/index.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { FontSize } from "./font-size";
+import { FontSize } from "./font-size.js";
-export * from "./font-size";
+export * from "./font-size.js";
export default FontSize;
diff --git a/packages/editor/src/extensions/heading/index.ts b/packages/editor/src/extensions/heading/index.ts
index e70635bfd..5929ba622 100644
--- a/packages/editor/src/extensions/heading/index.ts
+++ b/packages/editor/src/extensions/heading/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./heading";
+export * from "./heading.js";
diff --git a/packages/editor/src/extensions/highlight/index.ts b/packages/editor/src/extensions/highlight/index.ts
index 8ba11e832..7ef77256a 100644
--- a/packages/editor/src/extensions/highlight/index.ts
+++ b/packages/editor/src/extensions/highlight/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./highlight";
+export * from "./highlight.js";
diff --git a/packages/editor/src/extensions/image/component.tsx b/packages/editor/src/extensions/image/component.tsx
index 52ed460ae..92fa4bcc1 100644
--- a/packages/editor/src/extensions/image/component.tsx
+++ b/packages/editor/src/extensions/image/component.tsx
@@ -19,29 +19,29 @@ along with this program. If not, see .
import { ThemeUIStyleObject } from "@theme-ui/core";
import { Box, Flex, Image, Text } from "@theme-ui/components";
-import { ImageAttributes } from "./image";
+import { ImageAttributes } from "./image.js";
import { useEffect, useRef, useState } from "react";
-import { ReactNodeViewProps } from "../react";
-import { DesktopOnly } from "../../components/responsive";
+import { ReactNodeViewProps } from "../react/index.js";
+import { DesktopOnly } from "../../components/responsive/index.js";
import { Icon } from "@notesnook/ui";
-import { Icons } from "../../toolbar/icons";
-import { ToolbarGroup } from "../../toolbar/components/toolbar-group";
+import { Icons } from "../../toolbar/icons.js";
+import { ToolbarGroup } from "../../toolbar/components/toolbar-group.js";
import {
useIsMobile,
useToolbarStore
-} from "../../toolbar/stores/toolbar-store";
-import { Resizer } from "../../components/resizer";
+} from "../../toolbar/stores/toolbar-store.js";
+import { Resizer } from "../../components/resizer/index.js";
import {
corsify,
downloadImage,
revokeBloburl,
toBlobURL,
toDataURL
-} from "../../utils/downloader";
+} from "../../utils/downloader.js";
import { motion } from "framer-motion";
-import { useObserver } from "../../hooks/use-observer";
-import { Attachment, ImageAlignmentOptions } from "../attachment";
-import DataURL from "@notesnook/core/dist/utils/dataurl";
+import { useObserver } from "../../hooks/use-observer.js";
+import { Attachment, ImageAlignmentOptions } from "../attachment/index.js";
+import { DataURL } from "@notesnook/common";
export const AnimatedImage = motion(Image);
diff --git a/packages/editor/src/extensions/image/image.ts b/packages/editor/src/extensions/image/image.ts
index 7317f2986..78bbd863a 100644
--- a/packages/editor/src/extensions/image/image.ts
+++ b/packages/editor/src/extensions/image/image.ts
@@ -18,15 +18,15 @@ along with this program. If not, see .
*/
import { Node, nodeInputRule, mergeAttributes } from "@tiptap/core";
-import { hasSameAttributes } from "../../utils/prosemirror";
+import { hasSameAttributes } from "../../utils/prosemirror.js";
import {
ImageAlignmentOptions,
ImageAttachment,
getDataAttribute
-} from "../attachment";
-import { createNodeView } from "../react";
-import { TextDirections } from "../text-direction";
-import { ImageComponent } from "./component";
+} from "../attachment/index.js";
+import { createNodeView } from "../react/index.js";
+import { TextDirections } from "../text-direction/index.js";
+import { ImageComponent } from "./component.js";
export interface ImageOptions {
inline: boolean;
@@ -56,7 +56,7 @@ declare module "@tiptap/core" {
}
}
-export const inputRegex = /(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
+const inputRegex = /(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
export const ImageNode = Node.create({
name: "image",
diff --git a/packages/editor/src/extensions/image/index.ts b/packages/editor/src/extensions/image/index.ts
index 7eccbe2ef..c86575818 100644
--- a/packages/editor/src/extensions/image/index.ts
+++ b/packages/editor/src/extensions/image/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./image";
+export * from "./image.js";
diff --git a/packages/editor/src/extensions/keep-in-view/index.ts b/packages/editor/src/extensions/keep-in-view/index.ts
index d4c2ff018..96de3a367 100644
--- a/packages/editor/src/extensions/keep-in-view/index.ts
+++ b/packages/editor/src/extensions/keep-in-view/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./keep-in-view";
+export * from "./keep-in-view.js";
diff --git a/packages/editor/src/extensions/keep-in-view/keep-in-view.ts b/packages/editor/src/extensions/keep-in-view/keep-in-view.ts
index 6af387231..b3809d976 100644
--- a/packages/editor/src/extensions/keep-in-view/keep-in-view.ts
+++ b/packages/editor/src/extensions/keep-in-view/keep-in-view.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import { Editor, Extension, posToDOMRect } from "@tiptap/core";
-import { inlineDebounce } from "../../utils/debounce";
+import { inlineDebounce } from "../../utils/debounce.js";
type KeepInViewOptions = {
scrollIntoViewOnWindowResize: boolean;
diff --git a/packages/editor/src/extensions/key-map/index.ts b/packages/editor/src/extensions/key-map/index.ts
index f2a48bade..87963f9c8 100644
--- a/packages/editor/src/extensions/key-map/index.ts
+++ b/packages/editor/src/extensions/key-map/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./key-map";
+export * from "./key-map.js";
diff --git a/packages/editor/src/extensions/key-map/key-map.ts b/packages/editor/src/extensions/key-map/key-map.ts
index a90b240ed..148005836 100644
--- a/packages/editor/src/extensions/key-map/key-map.ts
+++ b/packages/editor/src/extensions/key-map/key-map.ts
@@ -19,9 +19,9 @@ along with this program. If not, see .
import { Extension } from "@tiptap/core";
import { isInTable } from "@tiptap/pm/tables";
-import { isListActive } from "../../utils/prosemirror";
-import { CodeBlock } from "../code-block";
-import { showLinkPopup } from "../../toolbar/popups/link-popup";
+import { CodeBlock } from "../code-block/index.js";
+import { showLinkPopup } from "../../toolbar/popups/link-popup.js";
+import { isListActive } from "../../utils/list.js";
export const KeyMap = Extension.create({
name: "key-map",
diff --git a/packages/editor/src/extensions/link/index.ts b/packages/editor/src/extensions/link/index.ts
index f63fec1d8..d4a267531 100644
--- a/packages/editor/src/extensions/link/index.ts
+++ b/packages/editor/src/extensions/link/index.ts
@@ -16,8 +16,8 @@ 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 .
*/
-import { Link } from "./link";
+import { Link } from "./link.js";
-export * from "./link";
+export * from "./link.js";
export default Link;
diff --git a/packages/editor/src/extensions/link/link.ts b/packages/editor/src/extensions/link/link.ts
index 42d966eb6..f0a7a4161 100644
--- a/packages/editor/src/extensions/link/link.ts
+++ b/packages/editor/src/extensions/link/link.ts
@@ -29,11 +29,11 @@ import {
} from "@tiptap/core";
import { Plugin, TextSelection } from "@tiptap/pm/state";
import { find, registerCustomProtocol, reset } from "linkifyjs";
-import { autolink } from "./helpers/autolink";
-import { clickHandler } from "./helpers/clickHandler";
-import { pasteHandler } from "./helpers/pasteHandler";
-import { ImageNode } from "../image";
-import { selectionToOffset } from "../../utils/prosemirror";
+import { autolink } from "./helpers/autolink.js";
+import { clickHandler } from "./helpers/clickHandler.js";
+import { pasteHandler } from "./helpers/pasteHandler.js";
+import { ImageNode } from "../image/index.js";
+import { selectionToOffset } from "../../utils/prosemirror.js";
export interface LinkProtocolOptions {
scheme: string;
diff --git a/packages/editor/src/extensions/list-item/index.ts b/packages/editor/src/extensions/list-item/index.ts
index a7211da75..5cfa37290 100644
--- a/packages/editor/src/extensions/list-item/index.ts
+++ b/packages/editor/src/extensions/list-item/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./list-item";
+export * from "./list-item.js";
diff --git a/packages/editor/src/extensions/math/index.ts b/packages/editor/src/extensions/math/index.ts
index 7dbb750e0..6aa445839 100644
--- a/packages/editor/src/extensions/math/index.ts
+++ b/packages/editor/src/extensions/math/index.ts
@@ -17,5 +17,5 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export { MathInline } from "./math-inline";
-export { MathBlock } from "./math-block";
+export { MathInline } from "./math-inline.js";
+export { MathBlock } from "./math-block.js";
diff --git a/packages/editor/src/extensions/math/math-block.ts b/packages/editor/src/extensions/math/math-block.ts
index be0312ff8..541468333 100644
--- a/packages/editor/src/extensions/math/math-block.ts
+++ b/packages/editor/src/extensions/math/math-block.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import { Node, mergeAttributes } from "@tiptap/core";
-import { insertMathNode } from "./plugin";
+import { insertMathNode } from "./plugin/index.js";
import { NodeSelection } from "prosemirror-state";
declare module "@tiptap/core" {
diff --git a/packages/editor/src/extensions/math/math-inline.ts b/packages/editor/src/extensions/math/math-inline.ts
index 64e694406..00314b414 100644
--- a/packages/editor/src/extensions/math/math-inline.ts
+++ b/packages/editor/src/extensions/math/math-inline.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import { Node, mergeAttributes } from "@tiptap/core";
-import { mathPlugin } from "./plugin";
+import { mathPlugin } from "./plugin/index.js";
declare module "@tiptap/core" {
interface Commands {
diff --git a/packages/editor/src/extensions/math/plugin/index.ts b/packages/editor/src/extensions/math/plugin/index.ts
index a8a4f5170..7a35a3263 100644
--- a/packages/editor/src/extensions/math/plugin/index.ts
+++ b/packages/editor/src/extensions/math/plugin/index.ts
@@ -23,22 +23,22 @@ along with this program. If not, see .
*--------------------------------------------------------*/
// core functionality
-export { MathView, type ICursorPosObserver } from "./math-node-view";
+export { MathView, type ICursorPosObserver } from "./math-node-view.js";
export {
mathPlugin,
createMathView,
type IMathPluginState
-} from "./math-plugin";
+} from "./math-plugin.js";
// recommended plugins
-export { mathBackspaceCmd } from "./plugins/math-backspace";
+export { mathBackspaceCmd } from "./plugins/math-backspace.js";
// optional / experimental plugins
-export { mathSelectPlugin } from "./plugins/math-select";
+export { mathSelectPlugin } from "./plugins/math-select.js";
// commands
-export { insertMathNode } from "./commands/insert-math-node";
+export { insertMathNode } from "./commands/insert-math-node.js";
// utilities
-export { mathSerializer } from "./utils/text-serializer";
-export * from "./utils/types";
+export { mathSerializer } from "./utils/text-serializer.js";
+export * from "./utils/types.js";
diff --git a/packages/editor/src/extensions/math/plugin/math-node-view.ts b/packages/editor/src/extensions/math/plugin/math-node-view.ts
index 72ab8d6c9..9a3a455a2 100644
--- a/packages/editor/src/extensions/math/plugin/math-node-view.ts
+++ b/packages/editor/src/extensions/math/plugin/math-node-view.ts
@@ -44,9 +44,9 @@ import {
deleteSelection
} from "prosemirror-commands";
-import { collapseMathNode } from "./commands/collapse-math-node";
-import { IMathPluginState } from "./math-plugin";
-import { MathRenderFn } from "./renderers/types";
+import { collapseMathNode } from "./commands/collapse-math-node.js";
+import { IMathPluginState } from "./math-plugin.js";
+import { MathRenderFn } from "./renderers/types.js";
type FragmentWithContent = Fragment & { content: ProseNode[] };
diff --git a/packages/editor/src/extensions/math/plugin/math-plugin.ts b/packages/editor/src/extensions/math/plugin/math-plugin.ts
index d6d700044..dea9abfe2 100644
--- a/packages/editor/src/extensions/math/plugin/math-plugin.ts
+++ b/packages/editor/src/extensions/math/plugin/math-plugin.ts
@@ -29,9 +29,9 @@ import {
PluginKey,
PluginSpec
} from "prosemirror-state";
-import { MathView } from "./math-node-view";
+import { MathView } from "./math-node-view.js";
import { EditorView } from "prosemirror-view";
-import { KatexRenderer } from "./renderers/katex";
+import { KatexRenderer } from "./renderers/katex.js";
////////////////////////////////////////////////////////////
diff --git a/packages/editor/src/extensions/math/plugin/renderers/katex.ts b/packages/editor/src/extensions/math/plugin/renderers/katex.ts
index 345044741..1a9b2aa75 100644
--- a/packages/editor/src/extensions/math/plugin/renderers/katex.ts
+++ b/packages/editor/src/extensions/math/plugin/renderers/katex.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { MathRenderer } from "./types";
+import { MathRenderer } from "./types.js";
async function loadKatex() {
const { default: katex } = await import("katex");
@@ -25,7 +25,7 @@ async function loadKatex() {
// Chemistry formulas support
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore TODO: maybe rewrite this in typescript?
- await import("katex/contrib/mhchem/mhchem");
+ await import("katex/contrib/mhchem/mhchem.js");
return katex;
}
diff --git a/packages/editor/src/extensions/ordered-list/index.ts b/packages/editor/src/extensions/ordered-list/index.ts
index b10981023..087b279dd 100644
--- a/packages/editor/src/extensions/ordered-list/index.ts
+++ b/packages/editor/src/extensions/ordered-list/index.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { OrderedList } from "./ordered-list";
+import { OrderedList } from "./ordered-list.js";
-export * from "./ordered-list";
+export * from "./ordered-list.js";
export default OrderedList;
diff --git a/packages/editor/src/extensions/ordered-list/ordered-list.ts b/packages/editor/src/extensions/ordered-list/ordered-list.ts
index 261c14cdc..7fd4edc81 100644
--- a/packages/editor/src/extensions/ordered-list/ordered-list.ts
+++ b/packages/editor/src/extensions/ordered-list/ordered-list.ts
@@ -19,7 +19,7 @@ along with this program. If not, see .
import { wrappingInputRule } from "@tiptap/core";
import TiptapOrderedList, { inputRegex } from "@tiptap/extension-ordered-list";
-import { getParentAttributes } from "../../utils/prosemirror";
+import { getParentAttributes } from "../../utils/prosemirror.js";
export const OrderedList = TiptapOrderedList.extend({
addAttributes() {
diff --git a/packages/editor/src/extensions/outline-list-item/index.ts b/packages/editor/src/extensions/outline-list-item/index.ts
index 895ecb7a3..13cf12b7f 100644
--- a/packages/editor/src/extensions/outline-list-item/index.ts
+++ b/packages/editor/src/extensions/outline-list-item/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./outline-list-item";
+export * from "./outline-list-item.js";
diff --git a/packages/editor/src/extensions/outline-list-item/outline-list-item.ts b/packages/editor/src/extensions/outline-list-item/outline-list-item.ts
index 8b38e9084..ba4003b9b 100644
--- a/packages/editor/src/extensions/outline-list-item/outline-list-item.ts
+++ b/packages/editor/src/extensions/outline-list-item/outline-list-item.ts
@@ -22,8 +22,8 @@ import {
mergeAttributes,
findParentNodeClosestToPos
} from "@tiptap/core";
-import { findParentNodeOfTypeClosestToPos } from "../../utils/prosemirror";
-import { OutlineList } from "../outline-list/outline-list";
+import { findParentNodeOfTypeClosestToPos } from "../../utils/prosemirror.js";
+import { OutlineList } from "../outline-list/outline-list.js";
export interface ListItemOptions {
HTMLAttributes: Record;
diff --git a/packages/editor/src/extensions/outline-list/index.ts b/packages/editor/src/extensions/outline-list/index.ts
index 83e0a3b31..68ecfd8bb 100644
--- a/packages/editor/src/extensions/outline-list/index.ts
+++ b/packages/editor/src/extensions/outline-list/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./outline-list";
+export * from "./outline-list.js";
diff --git a/packages/editor/src/extensions/outline-list/outline-list.ts b/packages/editor/src/extensions/outline-list/outline-list.ts
index 0bc2b8b73..22b780d94 100644
--- a/packages/editor/src/extensions/outline-list/outline-list.ts
+++ b/packages/editor/src/extensions/outline-list/outline-list.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { getParentAttributes } from "../../utils/prosemirror";
+import { getParentAttributes } from "../../utils/prosemirror.js";
import { Node, mergeAttributes, wrappingInputRule } from "@tiptap/core";
export type OutlineListAttributes = {
@@ -41,7 +41,7 @@ declare module "@tiptap/core" {
}
}
-export const inputRegex = /^\s*(-o)\s$/;
+const inputRegex = /^\s*(-o)\s$/;
const outlineListItemName = "outlineListItem";
export const OutlineList = Node.create({
name: "outlineList",
diff --git a/packages/editor/src/extensions/paragraph/index.ts b/packages/editor/src/extensions/paragraph/index.ts
index 23d14bcc3..8fb3e0fc9 100644
--- a/packages/editor/src/extensions/paragraph/index.ts
+++ b/packages/editor/src/extensions/paragraph/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./paragraph";
+export * from "./paragraph.js";
diff --git a/packages/editor/src/extensions/quirks/index.ts b/packages/editor/src/extensions/quirks/index.ts
index 2ea12bd7b..cee9c1e61 100644
--- a/packages/editor/src/extensions/quirks/index.ts
+++ b/packages/editor/src/extensions/quirks/index.ts
@@ -17,5 +17,5 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./quirks";
-export { Quirks as default } from "./quirks";
+export * from "./quirks.js";
+export { Quirks as default } from "./quirks.js";
diff --git a/packages/editor/src/extensions/quirks/quirks.ts b/packages/editor/src/extensions/quirks/quirks.ts
index 512416926..de2a463d2 100644
--- a/packages/editor/src/extensions/quirks/quirks.ts
+++ b/packages/editor/src/extensions/quirks/quirks.ts
@@ -19,7 +19,7 @@ along with this program. If not, see .
import { Editor, Extension, findParentNode } from "@tiptap/core";
import { EditorState, Selection } from "@tiptap/pm/state";
-import { isAndroid } from "../../utils/platform";
+import { isAndroid } from "../../utils/platform.js";
export type QuirksOptions = {
/**
diff --git a/packages/editor/src/extensions/react/index.ts b/packages/editor/src/extensions/react/index.ts
index f0e78cdbf..000ca8ab2 100644
--- a/packages/editor/src/extensions/react/index.ts
+++ b/packages/editor/src/extensions/react/index.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./react-node-view";
-export * from "./types";
-export * from "./react-portal-provider";
-export * from "./event-dispatcher";
+export * from "./react-node-view.js";
+export * from "./types.js";
+export * from "./react-portal-provider.js";
+export * from "./event-dispatcher.js";
diff --git a/packages/editor/src/extensions/react/react-node-view.tsx b/packages/editor/src/extensions/react/react-node-view.tsx
index a9121fa63..565ec4219 100644
--- a/packages/editor/src/extensions/react/react-node-view.tsx
+++ b/packages/editor/src/extensions/react/react-node-view.tsx
@@ -21,18 +21,18 @@ import React, { FunctionComponent, SyntheticEvent } from "react";
import { NodeView, Decoration, DecorationSource } from "prosemirror-view";
import { Node as PMNode, Slice } from "prosemirror-model";
import { NodeSelection } from "prosemirror-state";
-import { PortalProviderAPI } from "./react-portal-provider";
+import { PortalProviderAPI } from "./react-portal-provider.js";
import {
ReactNodeViewProps,
ReactNodeViewOptions,
GetPosNode,
ContentDOM
-} from "./types";
+} from "./types.js";
import { Editor, NodeViewRendererProps } from "@tiptap/core";
import { __serializeForClipboard, EditorView } from "prosemirror-view";
import { EmotionThemeProvider } from "@notesnook/theme";
-import { isAndroid, isiOS } from "../../utils/platform";
-import { useToolbarStore } from "../../toolbar/stores/toolbar-store";
+import { isAndroid, isiOS } from "../../utils/platform.js";
+import { useToolbarStore } from "../../toolbar/stores/toolbar-store.js";
// This is hacky workaround to manually handle serialization when
// drag/dropping on mobile devices.
diff --git a/packages/editor/src/extensions/react/react-portal-provider.tsx b/packages/editor/src/extensions/react/react-portal-provider.tsx
index 027cbc843..2d78fea22 100644
--- a/packages/editor/src/extensions/react/react-portal-provider.tsx
+++ b/packages/editor/src/extensions/react/react-portal-provider.tsx
@@ -19,7 +19,7 @@ along with this program. If not, see .
import { FunctionComponent, PropsWithChildren } from "react";
import { flushSync } from "react-dom";
-import { EventDispatcher } from "./event-dispatcher";
+import { EventDispatcher } from "./event-dispatcher.js";
import { Root, createRoot } from "react-dom/client";
export type BasePortalProviderProps = PropsWithChildren;
diff --git a/packages/editor/src/extensions/react/types.ts b/packages/editor/src/extensions/react/types.ts
index 758906e35..afa9ec3dc 100644
--- a/packages/editor/src/extensions/react/types.ts
+++ b/packages/editor/src/extensions/react/types.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { Editor } from "../../types";
+import { Editor } from "../../types.js";
import { Node as PMNode, Attrs } from "prosemirror-model";
export interface ReactNodeProps {
diff --git a/packages/editor/src/extensions/search-replace/index.ts b/packages/editor/src/extensions/search-replace/index.ts
index 05f65eed4..2529d2b66 100644
--- a/packages/editor/src/extensions/search-replace/index.ts
+++ b/packages/editor/src/extensions/search-replace/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./search-replace";
+export * from "./search-replace.js";
diff --git a/packages/editor/src/extensions/search-replace/search-replace.ts b/packages/editor/src/extensions/search-replace/search-replace.ts
index d98014c73..b3d895710 100644
--- a/packages/editor/src/extensions/search-replace/search-replace.ts
+++ b/packages/editor/src/extensions/search-replace/search-replace.ts
@@ -26,7 +26,7 @@ import {
Transaction,
TextSelection
} from "prosemirror-state";
-import { SearchSettings } from "../../toolbar/stores/search-store";
+import { SearchSettings } from "../../toolbar/stores/search-store.js";
type DispatchFn = (tr: Transaction) => void;
declare module "@tiptap/core" {
diff --git a/packages/editor/src/extensions/table-cell/index.ts b/packages/editor/src/extensions/table-cell/index.ts
index 7e5e7b348..abbe282d6 100644
--- a/packages/editor/src/extensions/table-cell/index.ts
+++ b/packages/editor/src/extensions/table-cell/index.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { TableCell } from "./table-cell";
+import { TableCell } from "./table-cell.js";
-export * from "./table-cell";
+export * from "./table-cell.js";
export default TableCell;
diff --git a/packages/editor/src/extensions/table-cell/table-cell.ts b/packages/editor/src/extensions/table-cell/table-cell.ts
index a504b5464..e56a58df9 100644
--- a/packages/editor/src/extensions/table-cell/table-cell.ts
+++ b/packages/editor/src/extensions/table-cell/table-cell.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import TiptapTableCell from "@tiptap/extension-table-cell";
-import { addStyleAttribute } from "./utils";
+import { addStyleAttribute } from "./utils.js";
export const TableCell = TiptapTableCell.extend({
addAttributes() {
diff --git a/packages/editor/src/extensions/table-header/index.ts b/packages/editor/src/extensions/table-header/index.ts
index 7cd9ffe61..25d9acec9 100644
--- a/packages/editor/src/extensions/table-header/index.ts
+++ b/packages/editor/src/extensions/table-header/index.ts
@@ -16,8 +16,8 @@ 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 .
*/
-import { TableHeader } from "./table-header";
+import { TableHeader } from "./table-header.js";
-export * from "./table-header";
+export * from "./table-header.js";
export default TableHeader;
diff --git a/packages/editor/src/extensions/table-header/table-header.ts b/packages/editor/src/extensions/table-header/table-header.ts
index 786817f55..a2f899213 100644
--- a/packages/editor/src/extensions/table-header/table-header.ts
+++ b/packages/editor/src/extensions/table-header/table-header.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import TipTapTableHeader from "@tiptap/extension-table-header";
-import { addStyleAttribute } from "../table-cell/utils";
+import { addStyleAttribute } from "../table-cell/utils.js";
export const TableHeader = TipTapTableHeader.extend({
addAttributes() {
diff --git a/packages/editor/src/extensions/table/component.tsx b/packages/editor/src/extensions/table/component.tsx
index 4c2084f16..f3d7513ea 100644
--- a/packages/editor/src/extensions/table/component.tsx
+++ b/packages/editor/src/extensions/table/component.tsx
@@ -18,9 +18,9 @@ along with this program. If not, see .
*/
import { Flex } from "@theme-ui/components";
-import { ReactNodeView, ReactNodeViewProps } from "../react";
+import { ReactNodeView, ReactNodeViewProps } from "../react/index.js";
import { Node as ProsemirrorNode } from "prosemirror-model";
-import { Editor } from "../../types";
+import { Editor } from "../../types.js";
import { Editor as TiptapEditor } from "@tiptap/core";
import { useEffect, useRef } from "react";
import { updateColumnsOnResize } from "@tiptap/pm/tables";
@@ -30,15 +30,15 @@ import {
InsertRowBelow,
RowProperties,
TableProperties
-} from "../../toolbar/tools/table";
-import { getToolDefinition } from "../../toolbar/tool-definitions";
+} from "../../toolbar/tools/table.js";
+import { getToolDefinition } from "../../toolbar/tool-definitions.js";
import { getPosition } from "@notesnook/ui";
import {
findSelectedDOMNode,
hasSameAttributes
-} from "../../utils/prosemirror";
-import { DesktopOnly } from "../../components/responsive";
-import { TextDirections } from "../text-direction";
+} from "../../utils/prosemirror.js";
+import { DesktopOnly } from "../../components/responsive/index.js";
+import { TextDirections } from "../text-direction/index.js";
export function TableComponent(props: ReactNodeViewProps) {
const { editor, node, forwardRef } = props;
diff --git a/packages/editor/src/extensions/table/index.ts b/packages/editor/src/extensions/table/index.ts
index d77ecd153..56f42dca7 100644
--- a/packages/editor/src/extensions/table/index.ts
+++ b/packages/editor/src/extensions/table/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./table";
+export * from "./table.js";
diff --git a/packages/editor/src/extensions/table/table.ts b/packages/editor/src/extensions/table/table.ts
index 0338e3861..a89b4ac1b 100644
--- a/packages/editor/src/extensions/table/table.ts
+++ b/packages/editor/src/extensions/table/table.ts
@@ -19,7 +19,7 @@ along with this program. If not, see .
import { Table as TiptapTable, TableOptions } from "@tiptap/extension-table";
import { tableEditing, columnResizing, TableView } from "@tiptap/pm/tables";
-import { TableNodeView } from "./component";
+import { TableNodeView } from "./component.js";
import { Plugin, PluginKey } from "prosemirror-state";
export const Table = TiptapTable.extend({
diff --git a/packages/editor/src/extensions/task-item/component.tsx b/packages/editor/src/extensions/task-item/component.tsx
index 2a3310aa5..3618ff062 100644
--- a/packages/editor/src/extensions/task-item/component.tsx
+++ b/packages/editor/src/extensions/task-item/component.tsx
@@ -18,15 +18,16 @@ along with this program. If not, see .
*/
import { Box, Flex } from "@theme-ui/components";
-import { ReactNodeViewProps } from "../react";
+import { ReactNodeViewProps } from "../react/index.js";
import { Icon } from "@notesnook/ui";
-import { Icons } from "../../toolbar/icons";
+import { Icons } from "../../toolbar/icons.js";
import { findChildrenInRange } from "@tiptap/core";
import { useCallback } from "react";
-import { TaskItemNode, TaskItemAttributes } from "./task-item";
-import { useIsMobile } from "../../toolbar/stores/toolbar-store";
-import { isiOS } from "../../utils/platform";
-import { DesktopOnly } from "../../components/responsive";
+import type { TaskItemAttributes } from "./task-item.js";
+import { useIsMobile } from "../../toolbar/stores/toolbar-store.js";
+import { isiOS } from "../../utils/platform.js";
+import { DesktopOnly } from "../../components/responsive/index.js";
+import TaskItem from "@tiptap/extension-task-item";
export function TaskItemComponent(
props: ReactNodeViewProps
@@ -42,7 +43,7 @@ export function TaskItemComponent(
const selectedTaskItems = findChildrenInRange(
editor.state.doc,
{ from, to },
- (node) => node.type.name === TaskItemNode.name
+ (node) => node.type.name === TaskItem.name
);
if (!empty && selectedTaskItems.findIndex((a) => a.node === node) > -1) {
editor.commands.command(({ tr }) => {
diff --git a/packages/editor/src/extensions/task-item/index.ts b/packages/editor/src/extensions/task-item/index.ts
index 0afaf6d81..9a79a4589 100644
--- a/packages/editor/src/extensions/task-item/index.ts
+++ b/packages/editor/src/extensions/task-item/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./task-item";
+export * from "./task-item.js";
diff --git a/packages/editor/src/extensions/task-item/task-item.ts b/packages/editor/src/extensions/task-item/task-item.ts
index 70fb92ee4..467fea976 100644
--- a/packages/editor/src/extensions/task-item/task-item.ts
+++ b/packages/editor/src/extensions/task-item/task-item.ts
@@ -19,8 +19,8 @@ along with this program. If not, see .
import { mergeAttributes } from "@tiptap/core";
import { TaskItem } from "@tiptap/extension-task-item";
-import { TaskItemComponent } from "./component";
-import { createNodeView } from "../react";
+import { TaskItemComponent } from "./component.js";
+import { createNodeView } from "../react/index.js";
export type TaskItemAttributes = {
checked: boolean;
diff --git a/packages/editor/src/extensions/task-list/component.tsx b/packages/editor/src/extensions/task-list/component.tsx
index 868793e2f..7bf65511a 100644
--- a/packages/editor/src/extensions/task-list/component.tsx
+++ b/packages/editor/src/extensions/task-list/component.tsx
@@ -19,15 +19,15 @@ along with this program. If not, see .
import { Box, Flex, Input, Text } from "@theme-ui/components";
import { useMemo } from "react";
-import { ToolButton } from "../../toolbar/components/tool-button";
-import { ReactNodeViewProps } from "../react";
-import { toggleChildren, type TaskListAttributes } from "./task-list";
-import { replaceDateTime } from "../date-time";
-import { deleteCheckedItems, sortList } from "./utils";
+import { ToolButton } from "../../toolbar/components/tool-button.js";
+import { ReactNodeViewProps } from "../react/index.js";
+import { type TaskListAttributes } from "./task-list.js";
+import { replaceDateTime } from "../date-time/index.js";
+import { deleteCheckedItems, sortList, toggleChildren } from "./utils.js";
import TaskList from "@tiptap/extension-task-list";
import TaskItem from "@tiptap/extension-task-item";
-import { useIsMobile } from "../../toolbar/stores/toolbar-store";
-import { Icons } from "../../toolbar/icons";
+import { useIsMobile } from "../../toolbar/stores/toolbar-store.js";
+import { Icons } from "../../toolbar/icons.js";
import { Icon } from "@notesnook/ui";
export function TaskListComponent(
diff --git a/packages/editor/src/extensions/task-list/index.ts b/packages/editor/src/extensions/task-list/index.ts
index ad377915f..1b31475ed 100644
--- a/packages/editor/src/extensions/task-list/index.ts
+++ b/packages/editor/src/extensions/task-list/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./task-list";
+export * from "./task-list.js";
diff --git a/packages/editor/src/extensions/task-list/task-list.ts b/packages/editor/src/extensions/task-list/task-list.ts
index 73f6b862f..d52632221 100644
--- a/packages/editor/src/extensions/task-list/task-list.ts
+++ b/packages/editor/src/extensions/task-list/task-list.ts
@@ -19,14 +19,9 @@ along with this program. If not, see .
import { mergeAttributes, wrappingInputRule } from "@tiptap/core";
import { TaskList } from "@tiptap/extension-task-list";
-import { createNodeView } from "../react";
-import { TaskListComponent } from "./component";
-import {
- Plugin,
- PluginKey,
- NodeSelection,
- Transaction
-} from "prosemirror-state";
+import { createNodeView } from "../react/index.js";
+import { TaskListComponent } from "./component.js";
+import { Plugin, PluginKey, NodeSelection } from "prosemirror-state";
import { inputRegex } from "@tiptap/extension-task-item";
import { dropPoint } from "prosemirror-transform";
import {
@@ -36,10 +31,10 @@ import {
hasSameAttributes,
findParentNodeClosestToPos,
getExactChangedNodes
-} from "../../utils/prosemirror";
-import { countCheckedItems, findRootTaskList } from "./utils";
+} from "../../utils/prosemirror.js";
+import { countCheckedItems, findRootTaskList, toggleChildren } from "./utils.js";
import { Node as ProsemirrorNode } from "@tiptap/pm/model";
-import { TaskItemNode } from "../task-item";
+import { TaskItemNode } from "../task-item/index.js";
type TaskListStats = { checked: number; total: number };
export type TaskListAttributes = {
@@ -396,26 +391,3 @@ function areAllChecked(node: ProsemirrorNode) {
}
return allChecked;
}
-
-export function toggleChildren(
- tr: Transaction,
- node: ProsemirrorNode,
- toggleState: boolean,
- parentPos: number
-) {
- let changes = 0;
- node.descendants((node, pos) => {
- if (
- node.type.name === TaskItemNode.name &&
- toggleState !== node.attrs.checked
- ) {
- const actualPos = pos + parentPos + 1;
- tr.setNodeMarkup(tr.mapping.map(actualPos), undefined, {
- ...node.attrs,
- checked: toggleState
- });
- changes++;
- }
- });
- return changes;
-}
diff --git a/packages/editor/src/extensions/task-list/tests/task-list.test.ts b/packages/editor/src/extensions/task-list/tests/task-list.test.ts
index dfb91f200..f0babe121 100644
--- a/packages/editor/src/extensions/task-list/tests/task-list.test.ts
+++ b/packages/editor/src/extensions/task-list/tests/task-list.test.ts
@@ -17,12 +17,12 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { createEditor, h, ul, li } from "../../../../test-utils";
+import { createEditor, h, ul, li } from "../../../../test-utils/index.js";
import { test, expect } from "vitest";
-import { TaskListNode } from "../index";
-import { TaskItemNode } from "../../task-item";
+import { TaskListNode } from "../index.js";
+import { TaskItemNode } from "../../task-item/index.js";
import { p, eq } from "prosemirror-test-builder";
-import { countCheckedItems, deleteCheckedItems, sortList } from "../utils";
+import { countCheckedItems, deleteCheckedItems, sortList } from "../utils.js";
function taskList(...children: HTMLLIElement[]) {
return ul(children, { class: "checklist" });
diff --git a/packages/editor/src/extensions/task-list/utils.ts b/packages/editor/src/extensions/task-list/utils.ts
index d3c6485a1..174fcb4f1 100644
--- a/packages/editor/src/extensions/task-list/utils.ts
+++ b/packages/editor/src/extensions/task-list/utils.ts
@@ -21,8 +21,9 @@ import TaskList from "@tiptap/extension-task-list";
import { Transaction } from "@tiptap/pm/state";
import { Fragment, Node as ProsemirrorNode } from "prosemirror-model";
import { NodeWithPos } from "@tiptap/core";
-import { findParentNodeClosestToPos } from "../../utils/prosemirror";
+import { findParentNodeClosestToPos } from "../../utils/prosemirror.js";
import TaskItem from "@tiptap/extension-task-item";
+import { TaskItemNode } from "../task-item/index.js";
export function countCheckedItems(node: ProsemirrorNode) {
let checked = 0;
@@ -133,3 +134,26 @@ export function findRootTaskList(doc: ProsemirrorNode, pos?: number) {
(!parent || !invalidTaskListParents.includes(parent.type.name))
);
}
+
+export function toggleChildren(
+ tr: Transaction,
+ node: ProsemirrorNode,
+ toggleState: boolean,
+ parentPos: number
+) {
+ let changes = 0;
+ node.descendants((node, pos) => {
+ if (
+ node.type.name === TaskItemNode.name &&
+ toggleState !== node.attrs.checked
+ ) {
+ const actualPos = pos + parentPos + 1;
+ tr.setNodeMarkup(tr.mapping.map(actualPos), undefined, {
+ ...node.attrs,
+ checked: toggleState
+ });
+ changes++;
+ }
+ });
+ return changes;
+}
diff --git a/packages/editor/src/extensions/text-direction/index.ts b/packages/editor/src/extensions/text-direction/index.ts
index ab36ce082..779a72804 100644
--- a/packages/editor/src/extensions/text-direction/index.ts
+++ b/packages/editor/src/extensions/text-direction/index.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { TextDirection } from "./text-direction";
+import { TextDirection } from "./text-direction.js";
-export * from "./text-direction";
+export * from "./text-direction.js";
export default TextDirection;
diff --git a/packages/editor/src/extensions/text-direction/text-direction.ts b/packages/editor/src/extensions/text-direction/text-direction.ts
index 53f6c0c12..9547eb22b 100644
--- a/packages/editor/src/extensions/text-direction/text-direction.ts
+++ b/packages/editor/src/extensions/text-direction/text-direction.ts
@@ -17,11 +17,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { isListActive } from "../../utils/prosemirror";
import { Extension, Editor, findParentNode } from "@tiptap/core";
import "@tiptap/extension-text-style";
-import { Paragraph } from "../paragraph";
+import { Paragraph } from "../paragraph/index.js";
import { Node as ProsemirrorNode } from "@tiptap/pm/model";
+import { isListActive } from "../../utils/list.js";
export type TextDirections = undefined | "rtl";
const TEXT_DIRECTION_TYPES = [
diff --git a/packages/editor/src/extensions/web-clip/component.tsx b/packages/editor/src/extensions/web-clip/component.tsx
index faf74e74e..265f38edb 100644
--- a/packages/editor/src/extensions/web-clip/component.tsx
+++ b/packages/editor/src/extensions/web-clip/component.tsx
@@ -19,12 +19,12 @@ along with this program. If not, see .
import { Box, Flex, Text } from "@theme-ui/components";
import { useEffect, useRef, useState } from "react";
-import { ReactNodeViewProps } from "../react";
-import { Icons } from "../../toolbar";
+import { ReactNodeViewProps } from "../react/index.js";
+import { Icons } from "../../toolbar/index.js";
import { Icon } from "@notesnook/ui";
-import { WebClipAttributes } from "./web-clip";
-import { DesktopOnly } from "../../components/responsive";
-import { ToolbarGroup } from "../../toolbar/components/toolbar-group";
+import { WebClipAttributes } from "./web-clip.js";
+import { DesktopOnly } from "../../components/responsive/index.js";
+import { ToolbarGroup } from "../../toolbar/components/toolbar-group.js";
const FAILED_CONTENT = `
Failed to load web clip
diff --git a/packages/editor/src/extensions/web-clip/index.ts b/packages/editor/src/extensions/web-clip/index.ts
index 89128a0d9..82794f2f3 100644
--- a/packages/editor/src/extensions/web-clip/index.ts
+++ b/packages/editor/src/extensions/web-clip/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-export * from "./web-clip";
+export * from "./web-clip.js";
diff --git a/packages/editor/src/extensions/web-clip/web-clip.ts b/packages/editor/src/extensions/web-clip/web-clip.ts
index 8aaf4196e..88abcf0fa 100644
--- a/packages/editor/src/extensions/web-clip/web-clip.ts
+++ b/packages/editor/src/extensions/web-clip/web-clip.ts
@@ -18,10 +18,10 @@ along with this program. If not, see .
*/
import { Node, mergeAttributes } from "@tiptap/core";
-import { hasSameAttributes } from "../../utils/prosemirror";
-import { WebClipAttachment, getDataAttribute } from "../attachment";
-import { createNodeView } from "../react";
-import { WebClipComponent } from "./component";
+import { hasSameAttributes } from "../../utils/prosemirror.js";
+import { WebClipAttachment, getDataAttribute } from "../attachment/index.js";
+import { createNodeView } from "../react/index.js";
+import { WebClipComponent } from "./component.js";
export interface WebClipOptions {
HTMLAttributes: Record;
diff --git a/packages/editor/src/hooks/use-editor.ts b/packages/editor/src/hooks/use-editor.ts
index a1d1ba879..c17130124 100644
--- a/packages/editor/src/hooks/use-editor.ts
+++ b/packages/editor/src/hooks/use-editor.ts
@@ -24,9 +24,9 @@ import {
resolveFocusPosition
} from "@tiptap/core";
import { DependencyList, useEffect, useMemo, useRef, useState } from "react";
-import { Editor } from "../types";
+import { Editor } from "../types.js";
import { EditorState } from "@tiptap/pm/state";
-import { useToolbarStore } from "../toolbar/stores/toolbar-store";
+import { useToolbarStore } from "../toolbar/stores/toolbar-store.js";
function useForceUpdate() {
const [, setValue] = useState(0);
diff --git a/packages/editor/src/hooks/use-observer.ts b/packages/editor/src/hooks/use-observer.ts
index 4166b01b6..fe3132e44 100644
--- a/packages/editor/src/hooks/use-observer.ts
+++ b/packages/editor/src/hooks/use-observer.ts
@@ -18,7 +18,6 @@ along with this program. If not, see .
*/
import { useState, useRef, useEffect, useCallback } from "react";
-import { debounce } from "../utils/debounce";
type ObserverType = {
threshold: number;
diff --git a/packages/editor/src/hooks/use-permission-handler.ts b/packages/editor/src/hooks/use-permission-handler.ts
index 6900ba788..f92ed2b34 100644
--- a/packages/editor/src/hooks/use-permission-handler.ts
+++ b/packages/editor/src/hooks/use-permission-handler.ts
@@ -19,7 +19,7 @@ along with this program. If not, see .
import { UnionCommands } from "@tiptap/core";
import { useEffect } from "react";
-import { PermissionRequestEvent } from "../types";
+import { PermissionRequestEvent } from "../types.js";
export type Claims = "premium";
export type PermissionHandlerOptions = {
diff --git a/packages/editor/src/hooks/use-timer.ts b/packages/editor/src/hooks/use-timer.ts
index 42ac7d4ae..49d2430d5 100644
--- a/packages/editor/src/hooks/use-timer.ts
+++ b/packages/editor/src/hooks/use-timer.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { useCallback, useEffect, useRef, useState } from "react";
+import { useEffect, useRef, useState } from "react";
export function useTimer(duration: number) {
const [enabled, setEnabled] = useState(false);
diff --git a/packages/editor/src/index.ts b/packages/editor/src/index.ts
index 65b083cd5..b9708721a 100644
--- a/packages/editor/src/index.ts
+++ b/packages/editor/src/index.ts
@@ -26,11 +26,11 @@ import CharacterCount from "@tiptap/extension-character-count";
import { Code } from "@tiptap/extension-code";
import Color from "@tiptap/extension-color";
import HorizontalRule from "@tiptap/extension-horizontal-rule";
-import { Link, LinkAttributes } from "./extensions/link";
+import { Link, LinkAttributes } from "./extensions/link/index.js";
import Placeholder from "@tiptap/extension-placeholder";
import Subscript from "@tiptap/extension-subscript";
import Superscript from "@tiptap/extension-superscript";
-import TableHeader from "./extensions/table-header";
+import TableHeader from "./extensions/table-header/index.js";
import TableRow from "@tiptap/extension-table-row";
import TextAlign from "@tiptap/extension-text-align";
import TextStyle from "@tiptap/extension-text-style";
@@ -38,52 +38,52 @@ import Underline from "@tiptap/extension-underline";
import StarterKit from "@tiptap/starter-kit";
import ListKeymap from "@tiptap/extension-list-keymap";
import { useEffect, useLayoutEffect, useMemo } from "react";
-import "./extensions";
import {
Attachment,
AttachmentNode,
AttachmentType
-} from "./extensions/attachment";
-import BulletList from "./extensions/bullet-list";
-import { CodeBlock } from "./extensions/code-block";
-import { Codemark } from "./extensions/code-mark";
-import { DateTime, DateTimeOptions } from "./extensions/date-time";
-import { EmbedNode } from "./extensions/embed";
-import FontFamily from "./extensions/font-family";
-import FontSize from "./extensions/font-size";
-import { Highlight } from "./extensions/highlight";
-import { ImageNode, ImageOptions } from "./extensions/image";
-import { KeepInView } from "./extensions/keep-in-view";
-import { KeyMap } from "./extensions/key-map";
-import { ListItem } from "./extensions/list-item";
-import { MathBlock, MathInline } from "./extensions/math";
-import OrderedList from "./extensions/ordered-list";
-import { OutlineList } from "./extensions/outline-list";
-import { OutlineListItem } from "./extensions/outline-list-item";
-import { Paragraph } from "./extensions/paragraph";
-import { SearchReplace } from "./extensions/search-replace";
-import { Table } from "./extensions/table";
-import TableCell from "./extensions/table-cell";
-import { TaskItemNode } from "./extensions/task-item";
-import { TaskListNode } from "./extensions/task-list";
-import TextDirection from "./extensions/text-direction";
-import { WebClipNode, WebClipOptions } from "./extensions/web-clip";
-import { useEditor } from "./hooks/use-editor";
-import { usePermissionHandler } from "./hooks/use-permission-handler";
-import Toolbar from "./toolbar";
-import { useToolbarStore } from "./toolbar/stores/toolbar-store";
-import { DownloadOptions } from "./utils/downloader";
-import { Heading } from "./extensions/heading";
-import Clipboard from "./extensions/clipboard";
-import Blockquote from "./extensions/blockquote";
-import { Quirks } from "./extensions/quirks";
-import { LIST_NODE_TYPES } from "./utils/node-types";
-import CheckList from "./extensions/check-list";
-import CheckListItem from "./extensions/check-list-item";
-import { Callout } from "./extensions/callout";
-import BlockId from "./extensions/block-id";
-import { useEditorSearchStore } from "./toolbar/stores/search-store";
-import { DiffHighlighter } from "./extensions/diff-highlighter";
+} from "./extensions/attachment/index.js";
+import BulletList from "./extensions/bullet-list/index.js";
+import { CodeBlock } from "./extensions/code-block/index.js";
+import { Codemark } from "./extensions/code-mark/index.js";
+import { DateTime, DateTimeOptions } from "./extensions/date-time/index.js";
+import { EmbedNode } from "./extensions/embed/index.js";
+import FontFamily from "./extensions/font-family/index.js";
+import FontSize from "./extensions/font-size/index.js";
+import { Highlight } from "./extensions/highlight/index.js";
+import { ImageNode, ImageOptions } from "./extensions/image/index.js";
+import { KeepInView } from "./extensions/keep-in-view/index.js";
+import { KeyMap } from "./extensions/key-map/index.js";
+import { ListItem } from "./extensions/list-item/index.js";
+import { MathBlock, MathInline } from "./extensions/math/index.js";
+import OrderedList from "./extensions/ordered-list/index.js";
+import { OutlineList } from "./extensions/outline-list/index.js";
+import { OutlineListItem } from "./extensions/outline-list-item/index.js";
+import { Paragraph } from "./extensions/paragraph/index.js";
+import { SearchReplace } from "./extensions/search-replace/index.js";
+import { Table } from "./extensions/table/index.js";
+import TableCell from "./extensions/table-cell/index.js";
+import { TaskItemNode } from "./extensions/task-item/index.js";
+import { TaskListNode } from "./extensions/task-list/index.js";
+import TextDirection from "./extensions/text-direction/index.js";
+import { WebClipNode, WebClipOptions } from "./extensions/web-clip/index.js";
+import { useEditor } from "./hooks/use-editor.js";
+import { usePermissionHandler } from "./hooks/use-permission-handler.js";
+import Toolbar from "./toolbar/index.js";
+import { useToolbarStore } from "./toolbar/stores/toolbar-store.js";
+import { DownloadOptions } from "./utils/downloader.js";
+import { Heading } from "./extensions/heading/index.js";
+import Clipboard from "./extensions/clipboard/index.js";
+import Blockquote from "./extensions/blockquote/index.js";
+import { Quirks } from "./extensions/quirks/index.js";
+import { LIST_NODE_TYPES } from "./utils/node-types.js";
+import CheckList from "./extensions/check-list/index.js";
+import CheckListItem from "./extensions/check-list-item/index.js";
+import { Callout } from "./extensions/callout/index.js";
+import BlockId from "./extensions/block-id/index.js";
+import { useEditorSearchStore } from "./toolbar/stores/search-store.js";
+import { DiffHighlighter } from "./extensions/diff-highlighter/index.js";
+import { getChangedNodes } from "./utils/prosemirror.js";
interface TiptapStorage {
dateFormat?: DateTimeOptions["dateFormat"];
@@ -395,24 +395,32 @@ const useTiptap = (
return editor;
};
-export { type Fragment } from "prosemirror-model";
-export { type Attachment, type AttachmentType } from "./extensions/attachment";
-export { type ImageAttributes } from "./extensions/image";
-export * from "./toolbar";
-export * from "./types";
-export * from "./utils/word-counter";
-export * from "./utils/font";
-export * from "./utils/toc";
-export {
- useTiptap,
- Toolbar,
- usePermissionHandler,
- getHTMLFromFragment,
- type DownloadOptions
-};
-
function hasStyle(element: HTMLElement | string) {
const style = (element as HTMLElement).getAttribute("style");
if (!style || style === "font-family: inherit;") return false;
return true;
}
+
+export { type Fragment } from "prosemirror-model";
+export {
+ type Attachment,
+ type AttachmentType
+} from "./extensions/attachment/index.js";
+export { type ImageAttributes } from "./extensions/image/index.js";
+export { type LinkAttributes } from "./extensions/link/index.js";
+export * from "./toolbar/index.js";
+export * from "./types.js";
+export * from "./utils/word-counter.js";
+export * from "./utils/font.js";
+export * from "./utils/toc.js";
+export * from "./utils/downloader.js";
+export {
+ useTiptap,
+ Toolbar,
+ usePermissionHandler,
+ getHTMLFromFragment,
+ getChangedNodes,
+ type DownloadOptions
+};
+export { replaceDateTime } from "./extensions/date-time/index.js";
+export type * from "./extension-imports.js";
diff --git a/packages/editor/src/toolbar/components/counter.tsx b/packages/editor/src/toolbar/components/counter.tsx
index 969c53ecd..bfb0e2864 100644
--- a/packages/editor/src/toolbar/components/counter.tsx
+++ b/packages/editor/src/toolbar/components/counter.tsx
@@ -19,8 +19,8 @@ along with this program. If not, see .
import React from "react";
import { Flex, Text } from "@theme-ui/components";
-import { ToolButton } from "./tool-button";
-import { useIsMobile } from "../stores/toolbar-store";
+import { ToolButton } from "./tool-button.js";
+import { useIsMobile } from "../stores/toolbar-store.js";
export type CounterProps = {
title: string;
diff --git a/packages/editor/src/toolbar/components/dropdown.tsx b/packages/editor/src/toolbar/components/dropdown.tsx
index 1cd57855e..72246f958 100644
--- a/packages/editor/src/toolbar/components/dropdown.tsx
+++ b/packages/editor/src/toolbar/components/dropdown.tsx
@@ -20,14 +20,14 @@ along with this program. If not, see .
import { useRef } from "react";
import { Text } from "@theme-ui/components";
import { Icon, MenuItem, MenuPresenter } from "@notesnook/ui";
-import { Icons } from "../icons";
+import { Icons } from "../icons.js";
import {
useIsMobile,
usePopupManager,
useToolbarLocation
-} from "../stores/toolbar-store";
-import { getToolbarElement } from "../utils/dom";
-import { Button } from "../../components/button";
+} from "../stores/toolbar-store.js";
+import { getToolbarElement } from "../utils/dom.js";
+import { Button } from "../../components/button.js";
type DropdownProps = {
id: string;
diff --git a/packages/editor/src/toolbar/components/more-tools.tsx b/packages/editor/src/toolbar/components/more-tools.tsx
index fb9af21b7..1c5f10ae2 100644
--- a/packages/editor/src/toolbar/components/more-tools.tsx
+++ b/packages/editor/src/toolbar/components/more-tools.tsx
@@ -18,13 +18,13 @@ along with this program. If not, see .
*/
import { useEffect, useRef } from "react";
-import { PopupWrapper } from "../../components/popup-presenter";
-import { ToolButton } from "../components/tool-button";
-import { usePopupManager, useToolbarLocation } from "../stores/toolbar-store";
-import { ToolProps } from "../types";
-import { getToolbarElement } from "../utils/dom";
-import { ToolId } from "../tools";
-import { ToolbarGroup } from "./toolbar-group";
+import { PopupWrapper } from "../../components/popup-presenter/index.js";
+import { ToolButton } from "../components/tool-button.js";
+import { usePopupManager, useToolbarLocation } from "../stores/toolbar-store.js";
+import { ToolProps } from "../types.js";
+import { getToolbarElement } from "../utils/dom.js";
+import { ToolId } from "../tools/index.js";
+import { ToolbarGroup } from "./toolbar-group.js";
type MoreToolsProps = ToolProps & {
popupId: string;
diff --git a/packages/editor/src/toolbar/components/popup.tsx b/packages/editor/src/toolbar/components/popup.tsx
index 42e312a88..5d05483ad 100644
--- a/packages/editor/src/toolbar/components/popup.tsx
+++ b/packages/editor/src/toolbar/components/popup.tsx
@@ -21,8 +21,8 @@ import { EmotionThemeProvider } from "@notesnook/theme";
import { Icon } from "@notesnook/ui";
import { Button, Flex, Text } from "@theme-ui/components";
import { PropsWithChildren } from "react";
-import { DesktopOnly, MobileOnly } from "../../components/responsive";
-import { Icons } from "../icons";
+import { DesktopOnly, MobileOnly } from "../../components/responsive/index.js";
+import { Icons } from "../icons.js";
type Action = {
title: string;
diff --git a/packages/editor/src/toolbar/components/split-button.tsx b/packages/editor/src/toolbar/components/split-button.tsx
index 9bd3852ae..6593be2c5 100644
--- a/packages/editor/src/toolbar/components/split-button.tsx
+++ b/packages/editor/src/toolbar/components/split-button.tsx
@@ -19,8 +19,8 @@ along with this program. If not, see .
import { PropsWithChildren } from "react";
import { Flex } from "@theme-ui/components";
-import { ToolButton, ToolButtonProps } from "./tool-button";
-import { useIsMobile, useToolbarLocation } from "../stores/toolbar-store";
+import { ToolButton, ToolButtonProps } from "./tool-button.js";
+import { useIsMobile, useToolbarLocation } from "../stores/toolbar-store.js";
import React from "react";
export type SplitButtonProps = ToolButtonProps & {
diff --git a/packages/editor/src/toolbar/components/tool-button.tsx b/packages/editor/src/toolbar/components/tool-button.tsx
index 2a575e711..83774cff1 100644
--- a/packages/editor/src/toolbar/components/tool-button.tsx
+++ b/packages/editor/src/toolbar/components/tool-button.tsx
@@ -21,11 +21,11 @@ import { Theme } from "@notesnook/theme";
import { SchemeColors } from "@notesnook/theme";
import React from "react";
import { ButtonProps } from "@theme-ui/components";
-import { IconNames, Icons } from "../icons";
-import { ToolButtonVariant } from "../types";
-import { Button } from "../../components/button";
+import { IconNames, Icons } from "../icons.js";
+import { ToolButtonVariant } from "../types.js";
+import { Button } from "../../components/button.js";
import { Icon } from "@notesnook/ui";
-import { useIsMobile } from "../stores/toolbar-store";
+import { useIsMobile } from "../stores/toolbar-store.js";
export type ToolButtonProps = ButtonProps & {
icon: IconNames;
diff --git a/packages/editor/src/toolbar/components/toolbar-group.tsx b/packages/editor/src/toolbar/components/toolbar-group.tsx
index 96da90db7..74a78c212 100644
--- a/packages/editor/src/toolbar/components/toolbar-group.tsx
+++ b/packages/editor/src/toolbar/components/toolbar-group.tsx
@@ -17,12 +17,12 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolbarGroupDefinition, ToolButtonVariant } from "../types";
-import { findTool } from "../tools";
+import { ToolbarGroupDefinition, ToolButtonVariant } from "../types.js";
+import { findTool } from "../tools/index.js";
import { Flex, FlexProps } from "@theme-ui/components";
-import { Editor } from "../../types";
-import { MoreTools } from "./more-tools";
-import { getToolDefinition } from "../tool-definitions";
+import { Editor } from "../../types.js";
+import { MoreTools } from "./more-tools.js";
+import { getToolDefinition } from "../tool-definitions.js";
export type ToolbarGroupProps = FlexProps & {
tools: ToolbarGroupDefinition;
diff --git a/packages/editor/src/toolbar/floating-menus/hover-popup/context.ts b/packages/editor/src/toolbar/floating-menus/hover-popup/context.ts
index 8734168cf..a2ad57a75 100644
--- a/packages/editor/src/toolbar/floating-menus/hover-popup/context.ts
+++ b/packages/editor/src/toolbar/floating-menus/hover-popup/context.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { NodeWithOffset } from "../../../utils/prosemirror";
+import { NodeWithOffset } from "../../../utils/prosemirror.js";
import { createContext, useContext } from "react";
const HoverPopupContext = createContext<{
diff --git a/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx b/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx
index dbd405fa1..b17a8aa06 100644
--- a/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx
+++ b/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx
@@ -18,11 +18,11 @@ along with this program. If not, see .
*/
import { useEffect, useRef } from "react";
-import { showPopup } from "../../../components/popup-presenter";
-import { Editor } from "../../../types";
-import { FloatingMenuProps } from "../types";
-import { LinkHoverPopupHandler } from "./link";
-import { HoverPopupContextProvider } from "./context";
+import { showPopup } from "../../../components/popup-presenter/index.js";
+import { Editor } from "../../../types.js";
+import { FloatingMenuProps } from "../types.js";
+import { LinkHoverPopupHandler } from "./link.js";
+import { HoverPopupContextProvider } from "./context.js";
export type HoverPopupProps = {
editor: Editor;
diff --git a/packages/editor/src/toolbar/floating-menus/hover-popup/link.tsx b/packages/editor/src/toolbar/floating-menus/hover-popup/link.tsx
index 66a3b1529..31964c058 100644
--- a/packages/editor/src/toolbar/floating-menus/hover-popup/link.tsx
+++ b/packages/editor/src/toolbar/floating-menus/hover-popup/link.tsx
@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolbarGroup } from "../../components/toolbar-group";
-import { HoverPopupProps } from ".";
-import { useHoverPopupContext } from "./context";
-import { ToolbarGroupDefinition } from "../../types";
+import { ToolbarGroup } from "../../components/toolbar-group.js";
+import { HoverPopupProps } from "./index.js";
+import { useHoverPopupContext } from "./context.js";
+import { ToolbarGroupDefinition } from "../../types.js";
const LINK_TOOLS: ToolbarGroupDefinition = [
"openLink",
diff --git a/packages/editor/src/toolbar/floating-menus/index.tsx b/packages/editor/src/toolbar/floating-menus/index.tsx
index 10cd4d384..b86d3bdf0 100644
--- a/packages/editor/src/toolbar/floating-menus/index.tsx
+++ b/packages/editor/src/toolbar/floating-menus/index.tsx
@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { DesktopOnly } from "../../components/responsive";
-import { HoverPopupHandler } from "./hover-popup";
-import { SearchReplaceFloatingMenu } from "./search-replace";
-import { FloatingMenuProps } from "./types";
+import { DesktopOnly } from "../../components/responsive/index.js";
+import { HoverPopupHandler } from "./hover-popup/index.js";
+import { SearchReplaceFloatingMenu } from "./search-replace.js";
+import { FloatingMenuProps } from "./types.js";
export function EditorFloatingMenus(props: FloatingMenuProps) {
return (
diff --git a/packages/editor/src/toolbar/floating-menus/search-replace.tsx b/packages/editor/src/toolbar/floating-menus/search-replace.tsx
index 501706085..493ecd4c9 100644
--- a/packages/editor/src/toolbar/floating-menus/search-replace.tsx
+++ b/packages/editor/src/toolbar/floating-menus/search-replace.tsx
@@ -18,11 +18,11 @@ along with this program. If not, see .
*/
import { useLayoutEffect } from "react";
-import { FloatingMenuProps } from "./types";
-import { SearchReplacePopup } from "../popups/search-replace";
-import { ResponsivePresenter } from "../../components/responsive";
-import { getToolbarElement } from "../utils/dom";
-import { useEditorSearchStore } from "../stores/search-store";
+import { FloatingMenuProps } from "./types.js";
+import { SearchReplacePopup } from "../popups/search-replace.js";
+import { ResponsivePresenter } from "../../components/responsive/index.js";
+import { getToolbarElement } from "../utils/dom.js";
+import { useEditorSearchStore } from "../stores/search-store.js";
export function SearchReplaceFloatingMenu(props: FloatingMenuProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/floating-menus/types.ts b/packages/editor/src/toolbar/floating-menus/types.ts
index 1d42d2d88..11ed51f91 100644
--- a/packages/editor/src/toolbar/floating-menus/types.ts
+++ b/packages/editor/src/toolbar/floating-menus/types.ts
@@ -17,5 +17,5 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { Editor } from "../../types";
+import { Editor } from "../../types.js";
export type FloatingMenuProps = { editor: Editor };
diff --git a/packages/editor/src/toolbar/index.ts b/packages/editor/src/toolbar/index.ts
index 1381e5fda..5256cb2e9 100644
--- a/packages/editor/src/toolbar/index.ts
+++ b/packages/editor/src/toolbar/index.ts
@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { Toolbar } from "./toolbar";
+import { Toolbar } from "./toolbar.js";
export default Toolbar;
-export * from "./types";
-export * from "./icons";
-export * from "./tools";
-export * from "./tool-definitions";
+export * from "./types.js";
+export * from "./icons.js";
+export * from "./tools/index.js";
+export * from "./tool-definitions.js";
diff --git a/packages/editor/src/toolbar/popups/cell-properties.tsx b/packages/editor/src/toolbar/popups/cell-properties.tsx
index 979e4ea25..45454966b 100644
--- a/packages/editor/src/toolbar/popups/cell-properties.tsx
+++ b/packages/editor/src/toolbar/popups/cell-properties.tsx
@@ -17,14 +17,14 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { Editor } from "../../types";
+import { Editor } from "../../types.js";
import { Box } from "@theme-ui/components";
-import { Tab, Tabs } from "../../components/tabs";
+import { Tab, Tabs } from "../../components/tabs/index.js";
import { Icon } from "@notesnook/ui";
// import { MenuPresenter } from "../../components/menu/menu";
-import { Popup } from "../components/popup";
-import { Icons } from "../icons";
-import { ColorPicker } from "./color-picker";
+import { Popup } from "../components/popup.js";
+import { Icons } from "../icons.js";
+import { ColorPicker } from "./color-picker.js";
type CellPropertiesProps = { editor: Editor; onClose: () => void };
export function CellProperties(props: CellPropertiesProps) {
diff --git a/packages/editor/src/toolbar/popups/color-picker.tsx b/packages/editor/src/toolbar/popups/color-picker.tsx
index ede55d27b..6c94d6126 100644
--- a/packages/editor/src/toolbar/popups/color-picker.tsx
+++ b/packages/editor/src/toolbar/popups/color-picker.tsx
@@ -20,15 +20,15 @@ along with this program. If not, see .
import { ButtonProps, Flex } from "@theme-ui/components";
import { Input } from "@theme-ui/components";
import { Icon } from "@notesnook/ui";
-import { Icons } from "../icons";
+import { Icons } from "../icons.js";
import { useCallback, useEffect, useRef, useState } from "react";
import tinycolor from "tinycolor2";
import { HexColorPicker } from "react-colorful";
-import { Button } from "../../components/button";
-import { debounce } from "../../utils/debounce";
-import { Popup } from "../components/popup";
+import { Button } from "../../components/button.js";
+import { debounce } from "../../utils/debounce.js";
+import { Popup } from "../components/popup.js";
import { SchemeColors } from "@notesnook/theme";
-import { Editor } from "../../types";
+import { Editor } from "../../types.js";
type ColorPickerProps = {
editor: Editor;
diff --git a/packages/editor/src/toolbar/popups/embed-popup.tsx b/packages/editor/src/toolbar/popups/embed-popup.tsx
index 5fa512da0..3e5ac3df7 100644
--- a/packages/editor/src/toolbar/popups/embed-popup.tsx
+++ b/packages/editor/src/toolbar/popups/embed-popup.tsx
@@ -19,12 +19,12 @@ along with this program. If not, see .
import { Flex, Text } from "@theme-ui/components";
import { useCallback, useState } from "react";
-import { Popup } from "../components/popup";
+import { Popup } from "../components/popup.js";
import { Input, Textarea } from "@theme-ui/components";
-import { Embed, EmbedSizeOptions } from "../../extensions/embed";
+import { Embed, EmbedSizeOptions } from "../../extensions/embed/index.js";
import { convertUrlToEmbedUrl } from "@social-embed/lib";
-import { InlineInput } from "../../components/inline-input";
-import { Tabs, Tab } from "../../components/tabs";
+import { InlineInput } from "../../components/inline-input/index.js";
+import { Tabs, Tab } from "../../components/tabs/index.js";
type EmbedSource = "url" | "code";
export type EmbedPopupProps = {
diff --git a/packages/editor/src/toolbar/popups/image-properties.tsx b/packages/editor/src/toolbar/popups/image-properties.tsx
index 4f0a9f2db..b7bdbc62c 100644
--- a/packages/editor/src/toolbar/popups/image-properties.tsx
+++ b/packages/editor/src/toolbar/popups/image-properties.tsx
@@ -18,11 +18,11 @@ along with this program. If not, see .
*/
import { Flex } from "@theme-ui/components";
-import { Popup } from "../components/popup";
-import { ImageAttributes } from "../../extensions/image";
-import { Editor } from "../../types";
-import { InlineInput } from "../../components/inline-input";
-import { findSelectedNode } from "../../utils/prosemirror";
+import { Popup } from "../components/popup.js";
+import { ImageAttributes } from "../../extensions/image/index.js";
+import { Editor } from "../../types.js";
+import { InlineInput } from "../../components/inline-input/index.js";
+import { findSelectedNode } from "../../utils/prosemirror.js";
export type ImagePropertiesProps = {
editor: Editor;
diff --git a/packages/editor/src/toolbar/popups/image-upload.tsx b/packages/editor/src/toolbar/popups/image-upload.tsx
index 55cbb99db..a56e821d7 100644
--- a/packages/editor/src/toolbar/popups/image-upload.tsx
+++ b/packages/editor/src/toolbar/popups/image-upload.tsx
@@ -20,10 +20,10 @@ along with this program. If not, see .
import { Input } from "@theme-ui/components";
import { useState } from "react";
import { Flex, Text } from "@theme-ui/components";
-import { ImageAttributes } from "../../extensions/image";
-import { Popup } from "../components/popup";
-import { downloadImage, toDataURL } from "../../utils/downloader";
-import { useToolbarStore } from "../stores/toolbar-store";
+import { ImageAttributes } from "../../extensions/image/index.js";
+import { Popup } from "../components/popup.js";
+import { downloadImage, toDataURL } from "../../utils/downloader.js";
+import { useToolbarStore } from "../stores/toolbar-store.js";
export type ImageUploadPopupProps = {
onInsert: (image: Partial) => void;
diff --git a/packages/editor/src/toolbar/popups/link-popup.tsx b/packages/editor/src/toolbar/popups/link-popup.tsx
index 330fdcc7f..740f6bf1b 100644
--- a/packages/editor/src/toolbar/popups/link-popup.tsx
+++ b/packages/editor/src/toolbar/popups/link-popup.tsx
@@ -19,13 +19,13 @@ along with this program. If not, see .
import { Input } from "@theme-ui/components";
import { Flex } from "@theme-ui/components";
-import { useRefValue } from "../../hooks/use-ref-value";
-import { Popup } from "../components/popup";
-import { isInternalLink, LinkDefinition } from "../tools/link";
-import { showPopup } from "../../components/popup-presenter";
-import Link, { LinkAttributes } from "../../extensions/link";
-import { ImageNode } from "../../extensions/image";
-import { findMark, selectionToOffset } from "../../utils/prosemirror";
+import { useRefValue } from "../../hooks/use-ref-value.js";
+import { Popup } from "../components/popup.js";
+import { isInternalLink, LinkDefinition } from "../tools/link.js";
+import { showPopup } from "../../components/popup-presenter/index.js";
+import Link, { LinkAttributes } from "../../extensions/link/index.js";
+import { ImageNode } from "../../extensions/image/index.js";
+import { findMark, selectionToOffset } from "../../utils/prosemirror.js";
import { Editor, getMarkAttributes } from "@tiptap/core";
export type LinkPopupProps = {
diff --git a/packages/editor/src/toolbar/popups/search-replace.tsx b/packages/editor/src/toolbar/popups/search-replace.tsx
index 8df1bd197..a388f0e9e 100644
--- a/packages/editor/src/toolbar/popups/search-replace.tsx
+++ b/packages/editor/src/toolbar/popups/search-replace.tsx
@@ -20,10 +20,10 @@ along with this program. If not, see .
import { Input } from "@theme-ui/components";
import { useCallback, useEffect, useRef } from "react";
import { Flex, Text } from "@theme-ui/components";
-import { SearchStorage } from "../../extensions/search-replace";
-import { ToolButton } from "../components/tool-button";
-import { Editor } from "../../types";
-import { useEditorSearchStore } from "../stores/search-store";
+import { SearchStorage } from "../../extensions/search-replace/index.js";
+import { ToolButton } from "../components/tool-button.js";
+import { Editor } from "../../types.js";
+import { useEditorSearchStore } from "../stores/search-store.js";
export type SearchReplacePopupProps = { editor: Editor };
export function SearchReplacePopup(props: SearchReplacePopupProps) {
diff --git a/packages/editor/src/toolbar/popups/table-popup.tsx b/packages/editor/src/toolbar/popups/table-popup.tsx
index fe7d1a49b..7cb83f37f 100644
--- a/packages/editor/src/toolbar/popups/table-popup.tsx
+++ b/packages/editor/src/toolbar/popups/table-popup.tsx
@@ -19,9 +19,9 @@ along with this program. If not, see .
import { Box, Flex, Text } from "@theme-ui/components";
import { useEffect, useState } from "react";
-import { Popup } from "../components/popup";
-import { useIsMobile } from "../stores/toolbar-store";
-import { InlineInput } from "../../components/inline-input";
+import { Popup } from "../components/popup.js";
+import { useIsMobile } from "../stores/toolbar-store.js";
+import { InlineInput } from "../../components/inline-input/index.js";
const MAX_COLUMNS = 20;
const MAX_ROWS = 20;
diff --git a/packages/editor/src/toolbar/stores/toolbar-store.ts b/packages/editor/src/toolbar/stores/toolbar-store.ts
index 40aacf3e2..997d2aa6f 100644
--- a/packages/editor/src/toolbar/stores/toolbar-store.ts
+++ b/packages/editor/src/toolbar/stores/toolbar-store.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import { create } from "zustand";
-import { DownloadOptions } from "../../utils/downloader";
+import { DownloadOptions } from "../../utils/downloader.js";
import { useCallback } from "react";
export type ToolbarLocation = "top" | "bottom";
diff --git a/packages/editor/src/toolbar/tool-definitions.ts b/packages/editor/src/toolbar/tool-definitions.ts
index aad4bd34f..94f0cba26 100644
--- a/packages/editor/src/toolbar/tool-definitions.ts
+++ b/packages/editor/src/toolbar/tool-definitions.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolbarDefinition, ToolDefinition } from "./types";
-import { ToolId } from "./tools";
+import { ToolbarDefinition, ToolDefinition } from "./types.js";
+import { ToolId } from "./tools/index.js";
const tools: Record = {
none: {
diff --git a/packages/editor/src/toolbar/toolbar.tsx b/packages/editor/src/toolbar/toolbar.tsx
index 18743cfd7..8d90a71dc 100644
--- a/packages/editor/src/toolbar/toolbar.tsx
+++ b/packages/editor/src/toolbar/toolbar.tsx
@@ -23,17 +23,17 @@ import {
STATIC_TOOLBAR_GROUPS,
MOBILE_STATIC_TOOLBAR_GROUPS,
READONLY_MOBILE_STATIC_TOOLBAR_GROUPS
-} from "./tool-definitions";
+} from "./tool-definitions.js";
import { useEffect, useMemo } from "react";
-import { Editor } from "../types";
-import { ToolbarGroup } from "./components/toolbar-group";
-import { EditorFloatingMenus } from "./floating-menus";
+import { Editor } from "../types.js";
+import { ToolbarGroup } from "./components/toolbar-group.js";
+import { EditorFloatingMenus } from "./floating-menus/index.js";
import {
ToolbarLocation,
useIsMobile,
useToolbarStore
-} from "./stores/toolbar-store";
-import { ToolbarDefinition } from "./types";
+} from "./stores/toolbar-store.js";
+import { ToolbarDefinition } from "./types.js";
type ToolbarProps = FlexProps & {
editor: Editor;
diff --git a/packages/editor/src/toolbar/tools/alignment.tsx b/packages/editor/src/toolbar/tools/alignment.tsx
index dc9614be7..db3b94fa0 100644
--- a/packages/editor/src/toolbar/tools/alignment.tsx
+++ b/packages/editor/src/toolbar/tools/alignment.tsx
@@ -17,11 +17,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { ToolButton } from "../components/tool-button";
-import { useRefValue } from "../../hooks/use-ref-value";
-import { IconNames } from "../icons";
-import { CodeBlock } from "../../extensions/code-block";
+import { ToolProps } from "../types.js";
+import { ToolButton } from "../components/tool-button.js";
+import { useRefValue } from "../../hooks/use-ref-value.js";
+import { IconNames } from "../icons.js";
+import { CodeBlock } from "../../extensions/code-block/index.js";
type Alignment = "left" | "right" | "center" | "justify";
type AlignmentToolProps = ToolProps & {
diff --git a/packages/editor/src/toolbar/tools/attachment.tsx b/packages/editor/src/toolbar/tools/attachment.tsx
index b7fcfa443..eed0a5d1b 100644
--- a/packages/editor/src/toolbar/tools/attachment.tsx
+++ b/packages/editor/src/toolbar/tools/attachment.tsx
@@ -17,12 +17,12 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { ToolButton } from "../components/tool-button";
-import { MoreTools } from "../components/more-tools";
-import { useToolbarLocation } from "../stores/toolbar-store";
-import { findSelectedNode } from "../../utils/prosemirror";
-import { Attachment } from "../../extensions/attachment";
+import { ToolProps } from "../types.js";
+import { ToolButton } from "../components/tool-button.js";
+import { MoreTools } from "../components/more-tools.js";
+import { useToolbarLocation } from "../stores/toolbar-store.js";
+import { findSelectedNode } from "../../utils/prosemirror.js";
+import { Attachment } from "../../extensions/attachment/index.js";
export function AttachmentSettings(props: ToolProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/tools/block.tsx b/packages/editor/src/toolbar/tools/block.tsx
index 8253cab8b..8a1f9dc95 100644
--- a/packages/editor/src/toolbar/tools/block.tsx
+++ b/packages/editor/src/toolbar/tools/block.tsx
@@ -17,18 +17,18 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { Editor } from "../../types";
-import { Icons } from "../icons";
+import { ToolProps } from "../types.js";
+import { Editor } from "../../types.js";
+import { Icons } from "../icons.js";
import { useMemo, useRef, useState } from "react";
-import { EmbedPopup } from "../popups/embed-popup";
-import { TablePopup } from "../popups/table-popup";
+import { EmbedPopup } from "../popups/embed-popup.js";
+import { TablePopup } from "../popups/table-popup.js";
import { MenuItem, Icon } from "@notesnook/ui";
-import { useIsMobile, useToolbarLocation } from "../stores/toolbar-store";
-import { ResponsivePresenter } from "../../components/responsive";
-import { showPopup } from "../../components/popup-presenter";
-import { ImageUploadPopup } from "../popups/image-upload";
-import { Button } from "../../components/button";
+import { useIsMobile, useToolbarLocation } from "../stores/toolbar-store.js";
+import { ResponsivePresenter } from "../../components/responsive/index.js";
+import { showPopup } from "../../components/popup-presenter/index.js";
+import { ImageUploadPopup } from "../popups/image-upload.js";
+import { Button } from "../../components/button.js";
export function InsertBlock(props: ToolProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/tools/colors.tsx b/packages/editor/src/toolbar/tools/colors.tsx
index da947f3fe..900247110 100644
--- a/packages/editor/src/toolbar/tools/colors.tsx
+++ b/packages/editor/src/toolbar/tools/colors.tsx
@@ -19,13 +19,13 @@ along with this program. If not, see .
import { useEffect, useMemo, useRef, useState } from "react";
import tinycolor from "tinycolor2";
-import { PopupWrapper } from "../../components/popup-presenter";
-import { config } from "../../utils/config";
-import { SplitButton } from "../components/split-button";
-import { ColorPicker } from "../popups/color-picker";
-import { usePopupManager, useToolbarLocation } from "../stores/toolbar-store";
-import { ToolProps } from "../types";
-import { getEditorToolbarPopup } from "../utils/dom";
+import { PopupWrapper } from "../../components/popup-presenter/index.js";
+import { config } from "../../utils/config.js";
+import { SplitButton } from "../components/split-button.js";
+import { ColorPicker } from "../popups/color-picker.js";
+import { usePopupManager, useToolbarLocation } from "../stores/toolbar-store.js";
+import { ToolProps } from "../types.js";
+import { getEditorToolbarPopup } from "../utils/dom.js";
import { PositionOptions } from "@notesnook/ui";
type ColorType = "background" | "text" | "border";
diff --git a/packages/editor/src/toolbar/tools/embed.tsx b/packages/editor/src/toolbar/tools/embed.tsx
index 74ebd661e..22c2a4f5b 100644
--- a/packages/editor/src/toolbar/tools/embed.tsx
+++ b/packages/editor/src/toolbar/tools/embed.tsx
@@ -17,15 +17,15 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { ToolButton } from "../components/tool-button";
+import { ToolProps } from "../types.js";
+import { ToolButton } from "../components/tool-button.js";
import { useMemo, useRef, useState } from "react";
-import { ResponsivePresenter } from "../../components/responsive";
-import { MoreTools } from "../components/more-tools";
-import { useToolbarLocation } from "../stores/toolbar-store";
-import { findSelectedNode } from "../../utils/prosemirror";
-import { Embed } from "../../extensions/embed";
-import { EmbedPopup } from "../popups/embed-popup";
+import { ResponsivePresenter } from "../../components/responsive/index.js";
+import { MoreTools } from "../components/more-tools.js";
+import { useToolbarLocation } from "../stores/toolbar-store.js";
+import { findSelectedNode } from "../../utils/prosemirror.js";
+import { Embed } from "../../extensions/embed/index.js";
+import { EmbedPopup } from "../popups/embed-popup.js";
export function EmbedSettings(props: ToolProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/tools/font.tsx b/packages/editor/src/toolbar/tools/font.tsx
index d37324500..9e6e28c09 100644
--- a/packages/editor/src/toolbar/tools/font.tsx
+++ b/packages/editor/src/toolbar/tools/font.tsx
@@ -17,16 +17,16 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { Editor } from "../../types";
-import { Dropdown } from "../components/dropdown";
+import { ToolProps } from "../types.js";
+import { Editor } from "../../types.js";
+import { Dropdown } from "../components/dropdown.js";
import { MenuItem } from "@notesnook/ui";
import { useCallback, useMemo } from "react";
-import { Counter } from "../components/counter";
-import { useRefValue } from "../../hooks/use-ref-value";
-import { useToolbarStore } from "../stores/toolbar-store";
-import { getFontById, getFontIds, getFonts } from "../../utils/font";
-import { CodeBlock } from "../../extensions/code-block";
+import { Counter } from "../components/counter.js";
+import { useRefValue } from "../../hooks/use-ref-value.js";
+import { useToolbarStore } from "../stores/toolbar-store.js";
+import { getFontById, getFontIds, getFonts } from "../../utils/font.js";
+import { CodeBlock } from "../../extensions/code-block/index.js";
export function FontSize(props: ToolProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/tools/headings.tsx b/packages/editor/src/toolbar/tools/headings.tsx
index 51c10dd44..8062de2ef 100644
--- a/packages/editor/src/toolbar/tools/headings.tsx
+++ b/packages/editor/src/toolbar/tools/headings.tsx
@@ -17,13 +17,13 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { Editor } from "../../types";
-import { Dropdown } from "../components/dropdown";
+import { ToolProps } from "../types.js";
+import { Editor } from "../../types.js";
+import { Dropdown } from "../components/dropdown.js";
import { MenuItem } from "@notesnook/ui";
-import { ToolbarLocation, useToolbarLocation } from "../stores/toolbar-store";
+import { ToolbarLocation, useToolbarLocation } from "../stores/toolbar-store.js";
import { useMemo } from "react";
-import { CodeBlock } from "../../extensions/code-block";
+import { CodeBlock } from "../../extensions/code-block/index.js";
const defaultLevels = [1, 2, 3, 4, 5, 6] as const;
diff --git a/packages/editor/src/toolbar/tools/image.tsx b/packages/editor/src/toolbar/tools/image.tsx
index 87be3901a..07ff9f1a9 100644
--- a/packages/editor/src/toolbar/tools/image.tsx
+++ b/packages/editor/src/toolbar/tools/image.tsx
@@ -17,15 +17,15 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { ToolButton } from "../components/tool-button";
+import { ToolProps } from "../types.js";
+import { ToolButton } from "../components/tool-button.js";
import { useRef, useState } from "react";
-import { ResponsivePresenter } from "../../components/responsive";
-import { MoreTools } from "../components/more-tools";
-import { useToolbarLocation } from "../stores/toolbar-store";
-import { ImageProperties as ImagePropertiesPopup } from "../popups/image-properties";
-import { findSelectedNode } from "../../utils/prosemirror";
-import { ImageAttributes } from "../../extensions/image";
+import { ResponsivePresenter } from "../../components/responsive/index.js";
+import { MoreTools } from "../components/more-tools.js";
+import { useToolbarLocation } from "../stores/toolbar-store.js";
+import { ImageProperties as ImagePropertiesPopup } from "../popups/image-properties.js";
+import { findSelectedNode } from "../../utils/prosemirror.js";
+import { ImageAttributes } from "../../extensions/image/index.js";
export function ImageSettings(props: ToolProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/tools/index.ts b/packages/editor/src/toolbar/tools/index.ts
index fba516868..38db1a07a 100644
--- a/packages/editor/src/toolbar/tools/index.ts
+++ b/packages/editor/src/toolbar/tools/index.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import React from "react";
-import { ToolProps } from "../types";
+import { ToolProps } from "../types.js";
import {
Bold,
Italic,
@@ -30,14 +30,14 @@ import {
ClearFormatting,
CodeRemove,
Math
-} from "./inline";
-import { InsertBlock } from "./block";
-import { FontSize, FontFamily } from "./font";
-import { Alignment } from "./alignment";
-import { Headings } from "./headings";
-import { NumberedList, BulletList, Outdent, Indent, CheckList } from "./lists";
-import { TextDirection } from "./text-direction";
-import { Highlight, TextColor } from "./colors";
+} from "./inline.js";
+import { InsertBlock } from "./block.js";
+import { FontSize, FontFamily } from "./font.js";
+import { Alignment } from "./alignment.js";
+import { Headings } from "./headings.js";
+import { NumberedList, BulletList, Outdent, Indent, CheckList } from "./lists.js";
+import { TextDirection } from "./text-direction.js";
+import { Highlight, TextColor } from "./colors.js";
import {
TableSettings,
ColumnProperties,
@@ -60,7 +60,7 @@ import {
CellBorderColor,
CellTextColor,
CellBorderWidth
-} from "./table";
+} from "./table.js";
import {
ImageSettings,
ImageAlignCenter,
@@ -68,20 +68,20 @@ import {
ImageAlignRight,
ImageFloat,
ImageProperties
-} from "./image";
+} from "./image.js";
import {
AttachmentSettings,
DownloadAttachment,
PreviewAttachment,
RemoveAttachment
-} from "./attachment";
+} from "./attachment.js";
import {
EmbedAlignCenter,
EmbedAlignLeft,
EmbedAlignRight,
EmbedProperties,
EmbedSettings
-} from "./embed";
+} from "./embed.js";
import {
AddLink,
AddInternalLink,
@@ -90,13 +90,13 @@ import {
LinkSettings,
OpenLink,
CopyLink
-} from "./link";
+} from "./link.js";
import {
WebClipFullScreen,
WebClipSettings,
WebClipOpenExternal,
WebClipOpenSource
-} from "./web-clip";
+} from "./web-clip.js";
export type ToolId = keyof typeof tools;
const tools = {
diff --git a/packages/editor/src/toolbar/tools/inline.tsx b/packages/editor/src/toolbar/tools/inline.tsx
index 945627ef1..6a373854b 100644
--- a/packages/editor/src/toolbar/tools/inline.tsx
+++ b/packages/editor/src/toolbar/tools/inline.tsx
@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { ToolButton } from "../components/tool-button";
-import { useToolbarLocation } from "../stores/toolbar-store";
-import { CodeBlock } from "../../extensions/code-block";
+import { ToolProps } from "../types.js";
+import { ToolButton } from "../components/tool-button.js";
+import { useToolbarLocation } from "../stores/toolbar-store.js";
+import { CodeBlock } from "../../extensions/code-block/index.js";
export function Italic(props: ToolProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/tools/link.tsx b/packages/editor/src/toolbar/tools/link.tsx
index ee57ed543..1a3f193f2 100644
--- a/packages/editor/src/toolbar/tools/link.tsx
+++ b/packages/editor/src/toolbar/tools/link.tsx
@@ -17,20 +17,20 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { ToolButton } from "../components/tool-button";
+import { ToolProps } from "../types.js";
+import { ToolButton } from "../components/tool-button.js";
import { useRef, useState } from "react";
-import { ResponsivePresenter } from "../../components/responsive";
-import { LinkPopup } from "../popups/link-popup";
-import { useToolbarLocation } from "../stores/toolbar-store";
-import { MoreTools } from "../components/more-tools";
-import { useRefValue } from "../../hooks/use-ref-value";
-import { findMark, selectionToOffset } from "../../utils/prosemirror";
+import { ResponsivePresenter } from "../../components/responsive/index.js";
+import { LinkPopup } from "../popups/link-popup.js";
+import { useToolbarLocation } from "../stores/toolbar-store.js";
+import { MoreTools } from "../components/more-tools.js";
+import { useRefValue } from "../../hooks/use-ref-value.js";
+import { findMark, selectionToOffset } from "../../utils/prosemirror.js";
import { Flex, Link } from "@theme-ui/components";
-import { ImageNode } from "../../extensions/image";
-import { Link as LinkNode } from "../../extensions/link";
+import { ImageNode } from "../../extensions/image/index.js";
+import { Link as LinkNode } from "../../extensions/link/index.js";
import { getMarkAttributes } from "@tiptap/core";
-import { useHoverPopupContext } from "../floating-menus/hover-popup/context";
+import { useHoverPopupContext } from "../floating-menus/hover-popup/context.js";
export function LinkSettings(props: ToolProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/tools/lists.tsx b/packages/editor/src/toolbar/tools/lists.tsx
index 2bdaa154c..eddaa802b 100644
--- a/packages/editor/src/toolbar/tools/lists.tsx
+++ b/packages/editor/src/toolbar/tools/lists.tsx
@@ -17,16 +17,16 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
+import { ToolProps } from "../types.js";
import { Box, Button, Flex } from "@theme-ui/components";
-import { IconNames } from "../icons";
+import { IconNames } from "../icons.js";
import { useCallback, useRef } from "react";
-import { SplitButton } from "../components/split-button";
-import { usePopupManager, useToolbarLocation } from "../stores/toolbar-store";
-import { getToolbarElement } from "../utils/dom";
-import { PopupWrapper } from "../../components/popup-presenter";
-import { ToolButton } from "../components/tool-button";
-import { findListItemType, isListActive } from "../../utils/prosemirror";
+import { SplitButton } from "../components/split-button.js";
+import { usePopupManager, useToolbarLocation } from "../stores/toolbar-store.js";
+import { getToolbarElement } from "../utils/dom.js";
+import { PopupWrapper } from "../../components/popup-presenter/index.js";
+import { ToolButton } from "../components/tool-button.js";
+import { findListItemType, isListActive } from "../../utils/list.js";
type ListSubType = {
items: string[];
diff --git a/packages/editor/src/toolbar/tools/table.tsx b/packages/editor/src/toolbar/tools/table.tsx
index 5612f198c..24657f00d 100644
--- a/packages/editor/src/toolbar/tools/table.tsx
+++ b/packages/editor/src/toolbar/tools/table.tsx
@@ -17,27 +17,27 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { Editor } from "../../types";
-import { ToolButton } from "../components/tool-button";
+import { ToolProps } from "../types.js";
+import { Editor } from "../../types.js";
+import { ToolButton } from "../components/tool-button.js";
import { useCallback, useMemo, useRef, useState } from "react";
-import { ResponsivePresenter } from "../../components/responsive";
+import { ResponsivePresenter } from "../../components/responsive/index.js";
import { MenuButtonItem, MenuItem } from "@notesnook/ui";
import {
moveColumnLeft as moveColumnLeftAction,
moveColumnRight as moveColumnRightAction,
moveRowDown as moveRowDownAction,
moveRowUp as moveRowUpAction
-} from "../../extensions/table/actions";
-import { MoreTools } from "../components/more-tools";
-import { menuButtonToTool, toolToMenuButton } from "./utils";
-import { getToolDefinition } from "../tool-definitions";
-import { CellProperties as CellPropertiesPopup } from "../popups/cell-properties";
-import { ColorTool } from "./colors";
-import { Counter } from "../components/counter";
-import { useToolbarLocation } from "../stores/toolbar-store";
-import { showPopup } from "../../components/popup-presenter";
-import { useRefValue } from "../../hooks/use-ref-value";
+} from "../../extensions/table/actions.js";
+import { MoreTools } from "../components/more-tools.js";
+import { menuButtonToTool, toolToMenuButton } from "./utils.js";
+import { getToolDefinition } from "../tool-definitions.js";
+import { CellProperties as CellPropertiesPopup } from "../popups/cell-properties.js";
+import { ColorTool } from "./colors.js";
+import { Counter } from "../components/counter.js";
+import { useToolbarLocation } from "../stores/toolbar-store.js";
+import { showPopup } from "../../components/popup-presenter/index.js";
+import { useRefValue } from "../../hooks/use-ref-value.js";
export function TableSettings(props: ToolProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/tools/text-direction.tsx b/packages/editor/src/toolbar/tools/text-direction.tsx
index 5878dd883..fdf752a2a 100644
--- a/packages/editor/src/toolbar/tools/text-direction.tsx
+++ b/packages/editor/src/toolbar/tools/text-direction.tsx
@@ -17,15 +17,15 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { ToolButton } from "../components/tool-button";
-import { IconNames } from "../icons";
-import { useRefValue } from "../../hooks/use-ref-value";
+import { ToolProps } from "../types.js";
+import { ToolButton } from "../components/tool-button.js";
+import { IconNames } from "../icons.js";
+import { useRefValue } from "../../hooks/use-ref-value.js";
import {
getTextDirection,
TextDirections
-} from "../../extensions/text-direction";
-import { CodeBlock } from "../../extensions/code-block";
+} from "../../extensions/text-direction/index.js";
+import { CodeBlock } from "../../extensions/code-block/index.js";
type TextDirectionToolProps = ToolProps & {
direction: TextDirections;
diff --git a/packages/editor/src/toolbar/tools/utils.tsx b/packages/editor/src/toolbar/tools/utils.tsx
index aacfa6fa9..50a5b47ca 100644
--- a/packages/editor/src/toolbar/tools/utils.tsx
+++ b/packages/editor/src/toolbar/tools/utils.tsx
@@ -17,11 +17,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { Editor } from "../../types";
+import { Editor } from "../../types.js";
import { MenuButtonItem } from "@notesnook/ui";
-import { ToolButton } from "../components/tool-button";
-import { ToolDefinition, ToolProps } from "../types";
-import { IconNames, Icons } from "../icons";
+import { ToolButton } from "../components/tool-button.js";
+import { ToolDefinition, ToolProps } from "../types.js";
+import { IconNames, Icons } from "../icons.js";
export function menuButtonToTool(
constructItem: (editor: Editor) => MenuButtonItem
diff --git a/packages/editor/src/toolbar/tools/web-clip.tsx b/packages/editor/src/toolbar/tools/web-clip.tsx
index 7c782aa8f..f6d3ed1f9 100644
--- a/packages/editor/src/toolbar/tools/web-clip.tsx
+++ b/packages/editor/src/toolbar/tools/web-clip.tsx
@@ -17,11 +17,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { ToolProps } from "../types";
-import { ToolButton } from "../components/tool-button";
-import { MoreTools } from "../components/more-tools";
-import { useToolbarLocation } from "../stores/toolbar-store";
-import { findSelectedNode, selectionToOffset } from "../../utils/prosemirror";
+import { ToolProps } from "../types.js";
+import { ToolButton } from "../components/tool-button.js";
+import { MoreTools } from "../components/more-tools.js";
+import { useToolbarLocation } from "../stores/toolbar-store.js";
+import { findSelectedNode, selectionToOffset } from "../../utils/prosemirror.js";
export function WebClipSettings(props: ToolProps) {
const { editor } = props;
diff --git a/packages/editor/src/toolbar/types.ts b/packages/editor/src/toolbar/types.ts
index f47685284..e925fcca1 100644
--- a/packages/editor/src/toolbar/types.ts
+++ b/packages/editor/src/toolbar/types.ts
@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { Editor } from "../types";
-import { IconNames } from "./icons";
-import { ToolId } from "./tools";
+import { Editor } from "../types.js";
+import { IconNames } from "./icons.js";
+import { ToolId } from "./tools/index.js";
export type ToolButtonVariant = "small" | "normal";
export type ToolProps = ToolDefinition & {
diff --git a/packages/editor/src/utils/downloader.ts b/packages/editor/src/utils/downloader.ts
index 13ca55dd1..409f0da68 100644
--- a/packages/editor/src/utils/downloader.ts
+++ b/packages/editor/src/utils/downloader.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import DataURL from "@notesnook/core/dist/utils/dataurl";
+import { DataURL } from "@notesnook/common";
export type DownloadOptions = {
corsHost?: string;
diff --git a/packages/editor/src/utils/font.ts b/packages/editor/src/utils/font.ts
index e6d0b9a0d..32c4dbb25 100644
--- a/packages/editor/src/utils/font.ts
+++ b/packages/editor/src/utils/font.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { getFontConfig } from "@notesnook/theme/dist/theme/font";
+import { getFontConfig } from "@notesnook/theme";
const FONTS = [
{
diff --git a/packages/editor/src/utils/list.ts b/packages/editor/src/utils/list.ts
new file mode 100644
index 000000000..d38974600
--- /dev/null
+++ b/packages/editor/src/utils/list.ts
@@ -0,0 +1,52 @@
+/*
+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 .
+*/
+
+import { BulletList } from "../extensions/bullet-list/index.js";
+import { ListItem } from "../extensions/list-item/index.js";
+import { OrderedList } from "../extensions/ordered-list/index.js";
+import { OutlineList } from "../extensions/outline-list/index.js";
+import { OutlineListItem } from "../extensions/outline-list-item/index.js";
+import { TaskItemNode } from "../extensions/task-item/index.js";
+import { TaskListNode } from "../extensions/task-list/index.js";
+import CheckList from "../extensions/check-list/index.js";
+import CheckListItem from "../extensions/check-list-item/index.js";
+import { Editor } from "@tiptap/core";
+import { LIST_NODE_TYPES } from "./node-types.js";
+
+export function isListActive(editor: Editor): boolean {
+ return LIST_NODE_TYPES.some((name) => editor.isActive(name));
+}
+
+export function findListItemType(editor: Editor): string | null {
+ const isTaskList = editor.isActive(TaskListNode.name);
+ const isCheckList = editor.isActive(CheckList.name);
+ const isOutlineList = editor.isActive(OutlineList.name);
+ const isList =
+ editor.isActive(BulletList.name) || editor.isActive(OrderedList.name);
+
+ return isList
+ ? ListItem.name
+ : isOutlineList
+ ? OutlineListItem.name
+ : isTaskList
+ ? TaskItemNode.name
+ : isCheckList
+ ? CheckListItem.name
+ : null;
+}
diff --git a/packages/editor/src/utils/node-types.ts b/packages/editor/src/utils/node-types.ts
index 852a671a2..314f2f316 100644
--- a/packages/editor/src/utils/node-types.ts
+++ b/packages/editor/src/utils/node-types.ts
@@ -21,8 +21,8 @@ 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 { OutlineList } from "../extensions/outline-list/index.js";
+import { OutlineListItem } from "../extensions/outline-list-item/index.js";
import { TaskItem } from "@tiptap/extension-task-item";
export const LIST_NODE_TYPES = [
diff --git a/packages/editor/src/utils/prosemirror.ts b/packages/editor/src/utils/prosemirror.ts
index bcc0aa802..34b36b3f6 100644
--- a/packages/editor/src/utils/prosemirror.ts
+++ b/packages/editor/src/utils/prosemirror.ts
@@ -34,17 +34,7 @@ import {
Slice
} from "prosemirror-model";
import { EditorState, Selection, Transaction } from "prosemirror-state";
-import { BulletList } from "../extensions/bullet-list";
-import { ListItem } from "../extensions/list-item";
-import { OrderedList } from "../extensions/ordered-list";
-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";
import TextStyle from "@tiptap/extension-text-style";
-import CheckList from "../extensions/check-list";
-import CheckListItem from "../extensions/check-list-item";
export type NodeWithOffset = {
node?: ProsemirrorNode;
@@ -61,28 +51,6 @@ export function hasSameAttributes(prev: Attrs, next: Attrs) {
return true;
}
-export function findListItemType(editor: Editor): string | null {
- const isTaskList = editor.isActive(TaskListNode.name);
- const isCheckList = editor.isActive(CheckList.name);
- const isOutlineList = editor.isActive(OutlineList.name);
- const isList =
- editor.isActive(BulletList.name) || editor.isActive(OrderedList.name);
-
- return isList
- ? ListItem.name
- : isOutlineList
- ? OutlineListItem.name
- : isTaskList
- ? TaskItemNode.name
- : isCheckList
- ? CheckListItem.name
- : null;
-}
-
-export function isListActive(editor: Editor): boolean {
- return LIST_NODE_TYPES.some((name) => editor.isActive(name));
-}
-
export function findSelectedDOMNode(
editor: Editor,
types: string[]
diff --git a/packages/editor/test-utils/index.ts b/packages/editor/test-utils/index.ts
index bd9f0aeee..6227a17bd 100644
--- a/packages/editor/test-utils/index.ts
+++ b/packages/editor/test-utils/index.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import { Editor, AnyExtension, Extensions } from "@tiptap/core";
-import StarterKit, { StarterKitOptions } from "@tiptap/starter-kit";
+import StarterKit from "@tiptap/starter-kit";
import { builders, NodeBuilder } from "prosemirror-test-builder";
import { Schema } from "@tiptap/pm/model";