mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-21 14:09:34 +01:00
editor: update tiptap packages
This commit is contained in:
committed by
Abdullah Atta
parent
dc62291fba
commit
08363f95e0
1647
packages/editor/package-lock.json
generated
1647
packages/editor/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,38 +4,36 @@
|
|||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@_ueberdosis/prosemirror-tables": "^1.1.3",
|
|
||||||
"@emotion/react": "^11.10.0",
|
"@emotion/react": "^11.10.0",
|
||||||
"@notesnook/theme": "*",
|
"@notesnook/theme": "*",
|
||||||
"@social-embed/lib": "^0.0.1-next.12",
|
"@social-embed/lib": "^0.0.2-next.1",
|
||||||
"@theme-ui/components": "^0.14.7",
|
"@theme-ui/components": "^0.14.7",
|
||||||
"@theme-ui/core": "^0.14.7",
|
"@theme-ui/core": "^0.14.7",
|
||||||
"@tiptap/core": "^2.0.0-beta.199",
|
"@tiptap/core": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-character-count": "^2.0.0-beta.199",
|
"@tiptap/extension-character-count": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-color": "^2.0.0-beta.199",
|
"@tiptap/extension-color": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-font-family": "^2.0.0-beta.199",
|
"@tiptap/extension-font-family": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-history": "^2.0.0-beta.199",
|
"@tiptap/extension-history": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.199",
|
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-link": "^2.0.0-beta.199",
|
"@tiptap/extension-link": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-placeholder": "^2.0.0-beta.199",
|
"@tiptap/extension-placeholder": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-subscript": "^2.0.0-beta.199",
|
"@tiptap/extension-subscript": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-superscript": "^2.0.0-beta.199",
|
"@tiptap/extension-superscript": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-table": "^2.0.0-beta.199",
|
"@tiptap/extension-table": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-table-cell": "^2.0.0-beta.199",
|
"@tiptap/extension-table-cell": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-table-header": "^2.0.0-beta.199",
|
"@tiptap/extension-table-header": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-table-row": "^2.0.0-beta.199",
|
"@tiptap/extension-table-row": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-task-item": "^2.0.0-beta.199",
|
"@tiptap/extension-task-item": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-task-list": "^2.0.0-beta.199",
|
"@tiptap/extension-task-list": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-text-align": "^2.0.0-beta.199",
|
"@tiptap/extension-text-align": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-text-style": "^2.0.0-beta.199",
|
"@tiptap/extension-text-style": "^2.0.0-beta.218",
|
||||||
"@tiptap/extension-underline": "^2.0.0-beta.199",
|
"@tiptap/extension-underline": "^2.0.0-beta.218",
|
||||||
"@tiptap/starter-kit": "^2.0.0-beta.199",
|
"@tiptap/starter-kit": "^2.0.0-beta.218",
|
||||||
|
"@tiptap/pm": "^2.0.0-beta.218",
|
||||||
"detect-indent": "^7.0.0",
|
"detect-indent": "^7.0.0",
|
||||||
"katex": "^0.16.2",
|
"katex": "^0.16.2",
|
||||||
"prism-themes": "^1.9.0",
|
"prism-themes": "^1.9.0",
|
||||||
"prosemirror-codemark": "^0.4.1",
|
"prosemirror-codemark": "^0.4.1",
|
||||||
"prosemirror-commands": "^1.3.1",
|
|
||||||
"prosemirror-view": "1.29.0",
|
|
||||||
"re-resizable": "^6.9.9",
|
"re-resizable": "^6.9.9",
|
||||||
"react-colorful": "^5.5.1",
|
"react-colorful": "^5.5.1",
|
||||||
"react-modal": "^3.15.1",
|
"react-modal": "^3.15.1",
|
||||||
@@ -47,6 +45,8 @@
|
|||||||
"zustand": "^3.7.2"
|
"zustand": "^3.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@mdi/js": "^6.9.96",
|
||||||
|
"@mdi/react": "^1.6.0",
|
||||||
"@types/katex": "^0.14.0",
|
"@types/katex": "^0.14.0",
|
||||||
"@types/prismjs": "^1.26.0",
|
"@types/prismjs": "^1.26.0",
|
||||||
"@types/react": "17.0.2",
|
"@types/react": "17.0.2",
|
||||||
@@ -58,15 +58,13 @@
|
|||||||
"isomorphic-fetch": "^3.0.0",
|
"isomorphic-fetch": "^3.0.0",
|
||||||
"typescript": "^4.8.2",
|
"typescript": "^4.8.2",
|
||||||
"web-vitals": "^2.1.4",
|
"web-vitals": "^2.1.4",
|
||||||
"@mdi/js": "^6.9.96",
|
|
||||||
"@mdi/react": "^1.6.0",
|
|
||||||
"zx": "^7.0.8"
|
"zx": "^7.0.8"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=17.0.0",
|
|
||||||
"react-dom": ">=17.0.0",
|
|
||||||
"@mdi/js": ">=6.9.96",
|
"@mdi/js": ">=6.9.96",
|
||||||
"@mdi/react": ">=1.6.0"
|
"@mdi/react": ">=1.6.0",
|
||||||
|
"react": ">=17.0.0",
|
||||||
|
"react-dom": ">=17.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "zx ./scripts/build.mjs",
|
"prebuild": "zx ./scripts/build.mjs",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Extension } from "@tiptap/core";
|
import { Extension } from "@tiptap/core";
|
||||||
import { isInTable } from "@_ueberdosis/prosemirror-tables";
|
import { isInTable } from "@tiptap/pm/tables";
|
||||||
import { isListActive } from "../../utils/prosemirror";
|
import { isListActive } from "../../utils/prosemirror";
|
||||||
|
|
||||||
export const KeyMap = Extension.create({
|
export const KeyMap = Extension.create({
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ export const Paragraph = Node.create<ParagraphOptions>({
|
|||||||
setParagraph:
|
setParagraph:
|
||||||
() =>
|
() =>
|
||||||
({ commands }) => {
|
({ commands }) => {
|
||||||
console.log("HELLO2");
|
|
||||||
return commands.setNode(this.name);
|
return commands.setNode(this.name);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,9 +29,8 @@ import {
|
|||||||
ForwardRef,
|
ForwardRef,
|
||||||
ContentDOM
|
ContentDOM
|
||||||
} from "./types";
|
} from "./types";
|
||||||
import { NodeViewRendererProps } from "@tiptap/core";
|
import { Editor, NodeViewRendererProps } from "@tiptap/core";
|
||||||
import { __serializeForClipboard, EditorView } from "prosemirror-view";
|
import { __serializeForClipboard, EditorView } from "prosemirror-view";
|
||||||
import { Editor } from "../../types";
|
|
||||||
import { ThemeProvider } from "../../components/theme-provider";
|
import { ThemeProvider } from "../../components/theme-provider";
|
||||||
|
|
||||||
// This is hacky workaround to manually handle serialization when
|
// This is hacky workaround to manually handle serialization when
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ import {
|
|||||||
ForwardRef
|
ForwardRef
|
||||||
} from "./types";
|
} from "./types";
|
||||||
import { ReactNodeView } from "./react-node-view";
|
import { ReactNodeView } from "./react-node-view";
|
||||||
import { NodeViewRendererProps } from "@tiptap/core";
|
import { Editor, NodeViewRendererProps } from "@tiptap/core";
|
||||||
import { Editor } from "../../types";
|
|
||||||
import { ThemeProvider } from "../../components/theme-provider";
|
import { ThemeProvider } from "../../components/theme-provider";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,7 +92,7 @@ export class SelectionBasedNodeView<
|
|||||||
if (!this.options.component) return null;
|
if (!this.options.component) return null;
|
||||||
const isSelected =
|
const isSelected =
|
||||||
this.editor.isEditable &&
|
this.editor.isEditable &&
|
||||||
(this.insideSelection() || this.nodeInsideSelection());
|
this.isSelectedNode(this.editor.view.state.selection);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider>
|
<ThemeProvider>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Editor } from "@tiptap/core";
|
import { Editor } from "@tiptap/core";
|
||||||
import { selectedRect, TableRect } from "@_ueberdosis/prosemirror-tables";
|
import { selectedRect, TableRect } from "@tiptap/pm/tables";
|
||||||
import { Transaction } from "prosemirror-state";
|
import { Transaction } from "prosemirror-state";
|
||||||
import { Node } from "prosemirror-model";
|
import { Node } from "prosemirror-model";
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ import {
|
|||||||
} from "../react";
|
} from "../react";
|
||||||
import { Node as ProsemirrorNode } from "prosemirror-model";
|
import { Node as ProsemirrorNode } from "prosemirror-model";
|
||||||
import { Editor } from "../../types";
|
import { Editor } from "../../types";
|
||||||
|
import { Editor as TiptapEditor } from "@tiptap/core";
|
||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { updateColumnsOnResize } from "@_ueberdosis/prosemirror-tables";
|
import { updateColumnsOnResize } from "@tiptap/pm/tables";
|
||||||
import { NodeView } from "prosemirror-view";
|
import { EditorView, NodeView } from "prosemirror-view";
|
||||||
import {
|
import {
|
||||||
InsertColumnRight,
|
InsertColumnRight,
|
||||||
InsertRowBelow,
|
InsertRowBelow,
|
||||||
@@ -88,7 +89,7 @@ export function TableComponent(props: SelectionBasedReactNodeViewProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TableNodeView(editor: Editor) {
|
export function TableNodeView(editor: TiptapEditor) {
|
||||||
class TableNode
|
class TableNode
|
||||||
extends SelectionBasedNodeView<SelectionBasedReactNodeViewProps<unknown>>
|
extends SelectionBasedNodeView<SelectionBasedReactNodeViewProps<unknown>>
|
||||||
implements NodeView
|
implements NodeView
|
||||||
@@ -120,7 +121,11 @@ export function TableNodeView(editor: Editor) {
|
|||||||
super.init();
|
super.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TableNode as unknown as NodeView;
|
return TableNode as unknown as new (
|
||||||
|
node: ProsemirrorNode,
|
||||||
|
cellMinWidth: number,
|
||||||
|
view: EditorView
|
||||||
|
) => NodeView;
|
||||||
}
|
}
|
||||||
|
|
||||||
type TableToolbarProps = {
|
type TableToolbarProps = {
|
||||||
|
|||||||
@@ -18,21 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Table as TiptapTable, TableOptions } from "@tiptap/extension-table";
|
import { Table as TiptapTable, TableOptions } from "@tiptap/extension-table";
|
||||||
import { columnResizing, tableEditing } from "@_ueberdosis/prosemirror-tables";
|
import { columnResizing, tableEditing } from "@tiptap/pm/tables";
|
||||||
import { Editor } from "../../types";
|
|
||||||
import { TableNodeView } from "./component";
|
import { TableNodeView } from "./component";
|
||||||
import { Plugin } from "prosemirror-state";
|
|
||||||
import { NodeView } from "prosemirror-view";
|
|
||||||
|
|
||||||
// TODO: send PR
|
|
||||||
declare module "@_ueberdosis/prosemirror-tables" {
|
|
||||||
export function columnResizing(props: {
|
|
||||||
handleWidth?: number;
|
|
||||||
cellMinWidth?: number;
|
|
||||||
View?: NodeView;
|
|
||||||
lastColumnResizable?: boolean;
|
|
||||||
}): Plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Table = TiptapTable.extend<TableOptions>({
|
export const Table = TiptapTable.extend<TableOptions>({
|
||||||
addProseMirrorPlugins() {
|
addProseMirrorPlugins() {
|
||||||
@@ -44,7 +31,7 @@ export const Table = TiptapTable.extend<TableOptions>({
|
|||||||
columnResizing({
|
columnResizing({
|
||||||
handleWidth: this.options.handleWidth,
|
handleWidth: this.options.handleWidth,
|
||||||
cellMinWidth: this.options.cellMinWidth,
|
cellMinWidth: this.options.cellMinWidth,
|
||||||
View: TableNodeView(this.editor as Editor),
|
View: TableNodeView(this.editor),
|
||||||
lastColumnResizable: this.options.lastColumnResizable
|
lastColumnResizable: this.options.lastColumnResizable
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user