@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
|
@@ -35,6 +35,7 @@ __export(use_scroll_to_hash_exports, {
|
|
|
35
35
|
useScrollToHash: () => useScrollToHash
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(use_scroll_to_hash_exports);
|
|
38
|
+
var import_editor_utils = require("@kopexa/editor-utils");
|
|
38
39
|
var React2 = __toESM(require("react"));
|
|
39
40
|
|
|
40
41
|
// src/hooks/use-floating-toolbar-visibility.ts
|
|
@@ -79,23 +80,6 @@ function useTiptapEditor(providedEditor) {
|
|
|
79
80
|
return editorState || { editor: null };
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
// src/utils/index.ts
|
|
83
|
-
var import_state2 = require("@tiptap/pm/state");
|
|
84
|
-
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
85
|
-
function getEditorExtension(editor, extensionName) {
|
|
86
|
-
if (!editor) return null;
|
|
87
|
-
const extension = editor.extensionManager.extensions.find(
|
|
88
|
-
(ext) => ext.name === extensionName
|
|
89
|
-
);
|
|
90
|
-
if (!extension) {
|
|
91
|
-
console.warn(
|
|
92
|
-
`Extension "${extensionName}" not found in the editor schema. Ensure it is included in the editor configuration.`
|
|
93
|
-
);
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
return extension;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
83
|
// src/ui/copy-anchor-link-button/use-scroll-to-hash.ts
|
|
100
84
|
function useScrollToHash(config = {}) {
|
|
101
85
|
const {
|
|
@@ -110,7 +94,7 @@ function useScrollToHash(config = {}) {
|
|
|
110
94
|
(id) => {
|
|
111
95
|
var _a, _b, _c;
|
|
112
96
|
if (!editor) return false;
|
|
113
|
-
const attributeName = (_c = (_b = (_a = getEditorExtension(editor, "uniqueID")) == null ? void 0 : _a.options) == null ? void 0 : _b.attributeName) != null ? _c : "data-id";
|
|
97
|
+
const attributeName = (_c = (_b = (_a = (0, import_editor_utils.getEditorExtension)(editor, "uniqueID")) == null ? void 0 : _a.options) == null ? void 0 : _b.attributeName) != null ? _c : "data-id";
|
|
114
98
|
let position = null;
|
|
115
99
|
editor.state.doc.descendants((node, pos) => {
|
|
116
100
|
var _a2;
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import {
|
|
4
4
|
useScrollToHash
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-C6M3CDOK.mjs";
|
|
5
|
+
} from "../../chunk-JNL4KY45.mjs";
|
|
7
6
|
import "../../chunk-TDFS3DCZ.mjs";
|
|
8
7
|
import "../../chunk-P55PLOHR.mjs";
|
|
9
|
-
import "../../chunk-WKV76XOR.mjs";
|
|
10
8
|
export {
|
|
11
9
|
useScrollToHash
|
|
12
10
|
};
|
|
@@ -38,6 +38,7 @@ __export(heading_button_exports, {
|
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(heading_button_exports);
|
|
40
40
|
var import_button = require("@kopexa/button");
|
|
41
|
+
var import_editor_utils = require("@kopexa/editor-utils");
|
|
41
42
|
var import_icons = require("@kopexa/icons");
|
|
42
43
|
var React = __toESM(require("react"));
|
|
43
44
|
|
|
@@ -70,14 +71,6 @@ function useTiptapEditor(providedEditor) {
|
|
|
70
71
|
return editorState || { editor: null };
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
// src/utils/index.ts
|
|
74
|
-
var import_state = require("@tiptap/pm/state");
|
|
75
|
-
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
76
|
-
var isNodeInSchema = (nodeName, editor) => {
|
|
77
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
78
|
-
return editor.schema.spec.nodes.get(nodeName) !== void 0;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
74
|
// src/ui/heading-button/utils.ts
|
|
82
75
|
var import_react3 = require("@tiptap/react");
|
|
83
76
|
var headingShortcutKeys = {
|
|
@@ -141,7 +134,7 @@ var headingIcons = {
|
|
|
141
134
|
6: import_icons.HeadingSixIcon
|
|
142
135
|
};
|
|
143
136
|
function useHeadingState(editor, level, disabled = false) {
|
|
144
|
-
const headingInSchema = isNodeInSchema("heading", editor);
|
|
137
|
+
const headingInSchema = (0, import_editor_utils.isNodeInSchema)("heading", editor);
|
|
145
138
|
const isDisabled = isHeadingButtonDisabled(editor, level, disabled);
|
|
146
139
|
const isActive = isHeadingActive(editor, level);
|
|
147
140
|
const Icon = headingIcons[level];
|
|
@@ -3,13 +3,11 @@ import {
|
|
|
3
3
|
HeadingButton,
|
|
4
4
|
headingIcons,
|
|
5
5
|
useHeadingState
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-EHY2NAW7.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getFormattedHeadingName
|
|
9
9
|
} from "../../chunk-33QD5PYJ.mjs";
|
|
10
|
-
import "../../chunk-C6M3CDOK.mjs";
|
|
11
10
|
import "../../chunk-P55PLOHR.mjs";
|
|
12
|
-
import "../../chunk-WKV76XOR.mjs";
|
|
13
11
|
export {
|
|
14
12
|
HeadingButton,
|
|
15
13
|
getFormattedHeadingName,
|
|
@@ -36,6 +36,7 @@ __export(heading_dropdown_menu_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(heading_dropdown_menu_exports);
|
|
37
37
|
var import_button2 = require("@kopexa/button");
|
|
38
38
|
var import_dropdown_menu = require("@kopexa/dropdown-menu");
|
|
39
|
+
var import_editor_utils2 = require("@kopexa/editor-utils");
|
|
39
40
|
var import_icons2 = require("@kopexa/icons");
|
|
40
41
|
var import_react4 = require("@tiptap/react");
|
|
41
42
|
var React2 = __toESM(require("react"));
|
|
@@ -69,16 +70,9 @@ function useTiptapEditor(providedEditor) {
|
|
|
69
70
|
return editorState || { editor: null };
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
// src/utils/index.ts
|
|
73
|
-
var import_state = require("@tiptap/pm/state");
|
|
74
|
-
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
75
|
-
var isNodeInSchema = (nodeName, editor) => {
|
|
76
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
77
|
-
return editor.schema.spec.nodes.get(nodeName) !== void 0;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
73
|
// src/ui/heading-button/index.tsx
|
|
81
74
|
var import_button = require("@kopexa/button");
|
|
75
|
+
var import_editor_utils = require("@kopexa/editor-utils");
|
|
82
76
|
var import_icons = require("@kopexa/icons");
|
|
83
77
|
var React = __toESM(require("react"));
|
|
84
78
|
|
|
@@ -145,7 +139,7 @@ var headingIcons = {
|
|
|
145
139
|
6: import_icons.HeadingSixIcon
|
|
146
140
|
};
|
|
147
141
|
function useHeadingState(editor, level, disabled = false) {
|
|
148
|
-
const headingInSchema = isNodeInSchema("heading", editor);
|
|
142
|
+
const headingInSchema = (0, import_editor_utils.isNodeInSchema)("heading", editor);
|
|
149
143
|
const isDisabled = isHeadingButtonDisabled(editor, level, disabled);
|
|
150
144
|
const isActive = isHeadingActive(editor, level);
|
|
151
145
|
const Icon = headingIcons[level];
|
|
@@ -237,7 +231,7 @@ function HeadingDropdownMenu({
|
|
|
237
231
|
var _a;
|
|
238
232
|
const [isOpen, setIsOpen] = React2.useState(false);
|
|
239
233
|
const { editor } = useTiptapEditor(providedEditor);
|
|
240
|
-
const headingInSchema = isNodeInSchema("heading", editor);
|
|
234
|
+
const headingInSchema = (0, import_editor_utils2.isNodeInSchema)("heading", editor);
|
|
241
235
|
const handleOnOpenChange = React2.useCallback(
|
|
242
236
|
(open) => {
|
|
243
237
|
setIsOpen(open);
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
HeadingDropdownMenu
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-V6TAZMQN.mjs";
|
|
5
|
+
import "../../chunk-EHY2NAW7.mjs";
|
|
6
6
|
import "../../chunk-33QD5PYJ.mjs";
|
|
7
|
-
import "../../chunk-C6M3CDOK.mjs";
|
|
8
7
|
import "../../chunk-P55PLOHR.mjs";
|
|
9
|
-
import "../../chunk-WKV76XOR.mjs";
|
|
10
8
|
export {
|
|
11
9
|
HeadingDropdownMenu
|
|
12
10
|
};
|
|
@@ -83,16 +83,12 @@ function useTiptapEditor(providedEditor) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// src/ui/link-popover/use-link-popover.ts
|
|
86
|
+
var import_editor_utils = require("@kopexa/editor-utils");
|
|
86
87
|
var import_icons = require("@kopexa/icons");
|
|
87
88
|
var React = __toESM(require("react"));
|
|
88
89
|
|
|
89
90
|
// src/utils/index.ts
|
|
90
|
-
var import_state = require("@tiptap/pm/state");
|
|
91
91
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
92
|
-
var isMarkInSchema = (markName, editor) => {
|
|
93
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
94
|
-
return editor.schema.spec.marks.get(markName) !== void 0;
|
|
95
|
-
};
|
|
96
92
|
var ATTR_WHITESPACE = (
|
|
97
93
|
// eslint-disable-next-line no-control-regex
|
|
98
94
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: we can do this yay
|
|
@@ -149,7 +145,7 @@ function isLinkActive(editor) {
|
|
|
149
145
|
}
|
|
150
146
|
function shouldShowLinkButton(props) {
|
|
151
147
|
const { editor, hideWhenUnavailable } = props;
|
|
152
|
-
const linkInSchema = isMarkInSchema("link", editor);
|
|
148
|
+
const linkInSchema = (0, import_editor_utils.isMarkInSchema)("link", editor);
|
|
153
149
|
if (!linkInSchema || !editor) {
|
|
154
150
|
return false;
|
|
155
151
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
LinkContent,
|
|
6
6
|
LinkMain,
|
|
7
7
|
LinkPopover
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-WHJ4B43N.mjs";
|
|
9
9
|
import {
|
|
10
10
|
canSetLink,
|
|
11
11
|
isLinkActive,
|
|
@@ -13,10 +13,9 @@ import {
|
|
|
13
13
|
useLinkHandler,
|
|
14
14
|
useLinkPopover,
|
|
15
15
|
useLinkState
|
|
16
|
-
} from "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
16
|
+
} from "../../chunk-LHXRE26G.mjs";
|
|
17
|
+
import "../../chunk-TZQQ6C2Q.mjs";
|
|
18
18
|
import "../../chunk-P55PLOHR.mjs";
|
|
19
|
-
import "../../chunk-WKV76XOR.mjs";
|
|
20
19
|
export {
|
|
21
20
|
LinkButton,
|
|
22
21
|
LinkContent,
|
|
@@ -75,16 +75,12 @@ function useTiptapEditor(providedEditor) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
// src/ui/link-popover/use-link-popover.ts
|
|
78
|
+
var import_editor_utils = require("@kopexa/editor-utils");
|
|
78
79
|
var import_icons = require("@kopexa/icons");
|
|
79
80
|
var React = __toESM(require("react"));
|
|
80
81
|
|
|
81
82
|
// src/utils/index.ts
|
|
82
|
-
var import_state = require("@tiptap/pm/state");
|
|
83
83
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
84
|
-
var isMarkInSchema = (markName, editor) => {
|
|
85
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
86
|
-
return editor.schema.spec.marks.get(markName) !== void 0;
|
|
87
|
-
};
|
|
88
84
|
var ATTR_WHITESPACE = (
|
|
89
85
|
// eslint-disable-next-line no-control-regex
|
|
90
86
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: we can do this yay
|
|
@@ -141,7 +137,7 @@ function isLinkActive(editor) {
|
|
|
141
137
|
}
|
|
142
138
|
function shouldShowLinkButton(props) {
|
|
143
139
|
const { editor, hideWhenUnavailable } = props;
|
|
144
|
-
const linkInSchema = isMarkInSchema("link", editor);
|
|
140
|
+
const linkInSchema = (0, import_editor_utils.isMarkInSchema)("link", editor);
|
|
145
141
|
if (!linkInSchema || !editor) {
|
|
146
142
|
return false;
|
|
147
143
|
}
|
|
@@ -4,11 +4,10 @@ import {
|
|
|
4
4
|
LinkContent,
|
|
5
5
|
LinkMain,
|
|
6
6
|
LinkPopover
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
7
|
+
} from "../../chunk-WHJ4B43N.mjs";
|
|
8
|
+
import "../../chunk-LHXRE26G.mjs";
|
|
9
|
+
import "../../chunk-TZQQ6C2Q.mjs";
|
|
10
10
|
import "../../chunk-P55PLOHR.mjs";
|
|
11
|
-
import "../../chunk-WKV76XOR.mjs";
|
|
12
11
|
export {
|
|
13
12
|
LinkButton,
|
|
14
13
|
LinkContent,
|
|
@@ -40,6 +40,7 @@ __export(use_link_popover_exports, {
|
|
|
40
40
|
useLinkState: () => useLinkState
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(use_link_popover_exports);
|
|
43
|
+
var import_editor_utils = require("@kopexa/editor-utils");
|
|
43
44
|
var import_icons = require("@kopexa/icons");
|
|
44
45
|
var React = __toESM(require("react"));
|
|
45
46
|
|
|
@@ -73,12 +74,7 @@ function useTiptapEditor(providedEditor) {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
// src/utils/index.ts
|
|
76
|
-
var import_state = require("@tiptap/pm/state");
|
|
77
77
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
78
|
-
var isMarkInSchema = (markName, editor) => {
|
|
79
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
80
|
-
return editor.schema.spec.marks.get(markName) !== void 0;
|
|
81
|
-
};
|
|
82
78
|
var ATTR_WHITESPACE = (
|
|
83
79
|
// eslint-disable-next-line no-control-regex
|
|
84
80
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: we can do this yay
|
|
@@ -135,7 +131,7 @@ function isLinkActive(editor) {
|
|
|
135
131
|
}
|
|
136
132
|
function shouldShowLinkButton(props) {
|
|
137
133
|
const { editor, hideWhenUnavailable } = props;
|
|
138
|
-
const linkInSchema = isMarkInSchema("link", editor);
|
|
134
|
+
const linkInSchema = (0, import_editor_utils.isMarkInSchema)("link", editor);
|
|
139
135
|
if (!linkInSchema || !editor) {
|
|
140
136
|
return false;
|
|
141
137
|
}
|
|
@@ -7,10 +7,9 @@ import {
|
|
|
7
7
|
useLinkHandler,
|
|
8
8
|
useLinkPopover,
|
|
9
9
|
useLinkState
|
|
10
|
-
} from "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
10
|
+
} from "../../chunk-LHXRE26G.mjs";
|
|
11
|
+
import "../../chunk-TZQQ6C2Q.mjs";
|
|
12
12
|
import "../../chunk-P55PLOHR.mjs";
|
|
13
|
-
import "../../chunk-WKV76XOR.mjs";
|
|
14
13
|
export {
|
|
15
14
|
canSetLink,
|
|
16
15
|
isLinkActive,
|
|
@@ -33,6 +33,7 @@ __export(list_button_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(list_button_exports);
|
|
35
35
|
var import_button = require("@kopexa/button");
|
|
36
|
+
var import_editor_utils = require("@kopexa/editor-utils");
|
|
36
37
|
var import_icons = require("@kopexa/icons");
|
|
37
38
|
var import_react3 = require("@tiptap/react");
|
|
38
39
|
var import_react4 = require("react");
|
|
@@ -66,14 +67,6 @@ function useTiptapEditor(providedEditor) {
|
|
|
66
67
|
return editorState || { editor: null };
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
// src/utils/index.ts
|
|
70
|
-
var import_state = require("@tiptap/pm/state");
|
|
71
|
-
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
72
|
-
var isNodeInSchema = (nodeName, editor) => {
|
|
73
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
74
|
-
return editor.schema.spec.nodes.get(nodeName) !== void 0;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
70
|
// src/ui/list-button/index.tsx
|
|
78
71
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
79
72
|
var listOptions = [
|
|
@@ -156,7 +149,7 @@ function shouldShowListButton(params) {
|
|
|
156
149
|
return true;
|
|
157
150
|
}
|
|
158
151
|
function useListState(editor, type) {
|
|
159
|
-
const listInSchema = isNodeInSchema(type, editor);
|
|
152
|
+
const listInSchema = (0, import_editor_utils.isNodeInSchema)(type, editor);
|
|
160
153
|
const listOption = getListOption(type);
|
|
161
154
|
const isActive = isListActive(editor, type);
|
|
162
155
|
const shortcutKey = listShortcutKeys[type];
|
|
@@ -9,10 +9,8 @@ import {
|
|
|
9
9
|
shouldShowListButton,
|
|
10
10
|
toggleList,
|
|
11
11
|
useListState
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-C6M3CDOK.mjs";
|
|
12
|
+
} from "../../chunk-IOB3REX6.mjs";
|
|
14
13
|
import "../../chunk-P55PLOHR.mjs";
|
|
15
|
-
import "../../chunk-WKV76XOR.mjs";
|
|
16
14
|
export {
|
|
17
15
|
ListButton,
|
|
18
16
|
canToggleList,
|
|
@@ -32,6 +32,7 @@ __export(list_dropdown_menu_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(list_dropdown_menu_exports);
|
|
33
33
|
var import_button2 = require("@kopexa/button");
|
|
34
34
|
var import_dropdown_menu = require("@kopexa/dropdown-menu");
|
|
35
|
+
var import_editor_utils2 = require("@kopexa/editor-utils");
|
|
35
36
|
var import_icons2 = require("@kopexa/icons");
|
|
36
37
|
var import_react5 = require("@tiptap/react");
|
|
37
38
|
var import_react6 = require("react");
|
|
@@ -65,16 +66,9 @@ function useTiptapEditor(providedEditor) {
|
|
|
65
66
|
return editorState || { editor: null };
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
// src/utils/index.ts
|
|
69
|
-
var import_state = require("@tiptap/pm/state");
|
|
70
|
-
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
71
|
-
var isNodeInSchema = (nodeName, editor) => {
|
|
72
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
73
|
-
return editor.schema.spec.nodes.get(nodeName) !== void 0;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
69
|
// src/ui/list-button/index.tsx
|
|
77
70
|
var import_button = require("@kopexa/button");
|
|
71
|
+
var import_editor_utils = require("@kopexa/editor-utils");
|
|
78
72
|
var import_icons = require("@kopexa/icons");
|
|
79
73
|
var import_react3 = require("@tiptap/react");
|
|
80
74
|
var import_react4 = require("react");
|
|
@@ -159,7 +153,7 @@ function shouldShowListButton(params) {
|
|
|
159
153
|
return true;
|
|
160
154
|
}
|
|
161
155
|
function useListState(editor, type) {
|
|
162
|
-
const listInSchema = isNodeInSchema(type, editor);
|
|
156
|
+
const listInSchema = (0, import_editor_utils.isNodeInSchema)(type, editor);
|
|
163
157
|
const listOption = getListOption(type);
|
|
164
158
|
const isActive = isListActive(editor, type);
|
|
165
159
|
const shortcutKey = listShortcutKeys[type];
|
|
@@ -259,7 +253,7 @@ function shouldShowListDropdown(params) {
|
|
|
259
253
|
function useListDropdownState(editor, availableTypes) {
|
|
260
254
|
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
261
255
|
const listInSchema = availableTypes.some(
|
|
262
|
-
(type) => isNodeInSchema(type, editor)
|
|
256
|
+
(type) => (0, import_editor_utils2.isNodeInSchema)(type, editor)
|
|
263
257
|
);
|
|
264
258
|
const filteredLists = (0, import_react6.useMemo)(
|
|
265
259
|
() => getFilteredListOptions(availableTypes),
|
|
@@ -7,11 +7,9 @@ import {
|
|
|
7
7
|
shouldShowListDropdown,
|
|
8
8
|
useActiveListIcon,
|
|
9
9
|
useListDropdownState
|
|
10
|
-
} from "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-C6M3CDOK.mjs";
|
|
10
|
+
} from "../../chunk-Q7DFJ5NI.mjs";
|
|
11
|
+
import "../../chunk-IOB3REX6.mjs";
|
|
13
12
|
import "../../chunk-P55PLOHR.mjs";
|
|
14
|
-
import "../../chunk-WKV76XOR.mjs";
|
|
15
13
|
export {
|
|
16
14
|
ListDropdownMenu,
|
|
17
15
|
canToggleAnyList,
|
|
@@ -33,6 +33,7 @@ __export(mark_button_exports, {
|
|
|
33
33
|
useMarkState: () => useMarkState
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(mark_button_exports);
|
|
36
|
+
var import_editor_utils = require("@kopexa/editor-utils");
|
|
36
37
|
var import_icons = require("@kopexa/icons");
|
|
37
38
|
var import_toolbar = require("@kopexa/toolbar");
|
|
38
39
|
var import_react3 = require("@tiptap/react");
|
|
@@ -67,25 +68,6 @@ function useTiptapEditor(providedEditor) {
|
|
|
67
68
|
return editorState || { editor: null };
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
// src/utils/index.ts
|
|
71
|
-
var import_state = require("@tiptap/pm/state");
|
|
72
|
-
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
73
|
-
var isMarkInSchema = (markName, editor) => {
|
|
74
|
-
if (!(editor == null ? void 0 : editor.schema)) return false;
|
|
75
|
-
return editor.schema.spec.marks.get(markName) !== void 0;
|
|
76
|
-
};
|
|
77
|
-
function isNodeTypeSelected(editor, types = []) {
|
|
78
|
-
if (!editor || !editor.state.selection) return false;
|
|
79
|
-
const { state } = editor;
|
|
80
|
-
const { selection } = state;
|
|
81
|
-
if (selection.empty) return false;
|
|
82
|
-
if (selection instanceof import_state.NodeSelection) {
|
|
83
|
-
const node = selection.node;
|
|
84
|
-
return node ? types.includes(node.type.name) : false;
|
|
85
|
-
}
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
71
|
// src/ui/mark-button/index.tsx
|
|
90
72
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
91
73
|
var markIcons = {
|
|
@@ -108,7 +90,7 @@ var markShortcutKeys = {
|
|
|
108
90
|
};
|
|
109
91
|
function canToggleMark(editor, type) {
|
|
110
92
|
if (!editor || !editor.isEditable) return false;
|
|
111
|
-
if (!isMarkInSchema(type, editor) || isNodeTypeSelected(editor, ["image"]))
|
|
93
|
+
if (!(0, import_editor_utils.isMarkInSchema)(type, editor) || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"]))
|
|
112
94
|
return false;
|
|
113
95
|
return editor.can().toggleMark(type);
|
|
114
96
|
}
|
|
@@ -143,7 +125,7 @@ function getFormattedMarkName(type) {
|
|
|
143
125
|
return type.charAt(0).toUpperCase() + type.slice(1);
|
|
144
126
|
}
|
|
145
127
|
function useMarkState(editor, type, disabled = false) {
|
|
146
|
-
const markInSchema = isMarkInSchema(type, editor);
|
|
128
|
+
const markInSchema = (0, import_editor_utils.isMarkInSchema)(type, editor);
|
|
147
129
|
const isDisabled = isMarkButtonDisabled(editor, type, disabled);
|
|
148
130
|
const isActive = isMarkActive(editor, type);
|
|
149
131
|
const Icon = markIcons[type];
|
|
@@ -10,10 +10,8 @@ import {
|
|
|
10
10
|
shouldShowMarkButton,
|
|
11
11
|
toggleMark,
|
|
12
12
|
useMarkState
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-C6M3CDOK.mjs";
|
|
13
|
+
} from "../../chunk-LNVWG34E.mjs";
|
|
15
14
|
import "../../chunk-P55PLOHR.mjs";
|
|
16
|
-
import "../../chunk-WKV76XOR.mjs";
|
|
17
15
|
export {
|
|
18
16
|
MarkButton,
|
|
19
17
|
canToggleMark,
|