@opencloud-eu/web-pkg 7.0.0 → 7.0.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/assets/worker-BJYfkZQP.js +25 -0
- package/dist/assets/worker-CXvpBk--.js +25 -0
- package/dist/assets/worker-liEKqzWv.js +25 -0
- package/dist/{components-DGm07xAo.js → components-GUHsaO1-.js} +2900 -2885
- package/dist/src/composables/piniaStores/capabilities.d.ts +1 -13
- package/dist/web-pkg/editor.js +171 -180
- package/dist/web-pkg.css +3 -0
- package/dist/web-pkg.js +240 -226
- package/package.json +15 -5
- package/dist/assets/worker-B8V6K8WY.js +0 -25
- package/dist/assets/worker-BjLAp2qA.js +0 -25
- package/dist/assets/worker-Cz7k4ET0.js +0 -25
package/dist/web-pkg/editor.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Aa as e, Ba as t, Ea as n, Ia as r, Ja as i, La as a, Na as o, Oa as s, Pa as c, Ra as l, Sa as u, Ta as d, Ua as f, Va as p, Xa as m, Ya as h, ba as g, ca as _, eo as v, ga as y, ha as b, ja as x, no as S, o as C, pn as w, qa as T,
|
|
2
|
-
import { useGettext as
|
|
3
|
-
import { EditorContent as
|
|
4
|
-
import { Extension as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { Table as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { BackgroundColor as
|
|
14
|
-
import { Markdown as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
1
|
+
import { Aa as e, Ba as t, Ea as n, Ia as r, Ja as i, La as a, Na as o, Oa as s, Pa as c, Ra as l, Sa as u, Ta as d, Ua as f, Va as p, Xa as m, Ya as h, ba as g, ca as _, eo as v, ga as y, ha as b, ja as x, no as S, o as C, pn as w, qa as T, ro as E, va as D, xa as O, ya as k, za as A } from "../components-GUHsaO1-.js";
|
|
2
|
+
import { useGettext as j } from "vue3-gettext";
|
|
3
|
+
import { EditorContent as M, VueRenderer as N, useEditor as P } from "@tiptap/vue-3";
|
|
4
|
+
import { Extension as F } from "@tiptap/core";
|
|
5
|
+
import I from "@tiptap/suggestion";
|
|
6
|
+
import L from "@tiptap/starter-kit";
|
|
7
|
+
import R from "@tiptap/extension-underline";
|
|
8
|
+
import z from "@tiptap/extension-link";
|
|
9
|
+
import B from "@tiptap/extension-image";
|
|
10
|
+
import { Table as V, TableCell as H, TableHeader as U, TableRow as W } from "@tiptap/extension-table";
|
|
11
|
+
import G from "@tiptap/extension-task-list";
|
|
12
|
+
import K from "@tiptap/extension-task-item";
|
|
13
|
+
import { BackgroundColor as q, Color as J, FontFamily as Y, FontSize as X, LineHeight as Z, TextStyle as Q } from "@tiptap/extension-text-style";
|
|
14
|
+
import { Markdown as ee } from "@tiptap/markdown";
|
|
15
|
+
import te from "@tiptap/extension-document";
|
|
16
|
+
import ne from "@tiptap/extension-paragraph";
|
|
17
|
+
import re from "@tiptap/extension-text";
|
|
18
|
+
import ie from "@tiptap/extension-hard-break";
|
|
19
19
|
//#region src/editor/components/SlashCommandMenu.vue?vue&type=script&setup=true&lang.ts
|
|
20
|
-
var
|
|
20
|
+
var ae = { class: "text-editor-slash-menu" }, oe = ["textContent"], se = { class: "text-editor-slash-menu__item-text" }, ce = ["textContent"], le = ["textContent"], ue = {
|
|
21
21
|
key: 1,
|
|
22
22
|
class: "text-editor-slash-menu__empty"
|
|
23
|
-
},
|
|
23
|
+
}, de = /* @__PURE__ */ n({
|
|
24
24
|
__name: "SlashCommandMenu",
|
|
25
25
|
props: {
|
|
26
26
|
editor: {},
|
|
@@ -37,7 +37,7 @@ var ie = { class: "text-editor-slash-menu" }, ae = ["textContent"], oe = { class
|
|
|
37
37
|
i(() => o.items, () => {
|
|
38
38
|
p.value = 0;
|
|
39
39
|
});
|
|
40
|
-
let m =
|
|
40
|
+
let m = D(() => {
|
|
41
41
|
let e = [], t = null;
|
|
42
42
|
return o.items.forEach((n, r) => {
|
|
43
43
|
(!t || t.id !== n.groupId) && (t = {
|
|
@@ -64,23 +64,23 @@ var ie = { class: "text-editor-slash-menu" }, ae = ["textContent"], oe = { class
|
|
|
64
64
|
i(p, async () => {
|
|
65
65
|
await e(), (s.value?.$el?.querySelector(".text-editor-slash-menu__item--selected"))?.scrollIntoView({ block: "nearest" });
|
|
66
66
|
});
|
|
67
|
-
let
|
|
68
|
-
s.value?.update?.({ anchorElement:
|
|
69
|
-
},
|
|
67
|
+
let S = () => {
|
|
68
|
+
s.value?.update?.({ anchorElement: w() });
|
|
69
|
+
}, w = () => {
|
|
70
70
|
let e = o.clientRect?.();
|
|
71
71
|
return e ? { getBoundingClientRect: () => e } : null;
|
|
72
72
|
};
|
|
73
73
|
return c(async () => {
|
|
74
74
|
await e(), s.value?.show?.({
|
|
75
|
-
anchorElement:
|
|
75
|
+
anchorElement: w(),
|
|
76
76
|
noFocus: !0
|
|
77
77
|
});
|
|
78
78
|
}), a({
|
|
79
|
-
onUpdate:
|
|
79
|
+
onUpdate: S,
|
|
80
80
|
onKeyDown: b
|
|
81
81
|
}), (e, n) => {
|
|
82
82
|
let i = t("oc-icon"), a = t("oc-button");
|
|
83
|
-
return r(), g(
|
|
83
|
+
return r(), g(E(C), {
|
|
84
84
|
ref_key: "dropRef",
|
|
85
85
|
ref: s,
|
|
86
86
|
mode: "manual",
|
|
@@ -88,13 +88,13 @@ var ie = { class: "text-editor-slash-menu" }, ae = ["textContent"], oe = { class
|
|
|
88
88
|
class: "z-10001",
|
|
89
89
|
"enforce-drop-on-mobile": ""
|
|
90
90
|
}, {
|
|
91
|
-
default: h(() => [
|
|
91
|
+
default: h(() => [k("div", ae, [m.value.length ? (r(!0), u(y, { key: 0 }, l(m.value, (e) => (r(), u("div", {
|
|
92
92
|
key: e.id,
|
|
93
93
|
class: "text-editor-slash-menu__group"
|
|
94
|
-
}, [
|
|
94
|
+
}, [k("div", {
|
|
95
95
|
class: "text-editor-slash-menu__group-title",
|
|
96
96
|
textContent: f(e.title)
|
|
97
|
-
}, null, 8,
|
|
97
|
+
}, null, 8, oe), k("ul", null, [(r(!0), u(y, null, l(e.entries, (e) => (r(), u("li", { key: `slash-command-item-${e.item.id}` }, [d(a, {
|
|
98
98
|
appearance: "raw",
|
|
99
99
|
class: x(["text-editor-slash-menu__item", { "text-editor-slash-menu__item--selected": e.index === p.value }]),
|
|
100
100
|
onClick: (t) => _(e.item)
|
|
@@ -105,16 +105,16 @@ var ie = { class: "text-editor-slash-menu" }, ae = ["textContent"], oe = { class
|
|
|
105
105
|
"fill-type": e.item.iconFillType || "none",
|
|
106
106
|
size: "small",
|
|
107
107
|
class: "text-editor-slash-menu__item-icon"
|
|
108
|
-
}, null, 8, ["name", "fill-type"])) :
|
|
108
|
+
}, null, 8, ["name", "fill-type"])) : O("", !0), k("span", se, [k("span", {
|
|
109
109
|
class: "text-editor-slash-menu__item-title",
|
|
110
110
|
textContent: f(e.item.title)
|
|
111
|
-
}, null, 8,
|
|
111
|
+
}, null, 8, ce), e.item.description ? (r(), u("span", {
|
|
112
112
|
key: 0,
|
|
113
113
|
class: "text-editor-slash-menu__item-description",
|
|
114
114
|
textContent: f(e.item.description)
|
|
115
|
-
}, null, 8,
|
|
115
|
+
}, null, 8, le)) : O("", !0)])]),
|
|
116
116
|
_: 2
|
|
117
|
-
}, 1032, ["class", "onClick"])]))), 128))])]))), 128)) : (r(), u("div",
|
|
117
|
+
}, 1032, ["class", "onClick"])]))), 128))])]))), 128)) : (r(), u("div", ue, f(e.$gettext("No matching commands")), 1))])]),
|
|
118
118
|
_: 1
|
|
119
119
|
}, 512);
|
|
120
120
|
};
|
|
@@ -122,7 +122,7 @@ var ie = { class: "text-editor-slash-menu" }, ae = ["textContent"], oe = { class
|
|
|
122
122
|
});
|
|
123
123
|
//#endregion
|
|
124
124
|
//#region src/editor/extensions/slashCommands.ts
|
|
125
|
-
function
|
|
125
|
+
function fe(e, t, n) {
|
|
126
126
|
let r = t.trim().toLowerCase(), i = [];
|
|
127
127
|
for (let t of e) for (let e of t.actions) if (!(e.showInSlashCommands === !1 || e.isEnabled && !e.isEnabled(n))) {
|
|
128
128
|
if (!r) {
|
|
@@ -145,17 +145,17 @@ function de(e, t, n) {
|
|
|
145
145
|
}
|
|
146
146
|
return i;
|
|
147
147
|
}
|
|
148
|
-
var
|
|
148
|
+
var pe = F.create({
|
|
149
149
|
name: "slashCommands",
|
|
150
150
|
addOptions() {
|
|
151
151
|
return { getGroups: () => [] };
|
|
152
152
|
},
|
|
153
153
|
addProseMirrorPlugins() {
|
|
154
|
-
return [
|
|
154
|
+
return [I({
|
|
155
155
|
editor: this.editor,
|
|
156
156
|
char: "/",
|
|
157
157
|
startOfLine: !1,
|
|
158
|
-
items: ({ query: e, editor: t }) =>
|
|
158
|
+
items: ({ query: e, editor: t }) => fe(this.options.getGroups(), e, t),
|
|
159
159
|
command: ({ editor: e, range: t, props: n }) => {
|
|
160
160
|
n.slashCommandAction({
|
|
161
161
|
editor: e,
|
|
@@ -166,7 +166,7 @@ var fe = P.create({
|
|
|
166
166
|
let e = null, t = () => e?.ref ?? null;
|
|
167
167
|
return {
|
|
168
168
|
onStart: (t) => {
|
|
169
|
-
e = new
|
|
169
|
+
e = new N(de, {
|
|
170
170
|
props: t,
|
|
171
171
|
editor: t.editor
|
|
172
172
|
}), e.el && document.body.appendChild(e.el);
|
|
@@ -186,7 +186,7 @@ var fe = P.create({
|
|
|
186
186
|
//#endregion
|
|
187
187
|
//#region src/editor/composables/useEditorActions.ts
|
|
188
188
|
function $(e, t = {}) {
|
|
189
|
-
let { $gettext: n } =
|
|
189
|
+
let { $gettext: n } = j(), { dispatchModal: r } = w(), i = () => ({
|
|
190
190
|
id: "undo",
|
|
191
191
|
title: n("Undo"),
|
|
192
192
|
icon: "arrow-go-back",
|
|
@@ -505,7 +505,7 @@ function $(e, t = {}) {
|
|
|
505
505
|
e.chain().focus().deleteRange(t).toggleBlockquote().run();
|
|
506
506
|
},
|
|
507
507
|
isActive: (e) => e.isActive("blockquote")
|
|
508
|
-
}),
|
|
508
|
+
}), S = () => ({
|
|
509
509
|
id: "code-block",
|
|
510
510
|
title: n("Code block"),
|
|
511
511
|
description: n("Preformatted code block"),
|
|
@@ -516,7 +516,7 @@ function $(e, t = {}) {
|
|
|
516
516
|
e.chain().focus().deleteRange(t).toggleCodeBlock().run();
|
|
517
517
|
},
|
|
518
518
|
isActive: (e) => e.isActive("codeBlock")
|
|
519
|
-
}),
|
|
519
|
+
}), C = () => ({
|
|
520
520
|
id: "bullet-list",
|
|
521
521
|
title: n("Bullet list"),
|
|
522
522
|
description: n("Unordered list of items"),
|
|
@@ -527,7 +527,7 @@ function $(e, t = {}) {
|
|
|
527
527
|
e.chain().focus().deleteRange(t).toggleBulletList().run();
|
|
528
528
|
},
|
|
529
529
|
isActive: (e) => e.isActive("bulletList")
|
|
530
|
-
}),
|
|
530
|
+
}), T = () => ({
|
|
531
531
|
id: "ordered-list",
|
|
532
532
|
title: n("Ordered list"),
|
|
533
533
|
description: n("Numbered list of items"),
|
|
@@ -554,7 +554,7 @@ function $(e, t = {}) {
|
|
|
554
554
|
title: n("Link"),
|
|
555
555
|
icon: "link",
|
|
556
556
|
toolbarAction: (e) => {
|
|
557
|
-
let n =
|
|
557
|
+
let n = E(t);
|
|
558
558
|
if (n.onRequestLinkUrl) {
|
|
559
559
|
let t = e.getAttributes("link").href;
|
|
560
560
|
n.onRequestLinkUrl(e, t);
|
|
@@ -582,7 +582,7 @@ function $(e, t = {}) {
|
|
|
582
582
|
!n || !/^https?:\/\//i.test(n) || e.chain().focus().setImage({ src: n }).run();
|
|
583
583
|
}
|
|
584
584
|
});
|
|
585
|
-
},
|
|
585
|
+
}, A = () => ({
|
|
586
586
|
id: "image-url",
|
|
587
587
|
title: n("Image from URL"),
|
|
588
588
|
description: n("Insert an image from a web URL"),
|
|
@@ -627,7 +627,7 @@ function $(e, t = {}) {
|
|
|
627
627
|
"url"
|
|
628
628
|
],
|
|
629
629
|
showInSlashCommands: !1,
|
|
630
|
-
childActions: [M(),
|
|
630
|
+
childActions: [M(), A()],
|
|
631
631
|
isActive: () => !1
|
|
632
632
|
}), P = (e) => {
|
|
633
633
|
let t = document.createElement("input");
|
|
@@ -801,13 +801,13 @@ function $(e, t = {}) {
|
|
|
801
801
|
codeInline: m,
|
|
802
802
|
lineHeight: b,
|
|
803
803
|
blockquote: x,
|
|
804
|
-
codeBlock:
|
|
805
|
-
bulletList:
|
|
806
|
-
orderedList:
|
|
804
|
+
codeBlock: S,
|
|
805
|
+
bulletList: C,
|
|
806
|
+
orderedList: T,
|
|
807
807
|
taskList: D,
|
|
808
808
|
link: O,
|
|
809
809
|
image: N,
|
|
810
|
-
imageUrl:
|
|
810
|
+
imageUrl: A,
|
|
811
811
|
imageUpload: M,
|
|
812
812
|
horizontalRule: F,
|
|
813
813
|
tableMenu: () => ({
|
|
@@ -836,10 +836,10 @@ function $(e, t = {}) {
|
|
|
836
836
|
}
|
|
837
837
|
//#endregion
|
|
838
838
|
//#region src/editor/composables/strategies/html.ts
|
|
839
|
-
var
|
|
840
|
-
let { $gettext: t } =
|
|
841
|
-
|
|
842
|
-
|
|
839
|
+
var me = (e) => {
|
|
840
|
+
let { $gettext: t } = j(), n = () => "html", r = (e) => e.getHTML(), i = (e) => e, a = () => [
|
|
841
|
+
L.configure({ link: !1 }),
|
|
842
|
+
z.configure({
|
|
843
843
|
openOnClick: !0,
|
|
844
844
|
autolink: !0,
|
|
845
845
|
linkOnPaste: !0,
|
|
@@ -848,21 +848,21 @@ var pe = (e) => {
|
|
|
848
848
|
rel: "noopener noreferrer"
|
|
849
849
|
}
|
|
850
850
|
}),
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
U,
|
|
854
|
-
V,
|
|
855
|
-
H,
|
|
851
|
+
B.configure({ inline: !1 }),
|
|
852
|
+
V.configure({ resizable: !1 }),
|
|
856
853
|
W,
|
|
857
|
-
|
|
854
|
+
H,
|
|
855
|
+
U,
|
|
856
|
+
G,
|
|
857
|
+
K.configure({ nested: !0 }),
|
|
858
|
+
Y,
|
|
859
|
+
Q,
|
|
860
|
+
R,
|
|
858
861
|
J,
|
|
859
|
-
Z,
|
|
860
|
-
L,
|
|
861
862
|
q,
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
], { undo: o, redo: s, fontSize: c, lineHeight: l, backgroundColor: u, textColor: d, bold: f, italic: p, underline: m, strikethrough: h, heading: g, heading1: _, heading2: v, heading3: y, heading4: b, bulletList: x, orderedList: S, taskList: C, blockquote: w, codeBlock: T, horizontalRule: E, tableMenu: D, createTable: O, addRowBefore: k, addRowAfter: j, deleteRow: M, addColumnBefore: N, addColumnAfter: P, deleteColumn: F } = $(e);
|
|
863
|
+
X,
|
|
864
|
+
Z
|
|
865
|
+
], { undo: o, redo: s, fontSize: c, lineHeight: l, backgroundColor: u, textColor: d, bold: f, italic: p, underline: m, strikethrough: h, heading: g, heading1: _, heading2: v, heading3: y, heading4: b, bulletList: x, orderedList: S, taskList: C, blockquote: w, codeBlock: T, horizontalRule: E, tableMenu: D, createTable: O, addRowBefore: k, addRowAfter: A, deleteRow: M, addColumnBefore: N, addColumnAfter: P, deleteColumn: F } = $(e);
|
|
866
866
|
return {
|
|
867
867
|
editorContentType: n,
|
|
868
868
|
serialize: r,
|
|
@@ -915,7 +915,7 @@ var pe = (e) => {
|
|
|
915
915
|
O(),
|
|
916
916
|
P(),
|
|
917
917
|
N(),
|
|
918
|
-
|
|
918
|
+
A(),
|
|
919
919
|
k(),
|
|
920
920
|
F(),
|
|
921
921
|
M(),
|
|
@@ -924,11 +924,11 @@ var pe = (e) => {
|
|
|
924
924
|
}
|
|
925
925
|
]
|
|
926
926
|
};
|
|
927
|
-
},
|
|
928
|
-
let { $gettext: t } =
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
927
|
+
}, he = (e) => {
|
|
928
|
+
let { $gettext: t } = j(), n = () => "markdown", r = (e) => e.getMarkdown(), i = (e) => e, a = () => [
|
|
929
|
+
L.configure({ link: !1 }),
|
|
930
|
+
ee,
|
|
931
|
+
z.configure({
|
|
932
932
|
openOnClick: !0,
|
|
933
933
|
autolink: !0,
|
|
934
934
|
linkOnPaste: !0,
|
|
@@ -937,14 +937,14 @@ var pe = (e) => {
|
|
|
937
937
|
rel: "noopener noreferrer"
|
|
938
938
|
}
|
|
939
939
|
}),
|
|
940
|
-
|
|
941
|
-
U,
|
|
942
|
-
V,
|
|
943
|
-
H,
|
|
940
|
+
V.configure({ resizable: !1 }),
|
|
944
941
|
W,
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
942
|
+
H,
|
|
943
|
+
U,
|
|
944
|
+
G,
|
|
945
|
+
K.configure({ nested: !0 }),
|
|
946
|
+
B.configure({ inline: !1 })
|
|
947
|
+
], { undo: o, redo: s, toggleSourceMode: c, bold: l, italic: u, strikethrough: d, heading: f, heading1: p, heading2: m, heading3: h, heading4: g, bulletList: _, orderedList: v, taskList: y, blockquote: b, codeBlock: x, horizontalRule: S, image: C, imageUrl: w, imageUpload: T, tableMenu: E, createTable: D, addRowBefore: O, addRowAfter: k, deleteRow: A, addColumnBefore: M, addColumnAfter: N, deleteColumn: P } = $(e);
|
|
948
948
|
return {
|
|
949
949
|
editorContentType: n,
|
|
950
950
|
serialize: r,
|
|
@@ -1003,13 +1003,13 @@ var pe = (e) => {
|
|
|
1003
1003
|
k(),
|
|
1004
1004
|
O(),
|
|
1005
1005
|
P(),
|
|
1006
|
-
|
|
1006
|
+
A(),
|
|
1007
1007
|
S()
|
|
1008
1008
|
]
|
|
1009
1009
|
}
|
|
1010
1010
|
]
|
|
1011
1011
|
};
|
|
1012
|
-
},
|
|
1012
|
+
}, ge = (e) => ({
|
|
1013
1013
|
editorContentType: () => "plainText",
|
|
1014
1014
|
serialize: (e) => e.getText(),
|
|
1015
1015
|
deserialize: (e) => e ? {
|
|
@@ -1026,16 +1026,16 @@ var pe = (e) => {
|
|
|
1026
1026
|
content: [{ type: "paragraph" }]
|
|
1027
1027
|
},
|
|
1028
1028
|
extensions: () => [
|
|
1029
|
-
ee,
|
|
1030
1029
|
te,
|
|
1031
1030
|
ne,
|
|
1032
|
-
re
|
|
1031
|
+
re,
|
|
1032
|
+
ie
|
|
1033
1033
|
],
|
|
1034
1034
|
editorActionGroups: () => []
|
|
1035
|
-
}),
|
|
1036
|
-
let { $gettext: t } =
|
|
1037
|
-
|
|
1038
|
-
|
|
1035
|
+
}), _e = (e) => {
|
|
1036
|
+
let { $gettext: t } = j(), n = () => "json", r = (e) => JSON.stringify(e.getJSON()), i = (e) => JSON.parse(e), a = () => [
|
|
1037
|
+
L.configure({ link: !1 }),
|
|
1038
|
+
z.configure({
|
|
1039
1039
|
openOnClick: !0,
|
|
1040
1040
|
autolink: !0,
|
|
1041
1041
|
linkOnPaste: !0,
|
|
@@ -1044,21 +1044,21 @@ var pe = (e) => {
|
|
|
1044
1044
|
rel: "noopener noreferrer"
|
|
1045
1045
|
}
|
|
1046
1046
|
}),
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
U,
|
|
1050
|
-
V,
|
|
1051
|
-
H,
|
|
1047
|
+
B.configure({ inline: !1 }),
|
|
1048
|
+
V.configure({ resizable: !1 }),
|
|
1052
1049
|
W,
|
|
1053
|
-
|
|
1050
|
+
H,
|
|
1051
|
+
U,
|
|
1052
|
+
G,
|
|
1053
|
+
K.configure({ nested: !0 }),
|
|
1054
|
+
Y,
|
|
1055
|
+
Q,
|
|
1056
|
+
R,
|
|
1054
1057
|
J,
|
|
1055
|
-
Z,
|
|
1056
|
-
L,
|
|
1057
1058
|
q,
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
], { undo: o, redo: s, fontSize: c, lineHeight: l, backgroundColor: u, textColor: d, bold: f, italic: p, underline: m, strikethrough: h, heading: g, heading1: _, heading2: v, heading3: y, heading4: b, bulletList: x, orderedList: S, taskList: C, blockquote: w, codeBlock: T, horizontalRule: E, image: D, imageUrl: O, imageUpload: k, tableMenu: j, createTable: M, addRowBefore: N, addRowAfter: P, deleteRow: F, addColumnBefore: Q, addColumnAfter: ee, deleteColumn: te } = $(e);
|
|
1059
|
+
X,
|
|
1060
|
+
Z
|
|
1061
|
+
], { undo: o, redo: s, fontSize: c, lineHeight: l, backgroundColor: u, textColor: d, bold: f, italic: p, underline: m, strikethrough: h, heading: g, heading1: _, heading2: v, heading3: y, heading4: b, bulletList: x, orderedList: S, taskList: C, blockquote: w, codeBlock: T, horizontalRule: E, image: D, imageUrl: O, imageUpload: k, tableMenu: A, createTable: M, addRowBefore: N, addRowAfter: P, deleteRow: F, addColumnBefore: I, addColumnAfter: ee, deleteColumn: te } = $(e);
|
|
1062
1062
|
return {
|
|
1063
1063
|
editorContentType: n,
|
|
1064
1064
|
serialize: r,
|
|
@@ -1113,10 +1113,10 @@ var pe = (e) => {
|
|
|
1113
1113
|
D(),
|
|
1114
1114
|
O(),
|
|
1115
1115
|
k(),
|
|
1116
|
-
|
|
1116
|
+
A(),
|
|
1117
1117
|
M(),
|
|
1118
1118
|
ee(),
|
|
1119
|
-
|
|
1119
|
+
I(),
|
|
1120
1120
|
P(),
|
|
1121
1121
|
N(),
|
|
1122
1122
|
te(),
|
|
@@ -1126,32 +1126,32 @@ var pe = (e) => {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
]
|
|
1128
1128
|
};
|
|
1129
|
-
},
|
|
1129
|
+
}, ve = () => ({ resolveStrategy: (e, t) => {
|
|
1130
1130
|
switch (e) {
|
|
1131
|
-
case "plain-text": return
|
|
1132
|
-
case "markdown": return
|
|
1133
|
-
case "html": return
|
|
1134
|
-
case "tiptap-json": return
|
|
1131
|
+
case "plain-text": return ge(t);
|
|
1132
|
+
case "markdown": return he(t);
|
|
1133
|
+
case "html": return me(t);
|
|
1134
|
+
case "tiptap-json": return _e(t);
|
|
1135
1135
|
default: throw Error(`Unknown content type: ${e}`);
|
|
1136
1136
|
}
|
|
1137
1137
|
} });
|
|
1138
1138
|
//#endregion
|
|
1139
1139
|
//#region src/editor/composables/useTextEditor.ts
|
|
1140
|
-
function
|
|
1141
|
-
let { resolveStrategy: t } =
|
|
1140
|
+
function ye(e) {
|
|
1141
|
+
let { resolveStrategy: t } = ve(), n = { sourceMode: v(!1) }, r = v(e.contentType), a = v(e.readonly ?? !1), s = t(e.contentType, n), l = null, u = s.extensions();
|
|
1142
1142
|
if (e.slashCommands !== !1) {
|
|
1143
1143
|
let e = s.editorActionGroups();
|
|
1144
|
-
e.length > 0 && u.push(
|
|
1144
|
+
e.length > 0 && u.push(pe.configure({ getGroups: () => e }));
|
|
1145
1145
|
}
|
|
1146
1146
|
let d = {
|
|
1147
1147
|
extensions: u,
|
|
1148
|
-
content:
|
|
1148
|
+
content: E(e.modelValue) ? s.deserialize(E(e.modelValue)) : "",
|
|
1149
1149
|
editable: !a.value
|
|
1150
1150
|
};
|
|
1151
1151
|
i(e.modelValue, (e) => {
|
|
1152
|
-
!
|
|
1152
|
+
!E(f) || E(f)?.isFocused || m(e);
|
|
1153
1153
|
}), s.editorContentType && (d.contentType = s.editorContentType());
|
|
1154
|
-
let f =
|
|
1154
|
+
let f = P({
|
|
1155
1155
|
...d,
|
|
1156
1156
|
onUpdate({ editor: t }) {
|
|
1157
1157
|
e.onUpdate && (l && clearTimeout(l), l = setTimeout(() => {
|
|
@@ -1166,17 +1166,17 @@ function ve(e) {
|
|
|
1166
1166
|
if (!f.value) return;
|
|
1167
1167
|
let t = s.deserialize(e), n = { emitUpdate: !1 };
|
|
1168
1168
|
s.editorContentType && (n.contentType = s.editorContentType()), f.value.commands.setContent(t, n);
|
|
1169
|
-
}, h =
|
|
1169
|
+
}, h = D(() => f.value?.isEmpty ?? !0), g = D(() => f.value?.isFocused ?? !1), _ = () => {
|
|
1170
1170
|
f.value?.commands.focus("start");
|
|
1171
1171
|
}, y = () => {
|
|
1172
1172
|
f.value?.commands.blur();
|
|
1173
1173
|
}, b = () => {
|
|
1174
1174
|
l &&= (clearTimeout(l), e.onUpdate && f.value && e.onUpdate(s.serialize(f.value)), null), f.value?.destroy(), f.value = null;
|
|
1175
|
-
};
|
|
1175
|
+
}, x = () => S(f);
|
|
1176
1176
|
return c(() => {
|
|
1177
|
-
|
|
1177
|
+
f.value?.on("selectionUpdate", x), f.value?.on("transaction", x), E(a) || _();
|
|
1178
1178
|
}), o(() => {
|
|
1179
|
-
b();
|
|
1179
|
+
f.value?.off("selectionUpdate", x), f.value?.off("transaction", x), b();
|
|
1180
1180
|
}), {
|
|
1181
1181
|
state: n,
|
|
1182
1182
|
editor: f,
|
|
@@ -1193,63 +1193,54 @@ function ve(e) {
|
|
|
1193
1193
|
}
|
|
1194
1194
|
//#endregion
|
|
1195
1195
|
//#region src/editor/components/TextEditorProvider.vue?vue&type=script&setup=true&lang.ts
|
|
1196
|
-
var
|
|
1196
|
+
var be = { class: "text-editor-provider h-full flex flex-col" }, xe = /* @__PURE__ */ n({
|
|
1197
1197
|
__name: "TextEditorProvider",
|
|
1198
1198
|
props: { editor: {} },
|
|
1199
1199
|
setup(e) {
|
|
1200
|
-
return a("textEditor", e.editor), (e, t) => (r(), u("div",
|
|
1200
|
+
return a("textEditor", e.editor), (e, t) => (r(), u("div", be, [A(e.$slots, "default")]));
|
|
1201
1201
|
}
|
|
1202
|
-
}),
|
|
1202
|
+
}), Se = /* @__PURE__ */ n({
|
|
1203
1203
|
__name: "TextEditorContent",
|
|
1204
1204
|
props: { editor: { default: () => void 0 } },
|
|
1205
1205
|
setup(e) {
|
|
1206
|
-
let t = e.editor || s("textEditor"), n =
|
|
1207
|
-
return (e, i) =>
|
|
1206
|
+
let t = e.editor || s("textEditor"), n = D(() => E(t.contentType) === "markdown" && E(t.state.sourceMode));
|
|
1207
|
+
return (e, i) => E(t).editor.value ? (r(), g(E(M), {
|
|
1208
1208
|
key: 0,
|
|
1209
1209
|
class: x(["text-editor-content", { "markdown-source-mode": n.value }]),
|
|
1210
|
-
editor:
|
|
1211
|
-
}, null, 8, ["class", "editor"])) :
|
|
1210
|
+
editor: E(t).editor.value
|
|
1211
|
+
}, null, 8, ["class", "editor"])) : O("", !0);
|
|
1212
1212
|
}
|
|
1213
|
-
}),
|
|
1213
|
+
}), Ce = {
|
|
1214
1214
|
key: 0,
|
|
1215
1215
|
class: "text-editor-toolbar relative border-b border-b-role-border py-1"
|
|
1216
|
-
},
|
|
1216
|
+
}, we = { class: "oc-list" }, Te = { class: "inline-flex items-center gap-2" }, Ee = {
|
|
1217
1217
|
key: 0,
|
|
1218
1218
|
class: "pointer-events-none absolute inset-y-0 left-0 w-8 bg-gradient-to-r from-black/15 to-transparent"
|
|
1219
|
-
},
|
|
1219
|
+
}, De = {
|
|
1220
1220
|
key: 1,
|
|
1221
1221
|
class: "pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l from-black/15 to-transparent"
|
|
1222
|
-
},
|
|
1222
|
+
}, Oe = /* @__PURE__ */ _(/* @__PURE__ */ n({
|
|
1223
1223
|
__name: "TextEditorToolbar",
|
|
1224
1224
|
setup(n) {
|
|
1225
|
-
let
|
|
1226
|
-
let e =
|
|
1225
|
+
let i = s("textEditor"), a = T("scrollContainer"), o = v(!1), _ = v(!1), S = () => {
|
|
1226
|
+
let e = a.value;
|
|
1227
1227
|
if (!e) {
|
|
1228
|
-
|
|
1228
|
+
o.value = !1, _.value = !1;
|
|
1229
1229
|
return;
|
|
1230
1230
|
}
|
|
1231
|
-
|
|
1231
|
+
o.value = e.scrollLeft > 0, _.value = e.scrollLeft + e.clientWidth < e.scrollWidth - 1;
|
|
1232
1232
|
};
|
|
1233
1233
|
c(async () => {
|
|
1234
|
-
await e(),
|
|
1234
|
+
await e(), S();
|
|
1235
1235
|
});
|
|
1236
|
-
let
|
|
1237
|
-
|
|
1238
|
-
t && (t.off("selectionUpdate", j), t.off("transaction", j)), e && (e.on("selectionUpdate", j), e.on("transaction", j));
|
|
1239
|
-
}, { immediate: !0 });
|
|
1240
|
-
let j = () => {
|
|
1241
|
-
A.value++;
|
|
1242
|
-
}, M = (e) => {
|
|
1243
|
-
A.value;
|
|
1244
|
-
let t = S(a.editor);
|
|
1236
|
+
let C = D(() => E(i.readonly) || E(i.contentType) === "plain-text" ? !1 : !!E(i.editor)), w = (e) => {
|
|
1237
|
+
let t = E(i.editor);
|
|
1245
1238
|
return t ? e.isEnabled ? e.isEnabled(t) : !0 : !1;
|
|
1246
|
-
},
|
|
1247
|
-
|
|
1248
|
-
let t = S(a.editor);
|
|
1239
|
+
}, A = (e) => {
|
|
1240
|
+
let t = E(i.editor);
|
|
1249
1241
|
return t && e.isActive ? e.isActive(t) : !1;
|
|
1250
|
-
},
|
|
1251
|
-
|
|
1252
|
-
let t = S(a.editor);
|
|
1242
|
+
}, j = (e) => {
|
|
1243
|
+
let t = E(i.editor);
|
|
1253
1244
|
if (t && e.activeIcon) {
|
|
1254
1245
|
let n = e.activeIcon(t);
|
|
1255
1246
|
if (n) return n;
|
|
@@ -1260,27 +1251,27 @@ var ye = { class: "text-editor-provider h-full flex flex-col" }, be = /* @__PURE
|
|
|
1260
1251
|
};
|
|
1261
1252
|
};
|
|
1262
1253
|
return (e, n) => {
|
|
1263
|
-
let
|
|
1264
|
-
return
|
|
1265
|
-
|
|
1254
|
+
let a = t("oc-icon"), s = t("oc-button"), c = t("oc-drop"), v = p("oc-tooltip");
|
|
1255
|
+
return C.value ? (r(), u("div", Ce, [
|
|
1256
|
+
k("div", {
|
|
1266
1257
|
ref: "scrollContainer",
|
|
1267
1258
|
class: "flex items-center gap-1 overflow-x-auto before:grow after:grow",
|
|
1268
|
-
onScroll:
|
|
1269
|
-
}, [(r(!0), u(y, null, l(
|
|
1259
|
+
onScroll: S
|
|
1260
|
+
}, [(r(!0), u(y, null, l(E(i).actionGroups(), (e, t) => (r(), u("div", {
|
|
1270
1261
|
key: `toolbar-group-${e.id}`,
|
|
1271
1262
|
class: x(["text-editor-toolbar-group inline-flex items-stretch", { "border-l border-l-role-border pl-1": t > 0 }])
|
|
1272
|
-
}, [(r(!0), u(y, null, l(e.actions.filter((e) => e.showInToolbar !== !1), (e) => (r(), u(y, { key: `toolbar-item-${e.id}` }, [e.childActions ? (r(), u(y, { key: 0 }, [m((r(), g(
|
|
1263
|
+
}, [(r(!0), u(y, null, l(e.actions.filter((e) => e.showInToolbar !== !1), (e) => (r(), u(y, { key: `toolbar-item-${e.id}` }, [e.childActions ? (r(), u(y, { key: 0 }, [m((r(), g(s, {
|
|
1273
1264
|
id: `toolbar-dropdown-trigger-${e.id}`,
|
|
1274
1265
|
type: "button",
|
|
1275
1266
|
appearance: "raw",
|
|
1276
|
-
class: x(["text-editor-toolbar-btn min-w-[52px] inline-flex items-center justify-center p-2", { "text-editor-toolbar-btn--active":
|
|
1267
|
+
class: x(["text-editor-toolbar-btn min-w-[52px] inline-flex items-center justify-center p-2", { "text-editor-toolbar-btn--active": A(e) }]),
|
|
1277
1268
|
"aria-label": e.title
|
|
1278
1269
|
}, {
|
|
1279
|
-
default: h(() => [d(
|
|
1280
|
-
name:
|
|
1281
|
-
"fill-type":
|
|
1270
|
+
default: h(() => [d(a, {
|
|
1271
|
+
name: j(e).icon,
|
|
1272
|
+
"fill-type": j(e).iconFillType || "none",
|
|
1282
1273
|
size: "small"
|
|
1283
|
-
}, null, 8, ["name", "fill-type"]), d(
|
|
1274
|
+
}, null, 8, ["name", "fill-type"]), d(a, {
|
|
1284
1275
|
name: "arrow-down-s",
|
|
1285
1276
|
"fill-type": "line",
|
|
1286
1277
|
size: "small"
|
|
@@ -1290,7 +1281,7 @@ var ye = { class: "text-editor-provider h-full flex flex-col" }, be = /* @__PURE
|
|
|
1290
1281
|
"id",
|
|
1291
1282
|
"class",
|
|
1292
1283
|
"aria-label"
|
|
1293
|
-
])), [[
|
|
1284
|
+
])), [[v, e.title]]), d(c, {
|
|
1294
1285
|
"drop-id": `toolbar-dropdown-${e.id}`,
|
|
1295
1286
|
toggle: `#toolbar-dropdown-trigger-${e.id}`,
|
|
1296
1287
|
mode: "click",
|
|
@@ -1298,28 +1289,28 @@ var ye = { class: "text-editor-provider h-full flex flex-col" }, be = /* @__PURE
|
|
|
1298
1289
|
"padding-size": "small",
|
|
1299
1290
|
"close-on-click": ""
|
|
1300
1291
|
}, {
|
|
1301
|
-
default: h(() => [
|
|
1292
|
+
default: h(() => [k("ul", we, [(r(!0), u(y, null, l(e.childActions, (t) => (r(), u("li", {
|
|
1302
1293
|
key: `${e.id}-${t.id}`,
|
|
1303
1294
|
class: "oc-rounded oc-menu-item-hover"
|
|
1304
|
-
}, [d(
|
|
1305
|
-
appearance:
|
|
1306
|
-
"color-role":
|
|
1307
|
-
"no-hover":
|
|
1295
|
+
}, [d(s, {
|
|
1296
|
+
appearance: A(t) ? "filled" : "raw-inverse",
|
|
1297
|
+
"color-role": A(t) ? "secondaryContainer" : "surface",
|
|
1298
|
+
"no-hover": A(t),
|
|
1308
1299
|
"justify-content": "space-between",
|
|
1309
1300
|
class: "p-1",
|
|
1310
|
-
disabled: !
|
|
1311
|
-
onClick: (e) => t.toolbarAction?.(
|
|
1301
|
+
disabled: !w(t),
|
|
1302
|
+
onClick: (e) => t.toolbarAction?.(E(i).editor.value)
|
|
1312
1303
|
}, {
|
|
1313
|
-
default: h(() => [
|
|
1304
|
+
default: h(() => [k("span", Te, [d(a, {
|
|
1314
1305
|
name: t.icon,
|
|
1315
1306
|
"fill-type": t.iconFillType || "none",
|
|
1316
1307
|
size: "small"
|
|
1317
|
-
}, null, 8, ["name", "fill-type"]),
|
|
1308
|
+
}, null, 8, ["name", "fill-type"]), k("span", null, f(t.title), 1)]), A(t) ? (r(), g(a, {
|
|
1318
1309
|
key: 0,
|
|
1319
1310
|
name: "check",
|
|
1320
1311
|
"fill-type": "line",
|
|
1321
1312
|
size: "small"
|
|
1322
|
-
})) :
|
|
1313
|
+
})) : O("", !0)]),
|
|
1323
1314
|
_: 2
|
|
1324
1315
|
}, 1032, [
|
|
1325
1316
|
"appearance",
|
|
@@ -1329,16 +1320,16 @@ var ye = { class: "text-editor-provider h-full flex flex-col" }, be = /* @__PURE
|
|
|
1329
1320
|
"onClick"
|
|
1330
1321
|
])]))), 128))])]),
|
|
1331
1322
|
_: 2
|
|
1332
|
-
}, 1032, ["drop-id", "toggle"])], 64)) : m((r(), g(
|
|
1323
|
+
}, 1032, ["drop-id", "toggle"])], 64)) : m((r(), g(s, {
|
|
1333
1324
|
key: 1,
|
|
1334
1325
|
type: "button",
|
|
1335
1326
|
appearance: "raw",
|
|
1336
|
-
class: x(["text-editor-toolbar-btn min-w-[42px] inline-flex items-center justify-center p-2", { "text-editor-toolbar-btn--active":
|
|
1327
|
+
class: x(["text-editor-toolbar-btn min-w-[42px] inline-flex items-center justify-center p-2", { "text-editor-toolbar-btn--active": A(e) }]),
|
|
1337
1328
|
"aria-label": e.title,
|
|
1338
|
-
disabled: !
|
|
1339
|
-
onClick: b((t) => e.toolbarAction?.(
|
|
1329
|
+
disabled: !w(e),
|
|
1330
|
+
onClick: b((t) => e.toolbarAction?.(E(i).editor.value), ["stop"])
|
|
1340
1331
|
}, {
|
|
1341
|
-
default: h(() => [d(
|
|
1332
|
+
default: h(() => [d(a, {
|
|
1342
1333
|
name: e.icon,
|
|
1343
1334
|
"fill-type": e.iconFillType || "none",
|
|
1344
1335
|
size: "small"
|
|
@@ -1349,12 +1340,12 @@ var ye = { class: "text-editor-provider h-full flex flex-col" }, be = /* @__PURE
|
|
|
1349
1340
|
"aria-label",
|
|
1350
1341
|
"disabled",
|
|
1351
1342
|
"onClick"
|
|
1352
|
-
])), [[
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
])) :
|
|
1343
|
+
])), [[v, e.title]])], 64))), 128))], 2))), 128))], 544),
|
|
1344
|
+
o.value ? (r(), u("div", Ee)) : O("", !0),
|
|
1345
|
+
_.value ? (r(), u("div", De)) : O("", !0)
|
|
1346
|
+
])) : O("", !0);
|
|
1356
1347
|
};
|
|
1357
1348
|
}
|
|
1358
|
-
}), [["__scopeId", "data-v-
|
|
1349
|
+
}), [["__scopeId", "data-v-2cdb0540"]]);
|
|
1359
1350
|
//#endregion
|
|
1360
|
-
export {
|
|
1351
|
+
export { Se as TextEditorContent, xe as TextEditorProvider, Oe as TextEditorToolbar, ye as useTextEditor };
|