@kopexa/tiptap 1.0.0 → 2.0.0
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/{chunk-AASYBJDX.mjs → chunk-2SI7MRAE.mjs} +1 -1
- package/dist/{chunk-6W7J7PHZ.mjs → chunk-B2DHYFSH.mjs} +6 -7
- package/dist/{chunk-RQPJU4UB.mjs → chunk-B7WJOQ3X.mjs} +1 -1
- package/dist/{chunk-ACWAVTTK.mjs → chunk-BEV5U2DK.mjs} +6 -6
- package/dist/{chunk-TGQP45HH.mjs → chunk-EHY2NAW7.mjs} +1 -3
- package/dist/{chunk-O5P45H3I.mjs → chunk-GYIYX2JH.mjs} +1 -1
- package/dist/{chunk-QCULSZRZ.mjs → chunk-IOB3REX6.mjs} +1 -3
- package/dist/{chunk-ILPDDC4W.mjs → chunk-IQERE7KP.mjs} +1 -4
- package/dist/{chunk-6SS62RYU.mjs → chunk-JNL4KY45.mjs} +1 -3
- package/dist/{chunk-R2RRQUU5.mjs → chunk-LHXRE26G.mjs} +2 -2
- package/dist/{chunk-F2HHFSM4.mjs → chunk-LNVWG34E.mjs} +1 -4
- package/dist/chunk-NUCXXNTA.mjs +131 -0
- package/dist/{chunk-GLQRF7PR.mjs → chunk-OEVR5N7X.mjs} +2 -10
- package/dist/{chunk-YYHNT322.mjs → chunk-OZWCQMRA.mjs} +27 -19
- package/dist/{chunk-OX2A52WL.mjs → chunk-Q7DFJ5NI.mjs} +2 -4
- package/dist/{chunk-ODBSAQ5V.mjs → chunk-QF3YHPWM.mjs} +2 -4
- package/dist/{chunk-R5AMMJTQ.mjs → chunk-REJEJXOZ.mjs} +3 -3
- package/dist/chunk-TZQQ6C2Q.mjs +101 -0
- package/dist/{chunk-KI3YOPAA.mjs → chunk-UJ4BNZ63.mjs} +1 -4
- package/dist/{chunk-4LAWYE7B.mjs → chunk-V6TAZMQN.mjs} +2 -4
- package/dist/{chunk-QP2LCU5N.mjs → chunk-VX3HSJ76.mjs} +2 -2
- package/dist/{chunk-WCBSINO5.mjs → chunk-W2FLOOJ6.mjs} +1 -1
- package/dist/{chunk-JHMEXFB3.mjs → chunk-WHJ4B43N.mjs} +1 -1
- package/dist/{chunk-YD56B5SG.mjs → chunk-WPRDVMPN.mjs} +19 -18
- package/dist/{chunk-44V2Y6IU.mjs → chunk-XL5FS7LN.mjs} +3 -3
- package/dist/{chunk-ZSYXHD7D.mjs → chunk-YJAHZXLG.mjs} +1 -4
- package/dist/{chunk-T7LL5ZSR.mjs → chunk-ZVTJ6XD7.mjs} +1 -3
- package/dist/{chunk-I7WKP3OM.mjs → chunk-ZZ4OU46C.mjs} +6 -6
- package/dist/context/editor-context.d.mts +4 -4
- package/dist/context/editor-context.d.ts +4 -4
- package/dist/context/editor-context.js +5 -5
- package/dist/context/editor-context.mjs +5 -6
- package/dist/extensions/link/index.mjs +0 -1
- package/dist/extensions/selection/index.mjs +0 -1
- package/dist/extensions/trailing-node/index.mjs +0 -1
- package/dist/extensions/ui-state/index.mjs +0 -1
- package/dist/hooks/use-create-editor.d.mts +16 -5
- package/dist/hooks/use-create-editor.d.ts +16 -5
- package/dist/hooks/use-create-editor.js +84 -1062
- package/dist/hooks/use-create-editor.mjs +5 -18
- package/dist/hooks/use-cursor-visibility.mjs +0 -1
- package/dist/hooks/use-floating-element.mjs +0 -1
- package/dist/hooks/use-floating-toolbar-visibility.mjs +0 -1
- package/dist/hooks/use-menu-navigation.mjs +0 -1
- package/dist/hooks/use-tiptap-editor.mjs +0 -1
- package/dist/hooks/use-ui-editor-state.mjs +0 -1
- package/dist/hooks/use-window-size.mjs +0 -1
- package/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +483 -1584
- package/dist/index.mjs +39 -60
- package/dist/presets/basic/editor-header.js +112 -167
- package/dist/presets/basic/editor-header.mjs +25 -25
- package/dist/presets/basic/index.d.mts +6 -3
- package/dist/presets/basic/index.d.ts +6 -3
- package/dist/presets/basic/index.js +386 -1468
- package/dist/presets/basic/index.mjs +32 -46
- package/dist/ui/blockquote-button/blockquote-button.js +12 -67
- package/dist/ui/blockquote-button/blockquote-button.mjs +2 -4
- package/dist/ui/blockquote-button/index.js +12 -67
- package/dist/ui/blockquote-button/index.mjs +2 -4
- package/dist/ui/blockquote-button/use-blockquote.js +12 -65
- package/dist/ui/blockquote-button/use-blockquote.mjs +1 -3
- package/dist/ui/codeblock-button/code-block-button.js +13 -76
- package/dist/ui/codeblock-button/code-block-button.mjs +2 -4
- package/dist/ui/codeblock-button/index.js +13 -76
- package/dist/ui/codeblock-button/index.mjs +2 -4
- package/dist/ui/codeblock-button/use-code-block.js +12 -65
- package/dist/ui/codeblock-button/use-code-block.mjs +1 -3
- package/dist/ui/color-highlight-button/color-highlight-button.js +3 -23
- package/dist/ui/color-highlight-button/color-highlight-button.mjs +2 -4
- package/dist/ui/color-highlight-button/index.js +3 -23
- package/dist/ui/color-highlight-button/index.mjs +2 -4
- package/dist/ui/color-highlight-button/use-color-highlight.js +3 -21
- package/dist/ui/color-highlight-button/use-color-highlight.mjs +1 -3
- package/dist/ui/color-highlight-popover/color-highlight-popover.js +4 -24
- package/dist/ui/color-highlight-popover/color-highlight-popover.mjs +3 -5
- package/dist/ui/color-highlight-popover/index.js +4 -24
- package/dist/ui/color-highlight-popover/index.mjs +3 -5
- package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.js +2 -18
- package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.mjs +1 -3
- package/dist/ui/heading-button/index.js +2 -9
- package/dist/ui/heading-button/index.mjs +1 -3
- package/dist/ui/heading-button/utils.mjs +0 -1
- package/dist/ui/heading-dropdown-menu/index.js +4 -10
- package/dist/ui/heading-dropdown-menu/index.mjs +2 -4
- package/dist/ui/link-popover/index.js +2 -6
- package/dist/ui/link-popover/index.mjs +3 -4
- package/dist/ui/link-popover/link-popover.js +2 -6
- package/dist/ui/link-popover/link-popover.mjs +3 -4
- package/dist/ui/link-popover/use-link-popover.js +2 -6
- package/dist/ui/link-popover/use-link-popover.mjs +2 -3
- package/dist/ui/list-button/index.js +2 -9
- package/dist/ui/list-button/index.mjs +1 -3
- package/dist/ui/list-dropdown-menu/index.js +4 -10
- package/dist/ui/list-dropdown-menu/index.mjs +2 -4
- package/dist/ui/mark-button/index.js +3 -21
- package/dist/ui/mark-button/index.mjs +1 -3
- package/dist/ui/reset-all-formatting-button/index.mjs +0 -1
- package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.mjs +0 -1
- package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.mjs +0 -1
- package/dist/ui/slash-dropdown-menu/index.js +27 -129
- package/dist/ui/slash-dropdown-menu/index.mjs +3 -5
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +27 -129
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +3 -5
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +23 -116
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +2 -4
- package/dist/ui/suggestion-menu/index.mjs +0 -1
- package/dist/ui/suggestion-menu/suggestion-menu-utils.mjs +0 -1
- package/dist/ui/suggestion-menu/suggestion-menu.mjs +0 -1
- package/dist/ui/table-button/index.js +4 -24
- package/dist/ui/table-button/index.mjs +2 -4
- package/dist/ui/table-button/use-table.js +3 -21
- package/dist/ui/table-button/use-table.mjs +1 -3
- package/dist/ui/text-align-button/index.js +3 -32
- package/dist/ui/text-align-button/index.mjs +2 -4
- package/dist/ui/text-align-button/text-align-button.js +3 -32
- package/dist/ui/text-align-button/text-align-button.mjs +2 -4
- package/dist/ui/text-align-button/use-text-align.js +3 -30
- package/dist/ui/text-align-button/use-text-align.mjs +1 -3
- package/dist/ui/undo-redo-button/index.js +2 -18
- package/dist/ui/undo-redo-button/index.mjs +2 -4
- package/dist/ui/undo-redo-button/undo-redo-button.js +2 -18
- package/dist/ui/undo-redo-button/undo-redo-button.mjs +2 -4
- package/dist/ui/undo-redo-button/use-undo-redo.js +2 -16
- package/dist/ui/undo-redo-button/use-undo-redo.mjs +1 -3
- package/dist/utils/index.d.mts +1 -101
- package/dist/utils/index.d.ts +1 -101
- package/dist/utils/index.js +0 -166
- package/dist/utils/index.mjs +1 -28
- package/dist/utils/safe-parse.mjs +0 -1
- package/package.json +36 -30
- package/dist/chunk-4HTILXJM.mjs +0 -104
- package/dist/chunk-4IIGLBTD.mjs +0 -81
- package/dist/chunk-574UV65T.mjs +0 -111
- package/dist/chunk-7HC7D256.mjs +0 -91
- package/dist/chunk-AC22DSDA.mjs +0 -540
- package/dist/chunk-AGOMESFC.mjs +0 -1
- package/dist/chunk-BXPGSCTT.mjs +0 -39
- package/dist/chunk-C6M3CDOK.mjs +0 -254
- package/dist/chunk-EN3J5AMF.mjs +0 -12
- package/dist/chunk-HYDS6H67.mjs +0 -58
- package/dist/chunk-KRLE4MMD.mjs +0 -116
- package/dist/chunk-LKOQAQPZ.mjs +0 -13
- package/dist/chunk-LXZ53XU7.mjs +0 -1
- package/dist/chunk-T6P7CS4F.mjs +0 -42
- package/dist/chunk-TVFWG7IC.mjs +0 -43
- package/dist/chunk-VULWMVYS.mjs +0 -11
- package/dist/chunk-WKV76XOR.mjs +0 -8
- package/dist/extensions/table/index.d.mts +0 -8
- package/dist/extensions/table/index.d.ts +0 -8
- package/dist/extensions/table/index.js +0 -1044
- package/dist/extensions/table/index.mjs +0 -33
- package/dist/extensions/table/kit.d.mts +0 -30
- package/dist/extensions/table/kit.d.ts +0 -30
- package/dist/extensions/table/kit.js +0 -1034
- package/dist/extensions/table/kit.mjs +0 -20
- package/dist/extensions/table/table/icons.d.mts +0 -13
- package/dist/extensions/table/table/icons.d.ts +0 -13
- package/dist/extensions/table/table/icons.js +0 -81
- package/dist/extensions/table/table/icons.mjs +0 -8
- package/dist/extensions/table/table/index.d.mts +0 -3
- package/dist/extensions/table/table/index.d.ts +0 -3
- package/dist/extensions/table/table/index.js +0 -818
- package/dist/extensions/table/table/index.mjs +0 -16
- package/dist/extensions/table/table/table-controls.d.mts +0 -10
- package/dist/extensions/table/table/table-controls.d.ts +0 -10
- package/dist/extensions/table/table/table-controls.js +0 -129
- package/dist/extensions/table/table/table-controls.mjs +0 -8
- package/dist/extensions/table/table/table-view.d.mts +0 -43
- package/dist/extensions/table/table/table-view.d.ts +0 -43
- package/dist/extensions/table/table/table-view.js +0 -610
- package/dist/extensions/table/table/table-view.mjs +0 -12
- package/dist/extensions/table/table/table.d.mts +0 -17
- package/dist/extensions/table/table/table.d.ts +0 -17
- package/dist/extensions/table/table/table.js +0 -816
- package/dist/extensions/table/table/table.mjs +0 -15
- package/dist/extensions/table/table/utilities/col-style.d.mts +0 -3
- package/dist/extensions/table/table/utilities/col-style.d.ts +0 -3
- package/dist/extensions/table/table/utilities/col-style.js +0 -36
- package/dist/extensions/table/table/utilities/col-style.mjs +0 -8
- package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.d.mts +0 -5
- package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.d.ts +0 -5
- package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.js +0 -66
- package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.mjs +0 -40
- package/dist/extensions/table/table/utilities/get-table-node-types.d.mts +0 -7
- package/dist/extensions/table/table/utilities/get-table-node-types.d.ts +0 -7
- package/dist/extensions/table/table/utilities/get-table-node-types.js +0 -44
- package/dist/extensions/table/table/utilities/get-table-node-types.mjs +0 -21
- package/dist/extensions/table/table/utilities/insert-line-above-table-action.d.mts +0 -5
- package/dist/extensions/table/table/utilities/insert-line-above-table-action.d.ts +0 -5
- package/dist/extensions/table/table/utilities/insert-line-above-table-action.js +0 -80
- package/dist/extensions/table/table/utilities/insert-line-above-table-action.mjs +0 -9
- package/dist/extensions/table/table/utilities/insert-line-below-table-action.d.mts +0 -5
- package/dist/extensions/table/table/utilities/insert-line-below-table-action.d.ts +0 -5
- package/dist/extensions/table/table/utilities/insert-line-below-table-action.js +0 -79
- package/dist/extensions/table/table/utilities/insert-line-below-table-action.mjs +0 -9
- package/dist/extensions/table/table/utilities/is-cell-selection.d.mts +0 -5
- package/dist/extensions/table/table/utilities/is-cell-selection.d.ts +0 -5
- package/dist/extensions/table/table/utilities/is-cell-selection.js +0 -34
- package/dist/extensions/table/table/utilities/is-cell-selection.mjs +0 -8
- package/dist/extensions/table/table-cell.d.mts +0 -8
- package/dist/extensions/table/table-cell.d.ts +0 -8
- package/dist/extensions/table/table-cell.js +0 -139
- package/dist/extensions/table/table-cell.mjs +0 -8
- package/dist/extensions/table/table-header.d.mts +0 -6
- package/dist/extensions/table/table-header.d.ts +0 -6
- package/dist/extensions/table/table-header.js +0 -104
- package/dist/extensions/table/table-header.mjs +0 -8
- package/dist/extensions/table/table-row.d.mts +0 -6
- package/dist/extensions/table/table-row.d.ts +0 -6
- package/dist/extensions/table/table-row.js +0 -35
- package/dist/extensions/table/table-row.mjs +0 -8
package/dist/chunk-C6M3CDOK.mjs
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/utils/index.ts
|
|
4
|
-
import { NodeSelection } from "@tiptap/pm/state";
|
|
5
|
-
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
6
|
-
var isMarkInSchema = (markName, editor) => {
|
|
7
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
8
|
-
return editor.schema.spec.marks.get(markName) !== void 0;
|
|
9
|
-
};
|
|
10
|
-
var isNodeInSchema = (nodeName, editor) => {
|
|
11
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
12
|
-
return editor.schema.spec.nodes.get(nodeName) !== void 0;
|
|
13
|
-
};
|
|
14
|
-
function getActiveMarkAttrs(editor, markName) {
|
|
15
|
-
var _a;
|
|
16
|
-
if (!editor) return null;
|
|
17
|
-
const { state } = editor;
|
|
18
|
-
const marks = state.storedMarks || state.selection.$from.marks();
|
|
19
|
-
const mark = marks.find((mark2) => mark2.type.name === markName);
|
|
20
|
-
return (_a = mark == null ? void 0 : mark.attrs) != null ? _a : null;
|
|
21
|
-
}
|
|
22
|
-
function isEmptyNode(node) {
|
|
23
|
-
return !!node && node.content.size === 0;
|
|
24
|
-
}
|
|
25
|
-
function findNodePosition(props) {
|
|
26
|
-
var _a;
|
|
27
|
-
const { editor, node, nodePos } = props;
|
|
28
|
-
if (!editor || !((_a = editor.state) == null ? void 0 : _a.doc)) return null;
|
|
29
|
-
const hasValidNode = node !== void 0 && node !== null;
|
|
30
|
-
const hasValidPos = nodePos !== void 0 && nodePos !== null;
|
|
31
|
-
if (!hasValidNode && !hasValidPos) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
if (hasValidPos) {
|
|
35
|
-
try {
|
|
36
|
-
const nodeAtPos = editor.state.doc.nodeAt(nodePos);
|
|
37
|
-
if (nodeAtPos) {
|
|
38
|
-
return { pos: nodePos, node: nodeAtPos };
|
|
39
|
-
}
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error("Error checking node at position:", error);
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
let foundPos = -1;
|
|
46
|
-
let foundNode = null;
|
|
47
|
-
editor.state.doc.descendants((currentNode, pos) => {
|
|
48
|
-
if (currentNode === node) {
|
|
49
|
-
foundPos = pos;
|
|
50
|
-
foundNode = currentNode;
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
return true;
|
|
54
|
-
});
|
|
55
|
-
return foundPos !== -1 && foundNode !== null ? { pos: foundPos, node: foundNode } : null;
|
|
56
|
-
}
|
|
57
|
-
var handleImageUpload = async (file, onProgress, abortSignal) => {
|
|
58
|
-
if (!file) {
|
|
59
|
-
throw new Error("No file provided");
|
|
60
|
-
}
|
|
61
|
-
if (file.size > MAX_FILE_SIZE) {
|
|
62
|
-
throw new Error(
|
|
63
|
-
`File size exceeds maximum allowed (${MAX_FILE_SIZE / (1024 * 1024)}MB)`
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
for (let progress = 0; progress <= 100; progress += 10) {
|
|
67
|
-
if (abortSignal == null ? void 0 : abortSignal.aborted) {
|
|
68
|
-
throw new Error("Upload cancelled");
|
|
69
|
-
}
|
|
70
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
71
|
-
onProgress == null ? void 0 : onProgress({ progress });
|
|
72
|
-
}
|
|
73
|
-
return "/images/placeholder-image.png";
|
|
74
|
-
};
|
|
75
|
-
var convertFileToBase64 = (file, abortSignal) => {
|
|
76
|
-
if (!file) {
|
|
77
|
-
return Promise.reject(new Error("No file provided"));
|
|
78
|
-
}
|
|
79
|
-
return new Promise((resolve, reject) => {
|
|
80
|
-
const reader = new FileReader();
|
|
81
|
-
const abortHandler = () => {
|
|
82
|
-
reader.abort();
|
|
83
|
-
reject(new Error("Upload cancelled"));
|
|
84
|
-
};
|
|
85
|
-
if (abortSignal) {
|
|
86
|
-
abortSignal.addEventListener("abort", abortHandler);
|
|
87
|
-
}
|
|
88
|
-
reader.onloadend = () => {
|
|
89
|
-
if (abortSignal) {
|
|
90
|
-
abortSignal.removeEventListener("abort", abortHandler);
|
|
91
|
-
}
|
|
92
|
-
if (typeof reader.result === "string") {
|
|
93
|
-
resolve(reader.result);
|
|
94
|
-
} else {
|
|
95
|
-
reject(new Error("Failed to convert File to base64"));
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
reader.onerror = (error) => reject(new Error(`File reading error: ${error}`));
|
|
99
|
-
reader.readAsDataURL(file);
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
var ATTR_WHITESPACE = (
|
|
103
|
-
// eslint-disable-next-line no-control-regex
|
|
104
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: we can do this yay
|
|
105
|
-
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
106
|
-
);
|
|
107
|
-
function isAllowedUri(uri, protocols) {
|
|
108
|
-
const allowedProtocols = [
|
|
109
|
-
"http",
|
|
110
|
-
"https",
|
|
111
|
-
"ftp",
|
|
112
|
-
"ftps",
|
|
113
|
-
"mailto",
|
|
114
|
-
"tel",
|
|
115
|
-
"callto",
|
|
116
|
-
"sms",
|
|
117
|
-
"cid",
|
|
118
|
-
"xmpp"
|
|
119
|
-
];
|
|
120
|
-
if (protocols) {
|
|
121
|
-
for (const protocol of protocols) {
|
|
122
|
-
const nextProtocol = typeof protocol === "string" ? protocol : protocol.scheme;
|
|
123
|
-
if (nextProtocol) {
|
|
124
|
-
allowedProtocols.push(nextProtocol);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return !uri || uri.replace(ATTR_WHITESPACE, "").match(
|
|
129
|
-
new RegExp(
|
|
130
|
-
// eslint-disable-next-line no-useless-escape
|
|
131
|
-
`^(?:(?:${allowedProtocols.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
|
|
132
|
-
"i"
|
|
133
|
-
)
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
function sanitizeUrl(inputUrl, baseUrl, protocols) {
|
|
137
|
-
try {
|
|
138
|
-
const url = new URL(inputUrl, baseUrl);
|
|
139
|
-
if (isAllowedUri(url.href, protocols)) {
|
|
140
|
-
return url.href;
|
|
141
|
-
}
|
|
142
|
-
} catch {
|
|
143
|
-
}
|
|
144
|
-
return "#";
|
|
145
|
-
}
|
|
146
|
-
function isNodeTypeSelected(editor, types = []) {
|
|
147
|
-
if (!editor || !editor.state.selection) return false;
|
|
148
|
-
const { state } = editor;
|
|
149
|
-
const { selection } = state;
|
|
150
|
-
if (selection.empty) return false;
|
|
151
|
-
if (selection instanceof NodeSelection) {
|
|
152
|
-
const node = selection.node;
|
|
153
|
-
return node ? types.includes(node.type.name) : false;
|
|
154
|
-
}
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
function isExtensionAvailable(editor, extensionNames) {
|
|
158
|
-
if (!editor) return false;
|
|
159
|
-
const names = Array.isArray(extensionNames) ? extensionNames : [extensionNames];
|
|
160
|
-
const found = names.some(
|
|
161
|
-
(name) => editor.extensionManager.extensions.some((ext) => ext.name === name)
|
|
162
|
-
);
|
|
163
|
-
if (!found) {
|
|
164
|
-
console.warn(
|
|
165
|
-
`None of the extensions [${names.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
return found;
|
|
169
|
-
}
|
|
170
|
-
function getEditorExtension(editor, extensionName) {
|
|
171
|
-
if (!editor) return null;
|
|
172
|
-
const extension = editor.extensionManager.extensions.find(
|
|
173
|
-
(ext) => ext.name === extensionName
|
|
174
|
-
);
|
|
175
|
-
if (!extension) {
|
|
176
|
-
console.warn(
|
|
177
|
-
`Extension "${extensionName}" not found in the editor schema. Ensure it is included in the editor configuration.`
|
|
178
|
-
);
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
return extension;
|
|
182
|
-
}
|
|
183
|
-
function hasContentAbove(editor) {
|
|
184
|
-
if (!editor) return { hasContent: false, content: "" };
|
|
185
|
-
const { state } = editor;
|
|
186
|
-
const { $from } = state.selection;
|
|
187
|
-
for (let i = $from.index(0) - 1; i >= 0; i--) {
|
|
188
|
-
const node = state.doc.child(i);
|
|
189
|
-
const content = node.textContent.trim();
|
|
190
|
-
if (content) {
|
|
191
|
-
return { hasContent: true, content };
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return { hasContent: false, content: "" };
|
|
195
|
-
}
|
|
196
|
-
function findSelectionPosition(params) {
|
|
197
|
-
const { editor, node, nodePos } = params;
|
|
198
|
-
if (isValidPosition(nodePos)) return nodePos;
|
|
199
|
-
if (node) {
|
|
200
|
-
const found = findNodePosition({ editor, node });
|
|
201
|
-
if (found) return found.pos;
|
|
202
|
-
}
|
|
203
|
-
const { selection } = editor.state;
|
|
204
|
-
if (!selection.empty) return null;
|
|
205
|
-
const resolvedPos = selection.$anchor;
|
|
206
|
-
const nodeDepth = 1;
|
|
207
|
-
const selectedNode = resolvedPos.node(nodeDepth);
|
|
208
|
-
return selectedNode ? resolvedPos.before(nodeDepth) : null;
|
|
209
|
-
}
|
|
210
|
-
function isValidPosition(pos) {
|
|
211
|
-
return typeof pos === "number" && pos >= 0;
|
|
212
|
-
}
|
|
213
|
-
function getElementOverflowPosition(targetElement, containerElement) {
|
|
214
|
-
const targetBounds = targetElement.getBoundingClientRect();
|
|
215
|
-
const containerBounds = containerElement.getBoundingClientRect();
|
|
216
|
-
const isOverflowingTop = targetBounds.top < containerBounds.top;
|
|
217
|
-
const isOverflowingBottom = targetBounds.bottom > containerBounds.bottom;
|
|
218
|
-
if (isOverflowingTop && isOverflowingBottom) return "both";
|
|
219
|
-
if (isOverflowingTop) return "top";
|
|
220
|
-
if (isOverflowingBottom) return "bottom";
|
|
221
|
-
return "none";
|
|
222
|
-
}
|
|
223
|
-
function findParentNodeOfType(selection, typeName) {
|
|
224
|
-
let depth = selection.$anchor.depth;
|
|
225
|
-
while (depth > 0) {
|
|
226
|
-
const node = selection.$anchor.node(depth);
|
|
227
|
-
if (node.type.name === typeName) {
|
|
228
|
-
return { node, pos: selection.$anchor.start(depth) - 1 };
|
|
229
|
-
}
|
|
230
|
-
depth--;
|
|
231
|
-
}
|
|
232
|
-
return null;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export {
|
|
236
|
-
MAX_FILE_SIZE,
|
|
237
|
-
isMarkInSchema,
|
|
238
|
-
isNodeInSchema,
|
|
239
|
-
getActiveMarkAttrs,
|
|
240
|
-
isEmptyNode,
|
|
241
|
-
findNodePosition,
|
|
242
|
-
handleImageUpload,
|
|
243
|
-
convertFileToBase64,
|
|
244
|
-
isAllowedUri,
|
|
245
|
-
sanitizeUrl,
|
|
246
|
-
isNodeTypeSelected,
|
|
247
|
-
isExtensionAvailable,
|
|
248
|
-
getEditorExtension,
|
|
249
|
-
hasContentAbove,
|
|
250
|
-
findSelectionPosition,
|
|
251
|
-
isValidPosition,
|
|
252
|
-
getElementOverflowPosition,
|
|
253
|
-
findParentNodeOfType
|
|
254
|
-
};
|
package/dist/chunk-EN3J5AMF.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/extensions/table/table-row.ts
|
|
4
|
-
import { TableRow as TiptapTableRow } from "@tiptap/extension-table";
|
|
5
|
-
var TableRow = TiptapTableRow.extend({
|
|
6
|
-
allowGapCursor: false,
|
|
7
|
-
content: "(tableCell | tableHeader)*"
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
TableRow
|
|
12
|
-
};
|
package/dist/chunk-HYDS6H67.mjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/extensions/table/table/icons.ts
|
|
4
|
-
var icons = {
|
|
5
|
-
colorPicker: `<svg xmlns="http://www.w3.org/2000/svg" length="24" viewBox="0 0 24 24" style="transform: ;msFilter:;"><path fill="rgb(var(--color-text-300))" d="M20 14c-.092.064-2 2.083-2 3.5 0 1.494.949 2.448 2 2.5.906.044 2-.891 2-2.5 0-1.5-1.908-3.436-2-3.5zM9.586 20c.378.378.88.586 1.414.586s1.036-.208 1.414-.586l7-7-.707-.707L11 4.586 8.707 2.293 7.293 3.707 9.586 6 4 11.586c-.378.378-.586.88-.586 1.414s.208 1.036.586 1.414L9.586 20zM11 7.414 16.586 13H5.414L11 7.414z"></path></svg>`,
|
|
6
|
-
deleteColumn: `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash-2"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/></svg>`,
|
|
7
|
-
deleteRow: `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash-2"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/></svg>`,
|
|
8
|
-
insertLeftTableIcon: `<svg
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
length={12}
|
|
11
|
-
viewBox="0 -960 960 960"
|
|
12
|
-
>
|
|
13
|
-
<path
|
|
14
|
-
d="M224.617-140.001q-30.307 0-51.307-21-21-21-21-51.308v-535.382q0-30.308 21-51.308t51.307-21H360q30.307 0 51.307 21 21 21 21 51.308v535.382q0 30.308-21 51.308t-51.307 21H224.617Zm375.383 0q-30.307 0-51.307-21-21-21-21-51.308v-535.382q0-30.308 21-51.308t51.307-21h135.383q30.307 0 51.307 21 21 21 21 51.308v535.382q0 30.308-21 51.308t-51.307 21H600Zm147.691-607.69q0-4.616-3.846-8.463-3.846-3.846-8.462-3.846H600q-4.616 0-8.462 3.846-3.847 3.847-3.847 8.463v535.382q0 4.616 3.847 8.463Q595.384-200 600-200h135.383q4.616 0 8.462-3.846 3.846-3.847 3.846-8.463v-535.382ZM587.691-200h160-160Z"
|
|
15
|
-
fill="rgb(var(--color-text-300))"
|
|
16
|
-
/>
|
|
17
|
-
</svg>
|
|
18
|
-
`,
|
|
19
|
-
insertRightTableIcon: `<svg
|
|
20
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
-
length={12}
|
|
22
|
-
viewBox="0 -960 960 960"
|
|
23
|
-
>
|
|
24
|
-
<path
|
|
25
|
-
d="M600-140.001q-30.307 0-51.307-21-21-21-21-51.308v-535.382q0-30.308 21-51.308t51.307-21h135.383q30.307 0 51.307 21 21 21 21 51.308v535.382q0 30.308-21 51.308t-51.307 21H600Zm-375.383 0q-30.307 0-51.307-21-21-21-21-51.308v-535.382q0-30.308 21-51.308t51.307-21H360q30.307 0 51.307 21 21 21 21 51.308v535.382q0 30.308-21 51.308t-51.307 21H224.617Zm-12.308-607.69v535.382q0 4.616 3.846 8.463 3.846 3.846 8.462 3.846H360q4.616 0 8.462-3.846 3.847-3.847 3.847-8.463v-535.382q0-4.616-3.847-8.463Q364.616-760 360-760H224.617q-4.616 0-8.462 3.846-3.846 3.847-3.846 8.463Zm160 547.691h-160 160Z"
|
|
26
|
-
fill="rgb(var(--color-text-300))"
|
|
27
|
-
/>
|
|
28
|
-
</svg>
|
|
29
|
-
`,
|
|
30
|
-
insertTopTableIcon: `<svg
|
|
31
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
32
|
-
length={24}
|
|
33
|
-
viewBox="0 -960 960 960"
|
|
34
|
-
>
|
|
35
|
-
<path
|
|
36
|
-
d="M212.309-527.693q-30.308 0-51.308-21t-21-51.307v-135.383q0-30.307 21-51.307 21-21 51.308-21h535.382q30.308 0 51.308 21t21 51.307V-600q0 30.307-21 51.307-21 21-51.308 21H212.309Zm0 375.383q-30.308 0-51.308-21t-21-51.307V-360q0-30.307 21-51.307 21-21 51.308-21h535.382q30.308 0 51.308 21t21 51.307v135.383q0 30.307-21 51.307-21 21-51.308 21H212.309Zm0-59.999h535.382q4.616 0 8.463-3.846 3.846-3.846 3.846-8.462V-360q0-4.616-3.846-8.462-3.847-3.847-8.463-3.847H212.309q-4.616 0-8.463 3.847Q200-364.616 200-360v135.383q0 4.616 3.846 8.462 3.847 3.846 8.463 3.846Zm-12.309-160v160-160Z"
|
|
37
|
-
fill="rgb(var(--color-text-300))"
|
|
38
|
-
/>
|
|
39
|
-
</svg>
|
|
40
|
-
`,
|
|
41
|
-
toggleColumnHeader: `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-toggle-right"><rect width="20" height="12" x="2" y="6" rx="6" ry="6"/><circle cx="16" cy="12" r="2"/></svg>`,
|
|
42
|
-
toggleRowHeader: `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-toggle-right"><rect width="20" height="12" x="2" y="6" rx="6" ry="6"/><circle cx="16" cy="12" r="2"/></svg>`,
|
|
43
|
-
insertBottomTableIcon: `<svg
|
|
44
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
45
|
-
length={24}
|
|
46
|
-
viewBox="0 -960 960 960"
|
|
47
|
-
>
|
|
48
|
-
<path
|
|
49
|
-
d="M212.309-152.31q-30.308 0-51.308-21t-21-51.307V-360q0-30.307 21-51.307 21-21 51.308-21h535.382q30.308 0 51.308 21t21 51.307v135.383q0 30.307-21 51.307-21 21-51.308 21H212.309Zm0-375.383q-30.308 0-51.308-21t-21-51.307v-135.383q0-30.307 21-51.307 21-21 51.308-21h535.382q30.308 0 51.308 21t21 51.307V-600q0 30.307-21 51.307-21 21-51.308 21H212.309Zm535.382-219.998H212.309q-4.616 0-8.463 3.846-3.846 3.846-3.846 8.462V-600q0 4.616 3.846 8.462 3.847 3.847 8.463 3.847h535.382q4.616 0 8.463-3.847Q760-595.384 760-600v-135.383q0-4.616-3.846-8.462-3.847-3.846-8.463-3.846ZM200-587.691v-160 160Z"
|
|
50
|
-
fill="rgb(var(--color-text-300))"
|
|
51
|
-
/>
|
|
52
|
-
</svg>
|
|
53
|
-
`
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export {
|
|
57
|
-
icons
|
|
58
|
-
};
|
package/dist/chunk-KRLE4MMD.mjs
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/extensions/table/table-cell.ts
|
|
4
|
-
import { mergeAttributes, Node } from "@tiptap/core";
|
|
5
|
-
var TableCell = Node.create({
|
|
6
|
-
name: "tableCell",
|
|
7
|
-
content: "block+",
|
|
8
|
-
// DONT allow table in table.
|
|
9
|
-
tableRole: "cell",
|
|
10
|
-
isolating: true,
|
|
11
|
-
addOptions() {
|
|
12
|
-
return {
|
|
13
|
-
HTMLAttributes: {}
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
parseHTML() {
|
|
17
|
-
return [{ tag: "td" }];
|
|
18
|
-
},
|
|
19
|
-
renderHTML({ node, HTMLAttributes }) {
|
|
20
|
-
return [
|
|
21
|
-
"td",
|
|
22
|
-
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
|
|
23
|
-
style: `background-color: ${node.attrs.background}; color: ${node.attrs.textColor}`
|
|
24
|
-
}),
|
|
25
|
-
0
|
|
26
|
-
];
|
|
27
|
-
},
|
|
28
|
-
addAttributes() {
|
|
29
|
-
return {
|
|
30
|
-
colspan: {
|
|
31
|
-
default: 1,
|
|
32
|
-
parseHTML: (element) => {
|
|
33
|
-
const colspan = element.getAttribute("colspan");
|
|
34
|
-
const value = colspan ? Number.parseInt(colspan, 10) : 1;
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
rowspan: {
|
|
39
|
-
default: 1,
|
|
40
|
-
parseHTML: (element) => {
|
|
41
|
-
const rowspan = element.getAttribute("rowspan");
|
|
42
|
-
const value = rowspan ? Number.parseInt(rowspan, 10) : 1;
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
colwidth: {
|
|
47
|
-
default: null,
|
|
48
|
-
parseHTML: (element) => {
|
|
49
|
-
const colwidth = element.getAttribute("colwidth");
|
|
50
|
-
const value = colwidth ? [Number.parseInt(colwidth, 10)] : null;
|
|
51
|
-
return value;
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
background: {
|
|
55
|
-
default: null
|
|
56
|
-
},
|
|
57
|
-
textColor: {
|
|
58
|
-
default: null
|
|
59
|
-
},
|
|
60
|
-
style: {
|
|
61
|
-
default: null
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
// addProseMirrorPlugins() {
|
|
66
|
-
// return [
|
|
67
|
-
// new Plugin({
|
|
68
|
-
// props: {
|
|
69
|
-
// decorations: (state) => {
|
|
70
|
-
// const { isEditable } = this.editor;
|
|
71
|
-
// if (!isEditable) {
|
|
72
|
-
// return DecorationSet.empty;
|
|
73
|
-
// }
|
|
74
|
-
// const { doc, selection } = state;
|
|
75
|
-
// const decorations: Decoration[] = [];
|
|
76
|
-
// const cells = getCellsInColumn(0)(selection);
|
|
77
|
-
// if (cells) {
|
|
78
|
-
// cells.forEach(({ pos }: { pos: number }, index: number) => {
|
|
79
|
-
// decorations.push(
|
|
80
|
-
// Decoration.widget(pos + 1, () => {
|
|
81
|
-
// const rowSelected = isRowSelected(index)(selection);
|
|
82
|
-
// let className = "grip-row";
|
|
83
|
-
// if (rowSelected) {
|
|
84
|
-
// className += " selected";
|
|
85
|
-
// }
|
|
86
|
-
// if (index === 0) {
|
|
87
|
-
// className += " first";
|
|
88
|
-
// }
|
|
89
|
-
// if (index === cells.length - 1) {
|
|
90
|
-
// className += " last";
|
|
91
|
-
// }
|
|
92
|
-
// const grip = document.createElement("a");
|
|
93
|
-
// grip.className = className;
|
|
94
|
-
// grip.addEventListener("mousedown", (event) => {
|
|
95
|
-
// event.preventDefault();
|
|
96
|
-
// event.stopImmediatePropagation();
|
|
97
|
-
// this.editor.view.dispatch(
|
|
98
|
-
// selectRow(index)(this.editor.state.tr),
|
|
99
|
-
// );
|
|
100
|
-
// });
|
|
101
|
-
// return grip;
|
|
102
|
-
// }),
|
|
103
|
-
// );
|
|
104
|
-
// });
|
|
105
|
-
// }
|
|
106
|
-
// return DecorationSet.create(doc, decorations);
|
|
107
|
-
// },
|
|
108
|
-
// },
|
|
109
|
-
// }),
|
|
110
|
-
// ];
|
|
111
|
-
// },
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
export {
|
|
115
|
-
TableCell
|
|
116
|
-
};
|
package/dist/chunk-LKOQAQPZ.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/extensions/table/table/utilities/col-style.ts
|
|
4
|
-
function getColStyleDeclaration(minWidth, width) {
|
|
5
|
-
if (width) {
|
|
6
|
-
return ["width", `${Math.max(width, minWidth)}px`];
|
|
7
|
-
}
|
|
8
|
-
return ["min-width", `${minWidth}px`];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
getColStyleDeclaration
|
|
13
|
-
};
|
package/dist/chunk-LXZ53XU7.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";
|
package/dist/chunk-T6P7CS4F.mjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
findParentNodeOfType
|
|
4
|
-
} from "./chunk-C6M3CDOK.mjs";
|
|
5
|
-
|
|
6
|
-
// src/extensions/table/table/utilities/insert-line-below-table-action.ts
|
|
7
|
-
var insertLineBelowTableAction = ({
|
|
8
|
-
editor
|
|
9
|
-
}) => {
|
|
10
|
-
if (!editor.isActive("table")) return false;
|
|
11
|
-
try {
|
|
12
|
-
const { selection } = editor.state;
|
|
13
|
-
const tableNode = findParentNodeOfType(selection, "table");
|
|
14
|
-
if (!tableNode) return false;
|
|
15
|
-
const tablePos = tableNode.pos;
|
|
16
|
-
const table = tableNode.node;
|
|
17
|
-
const rowCount = table.childCount;
|
|
18
|
-
const lastRow = table.child(rowCount - 1);
|
|
19
|
-
const selectionPath = selection.$anchor.path;
|
|
20
|
-
const selectionInLastRow = selectionPath.includes(lastRow);
|
|
21
|
-
if (!selectionInLastRow) return false;
|
|
22
|
-
const nextNodePos = tablePos + table.nodeSize;
|
|
23
|
-
const nextNode = editor.state.doc.nodeAt(nextNodePos);
|
|
24
|
-
if (nextNode && nextNode.type.name === "paragraph") {
|
|
25
|
-
const endOfParagraphPos = nextNodePos + nextNode.nodeSize - 1;
|
|
26
|
-
editor.chain().setTextSelection(endOfParagraphPos).run();
|
|
27
|
-
} else if (!nextNode) {
|
|
28
|
-
editor.chain().insertContentAt(nextNodePos, { type: "paragraph" }).run();
|
|
29
|
-
editor.chain().setTextSelection(nextNodePos + 1).run();
|
|
30
|
-
} else {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
return true;
|
|
34
|
-
} catch (e) {
|
|
35
|
-
console.error("failed to insert line above table", e);
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export {
|
|
41
|
-
insertLineBelowTableAction
|
|
42
|
-
};
|
package/dist/chunk-TVFWG7IC.mjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
findParentNodeOfType
|
|
4
|
-
} from "./chunk-C6M3CDOK.mjs";
|
|
5
|
-
|
|
6
|
-
// src/extensions/table/table/utilities/insert-line-above-table-action.ts
|
|
7
|
-
var insertLineAboveTableAction = ({
|
|
8
|
-
editor
|
|
9
|
-
}) => {
|
|
10
|
-
if (!editor.isActive("table")) return false;
|
|
11
|
-
try {
|
|
12
|
-
const { selection } = editor.state;
|
|
13
|
-
const tableNode = findParentNodeOfType(selection, "table");
|
|
14
|
-
if (!tableNode) return false;
|
|
15
|
-
const tablePos = tableNode.pos;
|
|
16
|
-
const firstRow = tableNode.node.child(0);
|
|
17
|
-
const selectionPath = selection.$anchor.path;
|
|
18
|
-
const selectionInFirstRow = selectionPath.includes(firstRow);
|
|
19
|
-
if (!selectionInFirstRow) return false;
|
|
20
|
-
if (tablePos === 0) {
|
|
21
|
-
editor.chain().insertContentAt(tablePos, { type: "paragraph" }).run();
|
|
22
|
-
editor.chain().setTextSelection(tablePos + 1).run();
|
|
23
|
-
} else {
|
|
24
|
-
const prevNodePos = tablePos - 1;
|
|
25
|
-
if (prevNodePos <= 0) return false;
|
|
26
|
-
const prevNode = editor.state.doc.nodeAt(prevNodePos - 1);
|
|
27
|
-
if (prevNode && prevNode.type.name === "paragraph") {
|
|
28
|
-
const endOfParagraphPos = tablePos - prevNode.nodeSize;
|
|
29
|
-
editor.chain().setTextSelection(endOfParagraphPos).run();
|
|
30
|
-
} else {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
} catch (e) {
|
|
36
|
-
console.error("failed to insert line above table", e);
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
insertLineAboveTableAction
|
|
43
|
-
};
|
package/dist/chunk-VULWMVYS.mjs
DELETED
package/dist/chunk-WKV76XOR.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
__publicField
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { TableKit, TableKitOptions } from './kit.mjs';
|
|
2
|
-
export { Table } from './table/table.mjs';
|
|
3
|
-
export { TableCell, TableCellOptions } from './table-cell.mjs';
|
|
4
|
-
export { TableHeader } from './table-header.mjs';
|
|
5
|
-
export { TableRow } from './table-row.mjs';
|
|
6
|
-
import '@tiptap/extension-table';
|
|
7
|
-
import '@tiptap/react';
|
|
8
|
-
import '@tiptap/core';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { TableKit, TableKitOptions } from './kit.js';
|
|
2
|
-
export { Table } from './table/table.js';
|
|
3
|
-
export { TableCell, TableCellOptions } from './table-cell.js';
|
|
4
|
-
export { TableHeader } from './table-header.js';
|
|
5
|
-
export { TableRow } from './table-row.js';
|
|
6
|
-
import '@tiptap/extension-table';
|
|
7
|
-
import '@tiptap/react';
|
|
8
|
-
import '@tiptap/core';
|