@lunejs/admin-ui 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/api/codegen/graphql.d.ts +1 -0
- package/dist/lib/api/codegen/graphql.js +8 -8
- package/dist/lib/custom-fields/components/details/is-list/custom-field-is-list.js +6 -4
- package/dist/lib/custom-fields/components/details/use-form/form-schema.d.ts +1 -0
- package/dist/lib/custom-fields/components/details/use-form/form-schema.js +4 -3
- package/dist/lib/custom-fields/components/fields/custom-field.js +44 -36
- package/dist/lib/custom-fields/components/fields/rich-text.d.ts +8 -0
- package/dist/lib/custom-fields/components/fields/rich-text.js +17 -0
- package/dist/lib/custom-fields/components/fields/shared/primitive.d.ts +2 -1
- package/dist/lib/custom-fields/components/fields/shared/primitive.js +67 -61
- package/dist/lib/custom-fields/utils/custom-field.utils.js +63 -51
- package/dist/lib/translate/components/form/translate-form-row-data.d.ts +2 -1
- package/dist/lib/translate/components/form/translate-form-row-data.js +51 -19
- package/dist/lib/translate/components/form/translate-rich-text.d.ts +8 -0
- package/dist/lib/translate/components/form/translate-rich-text.js +65 -0
- package/dist/lib/translate/components/product-form/custom-fields/translate-product-custom-fields.js +95 -63
- package/dist/lib/translate/components/product-form/translate-product-form.js +19 -18
- package/dist/node_modules/@tiptap/core/dist/index.js +876 -872
- package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
- package/dist/node_modules/@tiptap/react/dist/index.js +35 -34
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -1
- package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/layout-list.js +13 -0
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
- package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
- package/dist/node_modules/rope-sequence/dist/index.js +100 -0
- package/dist/shared/components/rich-editor/rich-editor.d.ts +3 -1
- package/dist/shared/components/rich-editor/rich-editor.js +40 -36
- package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.js +10 -9
- package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.js +1 -0
- package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.js +1 -0
- package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.js +5 -4
- package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.js +8 -7
- package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.js +1 -0
- package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.js +9 -8
- package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.js +7 -6
- package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { Extension as u, callOrReturn as w, getExtensionField as S, isNodeEmpty as P, isNodeSelection as v } from "../../core/dist/index.js";
|
|
2
|
+
import { Plugin as p, PluginKey as m } from "../../../prosemirror-state/dist/index.js";
|
|
3
|
+
import { dropCursor as z } from "../../../prosemirror-dropcursor/dist/index.js";
|
|
4
|
+
import { DecorationSet as f, Decoration as g } from "../../../prosemirror-view/dist/index.js";
|
|
5
|
+
import { gapCursor as N } from "../../../prosemirror-gapcursor/dist/index.js";
|
|
6
|
+
import { history as E, redo as M, undo as O } from "../../../prosemirror-history/dist/index.js";
|
|
7
|
+
u.create({
|
|
8
|
+
name: "characterCount",
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
limit: null,
|
|
12
|
+
mode: "textSize",
|
|
13
|
+
textCounter: (e) => e.length,
|
|
14
|
+
wordCounter: (e) => e.split(" ").filter((t) => t !== "").length
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
addStorage() {
|
|
18
|
+
return {
|
|
19
|
+
characters: () => 0,
|
|
20
|
+
words: () => 0
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
onBeforeCreate() {
|
|
24
|
+
this.storage.characters = (e) => {
|
|
25
|
+
const t = e?.node || this.editor.state.doc;
|
|
26
|
+
if ((e?.mode || this.options.mode) === "textSize") {
|
|
27
|
+
const r = t.textBetween(0, t.content.size, void 0, " ");
|
|
28
|
+
return this.options.textCounter(r);
|
|
29
|
+
}
|
|
30
|
+
return t.nodeSize;
|
|
31
|
+
}, this.storage.words = (e) => {
|
|
32
|
+
const t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
|
|
33
|
+
return this.options.wordCounter(n);
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
addProseMirrorPlugins() {
|
|
37
|
+
let e = !1;
|
|
38
|
+
return [
|
|
39
|
+
new p({
|
|
40
|
+
key: new m("characterCount"),
|
|
41
|
+
appendTransaction: (t, n, r) => {
|
|
42
|
+
if (e)
|
|
43
|
+
return;
|
|
44
|
+
const o = this.options.limit;
|
|
45
|
+
if (o == null || o === 0) {
|
|
46
|
+
e = !0;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const s = this.storage.characters({ node: r.doc });
|
|
50
|
+
if (s > o) {
|
|
51
|
+
const i = s - o, d = 0, a = i;
|
|
52
|
+
console.warn(
|
|
53
|
+
`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`
|
|
54
|
+
);
|
|
55
|
+
const c = r.tr.deleteRange(d, a);
|
|
56
|
+
return e = !0, c;
|
|
57
|
+
}
|
|
58
|
+
e = !0;
|
|
59
|
+
},
|
|
60
|
+
filterTransaction: (t, n) => {
|
|
61
|
+
const r = this.options.limit;
|
|
62
|
+
if (!t.docChanged || r === 0 || r === null || r === void 0)
|
|
63
|
+
return !0;
|
|
64
|
+
const o = this.storage.characters({ node: n.doc }), s = this.storage.characters({ node: t.doc });
|
|
65
|
+
if (s <= r || o > r && s > r && s <= o)
|
|
66
|
+
return !0;
|
|
67
|
+
if (o > r && s > r && s > o || !t.getMeta("paste"))
|
|
68
|
+
return !1;
|
|
69
|
+
const d = t.selection.$head.pos, a = s - r, c = d - a, l = d;
|
|
70
|
+
return t.deleteRange(c, l), !(this.storage.characters({ node: t.doc }) > r);
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
u.create({
|
|
77
|
+
name: "dropCursor",
|
|
78
|
+
addOptions() {
|
|
79
|
+
return {
|
|
80
|
+
color: "currentColor",
|
|
81
|
+
width: 1,
|
|
82
|
+
class: void 0
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
addProseMirrorPlugins() {
|
|
86
|
+
return [z(this.options)];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
u.create({
|
|
90
|
+
name: "focus",
|
|
91
|
+
addOptions() {
|
|
92
|
+
return {
|
|
93
|
+
className: "has-focus",
|
|
94
|
+
mode: "all"
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
addProseMirrorPlugins() {
|
|
98
|
+
return [
|
|
99
|
+
new p({
|
|
100
|
+
key: new m("focus"),
|
|
101
|
+
props: {
|
|
102
|
+
decorations: ({ doc: e, selection: t }) => {
|
|
103
|
+
const { isEditable: n, isFocused: r } = this.editor, { anchor: o } = t, s = [];
|
|
104
|
+
if (!n || !r)
|
|
105
|
+
return f.create(e, []);
|
|
106
|
+
let i = 0;
|
|
107
|
+
this.options.mode === "deepest" && e.descendants((a, c) => {
|
|
108
|
+
if (a.isText)
|
|
109
|
+
return;
|
|
110
|
+
if (!(o >= c && o <= c + a.nodeSize - 1))
|
|
111
|
+
return !1;
|
|
112
|
+
i += 1;
|
|
113
|
+
});
|
|
114
|
+
let d = 0;
|
|
115
|
+
return e.descendants((a, c) => {
|
|
116
|
+
if (a.isText || !(o >= c && o <= c + a.nodeSize - 1))
|
|
117
|
+
return !1;
|
|
118
|
+
if (d += 1, this.options.mode === "deepest" && i - d > 0 || this.options.mode === "shallowest" && d > 1)
|
|
119
|
+
return this.options.mode === "deepest";
|
|
120
|
+
s.push(
|
|
121
|
+
g.node(c, c + a.nodeSize, {
|
|
122
|
+
class: this.options.className
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}), f.create(e, s);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
u.create({
|
|
133
|
+
name: "gapCursor",
|
|
134
|
+
addProseMirrorPlugins() {
|
|
135
|
+
return [N()];
|
|
136
|
+
},
|
|
137
|
+
extendNodeSchema(e) {
|
|
138
|
+
var t;
|
|
139
|
+
const n = {
|
|
140
|
+
name: e.name,
|
|
141
|
+
options: e.options,
|
|
142
|
+
storage: e.storage
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
allowGapCursor: (t = w(S(e, "allowGapCursor", n))) != null ? t : null
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
u.create({
|
|
150
|
+
name: "placeholder",
|
|
151
|
+
addOptions() {
|
|
152
|
+
return {
|
|
153
|
+
emptyEditorClass: "is-editor-empty",
|
|
154
|
+
emptyNodeClass: "is-empty",
|
|
155
|
+
placeholder: "Write something …",
|
|
156
|
+
showOnlyWhenEditable: !0,
|
|
157
|
+
showOnlyCurrent: !0,
|
|
158
|
+
includeChildren: !1
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
addProseMirrorPlugins() {
|
|
162
|
+
return [
|
|
163
|
+
new p({
|
|
164
|
+
key: new m("placeholder"),
|
|
165
|
+
props: {
|
|
166
|
+
decorations: ({ doc: e, selection: t }) => {
|
|
167
|
+
const n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: r } = t, o = [];
|
|
168
|
+
if (!n)
|
|
169
|
+
return null;
|
|
170
|
+
const s = this.editor.isEmpty;
|
|
171
|
+
return e.descendants((i, d) => {
|
|
172
|
+
const a = r >= d && r <= d + i.nodeSize, c = !i.isLeaf && P(i);
|
|
173
|
+
if ((a || !this.options.showOnlyCurrent) && c) {
|
|
174
|
+
const l = [this.options.emptyNodeClass];
|
|
175
|
+
s && l.push(this.options.emptyEditorClass);
|
|
176
|
+
const h = g.node(d, d + i.nodeSize, {
|
|
177
|
+
class: l.join(" "),
|
|
178
|
+
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
179
|
+
editor: this.editor,
|
|
180
|
+
node: i,
|
|
181
|
+
pos: d,
|
|
182
|
+
hasAnchor: a
|
|
183
|
+
}) : this.options.placeholder
|
|
184
|
+
});
|
|
185
|
+
o.push(h);
|
|
186
|
+
}
|
|
187
|
+
return this.options.includeChildren;
|
|
188
|
+
}), f.create(e, o);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
u.create({
|
|
196
|
+
name: "selection",
|
|
197
|
+
addOptions() {
|
|
198
|
+
return {
|
|
199
|
+
className: "selection"
|
|
200
|
+
};
|
|
201
|
+
},
|
|
202
|
+
addProseMirrorPlugins() {
|
|
203
|
+
const { editor: e, options: t } = this;
|
|
204
|
+
return [
|
|
205
|
+
new p({
|
|
206
|
+
key: new m("selection"),
|
|
207
|
+
props: {
|
|
208
|
+
decorations(n) {
|
|
209
|
+
return n.selection.empty || e.isFocused || !e.isEditable || v(n.selection) || e.view.dragging ? null : f.create(n.doc, [
|
|
210
|
+
g.inline(n.selection.from, n.selection.to, {
|
|
211
|
+
class: t.className
|
|
212
|
+
})
|
|
213
|
+
]);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
function y({ types: e, node: t }) {
|
|
221
|
+
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
222
|
+
}
|
|
223
|
+
var k = u.create({
|
|
224
|
+
name: "trailingNode",
|
|
225
|
+
addOptions() {
|
|
226
|
+
return {
|
|
227
|
+
node: void 0,
|
|
228
|
+
notAfter: []
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
addProseMirrorPlugins() {
|
|
232
|
+
var e;
|
|
233
|
+
const t = new m(this.name), n = this.options.node || ((e = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : e.name) || "paragraph", r = Object.entries(this.editor.schema.nodes).map(([, o]) => o).filter((o) => (this.options.notAfter || []).concat(n).includes(o.name));
|
|
234
|
+
return [
|
|
235
|
+
new p({
|
|
236
|
+
key: t,
|
|
237
|
+
appendTransaction: (o, s, i) => {
|
|
238
|
+
const { doc: d, tr: a, schema: c } = i, l = t.getState(i), h = d.content.size, C = c.nodes[n];
|
|
239
|
+
if (l)
|
|
240
|
+
return a.insert(h, C.create());
|
|
241
|
+
},
|
|
242
|
+
state: {
|
|
243
|
+
init: (o, s) => {
|
|
244
|
+
const i = s.tr.doc.lastChild;
|
|
245
|
+
return !y({ node: i, types: r });
|
|
246
|
+
},
|
|
247
|
+
apply: (o, s) => {
|
|
248
|
+
if (!o.docChanged || o.getMeta("__uniqueIDTransaction"))
|
|
249
|
+
return s;
|
|
250
|
+
const i = o.doc.lastChild;
|
|
251
|
+
return !y({ node: i, types: r });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
})
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
u.create({
|
|
259
|
+
name: "undoRedo",
|
|
260
|
+
addOptions() {
|
|
261
|
+
return {
|
|
262
|
+
depth: 100,
|
|
263
|
+
newGroupDelay: 500
|
|
264
|
+
};
|
|
265
|
+
},
|
|
266
|
+
addCommands() {
|
|
267
|
+
return {
|
|
268
|
+
undo: () => ({ state: e, dispatch: t }) => O(e, t),
|
|
269
|
+
redo: () => ({ state: e, dispatch: t }) => M(e, t)
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
addProseMirrorPlugins() {
|
|
273
|
+
return [E(this.options)];
|
|
274
|
+
},
|
|
275
|
+
addKeyboardShortcuts() {
|
|
276
|
+
return {
|
|
277
|
+
"Mod-z": () => this.editor.commands.undo(),
|
|
278
|
+
"Shift-Mod-z": () => this.editor.commands.redo(),
|
|
279
|
+
"Mod-y": () => this.editor.commands.redo(),
|
|
280
|
+
// Russian keyboard layouts
|
|
281
|
+
"Mod-я": () => this.editor.commands.undo(),
|
|
282
|
+
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
export {
|
|
287
|
+
k as TrailingNode
|
|
288
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import o, { useContext as l, createContext as h, useRef as
|
|
1
|
+
import o, { useContext as l, createContext as h, useRef as g, useState as p, useDebugValue as m, useEffect as f, forwardRef as C, useLayoutEffect as y } from "react";
|
|
2
2
|
import w from "react-dom";
|
|
3
3
|
import { s as b } from "../../../../_virtual/index6.js";
|
|
4
4
|
import { jsxs as R, Fragment as v, jsx as a } from "react/jsx-runtime";
|
|
5
5
|
import { Editor as x } from "../../core/dist/index.js";
|
|
6
|
-
import { CommandManager as Z, Extendable as $, Extension as ee, InputRule as te, MappablePosition as ne, Mark as re, Node as ie, NodePos as se, PasteRule as oe, callOrReturn as ae, combineTransactionSteps as de, commands as ue, createAtomBlockMarkdownSpec as ce, createBlockMarkdownSpec as le, createChainableState as he, createDocument as pe, createInlineMarkdownSpec as me, createMappablePosition as fe, createNodeFromContent as be, createStyleTag as ve, defaultBlockAt as Ee, deleteProps as
|
|
6
|
+
import { CommandManager as Z, Extendable as $, Extension as ee, InputRule as te, MappablePosition as ne, Mark as re, Node as ie, NodePos as se, PasteRule as oe, callOrReturn as ae, combineTransactionSteps as de, commands as ue, createAtomBlockMarkdownSpec as ce, createBlockMarkdownSpec as le, createChainableState as he, createDocument as pe, createInlineMarkdownSpec as me, createMappablePosition as fe, createNodeFromContent as be, createStyleTag as ve, defaultBlockAt as Ee, deleteProps as Se, elementFromString as ge, extensions as Ce, findChildrenInRange as ye, findDuplicates as we, findParentNode as Re, findParentNodeClosestToPos as xe, flattenExtensions as Ne, fromString as De, getAttributes as Te, getAttributesFromExtensions as _e, getChangedRanges as Me, getExtensionField as Ie, getHTMLFromFragment as Ae, getMarkAttributes as Pe, getMarkRange as Oe, getMarkType as ke, getMarksBetween as Be, getNodeAtPosition as Fe, getNodeAttributes as Ve, getNodeType as ze, getRenderedAttributes as Ue, getSchemaByResolvedExtensions as je, getSchemaTypeByName as qe, getSchemaTypeNameByName as Le, getSplittedAttributes as We, getText as He, getTextBetween as Ke, getTextContentFromNodes as Ge, getTextSerializersFromSchema as Je, getUpdatedPosition as Qe, injectExtensionAttributesToParseRule as Xe, inputRulesPlugin as Ye, isActive as Ze, isAndroid as $e, isAtEndOfNode as et, isAtStartOfNode as tt, isEmptyObject as nt, isExtensionRulesEnabled as rt, isFunction as it, isList as st, isMacOS as ot, isMarkActive as at, isNodeActive as dt, isNodeEmpty as ut, isNodeSelection as ct, isNumber as lt, isPlainObject as ht, isRegExp as pt, isTextSelection as mt, isiOS as ft, markInputRule as bt, markPasteRule as vt, markdown as Et, mergeAttributes as St, mergeDeep as gt, minMax as Ct, objectIncludes as yt, parseAttributes as wt, parseIndentedBlocks as Rt, pasteRulesPlugin as xt, removeDuplicates as Nt, renderNestedMarkdownContent as Dt, resolveExtensions as Tt, resolveFocusPosition as _t, selectionToInsertionEnd as Mt, serializeAttributes as It, sortExtensions as At, splitExtensions as Pt, textblockTypeInputRule as Ot, updateMarkViewAttributes as kt, wrappingInputRule as Bt } from "../../core/dist/index.js";
|
|
7
7
|
import { deepEqual as N } from "../../../fast-equals/dist/es/index.js";
|
|
8
8
|
import { w as D } from "../../../../_virtual/with-selector.js";
|
|
9
9
|
var T = (...r) => (e) => {
|
|
@@ -330,7 +330,7 @@ var c = process.env.NODE_ENV !== "production", d = typeof window > "u", B = d ||
|
|
|
330
330
|
}
|
|
331
331
|
};
|
|
332
332
|
function J(r = {}, e = []) {
|
|
333
|
-
const t =
|
|
333
|
+
const t = g(r);
|
|
334
334
|
t.current = r;
|
|
335
335
|
const [n] = p(() => new F(t)), i = b.useSyncExternalStore(
|
|
336
336
|
n.subscribe,
|
|
@@ -342,11 +342,11 @@ function J(r = {}, e = []) {
|
|
|
342
342
|
selector: ({ transactionNumber: s }) => r.shouldRerenderOnTransaction === !1 || r.shouldRerenderOnTransaction === void 0 ? null : r.immediatelyRender && s === 0 ? 0 : s + 1
|
|
343
343
|
}), i;
|
|
344
344
|
}
|
|
345
|
-
var
|
|
345
|
+
var S = h({
|
|
346
346
|
editor: null
|
|
347
347
|
});
|
|
348
|
-
|
|
349
|
-
var Q = () => l(
|
|
348
|
+
S.Consumer;
|
|
349
|
+
var Q = () => l(S), V = h({
|
|
350
350
|
onDragStart: () => {
|
|
351
351
|
},
|
|
352
352
|
nodeViewContentChildren: void 0,
|
|
@@ -380,7 +380,7 @@ export {
|
|
|
380
380
|
Z as CommandManager,
|
|
381
381
|
x as Editor,
|
|
382
382
|
G as EditorContent,
|
|
383
|
-
|
|
383
|
+
S as EditorContext,
|
|
384
384
|
$ as Extendable,
|
|
385
385
|
ee as Extension,
|
|
386
386
|
te as InputRule,
|
|
@@ -403,8 +403,8 @@ export {
|
|
|
403
403
|
be as createNodeFromContent,
|
|
404
404
|
ve as createStyleTag,
|
|
405
405
|
Ee as defaultBlockAt,
|
|
406
|
-
|
|
407
|
-
|
|
406
|
+
Se as deleteProps,
|
|
407
|
+
ge as elementFromString,
|
|
408
408
|
Ce as extensions,
|
|
409
409
|
ye as findChildrenInRange,
|
|
410
410
|
we as findDuplicates,
|
|
@@ -448,34 +448,35 @@ export {
|
|
|
448
448
|
at as isMarkActive,
|
|
449
449
|
dt as isNodeActive,
|
|
450
450
|
ut as isNodeEmpty,
|
|
451
|
-
ct as
|
|
452
|
-
lt as
|
|
453
|
-
ht as
|
|
454
|
-
pt as
|
|
455
|
-
mt as
|
|
456
|
-
ft as
|
|
457
|
-
bt as
|
|
458
|
-
vt as
|
|
459
|
-
Et as
|
|
451
|
+
ct as isNodeSelection,
|
|
452
|
+
lt as isNumber,
|
|
453
|
+
ht as isPlainObject,
|
|
454
|
+
pt as isRegExp,
|
|
455
|
+
mt as isTextSelection,
|
|
456
|
+
ft as isiOS,
|
|
457
|
+
bt as markInputRule,
|
|
458
|
+
vt as markPasteRule,
|
|
459
|
+
Et as markdown,
|
|
460
|
+
St as mergeAttributes,
|
|
460
461
|
gt as mergeDeep,
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
462
|
+
Ct as minMax,
|
|
463
|
+
yt as objectIncludes,
|
|
464
|
+
wt as parseAttributes,
|
|
465
|
+
Rt as parseIndentedBlocks,
|
|
466
|
+
xt as pasteRulesPlugin,
|
|
467
|
+
Nt as removeDuplicates,
|
|
468
|
+
Dt as renderNestedMarkdownContent,
|
|
469
|
+
Tt as resolveExtensions,
|
|
470
|
+
_t as resolveFocusPosition,
|
|
471
|
+
Mt as selectionToInsertionEnd,
|
|
472
|
+
It as serializeAttributes,
|
|
473
|
+
At as sortExtensions,
|
|
474
|
+
Pt as splitExtensions,
|
|
475
|
+
Ot as textblockTypeInputRule,
|
|
476
|
+
kt as updateMarkViewAttributes,
|
|
476
477
|
Q as useCurrentEditor,
|
|
477
478
|
J as useEditor,
|
|
478
479
|
k as useEditorState,
|
|
479
480
|
z as useReactNodeView,
|
|
480
|
-
|
|
481
|
+
Bt as wrappingInputRule
|
|
481
482
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import t from "../createLucideIcon.js";
|
|
2
|
+
const e = [
|
|
3
|
+
["rect", { width: "7", height: "7", x: "3", y: "3", rx: "1", key: "1g98yp" }],
|
|
4
|
+
["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }],
|
|
5
|
+
["path", { d: "M14 4h7", key: "3xa0d5" }],
|
|
6
|
+
["path", { d: "M14 9h7", key: "1icrd9" }],
|
|
7
|
+
["path", { d: "M14 15h7", key: "1mj8o2" }],
|
|
8
|
+
["path", { d: "M14 20h7", key: "11slyb" }]
|
|
9
|
+
], y = t("layout-list", e);
|
|
10
|
+
export {
|
|
11
|
+
e as __iconNode,
|
|
12
|
+
y as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Plugin as w } from "../../prosemirror-state/dist/index.js";
|
|
2
|
+
import { dropPoint as v } from "../../prosemirror-transform/dist/index.js";
|
|
3
|
+
function y(m = {}) {
|
|
4
|
+
return new w({
|
|
5
|
+
view(e) {
|
|
6
|
+
return new C(e, m);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
class C {
|
|
11
|
+
constructor(e, t) {
|
|
12
|
+
var i;
|
|
13
|
+
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (i = t.width) !== null && i !== void 0 ? i : 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((s) => {
|
|
14
|
+
let d = (r) => {
|
|
15
|
+
this[s](r);
|
|
16
|
+
};
|
|
17
|
+
return e.dom.addEventListener(s, d), { name: s, handler: d };
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
destroy() {
|
|
21
|
+
this.handlers.forEach(({ name: e, handler: t }) => this.editorView.dom.removeEventListener(e, t));
|
|
22
|
+
}
|
|
23
|
+
update(e, t) {
|
|
24
|
+
this.cursorPos != null && t.doc != e.state.doc && (this.cursorPos > e.state.doc.content.size ? this.setCursor(null) : this.updateOverlay());
|
|
25
|
+
}
|
|
26
|
+
setCursor(e) {
|
|
27
|
+
e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
|
|
28
|
+
}
|
|
29
|
+
updateOverlay() {
|
|
30
|
+
let e = this.editorView.state.doc.resolve(this.cursorPos), t = !e.parent.inlineContent, i, s = this.editorView.dom, d = s.getBoundingClientRect(), r = d.width / s.offsetWidth, h = d.height / s.offsetHeight;
|
|
31
|
+
if (t) {
|
|
32
|
+
let o = e.nodeBefore, n = e.nodeAfter;
|
|
33
|
+
if (o || n) {
|
|
34
|
+
let a = this.editorView.nodeDOM(this.cursorPos - (o ? o.nodeSize : 0));
|
|
35
|
+
if (a) {
|
|
36
|
+
let c = a.getBoundingClientRect(), u = o ? c.bottom : c.top;
|
|
37
|
+
o && n && (u = (u + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
|
|
38
|
+
let g = this.width / 2 * h;
|
|
39
|
+
i = { left: c.left, right: c.right, top: u - g, bottom: u + g };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!i) {
|
|
44
|
+
let o = this.editorView.coordsAtPos(this.cursorPos), n = this.width / 2 * r;
|
|
45
|
+
i = { left: o.left - n, right: o.left + n, top: o.top, bottom: o.bottom };
|
|
46
|
+
}
|
|
47
|
+
let l = this.editorView.dom.offsetParent;
|
|
48
|
+
this.element || (this.element = l.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", t), this.element.classList.toggle("prosemirror-dropcursor-inline", !t);
|
|
49
|
+
let f, p;
|
|
50
|
+
if (!l || l == document.body && getComputedStyle(l).position == "static")
|
|
51
|
+
f = -pageXOffset, p = -pageYOffset;
|
|
52
|
+
else {
|
|
53
|
+
let o = l.getBoundingClientRect(), n = o.width / l.offsetWidth, a = o.height / l.offsetHeight;
|
|
54
|
+
f = o.left - l.scrollLeft * n, p = o.top - l.scrollTop * a;
|
|
55
|
+
}
|
|
56
|
+
this.element.style.left = (i.left - f) / r + "px", this.element.style.top = (i.top - p) / h + "px", this.element.style.width = (i.right - i.left) / r + "px", this.element.style.height = (i.bottom - i.top) / h + "px";
|
|
57
|
+
}
|
|
58
|
+
scheduleRemoval(e) {
|
|
59
|
+
clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
|
|
60
|
+
}
|
|
61
|
+
dragover(e) {
|
|
62
|
+
if (!this.editorView.editable)
|
|
63
|
+
return;
|
|
64
|
+
let t = this.editorView.posAtCoords({ left: e.clientX, top: e.clientY }), i = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), s = i && i.type.spec.disableDropCursor, d = typeof s == "function" ? s(this.editorView, t, e) : s;
|
|
65
|
+
if (t && !d) {
|
|
66
|
+
let r = t.pos;
|
|
67
|
+
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
68
|
+
let h = v(this.editorView.state.doc, r, this.editorView.dragging.slice);
|
|
69
|
+
h != null && (r = h);
|
|
70
|
+
}
|
|
71
|
+
this.setCursor(r), this.scheduleRemoval(5e3);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
dragend() {
|
|
75
|
+
this.scheduleRemoval(20);
|
|
76
|
+
}
|
|
77
|
+
drop() {
|
|
78
|
+
this.scheduleRemoval(20);
|
|
79
|
+
}
|
|
80
|
+
dragleave(e) {
|
|
81
|
+
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
y as dropCursor
|
|
86
|
+
};
|