@witchcraft/editor 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/Editor.d.vue.ts +11 -1
- package/dist/runtime/components/Editor.vue.d.ts +11 -1
- package/dist/runtime/components/EditorDemoApp.vue +4 -4
- package/dist/runtime/pm/features/Blocks/components/DragTreeHandle.d.vue.ts +2 -2
- package/dist/runtime/pm/features/Blocks/components/DragTreeHandle.vue.d.ts +2 -2
- package/dist/runtime/pm/features/CommandsMenus/commandBarMenuItems.js +5 -1
- package/dist/runtime/pm/schema.d.ts +1 -1
- package/package.json +4 -4
- package/src/runtime/components/EditorDemoApp.vue +4 -4
- package/src/runtime/pm/features/CommandsMenus/commandBarMenuItems.ts +5 -2
package/dist/module.json
CHANGED
|
@@ -26,6 +26,16 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
26
26
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
27
|
onLoad?: (() => any) | undefined;
|
|
28
28
|
onUnload?: (() => any) | undefined;
|
|
29
|
-
}>, {
|
|
29
|
+
}>, {
|
|
30
|
+
menus: Record<string, MenuRenderInfo>;
|
|
31
|
+
content: Content;
|
|
32
|
+
docId: string;
|
|
33
|
+
documentApi: DocumentApiInterface;
|
|
34
|
+
linkOptions: EditorLinkOptions;
|
|
35
|
+
dragScrollOptions: Pick<ScrollNearContainerEdgesOptions, "scrollMargin" | "outerScrollMargin" | "fastPixelMultiplier">;
|
|
36
|
+
cssVariables: Partial<CssVariables>;
|
|
37
|
+
editorOptions: Partial<EditorOptions>;
|
|
38
|
+
codeBlocksThemeIsDark: boolean;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
40
|
declare const _default: typeof __VLS_export;
|
|
31
41
|
export default _default;
|
|
@@ -26,6 +26,16 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
26
26
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
27
|
onLoad?: (() => any) | undefined;
|
|
28
28
|
onUnload?: (() => any) | undefined;
|
|
29
|
-
}>, {
|
|
29
|
+
}>, {
|
|
30
|
+
menus: Record<string, MenuRenderInfo>;
|
|
31
|
+
content: Content;
|
|
32
|
+
docId: string;
|
|
33
|
+
documentApi: DocumentApiInterface;
|
|
34
|
+
linkOptions: EditorLinkOptions;
|
|
35
|
+
dragScrollOptions: Pick<ScrollNearContainerEdgesOptions, "scrollMargin" | "outerScrollMargin" | "fastPixelMultiplier">;
|
|
36
|
+
cssVariables: Partial<CssVariables>;
|
|
37
|
+
editorOptions: Partial<EditorOptions>;
|
|
38
|
+
codeBlocksThemeIsDark: boolean;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
40
|
declare const _default: typeof __VLS_export;
|
|
31
41
|
export default _default;
|
|
@@ -86,12 +86,12 @@ const menus = shallowRef({
|
|
|
86
86
|
popupOptions: {
|
|
87
87
|
pinToItemDistance: (state) => {
|
|
88
88
|
const { $from, $to } = state.selection;
|
|
89
|
-
const fromNode = $from.node(-1);
|
|
90
|
-
const toNode = $to.node(-1);
|
|
91
|
-
if (fromNode
|
|
89
|
+
const fromNode = -1 < $from.depth ? $from.node(-1) : void 0;
|
|
90
|
+
const toNode = -1 < $to.depth ? $to.node(-1) : void 0;
|
|
91
|
+
if (fromNode?.type !== toNode?.type) {
|
|
92
92
|
return 0;
|
|
93
93
|
}
|
|
94
|
-
return fromNode
|
|
94
|
+
return fromNode?.type.name.startsWith("table") ? 120 : 0;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -12,6 +12,8 @@ interface Props {
|
|
|
12
12
|
passedDragThreshold: boolean;
|
|
13
13
|
hideChildren: boolean;
|
|
14
14
|
}
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
15
17
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
16
18
|
collapseIndicatorClick: (event: MouseEvent) => any;
|
|
17
19
|
grabHandlePassiveTouchStart: (event: TouchEvent) => any;
|
|
@@ -23,5 +25,3 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
23
25
|
onGrabHandlePointerDown?: ((event: PointerEvent) => any) | undefined;
|
|
24
26
|
onGrabHandleContextMenu?: ((event: PointerEvent) => any) | undefined;
|
|
25
27
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
|
-
declare const _default: typeof __VLS_export;
|
|
27
|
-
export default _default;
|
|
@@ -12,6 +12,8 @@ interface Props {
|
|
|
12
12
|
passedDragThreshold: boolean;
|
|
13
13
|
hideChildren: boolean;
|
|
14
14
|
}
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
15
17
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
16
18
|
collapseIndicatorClick: (event: MouseEvent) => any;
|
|
17
19
|
grabHandlePassiveTouchStart: (event: TouchEvent) => any;
|
|
@@ -23,5 +25,3 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
23
25
|
onGrabHandlePointerDown?: ((event: PointerEvent) => any) | undefined;
|
|
24
26
|
onGrabHandleContextMenu?: ((event: PointerEvent) => any) | undefined;
|
|
25
27
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
|
-
declare const _default: typeof __VLS_export;
|
|
27
|
-
export default _default;
|
|
@@ -64,7 +64,11 @@ export const toggleSuperscriptCommand = {
|
|
|
64
64
|
description: "Superscript the selected text.",
|
|
65
65
|
icon: { component: SuperscriptIcon }
|
|
66
66
|
};
|
|
67
|
-
export const tableCanShow = (state) =>
|
|
67
|
+
export const tableCanShow = (state) => {
|
|
68
|
+
const fromNode = -1 < state.selection.$from.depth ? state.selection.$from.node(-1) : void 0;
|
|
69
|
+
const toNode = -1 < state.selection.$to.depth ? state.selection.$to.node(-1) : void 0;
|
|
70
|
+
return fromNode?.type.name === "tableCell" && toNode?.type.name === "tableCell";
|
|
71
|
+
};
|
|
68
72
|
export const tableAddColBeforeCommand = {
|
|
69
73
|
type: "command",
|
|
70
74
|
command: "addColumnBefore",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type EditorOptions } from "@tiptap/core";
|
|
2
2
|
import type { Schema } from "@tiptap/pm/model";
|
|
3
3
|
export declare const extensions: EditorOptions["extensions"];
|
|
4
|
-
export declare const schema: Schema<"
|
|
4
|
+
export declare const schema: Schema<"blockquote" | "cite" | "iframe" | "table" | "image" | "text" | "codeBlock" | "paragraph" | "item" | "heading" | "embeddedDoc" | "list" | "tableCell" | "doc" | "tableRow" | "tableHeader", "code" | "highlight" | "bold" | "italic" | "strike" | "subscript" | "superscript" | "underline" | "hardBreak">;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@witchcraft/editor",
|
|
3
3
|
"description": "Block base prosemirror editor with partial/full editable document embeds, infinite embeds, and document uploads.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"main": "./dist/runtime/main.lib.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@tiptap/html": "^3.11.1",
|
|
93
93
|
"@tiptap/pm": "^3.11.1",
|
|
94
94
|
"@tiptap/vue-3": "^3.11.1",
|
|
95
|
-
"@witchcraft/ui": "^0.3.
|
|
95
|
+
"@witchcraft/ui": "^0.3.19",
|
|
96
96
|
"tailwindcss": "^4.1.17",
|
|
97
97
|
"vue": "^3.5.25"
|
|
98
98
|
},
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"@nuxt/eslint-config": "^1.11.0",
|
|
120
120
|
"@tiptap/html": "^3.11.1",
|
|
121
121
|
"@witchcraft/nuxt-utils": "^0.3.6",
|
|
122
|
-
"@witchcraft/ui": "^0.3.
|
|
122
|
+
"@witchcraft/ui": "^0.3.19",
|
|
123
123
|
"colord": "^2.9.3",
|
|
124
124
|
"defu": "^6.1.4",
|
|
125
125
|
"highlight.js": "^11.11.1",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"@vitejs/plugin-vue": "^6.0.2",
|
|
154
154
|
"@vitest/browser-playwright": "^4.0.14",
|
|
155
155
|
"@vitest/coverage-v8": "^4.0.14",
|
|
156
|
-
"@witchcraft/ui": "^0.3.
|
|
156
|
+
"@witchcraft/ui": "^0.3.19",
|
|
157
157
|
"concurrently": "^9.2.1",
|
|
158
158
|
"cross-env": "^10.0.0",
|
|
159
159
|
"eslint": "^9.39.1",
|
|
@@ -98,13 +98,13 @@ const menus = shallowRef<Record<string, MenuRenderInfo>>({
|
|
|
98
98
|
popupOptions: {
|
|
99
99
|
pinToItemDistance: state => {
|
|
100
100
|
const { $from, $to } = state.selection
|
|
101
|
-
const fromNode = $from.node(-1)
|
|
102
|
-
const toNode = $to.node(-1)
|
|
101
|
+
const fromNode = -1 < $from.depth ? $from.node(-1) : undefined
|
|
102
|
+
const toNode = -1 < $to.depth ? $to.node(-1) : undefined
|
|
103
103
|
// tables don't support selections outside of each cell, so no need to check we're in the same table or anything
|
|
104
|
-
if (fromNode
|
|
104
|
+
if (fromNode?.type !== toNode?.type) {
|
|
105
105
|
return 0
|
|
106
106
|
}
|
|
107
|
-
return (fromNode
|
|
107
|
+
return (fromNode?.type.name.startsWith("table")) ? 120 : 0
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -76,8 +76,11 @@ export const toggleSuperscriptCommand: CommandBarCommand = {
|
|
|
76
76
|
icon: { component: SuperscriptIcon }
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export const tableCanShow = (state: EditorState): boolean =>
|
|
80
|
-
|
|
79
|
+
export const tableCanShow = (state: EditorState): boolean => {
|
|
80
|
+
const fromNode = -1 < state.selection.$from.depth ? state.selection.$from.node(-1) : undefined
|
|
81
|
+
const toNode = -1 < state.selection.$to.depth ? state.selection.$to.node(-1) : undefined
|
|
82
|
+
return fromNode?.type.name === "tableCell" && toNode?.type.name === "tableCell"
|
|
83
|
+
}
|
|
81
84
|
|
|
82
85
|
export const tableAddColBeforeCommand: CommandBarCommand = {
|
|
83
86
|
type: "command" as const,
|