@dialpad/dialtone-vue 2.195.3 → 2.195.4
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/common/emoji/index.cjs +1 -1
- package/dist/common/emoji/index.cjs.map +1 -1
- package/dist/common/emoji/index.js +17 -19
- package/dist/common/emoji/index.js.map +1 -1
- package/dist/lib/message-input/message-input.cjs +1 -1
- package/dist/lib/message-input/message-input.cjs.map +1 -1
- package/dist/lib/message-input/message-input.js +3 -1
- package/dist/lib/message-input/message-input.js.map +1 -1
- package/dist/lib/rich-text-editor/rich-text-editor.cjs +7 -7
- package/dist/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
- package/dist/lib/rich-text-editor/rich-text-editor.js +412 -381
- package/dist/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/types/common/emoji/index.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/extensions/emoji/emoji.d.ts.map +1 -1
- package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/types/components/rich_text_editor/extensions/emoji/EmojiComponent.vue.d.ts +0 -45
- package/dist/types/components/rich_text_editor/extensions/emoji/EmojiComponent.vue.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NodeViewWrapper as _, nodeViewProps as
|
|
2
|
-
import { Node as
|
|
1
|
+
import { NodeViewWrapper as _, nodeViewProps as w, VueRenderer as y, VueNodeViewRenderer as v, EditorContent as H, BubbleMenu as j, Editor as N } from "../../node_modules/@tiptap/vue-2.js";
|
|
2
|
+
import { Node as F, mergeAttributes as m, InputRule as K, nodePasteRule as E, getMarksBetween as q, combineTransactionSteps as U, getChangedRanges as z, findChildrenInRange as W, Mark as V, nodeInputRule as X, Extension as J } from "@tiptap/core";
|
|
3
3
|
import Y from "@tiptap/extension-blockquote";
|
|
4
4
|
import G from "@tiptap/extension-code-block";
|
|
5
5
|
import Q from "@tiptap/extension-code";
|
|
@@ -26,39 +26,54 @@ import _e from "@tiptap/suggestion";
|
|
|
26
26
|
import { emojiPattern as O } from "regex-combined-emojis";
|
|
27
27
|
import { n as c } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
|
|
28
28
|
import P from "../emoji/emoji.js";
|
|
29
|
-
import
|
|
30
|
-
import {
|
|
29
|
+
import we from "../skeleton/skeleton.js";
|
|
30
|
+
import { codeToEmojiData as L, stringToUnicode as ye, emojiRegex as ve, emojiShortCodeRegex as xe } from "../../common/emoji/index.js";
|
|
31
|
+
import { emojisIndexed as ke } from "@dialpad/dialtone-emojis";
|
|
31
32
|
import be from "../list-item/list-item.js";
|
|
32
33
|
import x from "../stack/stack.js";
|
|
33
|
-
import
|
|
34
|
-
import { linkRegex as
|
|
35
|
-
import
|
|
34
|
+
import k from "tippy.js";
|
|
35
|
+
import { linkRegex as Ce, getPhoneNumberRegex as Te, warnIfUnmounted as Ee } from "../../common/utils/index.js";
|
|
36
|
+
import Se from "@tiptap/extension-image";
|
|
36
37
|
import R from "@tiptap/extension-mention";
|
|
37
38
|
import D from "../link/link.js";
|
|
38
|
-
import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import { DialtoneLocalization as
|
|
44
|
-
import
|
|
45
|
-
const
|
|
39
|
+
import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as Le, RICH_TEXT_EDITOR_OUTPUT_FORMATS as Re, RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as $ } from "./rich-text-editor-constants.js";
|
|
40
|
+
import $e from "../avatar/avatar.js";
|
|
41
|
+
import Ie from "@dialpad/dialtone-icons/vue2/hash";
|
|
42
|
+
import Ae from "@dialpad/dialtone-icons/vue2/lock";
|
|
43
|
+
import Be from "deep-equal";
|
|
44
|
+
import { DialtoneLocalization as Oe } from "../../localization/index.js";
|
|
45
|
+
import Pe from "../button/button.js";
|
|
46
|
+
const De = {
|
|
46
47
|
name: "EmojiComponent",
|
|
47
48
|
components: {
|
|
48
49
|
NodeViewWrapper: _,
|
|
49
|
-
DtEmoji: P
|
|
50
|
+
DtEmoji: P,
|
|
51
|
+
DtSkeleton: we
|
|
52
|
+
},
|
|
53
|
+
props: w,
|
|
54
|
+
data() {
|
|
55
|
+
return {
|
|
56
|
+
showSkeleton: !0
|
|
57
|
+
};
|
|
50
58
|
},
|
|
51
|
-
|
|
59
|
+
methods: {
|
|
60
|
+
handleImageLoad() {
|
|
61
|
+
this.showSkeleton = !1;
|
|
62
|
+
},
|
|
63
|
+
handleImageError: function(t) {
|
|
64
|
+
this.showSkeleton = !1, t.target.parentNode.remove();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
52
67
|
};
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block d-va-bottom d-lh0" }, [n("dt-emoji", { attrs: { size: "500", code:
|
|
56
|
-
},
|
|
57
|
-
Pe,
|
|
68
|
+
var Me = function() {
|
|
69
|
+
var e = this, n = e._self._c;
|
|
70
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block d-va-bottom d-lh0" }, [e.node.attrs.code ? n("dt-emoji", { attrs: { size: "500", code: e.node.attrs.code } }) : [e.showSkeleton ? n("dt-skeleton", { staticClass: "d-icon d-icon--size-500", attrs: { offset: 0, "shape-option": { shape: "circle", size: "100%" } } }) : e._e(), n("img", { directives: [{ name: "show", rawName: "v-show", value: !e.showSkeleton, expression: "!showSkeleton" }], staticClass: "d-icon d-icon--size-500", attrs: { alt: e.node.attrs.name, "aria-label": e.node.attrs.name, title: e.node.attrs.name, src: e.node.attrs.image }, on: { load: e.handleImageLoad, error: e.handleImageError } })]], 2);
|
|
71
|
+
}, He = [], je = /* @__PURE__ */ c(
|
|
58
72
|
De,
|
|
59
|
-
Me
|
|
73
|
+
Me,
|
|
74
|
+
He
|
|
60
75
|
);
|
|
61
|
-
const
|
|
76
|
+
const Ne = je.exports, Fe = {
|
|
62
77
|
name: "SuggestionList",
|
|
63
78
|
components: {
|
|
64
79
|
DtListItem: be
|
|
@@ -92,8 +107,8 @@ const je = He.exports, Fe = {
|
|
|
92
107
|
}
|
|
93
108
|
},
|
|
94
109
|
methods: {
|
|
95
|
-
onKeyDown({ event:
|
|
96
|
-
return
|
|
110
|
+
onKeyDown({ event: t }) {
|
|
111
|
+
return t.key === "ArrowUp" ? (this.upHandler(), !0) : t.key === "ArrowDown" ? (this.downHandler(), !0) : t.key === "Enter" || t.key === "Tab" ? (this.selectHandler(), !0) : !1;
|
|
97
112
|
},
|
|
98
113
|
upHandler() {
|
|
99
114
|
this.selectedIndex = (this.selectedIndex + this.items.length - 1) % this.items.length, this.scrollActiveElementIntoView();
|
|
@@ -103,8 +118,8 @@ const je = He.exports, Fe = {
|
|
|
103
118
|
},
|
|
104
119
|
async scrollActiveElementIntoView() {
|
|
105
120
|
await this.$nextTick();
|
|
106
|
-
const
|
|
107
|
-
|
|
121
|
+
const t = this.$refs.suggestionList.querySelector(".d-list-item--highlighted");
|
|
122
|
+
t && t.scrollIntoView({
|
|
108
123
|
behaviour: "smooth",
|
|
109
124
|
block: "center"
|
|
110
125
|
});
|
|
@@ -112,43 +127,43 @@ const je = He.exports, Fe = {
|
|
|
112
127
|
selectHandler() {
|
|
113
128
|
this.selectItem(this.selectedIndex);
|
|
114
129
|
},
|
|
115
|
-
selectItem(
|
|
116
|
-
const
|
|
130
|
+
selectItem(t) {
|
|
131
|
+
const e = this.items[t];
|
|
117
132
|
switch (this.itemType) {
|
|
118
133
|
case "emoji":
|
|
119
|
-
this.command(
|
|
134
|
+
this.command(e);
|
|
120
135
|
return;
|
|
121
136
|
case "mention":
|
|
122
|
-
this.command({ name:
|
|
137
|
+
this.command({ name: e.name, id: e.id, avatarSrc: e.avatarSrc });
|
|
123
138
|
break;
|
|
124
139
|
case "channel":
|
|
125
|
-
this.command({ name:
|
|
140
|
+
this.command({ name: e.name, id: e.id });
|
|
126
141
|
break;
|
|
127
142
|
case "slash-command":
|
|
128
|
-
this.command({ command:
|
|
143
|
+
this.command({ command: e.command });
|
|
129
144
|
break;
|
|
130
145
|
}
|
|
131
146
|
}
|
|
132
147
|
}
|
|
133
148
|
};
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
return n("div", { staticClass: "d-popover__dialog d-suggestion-list__container" }, [n("ul", { directives: [{ name: "show", rawName: "v-show", value:
|
|
149
|
+
var Ke = function() {
|
|
150
|
+
var e = this, n = e._self._c;
|
|
151
|
+
return n("div", { staticClass: "d-popover__dialog d-suggestion-list__container" }, [n("ul", { directives: [{ name: "show", rawName: "v-show", value: e.items.length, expression: "items.length" }], ref: "suggestionList", staticClass: "d-suggestion-list" }, e._l(e.items, function(r, s) {
|
|
137
152
|
return n("dt-list-item", { key: r.id, class: [
|
|
138
153
|
"d-suggestion-list__item",
|
|
139
|
-
{ "d-list-item--highlighted": s ===
|
|
154
|
+
{ "d-list-item--highlighted": s === e.selectedIndex }
|
|
140
155
|
], attrs: { "navigation-type": "arrow-keys" }, on: { click: function(o) {
|
|
141
|
-
return
|
|
156
|
+
return e.selectItem(s);
|
|
142
157
|
}, keydown: function(o) {
|
|
143
|
-
return o.preventDefault(),
|
|
144
|
-
} } }, [n(
|
|
158
|
+
return o.preventDefault(), e.onKeyDown.apply(null, arguments);
|
|
159
|
+
} } }, [n(e.itemComponent, { tag: "component", attrs: { item: r } })], 1);
|
|
145
160
|
}), 1)]);
|
|
146
|
-
},
|
|
161
|
+
}, qe = [], Ue = /* @__PURE__ */ c(
|
|
147
162
|
Fe,
|
|
148
|
-
|
|
149
|
-
|
|
163
|
+
Ke,
|
|
164
|
+
qe
|
|
150
165
|
);
|
|
151
|
-
const
|
|
166
|
+
const b = Ue.exports, ze = {
|
|
152
167
|
name: "EmojiSuggestion",
|
|
153
168
|
components: {
|
|
154
169
|
DtEmoji: P,
|
|
@@ -162,46 +177,46 @@ const k = qe.exports, Ue = {
|
|
|
162
177
|
}
|
|
163
178
|
};
|
|
164
179
|
var We = function() {
|
|
165
|
-
var
|
|
166
|
-
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [n("dt-emoji", { attrs: { size: "200", code:
|
|
167
|
-
}, Ve = [],
|
|
168
|
-
|
|
180
|
+
var e = this, n = e._self._c;
|
|
181
|
+
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [n("dt-emoji", { attrs: { size: "200", code: e.item.code } }), e._v(" " + e._s(e.item.code) + " ")], 1);
|
|
182
|
+
}, Ve = [], Xe = /* @__PURE__ */ c(
|
|
183
|
+
ze,
|
|
169
184
|
We,
|
|
170
185
|
Ve
|
|
171
186
|
);
|
|
172
|
-
const
|
|
187
|
+
const Je = Xe.exports, C = {
|
|
173
188
|
name: "hideOnEsc",
|
|
174
189
|
defaultValue: !0,
|
|
175
|
-
fn({ hide:
|
|
176
|
-
function
|
|
177
|
-
n.keyCode === 27 &&
|
|
190
|
+
fn({ hide: t }) {
|
|
191
|
+
function e(n) {
|
|
192
|
+
n.keyCode === 27 && t();
|
|
178
193
|
}
|
|
179
194
|
return {
|
|
180
195
|
onShow() {
|
|
181
|
-
document.addEventListener("keydown",
|
|
196
|
+
document.addEventListener("keydown", e);
|
|
182
197
|
},
|
|
183
198
|
onHide() {
|
|
184
|
-
document.removeEventListener("keydown",
|
|
199
|
+
document.removeEventListener("keydown", e);
|
|
185
200
|
}
|
|
186
201
|
};
|
|
187
202
|
}
|
|
188
|
-
},
|
|
189
|
-
items: ({ query:
|
|
190
|
-
if (
|
|
203
|
+
}, Ye = 20, Ge = {
|
|
204
|
+
items: ({ query: t }) => {
|
|
205
|
+
if (t.length < 2)
|
|
191
206
|
return [];
|
|
192
|
-
const
|
|
193
|
-
return
|
|
207
|
+
const e = Object.values(ke);
|
|
208
|
+
return t = t.toLowerCase(), e.filter(
|
|
194
209
|
(r) => [
|
|
195
210
|
r.name,
|
|
196
211
|
r.shortname.replaceAll(":", ""),
|
|
197
212
|
...r.keywords
|
|
198
|
-
].some((s) => s.startsWith(
|
|
199
|
-
).splice(0,
|
|
213
|
+
].some((s) => s.startsWith(t))
|
|
214
|
+
).splice(0, Ye).map((r) => ({ code: r.shortname }));
|
|
200
215
|
},
|
|
201
|
-
command: ({ editor:
|
|
216
|
+
command: ({ editor: t, range: e, props: n }) => {
|
|
202
217
|
var o, i;
|
|
203
|
-
const r =
|
|
204
|
-
((o = r == null ? void 0 : r.text) == null ? void 0 : o.startsWith(" ")) && (
|
|
218
|
+
const r = t.view.state.selection.$to.nodeAfter;
|
|
219
|
+
((o = r == null ? void 0 : r.text) == null ? void 0 : o.startsWith(" ")) && (e.to += 1), t.chain().focus().insertContentAt(e, [
|
|
205
220
|
{
|
|
206
221
|
type: "emoji",
|
|
207
222
|
attrs: n
|
|
@@ -209,21 +224,21 @@ const Xe = ze.exports, C = {
|
|
|
209
224
|
]).run(), (i = window.getSelection()) == null || i.collapseToEnd();
|
|
210
225
|
},
|
|
211
226
|
render: () => {
|
|
212
|
-
let
|
|
227
|
+
let t, e, n = !1;
|
|
213
228
|
return {
|
|
214
229
|
onStart: (r) => {
|
|
215
|
-
|
|
230
|
+
t = new y(b, {
|
|
216
231
|
parent: void 0,
|
|
217
232
|
propsData: {
|
|
218
|
-
itemComponent:
|
|
233
|
+
itemComponent: Je,
|
|
219
234
|
itemType: "emoji",
|
|
220
235
|
...r
|
|
221
236
|
},
|
|
222
237
|
editor: r.editor
|
|
223
|
-
}), r.clientRect && (
|
|
238
|
+
}), r.clientRect && (e = k("body", {
|
|
224
239
|
getReferenceClientRect: r.clientRect,
|
|
225
240
|
appendTo: () => document.body,
|
|
226
|
-
content:
|
|
241
|
+
content: t.element,
|
|
227
242
|
showOnCreate: !1,
|
|
228
243
|
onShow: () => {
|
|
229
244
|
n = !0;
|
|
@@ -236,31 +251,31 @@ const Xe = ze.exports, C = {
|
|
|
236
251
|
placement: "top-start",
|
|
237
252
|
zIndex: 650,
|
|
238
253
|
plugins: [C]
|
|
239
|
-
}), r.items.length > 0 && (
|
|
254
|
+
}), r.items.length > 0 && (e == null || e[0].show()));
|
|
240
255
|
},
|
|
241
256
|
onUpdate(r) {
|
|
242
|
-
|
|
257
|
+
t == null || t.updateProps(r), r.items.length > 0 ? e == null || e[0].show() : e == null || e[0].hide(), e == null || e[0].setProps({
|
|
243
258
|
getReferenceClientRect: r.clientRect
|
|
244
259
|
});
|
|
245
260
|
},
|
|
246
261
|
onKeyDown(r) {
|
|
247
262
|
var s;
|
|
248
263
|
if (n)
|
|
249
|
-
return (s =
|
|
264
|
+
return (s = t == null ? void 0 : t.ref) == null ? void 0 : s.onKeyDown(r);
|
|
250
265
|
},
|
|
251
266
|
onExit() {
|
|
252
|
-
|
|
267
|
+
e == null || e[0].destroy(), e = null, t == null || t.destroy(), t = null;
|
|
253
268
|
}
|
|
254
269
|
};
|
|
255
270
|
}
|
|
256
|
-
},
|
|
257
|
-
if (
|
|
258
|
-
return { text:
|
|
259
|
-
},
|
|
271
|
+
}, Qe = /(:\w+:)$/, Ze = new RegExp(O + "$"), et = (t) => {
|
|
272
|
+
if (t && L(t[0]))
|
|
273
|
+
return { text: t[2] || t[0] };
|
|
274
|
+
}, tt = (t) => [...t.matchAll(xe)].filter((n) => L(n[0])).map((n) => ({
|
|
260
275
|
index: n.index,
|
|
261
276
|
text: n[0],
|
|
262
277
|
match: n
|
|
263
|
-
})),
|
|
278
|
+
})), nt = F.create({
|
|
264
279
|
name: "emoji",
|
|
265
280
|
addOptions() {
|
|
266
281
|
return {
|
|
@@ -272,12 +287,18 @@ const Xe = ze.exports, C = {
|
|
|
272
287
|
selectable: !1,
|
|
273
288
|
atom: !0,
|
|
274
289
|
addNodeView() {
|
|
275
|
-
return v(
|
|
290
|
+
return v(Ne);
|
|
276
291
|
},
|
|
277
292
|
addAttributes() {
|
|
278
293
|
return {
|
|
279
294
|
code: {
|
|
280
295
|
default: null
|
|
296
|
+
},
|
|
297
|
+
image: {
|
|
298
|
+
default: null
|
|
299
|
+
},
|
|
300
|
+
name: {
|
|
301
|
+
default: null
|
|
281
302
|
}
|
|
282
303
|
};
|
|
283
304
|
},
|
|
@@ -288,22 +309,28 @@ const Xe = ze.exports, C = {
|
|
|
288
309
|
}
|
|
289
310
|
];
|
|
290
311
|
},
|
|
291
|
-
renderText({ node:
|
|
292
|
-
|
|
312
|
+
renderText({ node: t }) {
|
|
313
|
+
const { image: e, code: n } = t.attrs;
|
|
314
|
+
if (e !== null)
|
|
315
|
+
return e;
|
|
316
|
+
{
|
|
317
|
+
const r = L(n);
|
|
318
|
+
return ye(r.unicode_output);
|
|
319
|
+
}
|
|
293
320
|
},
|
|
294
|
-
renderHTML({ HTMLAttributes:
|
|
295
|
-
return ["emoji-component", m(this.options.HTMLAttributes,
|
|
321
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
322
|
+
return ["emoji-component", m(this.options.HTMLAttributes, t)];
|
|
296
323
|
},
|
|
297
324
|
addInputRules() {
|
|
298
325
|
return [
|
|
299
326
|
new K({
|
|
300
|
-
find: (
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
return
|
|
327
|
+
find: (t) => {
|
|
328
|
+
const e = t.match(Qe) || t.match(Ze);
|
|
329
|
+
if (e)
|
|
330
|
+
return et(e);
|
|
304
331
|
},
|
|
305
|
-
handler: ({ state:
|
|
306
|
-
const { tr: i } =
|
|
332
|
+
handler: ({ state: t, range: e, match: n, commands: r, chain: s, can: o }) => {
|
|
333
|
+
const { tr: i } = t, a = e.from, l = e.to;
|
|
307
334
|
i.replaceWith(a, l, this.type.create({ code: n[0] }));
|
|
308
335
|
}
|
|
309
336
|
})
|
|
@@ -312,20 +339,24 @@ const Xe = ze.exports, C = {
|
|
|
312
339
|
addPasteRules() {
|
|
313
340
|
return [
|
|
314
341
|
E({
|
|
315
|
-
find:
|
|
342
|
+
find: tt,
|
|
316
343
|
type: this.type,
|
|
317
|
-
getAttributes(
|
|
344
|
+
getAttributes(t) {
|
|
318
345
|
return {
|
|
319
|
-
code:
|
|
346
|
+
code: t[0],
|
|
347
|
+
image: t[1],
|
|
348
|
+
name: t[2]
|
|
320
349
|
};
|
|
321
350
|
}
|
|
322
351
|
}),
|
|
323
352
|
E({
|
|
324
|
-
find:
|
|
353
|
+
find: ve,
|
|
325
354
|
type: this.type,
|
|
326
|
-
getAttributes(
|
|
355
|
+
getAttributes(t) {
|
|
327
356
|
return {
|
|
328
|
-
code:
|
|
357
|
+
code: t[0],
|
|
358
|
+
image: t[1],
|
|
359
|
+
name: t[2]
|
|
329
360
|
};
|
|
330
361
|
}
|
|
331
362
|
})
|
|
@@ -338,48 +369,48 @@ const Xe = ze.exports, C = {
|
|
|
338
369
|
pluginKey: new f("emoji"),
|
|
339
370
|
editor: this.editor,
|
|
340
371
|
...this.options.suggestion,
|
|
341
|
-
...
|
|
372
|
+
...Ge
|
|
342
373
|
})
|
|
343
374
|
];
|
|
344
375
|
},
|
|
345
376
|
addKeyboardShortcuts() {
|
|
346
377
|
return {
|
|
347
|
-
Backspace: () => this.editor.commands.command(({ tr:
|
|
378
|
+
Backspace: () => this.editor.commands.command(({ tr: t, state: e }) => {
|
|
348
379
|
let n = !1;
|
|
349
|
-
const { selection: r } =
|
|
350
|
-
return s ? (
|
|
380
|
+
const { selection: r } = e, { empty: s, anchor: o } = r;
|
|
381
|
+
return s ? (e.doc.nodesBetween(o - 1, o, (i, a) => {
|
|
351
382
|
if (i.type.name === this.name)
|
|
352
|
-
return n = !0,
|
|
383
|
+
return n = !0, t.insertText("", a, a + i.nodeSize), !1;
|
|
353
384
|
}), n) : !1;
|
|
354
385
|
})
|
|
355
386
|
};
|
|
356
387
|
}
|
|
357
388
|
});
|
|
358
|
-
function
|
|
389
|
+
function rt(t, e, n = () => !0) {
|
|
359
390
|
const r = [];
|
|
360
|
-
|
|
391
|
+
e.lastIndex = 0;
|
|
361
392
|
let s;
|
|
362
|
-
for (; s =
|
|
363
|
-
n(
|
|
393
|
+
for (; s = e.exec(t); )
|
|
394
|
+
n(t, s) && r.push(s);
|
|
364
395
|
return r;
|
|
365
396
|
}
|
|
366
|
-
function
|
|
367
|
-
return !["#", "@"].includes(
|
|
397
|
+
function st(t, e) {
|
|
398
|
+
return !["#", "@"].includes(t.charAt(e.index)) && !["#", "@"].includes(t.charAt(e.index - 1));
|
|
368
399
|
}
|
|
369
|
-
function
|
|
370
|
-
const
|
|
400
|
+
function it(t) {
|
|
401
|
+
const e = new RegExp(
|
|
371
402
|
"(?:" + [
|
|
372
403
|
`[!?.,:;'"]`,
|
|
373
404
|
"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"
|
|
374
405
|
].join("|"),
|
|
375
406
|
"g"
|
|
376
407
|
);
|
|
377
|
-
return
|
|
408
|
+
return t.replace(e, "");
|
|
378
409
|
}
|
|
379
|
-
function
|
|
380
|
-
const n =
|
|
410
|
+
function ot(t, e) {
|
|
411
|
+
const n = t.slice(0, e + 1).search(/\S+\s*$/), r = t.slice(e).search(/\s/);
|
|
381
412
|
if (r < 0) {
|
|
382
|
-
const s =
|
|
413
|
+
const s = t.slice(n);
|
|
383
414
|
return {
|
|
384
415
|
text: s,
|
|
385
416
|
from: n,
|
|
@@ -387,61 +418,61 @@ function it(e, t) {
|
|
|
387
418
|
};
|
|
388
419
|
}
|
|
389
420
|
return {
|
|
390
|
-
text:
|
|
421
|
+
text: t.slice(n, r + e),
|
|
391
422
|
from: n,
|
|
392
|
-
to: r +
|
|
423
|
+
to: r + e
|
|
393
424
|
};
|
|
394
425
|
}
|
|
395
|
-
function S(
|
|
396
|
-
const s =
|
|
426
|
+
function S(t, e, n, r) {
|
|
427
|
+
const s = ot(t, e);
|
|
397
428
|
if (r.lastIndex = 0, !r.test(s.text))
|
|
398
429
|
return s;
|
|
399
430
|
const o = n === "left" ? s.from - 1 : s.to + 1;
|
|
400
|
-
return o <= 0 || o >=
|
|
431
|
+
return o <= 0 || o >= t.length || o === e ? s : S(t, o, n, r);
|
|
401
432
|
}
|
|
402
|
-
function
|
|
403
|
-
const s = Math.max(
|
|
433
|
+
function at(t, e, n, r) {
|
|
434
|
+
const s = Math.max(t.from - 1, 0), o = Math.min(t.to + 1, e.content.size), i = q(s, o, e);
|
|
404
435
|
for (const a of i)
|
|
405
436
|
a.mark.type === r && n.removeMark(a.from, a.to, r);
|
|
406
437
|
}
|
|
407
|
-
const I =
|
|
408
|
-
function A(
|
|
409
|
-
if (!
|
|
438
|
+
const I = Te(1, 15);
|
|
439
|
+
function A(t, e, n, r, s, o) {
|
|
440
|
+
if (!t)
|
|
410
441
|
return;
|
|
411
|
-
let i = n -
|
|
442
|
+
let i = n - e - 1;
|
|
412
443
|
i = i < 0 ? 0 : i;
|
|
413
|
-
const a = r -
|
|
414
|
-
|
|
444
|
+
const a = r - e, l = S(
|
|
445
|
+
t,
|
|
415
446
|
i,
|
|
416
447
|
"left",
|
|
417
448
|
I
|
|
418
449
|
), d = S(
|
|
419
|
-
|
|
450
|
+
t,
|
|
420
451
|
a,
|
|
421
452
|
"right",
|
|
422
453
|
I
|
|
423
|
-
), u =
|
|
424
|
-
|
|
425
|
-
const h =
|
|
454
|
+
), u = t.slice(l.from, d.to);
|
|
455
|
+
rt(u, Ce, st).forEach((T) => {
|
|
456
|
+
const h = it(T[0]), g = e + l.from + T.index + 1, M = g + h.length;
|
|
426
457
|
s.addMark(g, M, o.create());
|
|
427
458
|
});
|
|
428
459
|
}
|
|
429
|
-
function
|
|
430
|
-
let
|
|
460
|
+
function lt(t) {
|
|
461
|
+
let e = !1;
|
|
431
462
|
return new ge({
|
|
432
463
|
key: new f("autolink"),
|
|
433
464
|
appendTransaction: (n, r, s) => {
|
|
434
465
|
const o = n.some((u) => u.docChanged) && !r.doc.eq(s.doc);
|
|
435
|
-
if (
|
|
466
|
+
if (e && !o)
|
|
436
467
|
return;
|
|
437
468
|
const { tr: i } = s, { textContent: a } = s.doc;
|
|
438
|
-
|
|
469
|
+
e || A(a, 0, 0, a.length, i, t.type), e = !0;
|
|
439
470
|
const l = U(
|
|
440
471
|
r.doc,
|
|
441
472
|
[...n]
|
|
442
473
|
);
|
|
443
|
-
return
|
|
444
|
-
|
|
474
|
+
return z(l).forEach(({ oldRange: u, newRange: p }) => {
|
|
475
|
+
at(p, s.doc, i, t.type), W(
|
|
445
476
|
s.doc,
|
|
446
477
|
p,
|
|
447
478
|
(h) => h.isTextblock
|
|
@@ -452,37 +483,37 @@ function at(e) {
|
|
|
452
483
|
u.from,
|
|
453
484
|
p.to,
|
|
454
485
|
i,
|
|
455
|
-
|
|
486
|
+
t.type
|
|
456
487
|
);
|
|
457
488
|
});
|
|
458
489
|
}), i;
|
|
459
490
|
}
|
|
460
491
|
});
|
|
461
492
|
}
|
|
462
|
-
const
|
|
493
|
+
const ct = {
|
|
463
494
|
class: "d-link d-c-text d-d-inline-block d-wb-break-all",
|
|
464
495
|
rel: "noopener noreferrer nofollow"
|
|
465
|
-
},
|
|
496
|
+
}, dt = V.create({
|
|
466
497
|
name: "CustomLink",
|
|
467
|
-
renderHTML({ HTMLAttributes:
|
|
498
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
468
499
|
return [
|
|
469
500
|
"a",
|
|
470
501
|
m(
|
|
471
502
|
this.options.HTMLAttributes,
|
|
472
|
-
|
|
473
|
-
|
|
503
|
+
t,
|
|
504
|
+
ct
|
|
474
505
|
)
|
|
475
506
|
];
|
|
476
507
|
},
|
|
477
|
-
renderText({ node:
|
|
478
|
-
return
|
|
508
|
+
renderText({ node: t }) {
|
|
509
|
+
return t.attrs.text;
|
|
479
510
|
},
|
|
480
511
|
addProseMirrorPlugins() {
|
|
481
512
|
return [
|
|
482
|
-
|
|
513
|
+
lt({ type: this.type })
|
|
483
514
|
];
|
|
484
515
|
}
|
|
485
|
-
}),
|
|
516
|
+
}), ut = Se.extend({
|
|
486
517
|
name: "ConfigurableImage",
|
|
487
518
|
addAttributes() {
|
|
488
519
|
return {
|
|
@@ -506,37 +537,37 @@ const lt = {
|
|
|
506
537
|
}
|
|
507
538
|
};
|
|
508
539
|
}
|
|
509
|
-
}).configure({ inline: !0, allowBase64: !0 }),
|
|
540
|
+
}).configure({ inline: !0, allowBase64: !0 }), mt = B.extend({
|
|
510
541
|
parseHTML() {
|
|
511
542
|
return [{ tag: "div" }];
|
|
512
543
|
},
|
|
513
|
-
renderHTML({ HTMLAttributes:
|
|
514
|
-
return ["div", m(this.options.HTMLAttributes,
|
|
544
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
545
|
+
return ["div", m(this.options.HTMLAttributes, t), 0];
|
|
515
546
|
}
|
|
516
|
-
}),
|
|
547
|
+
}), ht = {
|
|
517
548
|
name: "MentionComponent",
|
|
518
549
|
components: {
|
|
519
550
|
NodeViewWrapper: _,
|
|
520
551
|
DtLink: D
|
|
521
552
|
},
|
|
522
|
-
props:
|
|
553
|
+
props: w,
|
|
523
554
|
computed: {
|
|
524
555
|
text() {
|
|
525
556
|
return "@" + this.$props.node.attrs.name;
|
|
526
557
|
}
|
|
527
558
|
}
|
|
528
559
|
};
|
|
529
|
-
var
|
|
530
|
-
var
|
|
531
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [
|
|
532
|
-
},
|
|
533
|
-
mt,
|
|
560
|
+
var ft = function() {
|
|
561
|
+
var e = this, n = e._self._c;
|
|
562
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [e._v(" " + e._s(e.text) + " ")])], 1);
|
|
563
|
+
}, pt = [], gt = /* @__PURE__ */ c(
|
|
534
564
|
ht,
|
|
535
|
-
ft
|
|
565
|
+
ft,
|
|
566
|
+
pt
|
|
536
567
|
);
|
|
537
|
-
const
|
|
568
|
+
const _t = gt.exports, wt = R.extend({
|
|
538
569
|
addNodeView() {
|
|
539
|
-
return v(
|
|
570
|
+
return v(_t);
|
|
540
571
|
},
|
|
541
572
|
parseHTML() {
|
|
542
573
|
return [
|
|
@@ -558,11 +589,11 @@ const gt = pt.exports, _t = R.extend({
|
|
|
558
589
|
}
|
|
559
590
|
};
|
|
560
591
|
},
|
|
561
|
-
renderText({ node:
|
|
562
|
-
return `@${
|
|
592
|
+
renderText({ node: t }) {
|
|
593
|
+
return `@${t.attrs.id}`;
|
|
563
594
|
},
|
|
564
|
-
renderHTML({ HTMLAttributes:
|
|
565
|
-
return ["mention-component", m(this.options.HTMLAttributes,
|
|
595
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
596
|
+
return ["mention-component", m(this.options.HTMLAttributes, t)];
|
|
566
597
|
}
|
|
567
598
|
}).configure({
|
|
568
599
|
suggestion: {
|
|
@@ -575,22 +606,22 @@ const gt = pt.exports, _t = R.extend({
|
|
|
575
606
|
NodeViewWrapper: _,
|
|
576
607
|
DtLink: D
|
|
577
608
|
},
|
|
578
|
-
props:
|
|
609
|
+
props: w,
|
|
579
610
|
computed: {
|
|
580
611
|
text() {
|
|
581
612
|
return "#" + this.$props.node.attrs.name;
|
|
582
613
|
}
|
|
583
614
|
}
|
|
584
615
|
};
|
|
585
|
-
var
|
|
586
|
-
var
|
|
587
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [
|
|
588
|
-
},
|
|
616
|
+
var vt = function() {
|
|
617
|
+
var e = this, n = e._self._c;
|
|
618
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [n("dt-link", { attrs: { kind: "mention" } }, [e._v(" " + e._s(e.text) + " ")])], 1);
|
|
619
|
+
}, xt = [], kt = /* @__PURE__ */ c(
|
|
589
620
|
yt,
|
|
590
|
-
|
|
591
|
-
|
|
621
|
+
vt,
|
|
622
|
+
xt
|
|
592
623
|
);
|
|
593
|
-
const bt =
|
|
624
|
+
const bt = kt.exports, Ct = R.extend({
|
|
594
625
|
name: "channel",
|
|
595
626
|
addNodeView() {
|
|
596
627
|
return v(bt);
|
|
@@ -615,24 +646,24 @@ const bt = xt.exports, kt = R.extend({
|
|
|
615
646
|
}
|
|
616
647
|
};
|
|
617
648
|
},
|
|
618
|
-
renderText({ node:
|
|
619
|
-
return `#${
|
|
649
|
+
renderText({ node: t }) {
|
|
650
|
+
return `#${t.attrs.id}`;
|
|
620
651
|
},
|
|
621
|
-
renderHTML({ HTMLAttributes:
|
|
622
|
-
return ["channel-component", m(this.options.HTMLAttributes,
|
|
652
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
653
|
+
return ["channel-component", m(this.options.HTMLAttributes, t)];
|
|
623
654
|
}
|
|
624
655
|
}).configure({
|
|
625
656
|
suggestion: {
|
|
626
657
|
char: "#",
|
|
627
658
|
pluginKey: new f("channelSuggestion")
|
|
628
659
|
}
|
|
629
|
-
}),
|
|
660
|
+
}), Tt = {
|
|
630
661
|
name: "SlashCommandsComponent",
|
|
631
662
|
components: {
|
|
632
663
|
NodeViewWrapper: _
|
|
633
664
|
},
|
|
634
665
|
props: {
|
|
635
|
-
...
|
|
666
|
+
...w
|
|
636
667
|
},
|
|
637
668
|
emits: ["selected-command"],
|
|
638
669
|
computed: {
|
|
@@ -642,35 +673,35 @@ const bt = xt.exports, kt = R.extend({
|
|
|
642
673
|
},
|
|
643
674
|
created() {
|
|
644
675
|
var n, r, s;
|
|
645
|
-
const
|
|
646
|
-
this.$emit("selected-command",
|
|
647
|
-
const
|
|
648
|
-
|
|
676
|
+
const t = this.$props.node.attrs.command;
|
|
677
|
+
this.$emit("selected-command", t);
|
|
678
|
+
const e = (s = (r = (n = this.editor) == null ? void 0 : n.storage) == null ? void 0 : r["slash-commands"]) == null ? void 0 : s.onSelectedCommand;
|
|
679
|
+
e && typeof e == "function" && e(t);
|
|
649
680
|
}
|
|
650
681
|
};
|
|
651
|
-
var
|
|
652
|
-
var
|
|
653
|
-
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [
|
|
654
|
-
},
|
|
655
|
-
Ct,
|
|
682
|
+
var Et = function() {
|
|
683
|
+
var e = this, n = e._self._c;
|
|
684
|
+
return n("node-view-wrapper", { staticClass: "d-d-inline-block" }, [e._v(" " + e._s(e.text) + " ")]);
|
|
685
|
+
}, St = [], Lt = /* @__PURE__ */ c(
|
|
656
686
|
Tt,
|
|
657
|
-
Et
|
|
687
|
+
Et,
|
|
688
|
+
St
|
|
658
689
|
);
|
|
659
|
-
const
|
|
690
|
+
const Rt = Lt.exports, $t = (t, e) => [...t.matchAll(e)].map((r) => {
|
|
660
691
|
let s = r[2];
|
|
661
692
|
return s.endsWith(" ") || (s += " "), {
|
|
662
693
|
index: r.index,
|
|
663
694
|
text: s,
|
|
664
695
|
match: r
|
|
665
696
|
};
|
|
666
|
-
}),
|
|
697
|
+
}), It = R.extend({
|
|
667
698
|
name: "slash-commands",
|
|
668
699
|
group: "inline",
|
|
669
700
|
inline: !0,
|
|
670
701
|
addOptions() {
|
|
671
|
-
var
|
|
702
|
+
var t;
|
|
672
703
|
return {
|
|
673
|
-
...(
|
|
704
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
674
705
|
onSelectedCommand: null
|
|
675
706
|
};
|
|
676
707
|
},
|
|
@@ -680,7 +711,7 @@ const Lt = St.exports, Rt = (e, t) => [...e.matchAll(t)].map((r) => {
|
|
|
680
711
|
};
|
|
681
712
|
},
|
|
682
713
|
addNodeView() {
|
|
683
|
-
return v(
|
|
714
|
+
return v(Rt);
|
|
684
715
|
},
|
|
685
716
|
parseHTML() {
|
|
686
717
|
return [
|
|
@@ -702,18 +733,18 @@ const Lt = St.exports, Rt = (e, t) => [...e.matchAll(t)].map((r) => {
|
|
|
702
733
|
}
|
|
703
734
|
};
|
|
704
735
|
},
|
|
705
|
-
renderText({ node:
|
|
706
|
-
return `/${
|
|
736
|
+
renderText({ node: t }) {
|
|
737
|
+
return `/${t.attrs.command}`;
|
|
707
738
|
},
|
|
708
|
-
renderHTML({ HTMLAttributes:
|
|
709
|
-
return ["command-component", m(this.options.HTMLAttributes,
|
|
739
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
740
|
+
return ["command-component", m(this.options.HTMLAttributes, t)];
|
|
710
741
|
},
|
|
711
742
|
addInputRules() {
|
|
712
743
|
var n;
|
|
713
|
-
const
|
|
744
|
+
const t = (n = this.options.suggestion) == null ? void 0 : n.items({ query: "" }).map((r) => r.command), e = new RegExp(`^((?:\\/)(${t.join("|")})) $`);
|
|
714
745
|
return [
|
|
715
746
|
X({
|
|
716
|
-
find:
|
|
747
|
+
find: e,
|
|
717
748
|
type: this.type,
|
|
718
749
|
getAttributes(r) {
|
|
719
750
|
return { command: r[2] };
|
|
@@ -723,10 +754,10 @@ const Lt = St.exports, Rt = (e, t) => [...e.matchAll(t)].map((r) => {
|
|
|
723
754
|
},
|
|
724
755
|
addPasteRules() {
|
|
725
756
|
var n;
|
|
726
|
-
const
|
|
757
|
+
const t = (n = this.options.suggestion) == null ? void 0 : n.items({ query: "" }).map((r) => r.command), e = new RegExp(`^((?:\\/)(${t.join("|")})) ?$`, "g");
|
|
727
758
|
return [
|
|
728
759
|
E({
|
|
729
|
-
find: (r) =>
|
|
760
|
+
find: (r) => $t(r, e),
|
|
730
761
|
type: this.type,
|
|
731
762
|
getAttributes(r) {
|
|
732
763
|
return { command: r[0].trim() };
|
|
@@ -739,10 +770,10 @@ const Lt = St.exports, Rt = (e, t) => [...e.matchAll(t)].map((r) => {
|
|
|
739
770
|
char: "/",
|
|
740
771
|
pluginKey: new f("slashCommandSuggestion")
|
|
741
772
|
}
|
|
742
|
-
}),
|
|
773
|
+
}), At = {
|
|
743
774
|
name: "MentionSuggestion",
|
|
744
775
|
components: {
|
|
745
|
-
DtAvatar:
|
|
776
|
+
DtAvatar: $e,
|
|
746
777
|
DtStack: x
|
|
747
778
|
},
|
|
748
779
|
props: {
|
|
@@ -780,35 +811,35 @@ const Lt = St.exports, Rt = (e, t) => [...e.matchAll(t)].map((r) => {
|
|
|
780
811
|
}
|
|
781
812
|
}
|
|
782
813
|
};
|
|
783
|
-
var
|
|
784
|
-
var
|
|
785
|
-
return n("dt-stack", { staticClass: "d-mention-suggestion__container", attrs: { direction: "row", gap: "400" } }, [n("dt-avatar", { attrs: { "full-name":
|
|
786
|
-
},
|
|
787
|
-
It,
|
|
814
|
+
var Bt = function() {
|
|
815
|
+
var e = this, n = e._self._c;
|
|
816
|
+
return n("dt-stack", { staticClass: "d-mention-suggestion__container", attrs: { direction: "row", gap: "400" } }, [n("dt-avatar", { attrs: { "full-name": e.name, "image-src": e.avatarSrc, "image-alt": e.name, "show-presence": e.showDetails, presence: e.presence, size: "sm" } }), n("dt-stack", { staticClass: "d-mention-suggestion__details-container", attrs: { gap: "100" } }, [n("span", { staticClass: "d-mention-suggestion__name" }, [e._v(" " + e._s(e.name) + " ")]), e.showDetails ? n("dt-stack", { staticClass: "d-label--sm-plain", attrs: { direction: "row", gap: "300" } }, [e.presenceText ? n("span", { staticClass: "d-mention-suggestion__presence", class: [e.presenceFontColorClass] }, [e._v(" " + e._s(e.presenceText) + " ")]) : e._e(), e.status && e.presenceText ? n("div", { staticClass: "d-mention-suggestion__divider" }, [e._v(" • ")]) : e._e(), e.status ? n("div", { staticClass: "d-mention-suggestion__status" }, [e._v(" " + e._s(e.status) + " ")]) : e._e()]) : e._e()], 1)], 1);
|
|
817
|
+
}, Ot = [], Pt = /* @__PURE__ */ c(
|
|
788
818
|
At,
|
|
789
|
-
Bt
|
|
819
|
+
Bt,
|
|
820
|
+
Ot
|
|
790
821
|
);
|
|
791
|
-
const
|
|
822
|
+
const Dt = Pt.exports, Mt = {
|
|
792
823
|
// This function comes from the user and passed to the editor directly.
|
|
793
824
|
// This will also activate the mention plugin on the editor
|
|
794
825
|
// items: ({ query }) => { return [] },
|
|
795
826
|
allowSpaces: !0,
|
|
796
827
|
render: () => {
|
|
797
|
-
let
|
|
828
|
+
let t, e, n = !1;
|
|
798
829
|
return {
|
|
799
830
|
onStart: (r) => {
|
|
800
|
-
|
|
831
|
+
t = new y(b, {
|
|
801
832
|
parent: void 0,
|
|
802
833
|
propsData: {
|
|
803
|
-
itemComponent:
|
|
834
|
+
itemComponent: Dt,
|
|
804
835
|
itemType: "mention",
|
|
805
836
|
...r
|
|
806
837
|
},
|
|
807
838
|
editor: r.editor
|
|
808
|
-
}), r.clientRect && (
|
|
839
|
+
}), r.clientRect && (e = k("body", {
|
|
809
840
|
getReferenceClientRect: r.clientRect,
|
|
810
841
|
appendTo: () => document.body,
|
|
811
|
-
content:
|
|
842
|
+
content: t.element,
|
|
812
843
|
showOnCreate: !1,
|
|
813
844
|
onShow: () => {
|
|
814
845
|
n = !0;
|
|
@@ -821,29 +852,29 @@ const Pt = Ot.exports, Dt = {
|
|
|
821
852
|
placement: "top-start",
|
|
822
853
|
zIndex: 650,
|
|
823
854
|
plugins: [C]
|
|
824
|
-
}), r.items.length > 0 && (
|
|
855
|
+
}), r.items.length > 0 && (e == null || e[0].show()));
|
|
825
856
|
},
|
|
826
857
|
onUpdate(r) {
|
|
827
|
-
|
|
858
|
+
t == null || t.updateProps(r), r.items.length > 0 ? e == null || e[0].show() : e == null || e[0].hide(), r.clientRect && (e == null || e[0].setProps({
|
|
828
859
|
getReferenceClientRect: r.clientRect
|
|
829
860
|
}));
|
|
830
861
|
},
|
|
831
862
|
onKeyDown(r) {
|
|
832
863
|
var s;
|
|
833
864
|
if (n)
|
|
834
|
-
return (s =
|
|
865
|
+
return (s = t == null ? void 0 : t.ref) == null ? void 0 : s.onKeyDown(r);
|
|
835
866
|
},
|
|
836
867
|
onExit() {
|
|
837
|
-
|
|
868
|
+
e == null || e[0].destroy(), e = null, t == null || t.destroy(), t = null;
|
|
838
869
|
}
|
|
839
870
|
};
|
|
840
871
|
}
|
|
841
|
-
},
|
|
872
|
+
}, Ht = {
|
|
842
873
|
name: "ChannelSuggestion",
|
|
843
874
|
components: {
|
|
844
875
|
DtStack: x,
|
|
845
|
-
DtIconHash:
|
|
846
|
-
DtIconLock:
|
|
876
|
+
DtIconHash: Ie,
|
|
877
|
+
DtIconLock: Ae
|
|
847
878
|
},
|
|
848
879
|
props: {
|
|
849
880
|
item: {
|
|
@@ -857,35 +888,35 @@ const Pt = Ot.exports, Dt = {
|
|
|
857
888
|
}
|
|
858
889
|
}
|
|
859
890
|
};
|
|
860
|
-
var
|
|
861
|
-
var
|
|
862
|
-
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [
|
|
863
|
-
},
|
|
864
|
-
Mt,
|
|
891
|
+
var jt = function() {
|
|
892
|
+
var e = this, n = e._self._c;
|
|
893
|
+
return n("dt-stack", { attrs: { direction: "row", gap: "400" } }, [e.item.locked ? n("dt-icon-lock", { attrs: { size: "300" } }) : n("dt-icon-hash", { attrs: { size: "300" } }), n("span", [e._v(e._s(e.name))])], 1);
|
|
894
|
+
}, Nt = [], Ft = /* @__PURE__ */ c(
|
|
865
895
|
Ht,
|
|
866
|
-
jt
|
|
896
|
+
jt,
|
|
897
|
+
Nt
|
|
867
898
|
);
|
|
868
|
-
const
|
|
899
|
+
const Kt = Ft.exports, qt = {
|
|
869
900
|
// This function comes from the user and passed to the editor directly.
|
|
870
901
|
// This will also activate the mention plugin on the editor
|
|
871
902
|
// items: ({ query }) => { return [] },
|
|
872
903
|
allowSpaces: !0,
|
|
873
904
|
render: () => {
|
|
874
|
-
let
|
|
905
|
+
let t, e, n = !1;
|
|
875
906
|
return {
|
|
876
907
|
onStart: (r) => {
|
|
877
|
-
|
|
908
|
+
t = new y(b, {
|
|
878
909
|
parent: void 0,
|
|
879
910
|
propsData: {
|
|
880
|
-
itemComponent:
|
|
911
|
+
itemComponent: Kt,
|
|
881
912
|
itemType: "channel",
|
|
882
913
|
...r
|
|
883
914
|
},
|
|
884
915
|
editor: r.editor
|
|
885
|
-
}), r.clientRect && (
|
|
916
|
+
}), r.clientRect && (e = k("body", {
|
|
886
917
|
getReferenceClientRect: r.clientRect,
|
|
887
918
|
appendTo: () => document.body,
|
|
888
|
-
content:
|
|
919
|
+
content: t.element,
|
|
889
920
|
showOnCreate: !1,
|
|
890
921
|
onShow: () => {
|
|
891
922
|
n = !0;
|
|
@@ -898,24 +929,24 @@ const Nt = Ft.exports, Kt = {
|
|
|
898
929
|
placement: "top-start",
|
|
899
930
|
zIndex: 650,
|
|
900
931
|
plugins: [C]
|
|
901
|
-
}), r.items.length > 0 && (
|
|
932
|
+
}), r.items.length > 0 && (e == null || e[0].show()));
|
|
902
933
|
},
|
|
903
934
|
onUpdate(r) {
|
|
904
|
-
|
|
935
|
+
t == null || t.updateProps(r), r.items.length > 0 ? e == null || e[0].show() : e == null || e[0].hide(), r.clientRect && (e == null || e[0].setProps({
|
|
905
936
|
getReferenceClientRect: r.clientRect
|
|
906
937
|
}));
|
|
907
938
|
},
|
|
908
939
|
onKeyDown(r) {
|
|
909
940
|
var s;
|
|
910
941
|
if (n)
|
|
911
|
-
return (s =
|
|
942
|
+
return (s = t == null ? void 0 : t.ref) == null ? void 0 : s.onKeyDown(r);
|
|
912
943
|
},
|
|
913
944
|
onExit() {
|
|
914
|
-
|
|
945
|
+
e == null || e[0].destroy(), e = null, t == null || t.destroy(), t = null;
|
|
915
946
|
}
|
|
916
947
|
};
|
|
917
948
|
}
|
|
918
|
-
},
|
|
949
|
+
}, Ut = {
|
|
919
950
|
name: "SlashCommandSuggestion",
|
|
920
951
|
props: {
|
|
921
952
|
item: {
|
|
@@ -935,36 +966,36 @@ const Nt = Ft.exports, Kt = {
|
|
|
935
966
|
}
|
|
936
967
|
}
|
|
937
968
|
};
|
|
938
|
-
var
|
|
939
|
-
var
|
|
940
|
-
return n("div", [n("div", { staticClass: "d-body--md-compact" }, [n("span", [
|
|
969
|
+
var zt = function() {
|
|
970
|
+
var e = this, n = e._self._c;
|
|
971
|
+
return n("div", [n("div", { staticClass: "d-body--md-compact" }, [n("span", [e._v("/" + e._s(e.command))]), e.parametersExample ? n("span", [e._v(" " + e._s(e.parametersExample))]) : e._e()]), n("div", { staticClass: "d-body--sm d-fc-tertiary" }, [e._v(" " + e._s(e.description) + " ")])]);
|
|
941
972
|
}, Wt = [], Vt = /* @__PURE__ */ c(
|
|
942
|
-
qt,
|
|
943
973
|
Ut,
|
|
974
|
+
zt,
|
|
944
975
|
Wt
|
|
945
976
|
);
|
|
946
|
-
const
|
|
977
|
+
const Xt = Vt.exports, Jt = {
|
|
947
978
|
// This function comes from the user and passed to the editor directly.
|
|
948
979
|
// This will also activate the mention plugin on the editor
|
|
949
980
|
// items: ({ query }) => { return [] },
|
|
950
981
|
allowSpaces: !0,
|
|
951
982
|
startOfLine: !0,
|
|
952
983
|
render: () => {
|
|
953
|
-
let
|
|
984
|
+
let t, e, n = !1;
|
|
954
985
|
return {
|
|
955
986
|
onStart: (r) => {
|
|
956
|
-
|
|
987
|
+
t = new y(b, {
|
|
957
988
|
parent: void 0,
|
|
958
989
|
propsData: {
|
|
959
|
-
itemComponent:
|
|
990
|
+
itemComponent: Xt,
|
|
960
991
|
itemType: "slash-command",
|
|
961
992
|
...r
|
|
962
993
|
},
|
|
963
994
|
editor: r.editor
|
|
964
|
-
}), r.clientRect && (
|
|
995
|
+
}), r.clientRect && (e = k("body", {
|
|
965
996
|
getReferenceClientRect: r.clientRect,
|
|
966
997
|
appendTo: () => document.body,
|
|
967
|
-
content:
|
|
998
|
+
content: t.element,
|
|
968
999
|
showOnCreate: !1,
|
|
969
1000
|
onShow: () => {
|
|
970
1001
|
n = !0;
|
|
@@ -977,29 +1008,29 @@ const zt = Vt.exports, Xt = {
|
|
|
977
1008
|
placement: "top-start",
|
|
978
1009
|
zIndex: 650,
|
|
979
1010
|
plugins: [C]
|
|
980
|
-
}), r.items.length > 0 && (
|
|
1011
|
+
}), r.items.length > 0 && (e == null || e[0].show()));
|
|
981
1012
|
},
|
|
982
1013
|
onUpdate(r) {
|
|
983
|
-
|
|
1014
|
+
t == null || t.updateProps(r), r.items.length > 0 ? e == null || e[0].show() : e == null || e[0].hide(), r.clientRect && (e == null || e[0].setProps({
|
|
984
1015
|
getReferenceClientRect: r.clientRect
|
|
985
1016
|
}));
|
|
986
1017
|
},
|
|
987
1018
|
onKeyDown(r) {
|
|
988
1019
|
var s;
|
|
989
1020
|
if (n)
|
|
990
|
-
return (s =
|
|
1021
|
+
return (s = t == null ? void 0 : t.ref) == null ? void 0 : s.onKeyDown(r);
|
|
991
1022
|
},
|
|
992
1023
|
onExit() {
|
|
993
|
-
|
|
1024
|
+
e == null || e[0].destroy(), e = null, t == null || t.destroy(), t = null;
|
|
994
1025
|
}
|
|
995
1026
|
};
|
|
996
1027
|
}
|
|
997
|
-
},
|
|
1028
|
+
}, Yt = {
|
|
998
1029
|
name: "DtRichTextEditor",
|
|
999
1030
|
components: {
|
|
1000
1031
|
EditorContent: H,
|
|
1001
1032
|
BubbleMenu: j,
|
|
1002
|
-
DtButton:
|
|
1033
|
+
DtButton: Pe,
|
|
1003
1034
|
DtStack: x
|
|
1004
1035
|
},
|
|
1005
1036
|
props: {
|
|
@@ -1071,8 +1102,8 @@ const zt = Vt.exports, Xt = {
|
|
|
1071
1102
|
autoFocus: {
|
|
1072
1103
|
type: [Boolean, String, Number],
|
|
1073
1104
|
default: !1,
|
|
1074
|
-
validator(
|
|
1075
|
-
return typeof
|
|
1105
|
+
validator(t) {
|
|
1106
|
+
return typeof t == "string" ? Le.includes(t) : !0;
|
|
1076
1107
|
}
|
|
1077
1108
|
},
|
|
1078
1109
|
/**
|
|
@@ -1084,8 +1115,8 @@ const zt = Vt.exports, Xt = {
|
|
|
1084
1115
|
outputFormat: {
|
|
1085
1116
|
type: String,
|
|
1086
1117
|
default: "html",
|
|
1087
|
-
validator(
|
|
1088
|
-
return
|
|
1118
|
+
validator(t) {
|
|
1119
|
+
return Re.includes(t);
|
|
1089
1120
|
}
|
|
1090
1121
|
},
|
|
1091
1122
|
/**
|
|
@@ -1343,12 +1374,12 @@ const zt = Vt.exports, Xt = {
|
|
|
1343
1374
|
editor: null,
|
|
1344
1375
|
tippyOptions: {
|
|
1345
1376
|
appendTo: () => {
|
|
1346
|
-
var
|
|
1347
|
-
return (
|
|
1377
|
+
var t;
|
|
1378
|
+
return (t = this.$refs.editor.$el.getRootNode()) == null ? void 0 : t.querySelector("body");
|
|
1348
1379
|
},
|
|
1349
1380
|
placement: "top-start"
|
|
1350
1381
|
},
|
|
1351
|
-
i18n: new
|
|
1382
|
+
i18n: new Oe()
|
|
1352
1383
|
};
|
|
1353
1384
|
},
|
|
1354
1385
|
computed: {
|
|
@@ -1365,55 +1396,55 @@ const zt = Vt.exports, Xt = {
|
|
|
1365
1396
|
},
|
|
1366
1397
|
// eslint-disable-next-line complexity
|
|
1367
1398
|
extensions() {
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1399
|
+
const t = [Z, de, me, te];
|
|
1400
|
+
t.push(this.useDivTags ? mt : B), this.allowBlockquote && t.push(Y), this.allowBold && t.push(ne), this.allowBulletList && (t.push(re), t.push(oe.extend({
|
|
1370
1401
|
renderText({ node: r }) {
|
|
1371
1402
|
return r.textContent;
|
|
1372
1403
|
}
|
|
1373
|
-
})),
|
|
1404
|
+
})), t.push(ae)), this.allowItalic && t.push(se), this.allowStrike && t.push(le), this.allowUnderline && t.push(ce), this.placeholder && t.push(
|
|
1374
1405
|
ee.configure({ placeholder: this.placeholder })
|
|
1375
1406
|
);
|
|
1376
|
-
const
|
|
1407
|
+
const e = this, n = J.create({
|
|
1377
1408
|
addKeyboardShortcuts() {
|
|
1378
1409
|
return {
|
|
1379
|
-
"Shift-Enter": ({ editor: r }) =>
|
|
1410
|
+
"Shift-Enter": ({ editor: r }) => e.allowLineBreaks ? !1 : (r.commands.first(({ commands: s }) => [
|
|
1380
1411
|
() => s.newlineInCode(),
|
|
1381
|
-
() =>
|
|
1412
|
+
() => e.allowBulletList && s.splitListItem("listItem"),
|
|
1382
1413
|
() => s.createParagraphNear(),
|
|
1383
1414
|
() => s.liftEmptyBlock(),
|
|
1384
1415
|
() => s.splitBlock()
|
|
1385
1416
|
]), !0),
|
|
1386
|
-
Enter: () =>
|
|
1417
|
+
Enter: () => e.allowLineBreaks ? !1 : (e.$emit("enter"), !0)
|
|
1387
1418
|
};
|
|
1388
1419
|
}
|
|
1389
1420
|
});
|
|
1390
|
-
if (
|
|
1421
|
+
if (t.push(n), this.link && t.push(ie.extend({ inclusive: !1 }).configure({
|
|
1391
1422
|
HTMLAttributes: {
|
|
1392
1423
|
class: "d-link d-wb-break-all"
|
|
1393
1424
|
},
|
|
1394
1425
|
openOnClick: !1,
|
|
1395
1426
|
autolink: !0,
|
|
1396
1427
|
protocols: $
|
|
1397
|
-
})), this.customLink &&
|
|
1398
|
-
const r = { ...this.mentionSuggestion, ...
|
|
1399
|
-
|
|
1428
|
+
})), this.customLink && t.push(this.getExtension(dt, this.customLink)), this.mentionSuggestion) {
|
|
1429
|
+
const r = { ...this.mentionSuggestion, ...Mt };
|
|
1430
|
+
t.push(wt.configure({ suggestion: r }));
|
|
1400
1431
|
}
|
|
1401
1432
|
if (this.channelSuggestion) {
|
|
1402
|
-
const r = { ...this.channelSuggestion, ...
|
|
1403
|
-
|
|
1433
|
+
const r = { ...this.channelSuggestion, ...qt };
|
|
1434
|
+
t.push(Ct.configure({ suggestion: r }));
|
|
1404
1435
|
}
|
|
1405
1436
|
if (this.slashCommandSuggestion) {
|
|
1406
|
-
const r = { ...this.slashCommandSuggestion, ...
|
|
1407
|
-
|
|
1437
|
+
const r = { ...this.slashCommandSuggestion, ...Jt };
|
|
1438
|
+
t.push(It.configure({
|
|
1408
1439
|
suggestion: r,
|
|
1409
1440
|
onSelectedCommand: (s) => {
|
|
1410
1441
|
this.$emit("selected-command", s);
|
|
1411
1442
|
}
|
|
1412
1443
|
}));
|
|
1413
1444
|
}
|
|
1414
|
-
return
|
|
1445
|
+
return t.push(nt), t.push(ue.configure({
|
|
1415
1446
|
types: ["paragraph"]
|
|
1416
|
-
})), this.allowCode &&
|
|
1447
|
+
})), this.allowCode && t.push(Q), this.allowCodeblock && t.push(G.extend({
|
|
1417
1448
|
renderText({ node: r }) {
|
|
1418
1449
|
return `\`\`\`
|
|
1419
1450
|
${r.textContent}
|
|
@@ -1423,15 +1454,15 @@ ${r.textContent}
|
|
|
1423
1454
|
HTMLAttributes: {
|
|
1424
1455
|
class: "d-rich-text-editor__code-block"
|
|
1425
1456
|
}
|
|
1426
|
-
})), this.allowInlineImages &&
|
|
1457
|
+
})), this.allowInlineImages && t.push(ut), (this.allowFontFamily || this.allowFontColor) && (t.push(he), this.allowFontColor && t.push(fe), this.allowFontFamily && t.push(pe)), this.additionalExtensions.length && t.push(...this.additionalExtensions), t;
|
|
1427
1458
|
},
|
|
1428
1459
|
inputAttrs() {
|
|
1429
|
-
const
|
|
1460
|
+
const t = {
|
|
1430
1461
|
"aria-label": this.inputAriaLabel,
|
|
1431
1462
|
"aria-multiline": !0,
|
|
1432
1463
|
role: "textbox"
|
|
1433
1464
|
};
|
|
1434
|
-
return this.editable || (
|
|
1465
|
+
return this.editable || (t["aria-readonly"] = !0), t;
|
|
1435
1466
|
}
|
|
1436
1467
|
},
|
|
1437
1468
|
/**
|
|
@@ -1440,20 +1471,20 @@ ${r.textContent}
|
|
|
1440
1471
|
* to be hooked up to the Editor's own API.
|
|
1441
1472
|
*/
|
|
1442
1473
|
watch: {
|
|
1443
|
-
editable(
|
|
1444
|
-
this.editor.setEditable(
|
|
1474
|
+
editable(t) {
|
|
1475
|
+
this.editor.setEditable(t), this.updateEditorAttributes({ "aria-readonly": !t });
|
|
1445
1476
|
},
|
|
1446
|
-
inputClass(
|
|
1447
|
-
this.updateEditorAttributes({ class:
|
|
1477
|
+
inputClass(t) {
|
|
1478
|
+
this.updateEditorAttributes({ class: t });
|
|
1448
1479
|
},
|
|
1449
|
-
inputAriaLabel(
|
|
1450
|
-
this.updateEditorAttributes({ "aria-label":
|
|
1480
|
+
inputAriaLabel(t) {
|
|
1481
|
+
this.updateEditorAttributes({ "aria-label": t });
|
|
1451
1482
|
},
|
|
1452
1483
|
extensions() {
|
|
1453
1484
|
this.destroyEditor(), this.createEditor();
|
|
1454
1485
|
},
|
|
1455
|
-
value(
|
|
1456
|
-
this.processValue(
|
|
1486
|
+
value(t) {
|
|
1487
|
+
this.processValue(t);
|
|
1457
1488
|
}
|
|
1458
1489
|
},
|
|
1459
1490
|
created() {
|
|
@@ -1463,11 +1494,11 @@ ${r.textContent}
|
|
|
1463
1494
|
this.destroyEditor();
|
|
1464
1495
|
},
|
|
1465
1496
|
mounted() {
|
|
1466
|
-
|
|
1497
|
+
Ee(this.$el, this.$options.name), this.processValue(this.value, !1);
|
|
1467
1498
|
},
|
|
1468
1499
|
methods: {
|
|
1469
1500
|
createEditor() {
|
|
1470
|
-
this.editor = new
|
|
1501
|
+
this.editor = new N({
|
|
1471
1502
|
autofocus: this.autoFocus,
|
|
1472
1503
|
content: this.value,
|
|
1473
1504
|
editable: this.editable,
|
|
@@ -1480,147 +1511,147 @@ ${r.textContent}
|
|
|
1480
1511
|
...this.inputAttrs,
|
|
1481
1512
|
class: this.inputClass
|
|
1482
1513
|
},
|
|
1483
|
-
handleKeyDown: (
|
|
1514
|
+
handleKeyDown: (t, e) => {
|
|
1484
1515
|
if (!this.preventTyping) return !1;
|
|
1485
1516
|
const n = ["Backspace"];
|
|
1486
|
-
return !this.allowLineBreaks && !
|
|
1517
|
+
return !this.allowLineBreaks && !e.shiftKey && n.push("Enter"), !n.includes(e.key);
|
|
1487
1518
|
},
|
|
1488
|
-
handlePaste: (
|
|
1489
|
-
const r =
|
|
1490
|
-
return this.processPasteData(
|
|
1519
|
+
handlePaste: (t, e, n) => {
|
|
1520
|
+
const r = e.clipboardData || window.clipboardData, s = r.getData("text/plain"), o = r.getData("text/html");
|
|
1521
|
+
return this.processPasteData(t, s, o);
|
|
1491
1522
|
},
|
|
1492
1523
|
// Moves the <br /> tags inside the previous closing tag to avoid
|
|
1493
1524
|
// Prosemirror wrapping them within another </p> tag.
|
|
1494
|
-
transformPastedHTML(
|
|
1495
|
-
return
|
|
1525
|
+
transformPastedHTML(t) {
|
|
1526
|
+
return t.replace(/(<\/\w+>)((<br \/>)+)/g, "$2$3$1");
|
|
1496
1527
|
}
|
|
1497
1528
|
}
|
|
1498
1529
|
}), this.addEditorListeners();
|
|
1499
1530
|
},
|
|
1500
|
-
bubbleMenuShouldShow({ editor:
|
|
1501
|
-
return
|
|
1531
|
+
bubbleMenuShouldShow({ editor: t, view: e, state: n, oldState: r, from: s, to: o }) {
|
|
1532
|
+
return t.isActive("link");
|
|
1502
1533
|
},
|
|
1503
1534
|
/**
|
|
1504
1535
|
* If the selection contains a link, return the existing link text.
|
|
1505
1536
|
* Otherwise, use just the selected text.
|
|
1506
1537
|
* @param editor the editor instance.
|
|
1507
1538
|
*/
|
|
1508
|
-
getSelectedLinkText(
|
|
1539
|
+
getSelectedLinkText(t) {
|
|
1509
1540
|
var a, l, d;
|
|
1510
|
-
const { view:
|
|
1541
|
+
const { view: e, state: n } = t, { from: r, to: s } = e.state.selection, o = n.doc.textBetween(r, s, ""), i = this.editor.state.doc.nodeAt(r);
|
|
1511
1542
|
return i && ((d = (l = (a = i.marks) == null ? void 0 : a.at(0)) == null ? void 0 : l.type) == null ? void 0 : d.name) === "link" ? i.textContent : o;
|
|
1512
1543
|
},
|
|
1513
1544
|
editLink() {
|
|
1514
|
-
const
|
|
1545
|
+
const t = this.getSelectedLinkText(this.editor), e = {
|
|
1515
1546
|
href: this.editor.getAttributes("link").href,
|
|
1516
|
-
text:
|
|
1547
|
+
text: t
|
|
1517
1548
|
};
|
|
1518
|
-
this.$emit("edit-link",
|
|
1549
|
+
this.$emit("edit-link", e);
|
|
1519
1550
|
},
|
|
1520
1551
|
removeLink() {
|
|
1521
|
-
var
|
|
1522
|
-
(r = (n = (
|
|
1552
|
+
var t, e, n, r;
|
|
1553
|
+
(r = (n = (e = (t = this.editor) == null ? void 0 : t.chain()) == null ? void 0 : e.focus()) == null ? void 0 : n.unsetLink()) == null || r.run();
|
|
1523
1554
|
},
|
|
1524
1555
|
openLink() {
|
|
1525
|
-
var
|
|
1526
|
-
(n = (
|
|
1527
|
-
const
|
|
1528
|
-
window.open(
|
|
1556
|
+
var e, n;
|
|
1557
|
+
(n = (e = this.editor) == null ? void 0 : e.chain()) == null || n.focus();
|
|
1558
|
+
const t = this.editor.getAttributes("link").href;
|
|
1559
|
+
window.open(t, "_blank");
|
|
1529
1560
|
},
|
|
1530
1561
|
// eslint-disable-next-line complexity
|
|
1531
|
-
setLink(
|
|
1562
|
+
setLink(t, e, n, r = $, s) {
|
|
1532
1563
|
var a, l, d;
|
|
1533
|
-
if (!
|
|
1564
|
+
if (!t) {
|
|
1534
1565
|
this.removeLink();
|
|
1535
1566
|
return;
|
|
1536
1567
|
}
|
|
1537
|
-
r.find((u) => u.test(
|
|
1568
|
+
r.find((u) => u.test(t)) || (t = `${s}${t}`), this.editor.chain().focus().extendMarkRange("link").run();
|
|
1538
1569
|
const i = (d = (l = (a = this.editor) == null ? void 0 : a.view) == null ? void 0 : l.state) == null ? void 0 : d.selection;
|
|
1539
|
-
this.editor.chain().focus().insertContent(
|
|
1570
|
+
this.editor.chain().focus().insertContent(e).setTextSelection({ from: i.from, to: i.from + e.length }).setLink({ href: t, class: n.class }).run();
|
|
1540
1571
|
},
|
|
1541
1572
|
// eslint-disable-next-line complexity
|
|
1542
|
-
processValue(
|
|
1573
|
+
processValue(t, e = !0) {
|
|
1543
1574
|
const n = this.getOutput();
|
|
1544
|
-
if (!(
|
|
1545
|
-
if (typeof
|
|
1575
|
+
if (!(e && Be(t, n))) {
|
|
1576
|
+
if (typeof t == "string" && this.outputFormat === "text") {
|
|
1546
1577
|
const r = new RegExp(`(${O})`, "g");
|
|
1547
|
-
|
|
1578
|
+
t = t == null ? void 0 : t.replace(r, '<emoji-component code="$1"></emoji-component>');
|
|
1548
1579
|
}
|
|
1549
|
-
this.editor.commands.setContent(
|
|
1580
|
+
this.editor.commands.setContent(t, !1, { preserveWhitespace: "full" });
|
|
1550
1581
|
}
|
|
1551
1582
|
},
|
|
1552
1583
|
destroyEditor() {
|
|
1553
1584
|
this.editor.destroy();
|
|
1554
1585
|
},
|
|
1555
|
-
insertPlainTextWithHardBreaks(
|
|
1556
|
-
const { tr: n } =
|
|
1586
|
+
insertPlainTextWithHardBreaks(t, e) {
|
|
1587
|
+
const { tr: n } = t.state, { from: r, to: s } = t.state.selection;
|
|
1557
1588
|
n.deleteRange(r, s);
|
|
1558
|
-
const o =
|
|
1589
|
+
const o = e.split(/\r?\n/);
|
|
1559
1590
|
let i = r;
|
|
1560
1591
|
for (let a = 0; a < o.length; a++)
|
|
1561
|
-
a > 0 && (n.insert(i,
|
|
1562
|
-
|
|
1592
|
+
a > 0 && (n.insert(i, t.state.schema.nodes.hardBreak.create()), i++), n.insertText(o[a], i), i += o[a].length;
|
|
1593
|
+
t.dispatch(n);
|
|
1563
1594
|
},
|
|
1564
|
-
shouldPreserveLineBreaks(
|
|
1565
|
-
return this.pasteRichText ? !
|
|
1595
|
+
shouldPreserveLineBreaks(t, e) {
|
|
1596
|
+
return this.pasteRichText ? !e && t && this.hasBlankLines(t) : !!t;
|
|
1566
1597
|
},
|
|
1567
|
-
processPasteData(
|
|
1568
|
-
if (this.shouldPreserveLineBreaks(
|
|
1569
|
-
return this.insertPlainTextWithHardBreaks(
|
|
1598
|
+
processPasteData(t, e, n) {
|
|
1599
|
+
if (this.shouldPreserveLineBreaks(e, n))
|
|
1600
|
+
return this.insertPlainTextWithHardBreaks(t, e), !0;
|
|
1570
1601
|
if (this.shouldHandlePreformattedHTML(n)) {
|
|
1571
1602
|
const r = this.extractPreformattedText(n);
|
|
1572
1603
|
if (r && r.includes(`
|
|
1573
1604
|
`))
|
|
1574
|
-
return this.insertPlainTextWithHardBreaks(
|
|
1605
|
+
return this.insertPlainTextWithHardBreaks(t, r), !0;
|
|
1575
1606
|
}
|
|
1576
1607
|
return !1;
|
|
1577
1608
|
},
|
|
1578
|
-
shouldHandlePreformattedHTML(
|
|
1579
|
-
return this.pasteRichText &&
|
|
1609
|
+
shouldHandlePreformattedHTML(t) {
|
|
1610
|
+
return this.pasteRichText && t && this.containsPreformattedContent(t);
|
|
1580
1611
|
},
|
|
1581
|
-
containsPreformattedContent(
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1584
|
-
const n =
|
|
1612
|
+
containsPreformattedContent(t) {
|
|
1613
|
+
const e = document.createElement("div");
|
|
1614
|
+
e.innerHTML = t;
|
|
1615
|
+
const n = e.querySelectorAll("*");
|
|
1585
1616
|
for (const r of n)
|
|
1586
1617
|
if (this.hasPreWhitespace(r) && this.hasLineBreaks(r))
|
|
1587
1618
|
return !0;
|
|
1588
1619
|
return !1;
|
|
1589
1620
|
},
|
|
1590
|
-
hasPreWhitespace(
|
|
1591
|
-
const
|
|
1621
|
+
hasPreWhitespace(t) {
|
|
1622
|
+
const e = t.getAttribute("style") || "", n = t.style.whiteSpace || "", r = n === "pre" || n === "pre-wrap", s = e.includes("white-space: pre");
|
|
1592
1623
|
return r || s;
|
|
1593
1624
|
},
|
|
1594
|
-
hasLineBreaks(
|
|
1595
|
-
return
|
|
1625
|
+
hasLineBreaks(t) {
|
|
1626
|
+
return t.textContent && t.textContent.includes(`
|
|
1596
1627
|
`);
|
|
1597
1628
|
},
|
|
1598
|
-
hasBlankLines(
|
|
1599
|
-
return
|
|
1629
|
+
hasBlankLines(t) {
|
|
1630
|
+
return t.includes(`
|
|
1600
1631
|
|
|
1601
|
-
`) || /\n\s*\n/.test(
|
|
1602
|
-
},
|
|
1603
|
-
extractPreformattedText(
|
|
1604
|
-
const
|
|
1605
|
-
return
|
|
1606
|
-
},
|
|
1607
|
-
walkAndExtractText(
|
|
1608
|
-
let
|
|
1609
|
-
if (
|
|
1610
|
-
|
|
1611
|
-
else if (
|
|
1612
|
-
if (this.hasPreWhitespace(
|
|
1613
|
-
|
|
1632
|
+
`) || /\n\s*\n/.test(t);
|
|
1633
|
+
},
|
|
1634
|
+
extractPreformattedText(t) {
|
|
1635
|
+
const e = document.createElement("div");
|
|
1636
|
+
return e.innerHTML = t, this.walkAndExtractText(e);
|
|
1637
|
+
},
|
|
1638
|
+
walkAndExtractText(t) {
|
|
1639
|
+
let e = "";
|
|
1640
|
+
if (t.nodeType === Node.TEXT_NODE)
|
|
1641
|
+
e += t.textContent;
|
|
1642
|
+
else if (t.nodeType === Node.ELEMENT_NODE)
|
|
1643
|
+
if (this.hasPreWhitespace(t))
|
|
1644
|
+
e += t.textContent;
|
|
1614
1645
|
else
|
|
1615
|
-
for (const n of
|
|
1616
|
-
|
|
1617
|
-
return
|
|
1646
|
+
for (const n of t.childNodes)
|
|
1647
|
+
e += this.walkAndExtractText(n);
|
|
1648
|
+
return e;
|
|
1618
1649
|
},
|
|
1619
1650
|
triggerInputChangeEvents() {
|
|
1620
|
-
const
|
|
1621
|
-
this.$emit("input",
|
|
1622
|
-
const
|
|
1623
|
-
this.$emit("json-input",
|
|
1651
|
+
const t = this.getOutput();
|
|
1652
|
+
this.$emit("input", t), this.$emit("update:value", t);
|
|
1653
|
+
const e = this.editor.getJSON();
|
|
1654
|
+
this.$emit("json-input", e);
|
|
1624
1655
|
const n = this.editor.getHTML();
|
|
1625
1656
|
this.$emit("html-input", n);
|
|
1626
1657
|
const r = this.editor.getText({ blockSeparator: `
|
|
@@ -1636,12 +1667,12 @@ ${r.textContent}
|
|
|
1636
1667
|
this.triggerInputChangeEvents();
|
|
1637
1668
|
}), this.editor.on("update", () => {
|
|
1638
1669
|
this.triggerInputChangeEvents();
|
|
1639
|
-
}), this.editor.on("selectionUpdate", ({ editor:
|
|
1640
|
-
this.$emit("selected", this.getSelectedLinkText(
|
|
1641
|
-
}), this.editor.on("focus", ({ event:
|
|
1642
|
-
this.$emit("focus",
|
|
1643
|
-
}), this.editor.on("blur", ({ event:
|
|
1644
|
-
this.$emit("blur",
|
|
1670
|
+
}), this.editor.on("selectionUpdate", ({ editor: t }) => {
|
|
1671
|
+
this.$emit("selected", this.getSelectedLinkText(t));
|
|
1672
|
+
}), this.editor.on("focus", ({ event: t }) => {
|
|
1673
|
+
this.$emit("focus", t);
|
|
1674
|
+
}), this.editor.on("blur", ({ event: t }) => {
|
|
1675
|
+
this.$emit("blur", t);
|
|
1645
1676
|
});
|
|
1646
1677
|
},
|
|
1647
1678
|
getOutput() {
|
|
@@ -1656,17 +1687,17 @@ ${r.textContent}
|
|
|
1656
1687
|
` });
|
|
1657
1688
|
}
|
|
1658
1689
|
},
|
|
1659
|
-
getExtension(
|
|
1690
|
+
getExtension(t, e) {
|
|
1660
1691
|
var n;
|
|
1661
|
-
return typeof
|
|
1692
|
+
return typeof e == "boolean" ? t : (n = t.configure) == null ? void 0 : n.call(t, e);
|
|
1662
1693
|
},
|
|
1663
|
-
updateEditorAttributes(
|
|
1694
|
+
updateEditorAttributes(t) {
|
|
1664
1695
|
this.editor.setOptions({
|
|
1665
1696
|
editorProps: {
|
|
1666
1697
|
attributes: {
|
|
1667
1698
|
...this.inputAttrs,
|
|
1668
1699
|
class: this.inputClass,
|
|
1669
|
-
...
|
|
1700
|
+
...t
|
|
1670
1701
|
}
|
|
1671
1702
|
}
|
|
1672
1703
|
});
|
|
@@ -1676,16 +1707,16 @@ ${r.textContent}
|
|
|
1676
1707
|
}
|
|
1677
1708
|
}
|
|
1678
1709
|
};
|
|
1679
|
-
var
|
|
1680
|
-
var
|
|
1681
|
-
return n("div", [
|
|
1682
|
-
},
|
|
1683
|
-
Jt,
|
|
1710
|
+
var Gt = function() {
|
|
1711
|
+
var e = this, n = e._self._c;
|
|
1712
|
+
return n("div", [e.editor && e.link && !e.hideLinkBubbleMenu ? n("bubble-menu", { staticStyle: { visibility: "visible" }, attrs: { editor: e.editor, "should-show": e.bubbleMenuShouldShow, "tippy-options": e.tippyOptions } }, [n("div", { staticClass: "d-popover__dialog" }, [n("dt-stack", { staticClass: "d-rich-text-editor-bubble-menu__button-stack", attrs: { direction: "row", gap: "0" } }, [n("dt-button", { attrs: { kind: "muted", importance: "clear" }, on: { click: e.editLink } }, [e._v(" " + e._s(e.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL")) + " ")]), n("dt-button", { attrs: { kind: "muted", importance: "clear" }, on: { click: e.openLink } }, [e._v(" " + e._s(e.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL")) + " ")]), n("dt-button", { attrs: { kind: "danger", importance: "clear" }, on: { click: e.removeLink } }, [e._v(" " + e._s(e.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL")) + " ")])], 1)], 1)]) : e._e(), n("editor-content", e._g({ ref: "editor", staticClass: "d-rich-text-editor", attrs: { editor: e.editor, "data-qa": "dt-rich-text-editor" } }, e.editorListeners))], 1);
|
|
1713
|
+
}, Qt = [], Zt = /* @__PURE__ */ c(
|
|
1684
1714
|
Yt,
|
|
1685
|
-
Gt
|
|
1715
|
+
Gt,
|
|
1716
|
+
Qt
|
|
1686
1717
|
);
|
|
1687
|
-
const
|
|
1718
|
+
const Wn = Zt.exports;
|
|
1688
1719
|
export {
|
|
1689
|
-
|
|
1720
|
+
Wn as default
|
|
1690
1721
|
};
|
|
1691
1722
|
//# sourceMappingURL=rich-text-editor.js.map
|