@vizel/core 0.0.1-alpha.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/README.md +44 -0
- package/dist/components.css +1 -0
- package/dist/components.css.map +1 -0
- package/dist/index.d.ts +2642 -0
- package/dist/index.js +150 -0
- package/dist/index10.js +118 -0
- package/dist/index11.js +174 -0
- package/dist/index12.js +78 -0
- package/dist/index13.js +141 -0
- package/dist/index14.js +150 -0
- package/dist/index15.js +20 -0
- package/dist/index16.js +17 -0
- package/dist/index17.js +308 -0
- package/dist/index18.js +52 -0
- package/dist/index19.js +29 -0
- package/dist/index2.js +93 -0
- package/dist/index20.js +268 -0
- package/dist/index21.js +72 -0
- package/dist/index22.js +360 -0
- package/dist/index23.js +87 -0
- package/dist/index24.js +39 -0
- package/dist/index25.js +95 -0
- package/dist/index26.js +104 -0
- package/dist/index27.js +136 -0
- package/dist/index28.js +56 -0
- package/dist/index29.js +69 -0
- package/dist/index3.js +69 -0
- package/dist/index30.js +40 -0
- package/dist/index31.js +26 -0
- package/dist/index32.js +15 -0
- package/dist/index33.js +12 -0
- package/dist/index34.js +19 -0
- package/dist/index35.js +60 -0
- package/dist/index36.js +17 -0
- package/dist/index37.js +66 -0
- package/dist/index38.js +6 -0
- package/dist/index39.js +125 -0
- package/dist/index4.js +89 -0
- package/dist/index40.js +329 -0
- package/dist/index41.js +489 -0
- package/dist/index42.js +50 -0
- package/dist/index43.js +676 -0
- package/dist/index44.js +6 -0
- package/dist/index45.js +6 -0
- package/dist/index46.js +240 -0
- package/dist/index47.js +84 -0
- package/dist/index48.js +288 -0
- package/dist/index49.js +1504 -0
- package/dist/index5.js +13 -0
- package/dist/index50.js +7 -0
- package/dist/index51.js +1563 -0
- package/dist/index52.js +204 -0
- package/dist/index53.js +725 -0
- package/dist/index54.js +23 -0
- package/dist/index55.js +12 -0
- package/dist/index56.js +9 -0
- package/dist/index57.js +10 -0
- package/dist/index58.js +16 -0
- package/dist/index59.js +21 -0
- package/dist/index6.js +135 -0
- package/dist/index60.js +27 -0
- package/dist/index61.js +86 -0
- package/dist/index62.js +248 -0
- package/dist/index63.js +1234 -0
- package/dist/index64.js +736 -0
- package/dist/index65.js +5 -0
- package/dist/index66.js +1063 -0
- package/dist/index67.js +57 -0
- package/dist/index68.js +100 -0
- package/dist/index69.js +6 -0
- package/dist/index7.js +456 -0
- package/dist/index70.js +93 -0
- package/dist/index8.js +52 -0
- package/dist/index9.js +275 -0
- package/dist/styles.css +1 -0
- package/dist/styles.css.map +1 -0
- package/package.json +109 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { BubbleMenuPlugin as r } from "@tiptap/extension-bubble-menu";
|
|
2
|
+
import { VIZEL_DEFAULT_AUTO_SAVE_OPTIONS as o, createVizelAutoSaveHandlers as t, formatVizelRelativeTime as i, getVizelStorageBackend as n } from "./index2.js";
|
|
3
|
+
import { VIZEL_DEFAULT_THEME as z, VIZEL_DEFAULT_THEME_STORAGE_KEY as s, VIZEL_THEME_DATA_ATTRIBUTE as m, applyVizelTheme as d, createVizelSystemThemeListener as E, getStoredVizelTheme as p, getVizelSystemTheme as c, getVizelThemeInitScript as x, resolveVizelTheme as f, storeVizelTheme as g } from "./index3.js";
|
|
4
|
+
import { VIZEL_HIGHLIGHT_COLORS as T, VIZEL_TEXT_COLORS as _, addVizelRecentColor as u, createVizelTextColorExtensions as h, getVizelRecentColors as L } from "./index4.js";
|
|
5
|
+
import { createVizelCharacterCountExtension as C } from "./index5.js";
|
|
6
|
+
import { createVizelCodeBlockExtension as M, findVizelLanguage as v, getAllVizelLanguageIds as A, getVizelRegisteredLanguages as P } from "./index6.js";
|
|
7
|
+
import { VizelEmbed as U, createVizelDefaultFetchEmbedData as O, createVizelEmbedExtension as R, detectVizelEmbedProvider as b, vizelDefaultEmbedProviders as k, vizelEmbedPastePluginKey as Z } from "./index7.js";
|
|
8
|
+
import { createVizelDetailsExtensions as B } from "./index8.js";
|
|
9
|
+
import { VizelDiagram as G, createVizelDiagramExtension as N } from "./index9.js";
|
|
10
|
+
import { VizelBlockMoveKeymap as K, createVizelDragHandleExtension as W, createVizelDragHandleExtensions as X } from "./index10.js";
|
|
11
|
+
import { createVizelExtensions as j } from "./index11.js";
|
|
12
|
+
import { VIZEL_DEFAULT_FILE_MIME_TYPES as J, createVizelFileHandlerExtension as Q, createVizelImageFileHandlers as $, filterVizelFilesByMimeType as ee } from "./index12.js";
|
|
13
|
+
import { createVizelImageExtension as re, createVizelImageUploadExtensions as ae, createVizelImageUploadWithFileHandler as oe, vizelDefaultBase64Upload as te } from "./index13.js";
|
|
14
|
+
import { createVizelImageUploadPlugin as ne, createVizelImageUploader as Ve, getVizelImageUploadPluginKey as ze, handleVizelImageDrop as se, handleVizelImagePaste as me, validateVizelImageFile as de } from "./index14.js";
|
|
15
|
+
import { createVizelLinkExtension as pe } from "./index15.js";
|
|
16
|
+
import { VizelMarkdown as xe, createVizelMarkdownExtension as fe } from "./index16.js";
|
|
17
|
+
import { VizelMathBlock as Ie, VizelMathInline as Te, createVizelMathematicsExtensions as _e } from "./index17.js";
|
|
18
|
+
import { createVizelTableExtensions as he } from "./index18.js";
|
|
19
|
+
import { createVizelTaskListExtensions as Se } from "./index19.js";
|
|
20
|
+
import { filterSlashCommands as De, flattenSlashCommandGroups as Me, groupSlashCommands as ve, searchSlashCommands as Ae, defaultGroupOrder as Pe, defaultSlashCommands as He } from "./index20.js";
|
|
21
|
+
import { getVizelActiveNodeType as Oe, vizelDefaultNodeTypes as Re } from "./index21.js";
|
|
22
|
+
import { VIZEL_TABLE_MENU_ITEMS as ke, VizelTableWithControls as Ze } from "./index22.js";
|
|
23
|
+
import { default as Be } from "@tiptap/extension-drag-handle";
|
|
24
|
+
import { default as Ge } from "@tiptap/extension-image";
|
|
25
|
+
import { VizelResizableImage as we, VizelResizableImage as Ke } from "./index23.js";
|
|
26
|
+
import { VizelSlashCommand as Xe } from "./index24.js";
|
|
27
|
+
import { VizelTable as je, VizelTableCell as qe, VizelTableHeader as Je } from "./index25.js";
|
|
28
|
+
import { getVizelIconId as $e, initVizelIconRenderer as el, renderVizelIcon as ll, renderVizelIconSvg as rl, setVizelIconRenderer as al, vizelDefaultIconIds as ol } from "./index26.js";
|
|
29
|
+
import { VIZEL_UPLOAD_IMAGE_EVENT as il, convertVizelCodeBlocksToDiagrams as nl, createVizelUploadEventHandler as Vl, getVizelEditorState as zl, registerVizelUploadEventHandler as sl, resolveVizelFeatures as ml, transformVizelDiagramCodeBlocks as dl, vizelDefaultEditorProps as El } from "./index27.js";
|
|
30
|
+
import { createVizelEditorInstance as cl } from "./index28.js";
|
|
31
|
+
import { VIZEL_DEFAULT_MARKDOWN_DEBOUNCE_MS as fl, createVizelMarkdownSyncHandlers as gl, getVizelMarkdown as Il, initializeVizelMarkdownContent as Tl, parseVizelMarkdown as _l, setVizelMarkdown as ul } from "./index29.js";
|
|
32
|
+
import { VIZEL_PORTAL_ID as Ll, VIZEL_PORTAL_Z_INDEX as Sl, createVizelPortalElement as Cl, getVizelPortalContainer as Dl, hasVizelPortalContainer as Ml, mountToVizelPortal as vl, removeVizelPortalContainer as Al, unmountFromVizelPortal as Pl } from "./index30.js";
|
|
33
|
+
import { VIZEL_SUGGESTION_Z_INDEX as Ul, createVizelSuggestionContainer as Ol, handleVizelSuggestionEscape as Rl } from "./index31.js";
|
|
34
|
+
import { isVizelValidHexColor as kl, normalizeVizelHexColor as Zl } from "./index32.js";
|
|
35
|
+
import { splitVizelTextByMatches as Bl } from "./index33.js";
|
|
36
|
+
export {
|
|
37
|
+
r as BubbleMenuPlugin,
|
|
38
|
+
o as VIZEL_DEFAULT_AUTO_SAVE_OPTIONS,
|
|
39
|
+
J as VIZEL_DEFAULT_FILE_MIME_TYPES,
|
|
40
|
+
fl as VIZEL_DEFAULT_MARKDOWN_DEBOUNCE_MS,
|
|
41
|
+
z as VIZEL_DEFAULT_THEME,
|
|
42
|
+
s as VIZEL_DEFAULT_THEME_STORAGE_KEY,
|
|
43
|
+
T as VIZEL_HIGHLIGHT_COLORS,
|
|
44
|
+
Ll as VIZEL_PORTAL_ID,
|
|
45
|
+
Sl as VIZEL_PORTAL_Z_INDEX,
|
|
46
|
+
Ul as VIZEL_SUGGESTION_Z_INDEX,
|
|
47
|
+
ke as VIZEL_TABLE_MENU_ITEMS,
|
|
48
|
+
_ as VIZEL_TEXT_COLORS,
|
|
49
|
+
m as VIZEL_THEME_DATA_ATTRIBUTE,
|
|
50
|
+
il as VIZEL_UPLOAD_IMAGE_EVENT,
|
|
51
|
+
K as VizelBlockMoveKeymap,
|
|
52
|
+
G as VizelDiagram,
|
|
53
|
+
Be as VizelDragHandle,
|
|
54
|
+
U as VizelEmbed,
|
|
55
|
+
Ge as VizelImage,
|
|
56
|
+
we as VizelImageResize,
|
|
57
|
+
xe as VizelMarkdown,
|
|
58
|
+
Ie as VizelMathBlock,
|
|
59
|
+
Te as VizelMathInline,
|
|
60
|
+
Ke as VizelResizableImage,
|
|
61
|
+
Xe as VizelSlashCommand,
|
|
62
|
+
je as VizelTable,
|
|
63
|
+
qe as VizelTableCell,
|
|
64
|
+
Je as VizelTableHeader,
|
|
65
|
+
Ze as VizelTableWithControls,
|
|
66
|
+
u as addVizelRecentColor,
|
|
67
|
+
d as applyVizelTheme,
|
|
68
|
+
nl as convertVizelCodeBlocksToDiagrams,
|
|
69
|
+
t as createVizelAutoSaveHandlers,
|
|
70
|
+
C as createVizelCharacterCountExtension,
|
|
71
|
+
M as createVizelCodeBlockExtension,
|
|
72
|
+
O as createVizelDefaultFetchEmbedData,
|
|
73
|
+
B as createVizelDetailsExtensions,
|
|
74
|
+
N as createVizelDiagramExtension,
|
|
75
|
+
W as createVizelDragHandleExtension,
|
|
76
|
+
X as createVizelDragHandleExtensions,
|
|
77
|
+
cl as createVizelEditorInstance,
|
|
78
|
+
R as createVizelEmbedExtension,
|
|
79
|
+
j as createVizelExtensions,
|
|
80
|
+
Q as createVizelFileHandlerExtension,
|
|
81
|
+
re as createVizelImageExtension,
|
|
82
|
+
$ as createVizelImageFileHandlers,
|
|
83
|
+
ae as createVizelImageUploadExtensions,
|
|
84
|
+
ne as createVizelImageUploadPlugin,
|
|
85
|
+
oe as createVizelImageUploadWithFileHandler,
|
|
86
|
+
Ve as createVizelImageUploader,
|
|
87
|
+
pe as createVizelLinkExtension,
|
|
88
|
+
fe as createVizelMarkdownExtension,
|
|
89
|
+
gl as createVizelMarkdownSyncHandlers,
|
|
90
|
+
_e as createVizelMathematicsExtensions,
|
|
91
|
+
Cl as createVizelPortalElement,
|
|
92
|
+
Ol as createVizelSuggestionContainer,
|
|
93
|
+
E as createVizelSystemThemeListener,
|
|
94
|
+
he as createVizelTableExtensions,
|
|
95
|
+
Se as createVizelTaskListExtensions,
|
|
96
|
+
h as createVizelTextColorExtensions,
|
|
97
|
+
Vl as createVizelUploadEventHandler,
|
|
98
|
+
b as detectVizelEmbedProvider,
|
|
99
|
+
ee as filterVizelFilesByMimeType,
|
|
100
|
+
De as filterVizelSlashCommands,
|
|
101
|
+
v as findVizelLanguage,
|
|
102
|
+
Me as flattenVizelSlashCommandGroups,
|
|
103
|
+
i as formatVizelRelativeTime,
|
|
104
|
+
A as getAllVizelLanguageIds,
|
|
105
|
+
p as getStoredVizelTheme,
|
|
106
|
+
Oe as getVizelActiveNodeType,
|
|
107
|
+
zl as getVizelEditorState,
|
|
108
|
+
$e as getVizelIconId,
|
|
109
|
+
ze as getVizelImageUploadPluginKey,
|
|
110
|
+
Il as getVizelMarkdown,
|
|
111
|
+
Dl as getVizelPortalContainer,
|
|
112
|
+
L as getVizelRecentColors,
|
|
113
|
+
P as getVizelRegisteredLanguages,
|
|
114
|
+
n as getVizelStorageBackend,
|
|
115
|
+
c as getVizelSystemTheme,
|
|
116
|
+
x as getVizelThemeInitScript,
|
|
117
|
+
ve as groupVizelSlashCommands,
|
|
118
|
+
se as handleVizelImageDrop,
|
|
119
|
+
me as handleVizelImagePaste,
|
|
120
|
+
Rl as handleVizelSuggestionEscape,
|
|
121
|
+
Ml as hasVizelPortalContainer,
|
|
122
|
+
el as initVizelIconRenderer,
|
|
123
|
+
Tl as initializeVizelMarkdownContent,
|
|
124
|
+
kl as isVizelValidHexColor,
|
|
125
|
+
vl as mountToVizelPortal,
|
|
126
|
+
Zl as normalizeVizelHexColor,
|
|
127
|
+
_l as parseVizelMarkdown,
|
|
128
|
+
sl as registerVizelUploadEventHandler,
|
|
129
|
+
Al as removeVizelPortalContainer,
|
|
130
|
+
ll as renderVizelIcon,
|
|
131
|
+
rl as renderVizelIconSvg,
|
|
132
|
+
ml as resolveVizelFeatures,
|
|
133
|
+
f as resolveVizelTheme,
|
|
134
|
+
Ae as searchVizelSlashCommands,
|
|
135
|
+
al as setVizelIconRenderer,
|
|
136
|
+
ul as setVizelMarkdown,
|
|
137
|
+
Bl as splitVizelTextByMatches,
|
|
138
|
+
g as storeVizelTheme,
|
|
139
|
+
dl as transformVizelDiagramCodeBlocks,
|
|
140
|
+
Pl as unmountFromVizelPortal,
|
|
141
|
+
de as validateVizelImageFile,
|
|
142
|
+
te as vizelDefaultBase64Upload,
|
|
143
|
+
El as vizelDefaultEditorProps,
|
|
144
|
+
k as vizelDefaultEmbedProviders,
|
|
145
|
+
Pe as vizelDefaultGroupOrder,
|
|
146
|
+
ol as vizelDefaultIconIds,
|
|
147
|
+
Re as vizelDefaultNodeTypes,
|
|
148
|
+
He as vizelDefaultSlashCommands,
|
|
149
|
+
Z as vizelEmbedPastePluginKey
|
|
150
|
+
};
|
package/dist/index10.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Extension as f } from "@tiptap/core";
|
|
2
|
+
import p from "@tiptap/extension-drag-handle";
|
|
3
|
+
import { default as B } from "@tiptap/extension-drag-handle";
|
|
4
|
+
import { renderVizelIcon as m } from "./index26.js";
|
|
5
|
+
import { TextSelection as a } from "./index41.js";
|
|
6
|
+
function v(e = {}) {
|
|
7
|
+
const { enabled: o = !0 } = e;
|
|
8
|
+
if (!o)
|
|
9
|
+
return f.create({ name: "vizelDragHandleDisabled" });
|
|
10
|
+
let r = null;
|
|
11
|
+
return p.configure({
|
|
12
|
+
render() {
|
|
13
|
+
const t = document.createElement("div");
|
|
14
|
+
t.classList.add("vizel-drag-handle"), t.setAttribute("data-vizel-drag-handle", ""), t.setAttribute("draggable", "true"), t.setAttribute("aria-label", "Drag to reorder block"), t.setAttribute("role", "button");
|
|
15
|
+
const n = document.createElement("div");
|
|
16
|
+
return n.classList.add("vizel-drag-handle-grip"), n.innerHTML = m("grip", { width: 14, height: 14 }), t.appendChild(n), r = t, t;
|
|
17
|
+
},
|
|
18
|
+
onNodeChange({ node: t }) {
|
|
19
|
+
r && (t ? r.classList.add("is-visible") : r.classList.remove("is-visible"));
|
|
20
|
+
},
|
|
21
|
+
computePositionConfig: {
|
|
22
|
+
placement: "left"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const b = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
|
|
27
|
+
function u(e) {
|
|
28
|
+
for (let o = e.depth; o > 0; o--) {
|
|
29
|
+
const r = e.node(o), t = r.type.name;
|
|
30
|
+
if (b.has(t))
|
|
31
|
+
return {
|
|
32
|
+
pos: e.before(o),
|
|
33
|
+
node: r,
|
|
34
|
+
depth: o
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (e.depth >= 1) {
|
|
38
|
+
const o = e.node(1);
|
|
39
|
+
return {
|
|
40
|
+
pos: e.before(1),
|
|
41
|
+
node: o,
|
|
42
|
+
depth: 1
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function g(e, o) {
|
|
48
|
+
const r = e.doc.resolve(o.pos), t = r.depth, n = r.start(t), i = r.parent;
|
|
49
|
+
let d = n, l = -1;
|
|
50
|
+
for (let s = 0; s < i.childCount; s++) {
|
|
51
|
+
if (d === o.pos) {
|
|
52
|
+
l = s;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
d += i.child(s).nodeSize;
|
|
56
|
+
}
|
|
57
|
+
if (l <= 0) return null;
|
|
58
|
+
let c = n;
|
|
59
|
+
for (let s = 0; s < l - 1; s++)
|
|
60
|
+
c += i.child(s).nodeSize;
|
|
61
|
+
return { pos: c, node: i.child(l - 1) };
|
|
62
|
+
}
|
|
63
|
+
function h(e, o) {
|
|
64
|
+
const r = o.pos + o.node.nodeSize, t = e.doc.resolve(r);
|
|
65
|
+
if (r >= t.end(t.depth)) return null;
|
|
66
|
+
const n = e.doc.nodeAt(r);
|
|
67
|
+
return n ? { pos: r, node: n } : null;
|
|
68
|
+
}
|
|
69
|
+
const S = f.create({
|
|
70
|
+
name: "vizelBlockMoveKeymap",
|
|
71
|
+
addCommands() {
|
|
72
|
+
return {
|
|
73
|
+
moveBlockUp: () => ({ tr: e, state: o, dispatch: r }) => {
|
|
74
|
+
const { $from: t } = o.selection, n = u(t);
|
|
75
|
+
if (!n || n.pos <= 0) return !1;
|
|
76
|
+
const i = g(o, n);
|
|
77
|
+
if (!i) return !1;
|
|
78
|
+
if (r) {
|
|
79
|
+
const d = n.pos + n.node.nodeSize;
|
|
80
|
+
e.delete(n.pos, d), e.insert(i.pos, n.node);
|
|
81
|
+
const l = i.pos + 1;
|
|
82
|
+
e.setSelection(a.near(e.doc.resolve(l)));
|
|
83
|
+
}
|
|
84
|
+
return !0;
|
|
85
|
+
},
|
|
86
|
+
moveBlockDown: () => ({ tr: e, state: o, dispatch: r }) => {
|
|
87
|
+
const { $from: t } = o.selection, n = u(t);
|
|
88
|
+
if (!n) return !1;
|
|
89
|
+
const i = h(o, n);
|
|
90
|
+
if (!i) return !1;
|
|
91
|
+
if (r) {
|
|
92
|
+
const d = n.pos + n.node.nodeSize;
|
|
93
|
+
e.delete(n.pos, d);
|
|
94
|
+
const l = n.pos + i.node.nodeSize;
|
|
95
|
+
e.insert(l, n.node);
|
|
96
|
+
const c = l + 1;
|
|
97
|
+
e.setSelection(a.near(e.doc.resolve(c)));
|
|
98
|
+
}
|
|
99
|
+
return !0;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
addKeyboardShortcuts() {
|
|
104
|
+
return {
|
|
105
|
+
"Alt-ArrowUp": () => this.editor.commands.moveBlockUp(),
|
|
106
|
+
"Alt-ArrowDown": () => this.editor.commands.moveBlockDown()
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
function x(e = {}) {
|
|
111
|
+
return [v(e), S];
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
S as VizelBlockMoveKeymap,
|
|
115
|
+
B as VizelDragHandle,
|
|
116
|
+
v as createVizelDragHandleExtension,
|
|
117
|
+
x as createVizelDragHandleExtensions
|
|
118
|
+
};
|
package/dist/index11.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import s from "@tiptap/extension-blockquote";
|
|
2
|
+
import m from "@tiptap/extension-bold";
|
|
3
|
+
import l from "@tiptap/extension-bullet-list";
|
|
4
|
+
import d from "@tiptap/extension-code";
|
|
5
|
+
import c from "@tiptap/extension-document";
|
|
6
|
+
import p from "@tiptap/extension-dropcursor";
|
|
7
|
+
import f from "@tiptap/extension-gapcursor";
|
|
8
|
+
import u from "@tiptap/extension-hard-break";
|
|
9
|
+
import h from "@tiptap/extension-heading";
|
|
10
|
+
import x from "@tiptap/extension-history";
|
|
11
|
+
import E from "@tiptap/extension-horizontal-rule";
|
|
12
|
+
import g from "@tiptap/extension-italic";
|
|
13
|
+
import b from "@tiptap/extension-list-item";
|
|
14
|
+
import k from "@tiptap/extension-list-keymap";
|
|
15
|
+
import z from "@tiptap/extension-ordered-list";
|
|
16
|
+
import y from "@tiptap/extension-paragraph";
|
|
17
|
+
import C from "@tiptap/extension-placeholder";
|
|
18
|
+
import V from "@tiptap/extension-strike";
|
|
19
|
+
import O from "@tiptap/extension-text";
|
|
20
|
+
import j from "./index37.js";
|
|
21
|
+
import { createVizelCharacterCountExtension as B } from "./index5.js";
|
|
22
|
+
import { createVizelCodeBlockExtension as a } from "./index6.js";
|
|
23
|
+
import { createVizelDetailsExtensions as L } from "./index8.js";
|
|
24
|
+
import { createVizelDiagramExtension as v } from "./index9.js";
|
|
25
|
+
import { createVizelDragHandleExtensions as w } from "./index10.js";
|
|
26
|
+
import { createVizelEmbedExtension as H } from "./index7.js";
|
|
27
|
+
import { vizelDefaultBase64Upload as T, createVizelImageUploadExtensions as D, defaultImageResizeOptions as S } from "./index13.js";
|
|
28
|
+
import { createVizelLinkExtension as U } from "./index15.js";
|
|
29
|
+
import { createVizelMarkdownExtension as I } from "./index16.js";
|
|
30
|
+
import { createVizelMathematicsExtensions as M } from "./index17.js";
|
|
31
|
+
import { VizelSlashCommand as F } from "./index24.js";
|
|
32
|
+
import { createVizelTableExtensions as P } from "./index18.js";
|
|
33
|
+
import { createVizelTaskListExtensions as R } from "./index19.js";
|
|
34
|
+
import { createVizelTextColorExtensions as q } from "./index4.js";
|
|
35
|
+
import { defaultSlashCommands as G } from "./index20.js";
|
|
36
|
+
function K(e = {}) {
|
|
37
|
+
const { headingLevels: o = [1, 2, 3] } = e;
|
|
38
|
+
return [
|
|
39
|
+
// Nodes
|
|
40
|
+
c,
|
|
41
|
+
y,
|
|
42
|
+
O,
|
|
43
|
+
h.configure({ levels: o }),
|
|
44
|
+
s,
|
|
45
|
+
l,
|
|
46
|
+
z,
|
|
47
|
+
b,
|
|
48
|
+
// CodeBlock is added separately based on feature options
|
|
49
|
+
u,
|
|
50
|
+
E,
|
|
51
|
+
// Marks
|
|
52
|
+
m,
|
|
53
|
+
d,
|
|
54
|
+
g,
|
|
55
|
+
V,
|
|
56
|
+
j,
|
|
57
|
+
// Functionality
|
|
58
|
+
p.configure({ color: "#3b82f6", width: 2 }),
|
|
59
|
+
f,
|
|
60
|
+
x,
|
|
61
|
+
k
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
function N(e, o) {
|
|
65
|
+
if (o.slashCommand === !1) return;
|
|
66
|
+
const t = typeof o.slashCommand == "object" ? o.slashCommand : {}, i = t.items ?? G;
|
|
67
|
+
e.push(
|
|
68
|
+
F.configure({
|
|
69
|
+
items: i,
|
|
70
|
+
...t.suggestion !== void 0 && {
|
|
71
|
+
suggestion: t.suggestion
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
function _(e, o) {
|
|
77
|
+
if (o.image === !1) return;
|
|
78
|
+
const t = typeof o.image == "object" ? o.image : {}, i = t.onUpload ?? T, n = t.resize !== !1;
|
|
79
|
+
e.push(
|
|
80
|
+
...D({
|
|
81
|
+
upload: {
|
|
82
|
+
onUpload: i,
|
|
83
|
+
...t.maxFileSize !== void 0 && { maxFileSize: t.maxFileSize },
|
|
84
|
+
...t.allowedTypes !== void 0 && { allowedTypes: t.allowedTypes },
|
|
85
|
+
...t.onValidationError !== void 0 && {
|
|
86
|
+
onValidationError: t.onValidationError
|
|
87
|
+
},
|
|
88
|
+
...t.onUploadError !== void 0 && {
|
|
89
|
+
onUploadError: t.onUploadError
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
resize: n ? S : !1
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
function A(e, o) {
|
|
97
|
+
if (o.markdown === !1) return;
|
|
98
|
+
const t = typeof o.markdown == "object" ? o.markdown : {};
|
|
99
|
+
e.push(I(t));
|
|
100
|
+
}
|
|
101
|
+
function J(e, o) {
|
|
102
|
+
if (o.taskList === !1) return;
|
|
103
|
+
const t = typeof o.taskList == "object" ? o.taskList : {};
|
|
104
|
+
e.push(...R(t));
|
|
105
|
+
}
|
|
106
|
+
function Q(e, o) {
|
|
107
|
+
if (o.characterCount === !1) return;
|
|
108
|
+
const t = typeof o.characterCount == "object" ? o.characterCount : {};
|
|
109
|
+
e.push(B(t));
|
|
110
|
+
}
|
|
111
|
+
function W(e, o) {
|
|
112
|
+
if (o.textColor === !1) return;
|
|
113
|
+
const t = typeof o.textColor == "object" ? o.textColor : {};
|
|
114
|
+
e.push(...q(t));
|
|
115
|
+
}
|
|
116
|
+
function X(e, o) {
|
|
117
|
+
if (o.codeBlock !== !1)
|
|
118
|
+
if (o.codeBlock === !0 || typeof o.codeBlock == "object") {
|
|
119
|
+
const t = typeof o.codeBlock == "object" ? o.codeBlock : {};
|
|
120
|
+
e.push(...a(t));
|
|
121
|
+
} else
|
|
122
|
+
e.push(...a());
|
|
123
|
+
}
|
|
124
|
+
function Y(e, o) {
|
|
125
|
+
if (o.mathematics === !1) return;
|
|
126
|
+
const t = typeof o.mathematics == "object" ? o.mathematics : {};
|
|
127
|
+
e.push(...M(t));
|
|
128
|
+
}
|
|
129
|
+
function Z(e, o) {
|
|
130
|
+
if (o.dragHandle === !1) return;
|
|
131
|
+
const t = typeof o.dragHandle == "object" ? o.dragHandle : {};
|
|
132
|
+
e.push(...w(t));
|
|
133
|
+
}
|
|
134
|
+
function $(e, o) {
|
|
135
|
+
if (o.details === !1) return;
|
|
136
|
+
const t = typeof o.details == "object" ? o.details : {};
|
|
137
|
+
e.push(...L(t));
|
|
138
|
+
}
|
|
139
|
+
function oo(e, o) {
|
|
140
|
+
if (o.embed === !1) return;
|
|
141
|
+
const t = typeof o.embed == "object" ? o.embed : {};
|
|
142
|
+
e.push(H(t));
|
|
143
|
+
}
|
|
144
|
+
function to(e, o) {
|
|
145
|
+
if (o.diagram === !1) return;
|
|
146
|
+
const t = typeof o.diagram == "object" ? o.diagram : {};
|
|
147
|
+
e.push(v(t));
|
|
148
|
+
}
|
|
149
|
+
function Fo(e = {}) {
|
|
150
|
+
const {
|
|
151
|
+
placeholder: o = "Type '/' for commands...",
|
|
152
|
+
headingLevels: t = [1, 2, 3],
|
|
153
|
+
features: i = {}
|
|
154
|
+
} = e, n = [
|
|
155
|
+
...K({ headingLevels: t }),
|
|
156
|
+
C.configure({
|
|
157
|
+
placeholder: o,
|
|
158
|
+
emptyEditorClass: "vizel-editor-empty",
|
|
159
|
+
emptyNodeClass: "vizel-node-empty"
|
|
160
|
+
})
|
|
161
|
+
];
|
|
162
|
+
if (N(n, i), i.table !== !1) {
|
|
163
|
+
const r = typeof i.table == "object" ? i.table : {};
|
|
164
|
+
n.push(...P(r));
|
|
165
|
+
}
|
|
166
|
+
if (i.link !== !1) {
|
|
167
|
+
const r = typeof i.link == "object" ? i.link : {};
|
|
168
|
+
n.push(U(r));
|
|
169
|
+
}
|
|
170
|
+
return _(n, i), A(n, i), J(n, i), Q(n, i), W(n, i), X(n, i), Y(n, i), Z(n, i), $(n, i), oo(n, i), to(n, i), n;
|
|
171
|
+
}
|
|
172
|
+
export {
|
|
173
|
+
Fo as createVizelExtensions
|
|
174
|
+
};
|
package/dist/index12.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { FileHandler as d } from "./index42.js";
|
|
2
|
+
const g = [
|
|
3
|
+
"image/jpeg",
|
|
4
|
+
"image/png",
|
|
5
|
+
"image/gif",
|
|
6
|
+
"image/webp",
|
|
7
|
+
"image/svg+xml"
|
|
8
|
+
], m = 20 * 1024 * 1024;
|
|
9
|
+
function c(l, r) {
|
|
10
|
+
return l.filter((i) => r.includes(i.type) ? !0 : r.some((t) => {
|
|
11
|
+
if (t.endsWith("/*")) {
|
|
12
|
+
const n = t.slice(0, -2);
|
|
13
|
+
return i.type.startsWith(`${n}/`);
|
|
14
|
+
}
|
|
15
|
+
return !1;
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
function p(l = {}) {
|
|
19
|
+
const { allowedMimeTypes: r = g, onPaste: i, onDrop: a, onError: t } = l;
|
|
20
|
+
return d.configure({
|
|
21
|
+
allowedMimeTypes: r,
|
|
22
|
+
onPaste: (n, e, o) => {
|
|
23
|
+
if (e.length === 0)
|
|
24
|
+
return;
|
|
25
|
+
const s = c(e, r);
|
|
26
|
+
if (s.length === 0) {
|
|
27
|
+
t?.({
|
|
28
|
+
type: "invalid_mime_type",
|
|
29
|
+
message: `No files with allowed MIME types. Allowed: ${r.join(", ")}`,
|
|
30
|
+
files: e
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
i?.(n, s, o);
|
|
35
|
+
},
|
|
36
|
+
onDrop: (n, e, o) => {
|
|
37
|
+
if (e.length === 0)
|
|
38
|
+
return;
|
|
39
|
+
const s = c(e, r);
|
|
40
|
+
if (s.length === 0) {
|
|
41
|
+
t?.({
|
|
42
|
+
type: "invalid_mime_type",
|
|
43
|
+
message: `No files with allowed MIME types. Allowed: ${r.join(", ")}`,
|
|
44
|
+
files: e
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
a?.(n, s, o);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function f(l) {
|
|
53
|
+
const { onUpload: r, onUploadError: i } = l, a = async (t, n) => {
|
|
54
|
+
for (const e of n)
|
|
55
|
+
try {
|
|
56
|
+
const o = await r(e);
|
|
57
|
+
t.chain().focus().setImage({ src: o }).run();
|
|
58
|
+
} catch (o) {
|
|
59
|
+
i?.(o instanceof Error ? o : new Error(String(o)), e);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
onPaste: (t, n, e) => {
|
|
64
|
+
a(t, n);
|
|
65
|
+
},
|
|
66
|
+
onDrop: (t, n, e) => {
|
|
67
|
+
a(t, n);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
d as FileHandler,
|
|
73
|
+
g as VIZEL_DEFAULT_FILE_MIME_TYPES,
|
|
74
|
+
m as VIZEL_DEFAULT_IMAGE_MAX_FILE_SIZE,
|
|
75
|
+
p as createVizelFileHandlerExtension,
|
|
76
|
+
f as createVizelImageFileHandlers,
|
|
77
|
+
c as filterVizelFilesByMimeType
|
|
78
|
+
};
|
package/dist/index13.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Extension as p } from "@tiptap/core";
|
|
2
|
+
import { FileHandler as V } from "./index42.js";
|
|
3
|
+
import W from "@tiptap/extension-image";
|
|
4
|
+
import { default as k } from "@tiptap/extension-image";
|
|
5
|
+
import { Plugin as U } from "./index41.js";
|
|
6
|
+
import { createVizelImageUploader as M, createVizelImageUploadPlugin as v, handleVizelImageDrop as T, handleVizelImagePaste as y, validateVizelImageFile as E } from "./index14.js";
|
|
7
|
+
import { getVizelImageUploadPluginKey as C } from "./index14.js";
|
|
8
|
+
import { VizelResizableImage as P } from "./index23.js";
|
|
9
|
+
const j = {
|
|
10
|
+
enabled: !0,
|
|
11
|
+
minWidth: 100,
|
|
12
|
+
minHeight: 100
|
|
13
|
+
};
|
|
14
|
+
function O(e) {
|
|
15
|
+
return new Promise((t, a) => {
|
|
16
|
+
const i = new FileReader();
|
|
17
|
+
i.onload = () => {
|
|
18
|
+
typeof i.result == "string" && t(i.result);
|
|
19
|
+
}, i.onerror = () => a(new Error("Failed to read file")), i.readAsDataURL(e);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function w(e = {}) {
|
|
23
|
+
return W.configure({
|
|
24
|
+
inline: e.inline ?? !1,
|
|
25
|
+
allowBase64: e.allowBase64 ?? !0,
|
|
26
|
+
HTMLAttributes: {
|
|
27
|
+
class: "vizel-image",
|
|
28
|
+
...e.HTMLAttributes
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function K(e) {
|
|
33
|
+
const t = M(e.upload), a = e.resize !== !1, i = typeof e.resize == "object" ? e.resize : {}, d = a ? P.configure({
|
|
34
|
+
inline: e.inline ?? !1,
|
|
35
|
+
allowBase64: e.allowBase64 ?? !0,
|
|
36
|
+
minWidth: i.minWidth ?? 100,
|
|
37
|
+
minHeight: i.minHeight ?? 100,
|
|
38
|
+
...i.maxWidth !== void 0 && { maxWidth: i.maxWidth },
|
|
39
|
+
HTMLAttributes: {
|
|
40
|
+
class: "vizel-image",
|
|
41
|
+
...e.HTMLAttributes
|
|
42
|
+
}
|
|
43
|
+
}) : w(e), c = p.create({
|
|
44
|
+
name: "imageUpload",
|
|
45
|
+
addProseMirrorPlugins() {
|
|
46
|
+
return [v(e.upload)];
|
|
47
|
+
}
|
|
48
|
+
}), g = p.create({
|
|
49
|
+
name: "imageDropPaste",
|
|
50
|
+
addProseMirrorPlugins() {
|
|
51
|
+
return [
|
|
52
|
+
new U({
|
|
53
|
+
props: {
|
|
54
|
+
handlePaste: (r, o) => y(r, o, t),
|
|
55
|
+
handleDrop: (r, o, z, u) => T(r, o, u, t)
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return [d, c, g];
|
|
62
|
+
}
|
|
63
|
+
function N(e) {
|
|
64
|
+
const { onUpload: t, maxFileSize: a, allowedTypes: i, onValidationError: d, onUploadError: c } = e.upload, g = e.resize !== !1, r = typeof e.resize == "object" ? e.resize : {}, o = g ? P.configure({
|
|
65
|
+
inline: e.inline ?? !1,
|
|
66
|
+
allowBase64: e.allowBase64 ?? !0,
|
|
67
|
+
minWidth: r.minWidth ?? 100,
|
|
68
|
+
minHeight: r.minHeight ?? 100,
|
|
69
|
+
...r.maxWidth !== void 0 && { maxWidth: r.maxWidth },
|
|
70
|
+
HTMLAttributes: {
|
|
71
|
+
class: "vizel-image",
|
|
72
|
+
...e.HTMLAttributes
|
|
73
|
+
}
|
|
74
|
+
}) : w(e), z = p.create({
|
|
75
|
+
name: "imageUpload",
|
|
76
|
+
addProseMirrorPlugins() {
|
|
77
|
+
return [v(e.upload)];
|
|
78
|
+
}
|
|
79
|
+
}), u = i ?? [
|
|
80
|
+
"image/jpeg",
|
|
81
|
+
"image/png",
|
|
82
|
+
"image/gif",
|
|
83
|
+
"image/webp",
|
|
84
|
+
"image/svg+xml"
|
|
85
|
+
], H = V.configure({
|
|
86
|
+
allowedMimeTypes: u,
|
|
87
|
+
onPaste: (s, f) => {
|
|
88
|
+
for (const m of f) {
|
|
89
|
+
const n = E(m, {
|
|
90
|
+
...a !== void 0 && { maxFileSize: a },
|
|
91
|
+
...i !== void 0 && { allowedTypes: i }
|
|
92
|
+
});
|
|
93
|
+
if (n) {
|
|
94
|
+
d?.(n);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
t(m).then((l) => {
|
|
98
|
+
s.chain().focus().setImage({ src: l }).run();
|
|
99
|
+
}).catch((l) => {
|
|
100
|
+
c?.(l, m);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
onDrop: (s, f, m) => {
|
|
105
|
+
for (const n of f) {
|
|
106
|
+
const l = E(n, {
|
|
107
|
+
...a !== void 0 && { maxFileSize: a },
|
|
108
|
+
...i !== void 0 && { allowedTypes: i }
|
|
109
|
+
});
|
|
110
|
+
if (l) {
|
|
111
|
+
d?.(l);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
t(n).then((h) => {
|
|
115
|
+
const { schema: I } = s.state, x = I.nodes.image?.create({ src: h });
|
|
116
|
+
if (x) {
|
|
117
|
+
const b = s.state.tr.insert(m, x);
|
|
118
|
+
s.view.dispatch(b);
|
|
119
|
+
}
|
|
120
|
+
}).catch((h) => {
|
|
121
|
+
c?.(h, n);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
return [o, z, H];
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
k as VizelImage,
|
|
130
|
+
w as createVizelImageExtension,
|
|
131
|
+
K as createVizelImageUploadExtensions,
|
|
132
|
+
v as createVizelImageUploadPlugin,
|
|
133
|
+
N as createVizelImageUploadWithFileHandler,
|
|
134
|
+
M as createVizelImageUploader,
|
|
135
|
+
j as defaultImageResizeOptions,
|
|
136
|
+
C as getVizelImageUploadPluginKey,
|
|
137
|
+
T as handleVizelImageDrop,
|
|
138
|
+
y as handleVizelImagePaste,
|
|
139
|
+
E as validateVizelImageFile,
|
|
140
|
+
O as vizelDefaultBase64Upload
|
|
141
|
+
};
|