@dialpad/dialtone 9.24.0 → 9.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/CHANGELOG.json +1 -1
- package/dist/css/dialtone.css +3 -2
- package/dist/css/dialtone.min.css +1 -1
- package/dist/tokens/android/java/tokens-dark.kt +1 -1
- package/dist/tokens/android/java/tokens-light.kt +1 -1
- package/dist/tokens/android/res/values/colors-dark.xml +1 -1
- package/dist/tokens/android/res/values/colors-light.xml +1 -1
- package/dist/tokens/android/res/values/dimens.xml +1 -1
- package/dist/tokens/css/variables-dark.css +1 -1
- package/dist/tokens/css/variables-light.css +1 -1
- package/dist/tokens/ios/tokens-dark.swift +1 -1
- package/dist/tokens/ios/tokens-light.swift +1 -1
- package/dist/tokens/less/variables-dark.less +1 -1
- package/dist/tokens/less/variables-light.less +1 -1
- package/dist/vue2/dialtone-vue.cjs +3 -2
- package/dist/vue2/dialtone-vue.cjs.map +1 -0
- package/dist/vue2/dialtone-vue.js +13 -7
- package/dist/vue2/dialtone-vue.js.map +1 -0
- package/dist/vue2/directives.cjs +1 -0
- package/dist/vue2/directives.cjs.map +1 -0
- package/dist/vue2/directives.js +1 -0
- package/dist/vue2/directives.js.map +1 -0
- package/dist/vue2/emoji.cjs +1 -0
- package/dist/vue2/emoji.cjs.map +1 -0
- package/dist/vue2/emoji.js +1 -0
- package/dist/vue2/emoji.js.map +1 -0
- package/dist/vue2/emoji_picker-kiTOKaq8.js +1 -0
- package/dist/vue2/emoji_picker-kiTOKaq8.js.map +1 -0
- package/dist/vue2/emoji_picker-njWWAm6V.cjs +1 -0
- package/dist/vue2/emoji_picker-njWWAm6V.cjs.map +1 -0
- package/dist/vue2/emoji_text_wrapper-48ClwKvf.js +1 -0
- package/dist/vue2/emoji_text_wrapper-48ClwKvf.js.map +1 -0
- package/dist/vue2/emoji_text_wrapper-ZlynvHnd.cjs +1 -0
- package/dist/vue2/emoji_text_wrapper-ZlynvHnd.cjs.map +1 -0
- package/dist/vue2/index-OF94C6nQ.js +1 -0
- package/dist/vue2/index-OF94C6nQ.js.map +1 -0
- package/dist/vue2/index-Wx7Jagcr.cjs +1 -0
- package/dist/vue2/index-Wx7Jagcr.cjs.map +1 -0
- package/dist/vue2/message_input.cjs +2 -1
- package/dist/vue2/message_input.cjs.map +1 -0
- package/dist/vue2/message_input.js +45 -28
- package/dist/vue2/message_input.js.map +1 -0
- package/dist/vue2/{rich_text_editor-hUaQyiPu.cjs → rich_text_editor-RVMsCB8N.cjs} +16 -15
- package/dist/vue2/rich_text_editor-RVMsCB8N.cjs.map +1 -0
- package/dist/vue2/{rich_text_editor-tzOBsCIH.js → rich_text_editor-eMvTs_Gp.js} +8 -7
- package/dist/vue2/rich_text_editor-eMvTs_Gp.js.map +1 -0
- package/dist/vue2/style.css +1 -1
- package/dist/vue2/tooltip-88U5vFMA.js +1 -0
- package/dist/vue2/tooltip-88U5vFMA.js.map +1 -0
- package/dist/vue2/tooltip-i2wxFIIi.cjs +1 -0
- package/dist/vue2/tooltip-i2wxFIIi.cjs.map +1 -0
- package/dist/vue2/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts +1 -0
- package/dist/vue2/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts.map +1 -1
- package/dist/vue2/types/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.d.ts +1 -1
- package/dist/vue2/types/recipes/conversation_view/editor/editor.vue.d.ts +9 -0
- package/dist/vue2/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts +2 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/vue3/dialtone-vue.cjs +3 -2
- package/dist/vue3/dialtone-vue.cjs.map +1 -0
- package/dist/vue3/dialtone-vue.js +410 -401
- package/dist/vue3/dialtone-vue.js.map +1 -0
- package/dist/vue3/directives.cjs +1 -0
- package/dist/vue3/directives.cjs.map +1 -0
- package/dist/vue3/directives.js +1 -0
- package/dist/vue3/directives.js.map +1 -0
- package/dist/vue3/emoji-DpXo7Avz.js +1 -0
- package/dist/vue3/emoji-DpXo7Avz.js.map +1 -0
- package/dist/vue3/emoji-njsSZBHg.cjs +1 -0
- package/dist/vue3/emoji-njsSZBHg.cjs.map +1 -0
- package/dist/vue3/emoji.cjs +1 -0
- package/dist/vue3/emoji.cjs.map +1 -0
- package/dist/vue3/emoji.js +1 -0
- package/dist/vue3/emoji.js.map +1 -0
- package/dist/vue3/emoji_picker-rUhIsKoU.cjs +1 -0
- package/dist/vue3/emoji_picker-rUhIsKoU.cjs.map +1 -0
- package/dist/vue3/emoji_picker-vEQ--pAv.js +1 -0
- package/dist/vue3/emoji_picker-vEQ--pAv.js.map +1 -0
- package/dist/vue3/emoji_text_wrapper-icAiqYqk.js +1 -0
- package/dist/vue3/emoji_text_wrapper-icAiqYqk.js.map +1 -0
- package/dist/vue3/emoji_text_wrapper-zz_nxXi-.cjs +1 -0
- package/dist/vue3/emoji_text_wrapper-zz_nxXi-.cjs.map +1 -0
- package/dist/vue3/message_input.cjs +2 -1
- package/dist/vue3/message_input.cjs.map +1 -0
- package/dist/vue3/message_input.js +46 -26
- package/dist/vue3/message_input.js.map +1 -0
- package/dist/vue3/{rich_text_editor-knDe1iDy.cjs → rich_text_editor-B2jQbDxj.cjs} +2 -1
- package/dist/vue3/rich_text_editor-B2jQbDxj.cjs.map +1 -0
- package/dist/vue3/{rich_text_editor-5t4kYsh_.js → rich_text_editor-mgv4CNR6.js} +9 -8
- package/dist/vue3/rich_text_editor-mgv4CNR6.js.map +1 -0
- package/dist/vue3/style.css +1 -1
- package/dist/vue3/tooltip-P8ouLQqi.cjs +1 -0
- package/dist/vue3/tooltip-P8ouLQqi.cjs.map +1 -0
- package/dist/vue3/tooltip-S6S4up2q.js +1 -0
- package/dist/vue3/tooltip-S6S4up2q.js.map +1 -0
- package/dist/vue3/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts +1 -0
- package/dist/vue3/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts.map +1 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.d.ts +1 -1
- package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts +9 -0
- package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +3 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { D as v, a as L, R as
|
|
2
|
-
import { t as
|
|
1
|
+
import { D as v, a as L, R as D, b as F } from "./rich_text_editor-mgv4CNR6.js";
|
|
2
|
+
import { t as I, w as B, x as E } from "./emoji-DpXo7Avz.js";
|
|
3
3
|
import { _ as T } from "./emoji_picker-vEQ--pAv.js";
|
|
4
4
|
import { _ as x, D as O } from "./tooltip-S6S4up2q.js";
|
|
5
|
-
import { resolveComponent as r, openBlock as u, createElementBlock as k, normalizeClass as S, withKeys as _, withModifiers as V, createElementVNode as d, normalizeStyle as M, createVNode as l, mergeProps as
|
|
5
|
+
import { resolveComponent as r, openBlock as u, createElementBlock as k, normalizeClass as S, withKeys as _, withModifiers as V, createElementVNode as d, normalizeStyle as M, createVNode as l, mergeProps as P, renderSlot as R, createBlock as c, withCtx as s, createCommentVNode as m, withDirectives as U, toDisplayString as h, vShow as q, createSlots as z } from "vue";
|
|
6
6
|
const A = {
|
|
7
7
|
name: "DtRecipeMessageInput",
|
|
8
8
|
components: {
|
|
9
|
-
DtButton:
|
|
9
|
+
DtButton: I,
|
|
10
10
|
DtEmojiPicker: T,
|
|
11
11
|
DtIcon: B,
|
|
12
12
|
DtInput: E,
|
|
@@ -64,7 +64,7 @@ const A = {
|
|
|
64
64
|
type: [Boolean, String, Number],
|
|
65
65
|
default: !1,
|
|
66
66
|
validator(t) {
|
|
67
|
-
return typeof t == "string" ?
|
|
67
|
+
return typeof t == "string" ? D.includes(t) : !0;
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
/**
|
|
@@ -77,7 +77,7 @@ const A = {
|
|
|
77
77
|
type: String,
|
|
78
78
|
default: "text",
|
|
79
79
|
validator(t) {
|
|
80
|
-
return
|
|
80
|
+
return F.includes(t);
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
/**
|
|
@@ -208,6 +208,13 @@ const A = {
|
|
|
208
208
|
* @type {Array}
|
|
209
209
|
*/
|
|
210
210
|
"add-media",
|
|
211
|
+
/**
|
|
212
|
+
* Fires when media is pasted into the message input
|
|
213
|
+
*
|
|
214
|
+
* @event paste-media
|
|
215
|
+
* @type {Array}
|
|
216
|
+
*/
|
|
217
|
+
"paste-media",
|
|
211
218
|
/**
|
|
212
219
|
* Fires when cancel button is pressed (only on edit mode)
|
|
213
220
|
*
|
|
@@ -292,8 +299,15 @@ const A = {
|
|
|
292
299
|
},
|
|
293
300
|
onDrop(t) {
|
|
294
301
|
t.stopPropagation(), t.preventDefault();
|
|
295
|
-
const e = t.dataTransfer,
|
|
296
|
-
this.$emit("add-media",
|
|
302
|
+
const e = t.dataTransfer, n = Array.from(e.files);
|
|
303
|
+
this.$emit("add-media", n);
|
|
304
|
+
},
|
|
305
|
+
onPaste(t) {
|
|
306
|
+
if (t.clipboardData.files.length) {
|
|
307
|
+
t.stopPropagation(), t.preventDefault();
|
|
308
|
+
const e = [...t.clipboardData.files];
|
|
309
|
+
this.$emit("paste-media", e);
|
|
310
|
+
}
|
|
297
311
|
},
|
|
298
312
|
onSkinTone(t) {
|
|
299
313
|
this.$emit("skin-tone", t);
|
|
@@ -326,7 +340,8 @@ const A = {
|
|
|
326
340
|
this.$emit("cancel");
|
|
327
341
|
},
|
|
328
342
|
onFocus(t) {
|
|
329
|
-
|
|
343
|
+
var e;
|
|
344
|
+
this.hasFocus = !0, (e = this.$refs.richTextEditor) == null || e.focusEditor(), this.$emit("focus", t);
|
|
330
345
|
},
|
|
331
346
|
onBlur(t) {
|
|
332
347
|
this.hasFocus = !1, this.$emit("blur", t);
|
|
@@ -336,8 +351,8 @@ const A = {
|
|
|
336
351
|
}
|
|
337
352
|
}
|
|
338
353
|
}, H = { class: "d-d-flex d-jc-space-between d-mx8 d-my4" }, N = { class: "d-d-flex" }, K = { class: "d-d-flex" }, W = { key: 0 };
|
|
339
|
-
function X(t, e, n,
|
|
340
|
-
const
|
|
354
|
+
function X(t, e, n, Y, a, i) {
|
|
355
|
+
const j = r("dt-rich-text-editor"), p = r("dt-icon"), f = r("dt-button"), w = r("dt-input"), g = r("dt-tooltip"), y = r("dt-emoji-picker"), C = r("dt-popover");
|
|
341
356
|
return u(), k("div", {
|
|
342
357
|
"data-qa": "dt-message-input",
|
|
343
358
|
role: "presentation",
|
|
@@ -350,17 +365,21 @@ function X(t, e, n, b, a, i) {
|
|
|
350
365
|
"d-c-text",
|
|
351
366
|
{ "d-bc-bold d-bs-sm": a.hasFocus, "d-bc-default": !a.hasFocus }
|
|
352
367
|
]),
|
|
353
|
-
onClick: e[15] || (e[15] = (o) =>
|
|
368
|
+
onClick: e[15] || (e[15] = (o) => {
|
|
369
|
+
var b;
|
|
370
|
+
return (b = t.$refs.richTextEditor) == null ? void 0 : b.focusEditor();
|
|
371
|
+
}),
|
|
354
372
|
onDragEnter: e[16] || (e[16] = (...o) => i.onDrag && i.onDrag(...o)),
|
|
355
373
|
onDragOver: e[17] || (e[17] = (...o) => i.onDrag && i.onDrag(...o)),
|
|
356
374
|
onDrop: e[18] || (e[18] = (...o) => i.onDrop && i.onDrop(...o)),
|
|
357
|
-
onKeydown: e[19] || (e[19] = _(V((...o) => i.onSend && i.onSend(...o), ["exact"]), ["enter"]))
|
|
375
|
+
onKeydown: e[19] || (e[19] = _(V((...o) => i.onSend && i.onSend(...o), ["exact"]), ["enter"])),
|
|
376
|
+
onPaste: e[20] || (e[20] = (...o) => i.onPaste && i.onPaste(...o))
|
|
358
377
|
}, [
|
|
359
378
|
d("div", {
|
|
360
379
|
class: "d-of-auto d-mx16 d-mt8 d-mb4",
|
|
361
380
|
style: M({ "max-height": n.maxHeight })
|
|
362
381
|
}, [
|
|
363
|
-
l(
|
|
382
|
+
l(j, P({
|
|
364
383
|
ref: "richTextEditor",
|
|
365
384
|
modelValue: a.internalInputValue,
|
|
366
385
|
"onUpdate:modelValue": e[0] || (e[0] = (o) => a.internalInputValue = o),
|
|
@@ -402,14 +421,14 @@ function X(t, e, n, b, a, i) {
|
|
|
402
421
|
onBlur: e[5] || (e[5] = (o) => a.imagePickerFocus = !1)
|
|
403
422
|
}, {
|
|
404
423
|
icon: s(() => [
|
|
405
|
-
l(
|
|
424
|
+
l(p, {
|
|
406
425
|
name: "image",
|
|
407
426
|
size: "300"
|
|
408
427
|
})
|
|
409
428
|
]),
|
|
410
429
|
_: 1
|
|
411
430
|
}, 8, ["kind", "aria-label", "onClick"]),
|
|
412
|
-
l(
|
|
431
|
+
l(w, {
|
|
413
432
|
ref: "messageInputImageUpload",
|
|
414
433
|
"data-qa": "dt-message-input-image-input",
|
|
415
434
|
type: "file",
|
|
@@ -452,7 +471,7 @@ function X(t, e, n, b, a, i) {
|
|
|
452
471
|
onBlur: e[9] || (e[9] = (o) => a.emojiPickerFocus = !1)
|
|
453
472
|
}, {
|
|
454
473
|
icon: s(() => [
|
|
455
|
-
l(
|
|
474
|
+
l(p, {
|
|
456
475
|
name: i.emojiPickerHovered ? "very-satisfied" : "satisfied",
|
|
457
476
|
size: "300"
|
|
458
477
|
}, null, 8, ["name"])
|
|
@@ -464,7 +483,7 @@ function X(t, e, n, b, a, i) {
|
|
|
464
483
|
}, 8, ["message"])
|
|
465
484
|
]),
|
|
466
485
|
content: s(() => [
|
|
467
|
-
l(y,
|
|
486
|
+
l(y, P(n.emojiPickerProps, {
|
|
468
487
|
onSkinTone: i.onSkinTone,
|
|
469
488
|
onSelectedEmoji: i.onSelectEmoji
|
|
470
489
|
}), null, 16, ["onSkinTone", "onSelectedEmoji"])
|
|
@@ -485,7 +504,7 @@ function X(t, e, n, b, a, i) {
|
|
|
485
504
|
U(d("p", {
|
|
486
505
|
class: "d-fc-error d-mr16 dt-message-input--remaining-char",
|
|
487
506
|
"data-qa": "dt-message-input-character-limit"
|
|
488
|
-
},
|
|
507
|
+
}, h(n.showCharacterLimit.count - i.inputLength), 513), [
|
|
489
508
|
[q, i.displayCharacterLimitWarning]
|
|
490
509
|
])
|
|
491
510
|
]),
|
|
@@ -502,7 +521,7 @@ function X(t, e, n, b, a, i) {
|
|
|
502
521
|
onClick: i.onCancel
|
|
503
522
|
}, {
|
|
504
523
|
default: s(() => [
|
|
505
|
-
d("p", null,
|
|
524
|
+
d("p", null, h(n.showCancel.text), 1)
|
|
506
525
|
]),
|
|
507
526
|
_: 1
|
|
508
527
|
}, 8, ["aria-label", "onClick"])) : m("", !0),
|
|
@@ -535,14 +554,14 @@ function X(t, e, n, b, a, i) {
|
|
|
535
554
|
onBlur: e[14] || (e[14] = (o) => a.sendButtonFocus = !1)
|
|
536
555
|
}, z({
|
|
537
556
|
default: s(() => [
|
|
538
|
-
n.showSend.text ? (u(), k("p", W,
|
|
557
|
+
n.showSend.text ? (u(), k("p", W, h(n.showSend.text), 1)) : m("", !0)
|
|
539
558
|
]),
|
|
540
559
|
_: 2
|
|
541
560
|
}, [
|
|
542
561
|
n.showSend.icon ? {
|
|
543
562
|
name: "icon",
|
|
544
563
|
fn: s(() => [
|
|
545
|
-
l(
|
|
564
|
+
l(p, {
|
|
546
565
|
name: n.showSend.icon,
|
|
547
566
|
size: "300"
|
|
548
567
|
}, null, 8, ["name"])
|
|
@@ -557,10 +576,11 @@ function X(t, e, n, b, a, i) {
|
|
|
557
576
|
])
|
|
558
577
|
], 34);
|
|
559
578
|
}
|
|
560
|
-
const
|
|
579
|
+
const ee = /* @__PURE__ */ x(A, [["render", X]]);
|
|
561
580
|
export {
|
|
562
|
-
|
|
581
|
+
ee as DtRecipeMessageInput,
|
|
563
582
|
L as DtRichTextEditor,
|
|
564
|
-
|
|
565
|
-
|
|
583
|
+
D as RICH_TEXT_EDITOR_AUTOFOCUS_TYPES,
|
|
584
|
+
F as RICH_TEXT_EDITOR_OUTPUT_FORMATS
|
|
566
585
|
};
|
|
586
|
+
//# sourceMappingURL=message_input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message_input.js","sources":["../recipes/conversation_view/message_input/message_input.vue"],"sourcesContent":["<!-- eslint-disable vue/no-restricted-class -->\n<template>\n <div\n data-qa=\"dt-message-input\"\n role=\"presentation\"\n :class=\"['d-d-flex', 'd-fd-column', 'd-bar8', 'd-baw1', 'd-ba', 'd-c-text',\n { 'd-bc-bold d-bs-sm': hasFocus, 'd-bc-default': !hasFocus }]\"\n @click=\"$refs.richTextEditor?.focusEditor()\"\n @drag-enter=\"onDrag\"\n @drag-over=\"onDrag\"\n @drop=\"onDrop\"\n @keydown.enter.exact=\"onSend\"\n @paste=\"onPaste\"\n >\n <!-- Some wrapper to restrict the height and show the scrollbar -->\n <div\n class=\"d-of-auto d-mx16 d-mt8 d-mb4\"\n :style=\"{ 'max-height': maxHeight }\"\n >\n <dt-rich-text-editor\n ref=\"richTextEditor\"\n v-model=\"internalInputValue\"\n :editable=\"editable\"\n :input-aria-label=\"inputAriaLabel\"\n :input-class=\"inputClass\"\n :output-format=\"outputFormat\"\n :auto-focus=\"autoFocus\"\n :link=\"link\"\n :placeholder=\"placeholder\"\n :mention-suggestion=\"mentionSuggestion\"\n v-bind=\"$attrs\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n @input=\"onInput($event)\"\n />\n </div>\n <!-- @slot Slot for attachment carousel -->\n <slot name=\"middle\" />\n <!-- Section for the bottom UI -->\n <section class=\"d-d-flex d-jc-space-between d-mx8 d-my4\">\n <!-- Left content -->\n <div class=\"d-d-flex\">\n <dt-tooltip\n v-if=\"showImagePicker\"\n placement=\"top-start\"\n :message=\"showImagePicker.tooltipLabel\"\n :offset=\"[-4, -4]\"\n >\n <template #anchor>\n <dt-button\n data-qa=\"dt-message-input-image-btn\"\n size=\"sm\"\n circle\n :kind=\"imagePickerFocus ? 'default' : 'muted'\"\n importance=\"clear\"\n :aria-label=\"showImagePicker.ariaLabel\"\n @click=\"onSelectImage\"\n @mouseenter=\"imagePickerFocus = true\"\n @mouseleave=\"imagePickerFocus = false\"\n @focus=\"imagePickerFocus = true\"\n @blur=\"imagePickerFocus = false\"\n >\n <template #icon>\n <dt-icon\n name=\"image\"\n size=\"300\"\n />\n </template>\n </dt-button>\n <dt-input\n ref=\"messageInputImageUpload\"\n data-qa=\"dt-message-input-image-input\"\n type=\"file\"\n class=\"d-ps-absolute\"\n multiple\n hidden\n @input=\"onImageUpload\"\n />\n </template>\n </dt-tooltip>\n <dt-popover\n v-if=\"showEmojiPicker\"\n data-qa=\"dt-message-input-emoji-picker-popover\"\n :open=\"emojiPickerOpened\"\n initial-focus-element=\"#searchInput\"\n padding=\"none\"\n @opened=\"(open) => { emojiPickerOpened = open }\"\n >\n <template #anchor>\n <dt-tooltip\n :message=\"emojiTooltipMessage\"\n :offset=\"[0, -4]\"\n >\n <template #anchor>\n <dt-button\n data-qa=\"dt-message-input-emoji-picker-btn\"\n size=\"sm\"\n circle\n :kind=\"emojiPickerHovered ? 'default' : 'muted'\"\n importance=\"clear\"\n :aria-label=\"emojiButtonAriaLabel\"\n :offset=\"[0, 0]\"\n @click=\"toggleEmojiPicker\"\n @mouseenter=\"emojiPickerFocus = true\"\n @mouseleave=\"emojiPickerFocus = false\"\n @focus=\"emojiPickerFocus = true\"\n @blur=\"emojiPickerFocus = false\"\n >\n <template #icon>\n <dt-icon\n :name=\"!emojiPickerHovered ? 'satisfied' : 'very-satisfied'\"\n size=\"300\"\n />\n </template>\n </dt-button>\n </template>\n </dt-tooltip>\n </template>\n <template #content>\n <dt-emoji-picker\n v-bind=\"emojiPickerProps\"\n @skin-tone=\"onSkinTone\"\n @selected-emoji=\"onSelectEmoji\"\n />\n </template>\n </dt-popover>\n </div>\n <!-- Right content -->\n <div class=\"d-d-flex\">\n <!-- Optionally displayed remaining character counter -->\n <dt-tooltip\n v-if=\"Boolean(showCharacterLimit)\"\n class=\"dt-message-input--remaining-char-tooltip\"\n placement=\"top-end\"\n :enabled=\"characterLimitTooltipEnabled\"\n :message=\"showCharacterLimit.message\"\n :offset=\"[10, -8]\"\n >\n <template #anchor>\n <p\n v-show=\"displayCharacterLimitWarning\"\n class=\"d-fc-error d-mr16 dt-message-input--remaining-char\"\n data-qa=\"dt-message-input-character-limit\"\n >\n {{ showCharacterLimit.count - inputLength }}\n </p>\n </template>\n </dt-tooltip>\n\n <!-- Cancel button for edit mode -->\n <dt-button\n v-if=\"showCancel\"\n data-qa=\"dt-message-input-cancel-button\"\n class=\"dt-message-input--cancel-button\"\n size=\"sm\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"showCancel.ariaLabel\"\n @click=\"onCancel\"\n >\n <p>{{ showCancel.text }}</p>\n </dt-button>\n\n <!-- Send button -->\n <dt-tooltip\n v-if=\"showSend\"\n placement=\"top-end\"\n :enabled=\"!showSend\"\n :message=\"showSend.tooltipLabel\"\n :show=\"!isSendDisabled && sendButtonFocus\"\n :offset=\"[6, -8]\"\n >\n <template #anchor>\n <!-- Right positioned UI - send button -->\n <dt-button\n data-qa=\"dt-message-input-send-btn\"\n size=\"sm\"\n kind=\"default\"\n importance=\"primary\"\n :class=\"[\n 'd-btn--circle',\n {\n 'message-input-button__disabled d-fc-muted': isSendDisabled,\n },\n ]\"\n :aria-label=\"showSend.ariaLabel\"\n :aria-disabled=\"isSendDisabled\"\n @click=\"onSend\"\n @mouseenter=\"sendButtonFocus = true\"\n @mouseleave=\"sendButtonFocus = false\"\n @focus=\"sendButtonFocus = true\"\n @blur=\"sendButtonFocus = false\"\n >\n <template\n v-if=\"showSend.icon\"\n #icon\n >\n <dt-icon\n :name=\"showSend.icon\"\n size=\"300\"\n />\n </template>\n <template\n v-if=\"showSend.text\"\n >\n <p>{{ showSend.text }}</p>\n </template>\n </dt-button>\n </template>\n </dt-tooltip>\n </div>\n </section>\n </div>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport {\n DtRichTextEditor,\n RICH_TEXT_EDITOR_OUTPUT_FORMATS,\n RICH_TEXT_EDITOR_AUTOFOCUS_TYPES,\n} from '@/components/rich_text_editor';\nimport { DtButton } from '@/components/button';\nimport { DtIcon } from '@/components/icon';\nimport { DtEmojiPicker } from '@/components/emoji_picker';\nimport { DtPopover } from '@/components/popover';\nimport { DtInput } from '@/components/input';\nimport { DtTooltip } from '@/components/tooltip';\n\nexport default {\n name: 'DtRecipeMessageInput',\n\n components: {\n DtButton,\n DtEmojiPicker,\n DtIcon,\n DtInput,\n DtPopover,\n DtRichTextEditor,\n DtTooltip,\n },\n\n mixins: [],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Value of the input. The object format should match TipTap's JSON\n * document structure: https://tiptap.dev/guide/output#option-1-json\n */\n modelValue: {\n type: [Object, String],\n default: '',\n },\n\n /**\n * Whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Descriptive label for the input element\n */\n inputAriaLabel: {\n type: String,\n required: true,\n default: '',\n },\n\n /**\n * Additional class name for the input element. Only accepts a String value\n * because this is passed to the editor via options. For multiple classes,\n * join them into one string, e.g. \"d-p8 d-hmx96\"\n */\n inputClass: {\n type: String,\n default: '',\n },\n\n /**\n * Whether the input should receive focus after the component has been\n * mounted. Either one of `start`, `end`, `all` or a Boolean or a Number.\n * - `start` Sets the focus to the beginning of the input\n * - `end` Sets the focus to the end of the input\n * - `all` Selects the whole contents of the input\n * - `Number` Sets the focus to a specific position in the input\n * - `true` Defaults to `start`\n * - `false` Disables autofocus\n * @values true, false, start, end, all, number\n */\n autoFocus: {\n type: [Boolean, String, Number],\n default: false,\n validator (autoFocus) {\n if (typeof autoFocus === 'string') {\n return RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(autoFocus);\n }\n return true;\n },\n },\n\n /**\n * The output format that the editor uses when emitting the \"@input\" event.\n * One of `text`, `json`, `html`. See https://tiptap.dev/guide/output for\n * examples.\n * @values text, json, html\n */\n outputFormat: {\n type: String,\n default: 'text',\n validator (outputFormat) {\n return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);\n },\n },\n\n /**\n * Enables the Link extension and optionally passes configurations to it\n */\n link: {\n type: [Boolean, Object],\n default: false,\n },\n\n /**\n * Placeholder text\n */\n placeholder: {\n type: String,\n default: '',\n },\n\n /**\n * Disable Send Button\n */\n disableSend: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Content area needs to dynamically adjust height based on the conversation area height.\n * can be vh|px|rem|em|%\n */\n maxHeight: {\n type: String,\n default: 'unset',\n },\n\n // Emoji picker props\n showEmojiPicker: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Props to pass into the emoji picker.\n */\n emojiPickerProps: {\n type: Object,\n default: () => ({}),\n validate (emojiPickerProps) {\n return [\n 'searchNoResultsLabel',\n 'searchResultsLabel',\n 'searchPlaceholderLabel',\n 'skinSelectorButtonTooltipLabel',\n 'tabSetLabels',\n ].every(prop => emojiPickerProps[prop] != null);\n },\n },\n\n /**\n * Emoji button tooltip label\n */\n emojiTooltipMessage: {\n type: String,\n default: 'Emoji',\n },\n\n // Aria label for buttons\n /**\n * Emoji button aria label\n */\n emojiButtonAriaLabel: {\n type: String,\n default: 'emoji button',\n },\n\n /**\n * Enable character Limit warning\n */\n showCharacterLimit: {\n type: [Boolean, Object],\n default: () => ({ count: 1500, warning: 500, message: '' }),\n },\n\n showImagePicker: {\n type: [Boolean, Object],\n default: () => ({ tooltipLabel: 'Attach Image', ariaLabel: 'image button' }),\n },\n\n /**\n * Send button defaults.\n */\n showSend: {\n type: [Boolean, Object],\n default: () => ({ icon: 'send' }),\n },\n\n /**\n * Cancel button defaults.\n */\n showCancel: {\n type: [Boolean, Object],\n default: () => ({ text: 'Cancel' }),\n },\n\n /**\n * suggestion object containing the items query function.\n * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion\n *\n * The only required key is the items function which is used to query the contacts for suggestion.\n * items({ query }) => { return [ContactObject]; }\n * ContactObject format:\n * { name: string, avatarSrc: string, id: string }\n *\n * When null, it does not add the plugin.\n */\n mentionSuggestion: {\n type: Object,\n default: null,\n },\n },\n\n emits: [\n /**\n * Fires when send button is clicked\n *\n * @event submit\n * @type {String}\n */\n 'submit',\n\n /**\n * Fires when media is selected from image button\n *\n * @event select-media\n * @type {Array}\n */\n 'select-media',\n\n /**\n * Fires when media is dropped into the message input\n *\n * @event add-media\n * @type {Array}\n */\n 'add-media',\n\n /**\n * Fires when media is pasted into the message input\n *\n * @event paste-media\n * @type {Array}\n */\n 'paste-media',\n\n /**\n * Fires when cancel button is pressed (only on edit mode)\n *\n * @event cancel\n * @type {Boolean}\n */\n 'cancel',\n\n /**\n * Fires when skin tone is selected from the emoji picker\n *\n * @event skin-tone\n * @type {String}\n */\n 'skin-tone',\n\n /**\n * Fires when emoji is selected from the emoji picker\n *\n * @event selected-emoji\n * @type {String}\n */\n 'selected-emoji',\n\n /**\n * Native focus event\n * @event input\n * @type {String|JSON}\n */\n 'focus',\n\n /**\n * Native blur event\n * @event input\n * @type {String|JSON}\n */\n 'blur',\n\n /**\n * Native input event\n * @event input\n * @type {String|JSON}\n */\n 'input',\n ],\n\n data () {\n return {\n internalInputValue: this.modelValue, // internal input content\n hasFocus: false,\n imagePickerFocus: false,\n emojiPickerFocus: false,\n sendButtonFocus: false,\n emojiPickerOpened: false,\n };\n },\n\n computed: {\n inputLength () {\n return this.internalInputValue.length;\n },\n\n displayCharacterLimitWarning () {\n return Boolean(this.showCharacterLimit) &&\n ((this.showCharacterLimit.count - this.inputLength) <= this.showCharacterLimit.warning);\n },\n\n characterLimitTooltipEnabled () {\n return this.showCharacterLimit.message && (this.showCharacterLimit.count - this.inputLength < 0);\n },\n\n isSendDisabled () {\n return this.disableSend ||\n (this.showCharacterLimit && this.inputLength > this.showCharacterLimit.count);\n },\n\n computedCloseButtonProps () {\n return {\n ariaLabel: 'Close',\n };\n },\n\n emojiPickerHovered () {\n return this.emojiPickerFocus || this.emojiPickerOpened;\n },\n },\n\n watch: {\n modelValue (newValue) {\n this.internalInputValue = newValue;\n },\n },\n\n methods: {\n onDrag (e) {\n e.stopPropagation();\n e.preventDefault();\n },\n\n onDrop (e) {\n e.stopPropagation();\n e.preventDefault();\n\n const dt = e.dataTransfer;\n const files = Array.from(dt.files);\n this.$emit('add-media', files);\n },\n\n onPaste (e) {\n if (e.clipboardData.files.length) {\n e.stopPropagation();\n e.preventDefault();\n const files = [...e.clipboardData.files];\n this.$emit('paste-media', files);\n }\n },\n\n onSkinTone (skinTone) {\n this.$emit('skin-tone', skinTone);\n },\n\n onSelectEmoji (emoji) {\n if (!emoji) {\n this.emojiPickerOpened = false;\n return;\n }\n\n // Insert emoji into the editor\n this.$refs.richTextEditor.editor.commands.insertContent({\n type: 'emoji',\n attrs: {\n code: emoji.shortname,\n },\n });\n this.emojiPickerOpened = false;\n this.$emit('selected-emoji', emoji);\n },\n\n onSelectImage () {\n this.$refs.messageInputImageUpload.$refs.input.click();\n },\n\n onImageUpload () {\n this.$emit('select-media', this.$refs.messageInputImageUpload.$refs.input.files);\n },\n\n toggleEmojiPicker () {\n this.emojiPickerOpened = !this.emojiPickerOpened;\n },\n\n onSend () {\n if (this.isSendDisabled) {\n return;\n }\n this.$emit('submit', this.internalInputValue);\n },\n\n onCancel () {\n this.$emit('cancel');\n },\n\n onFocus (event) {\n this.hasFocus = true;\n this.$refs.richTextEditor?.focusEditor();\n this.$emit('focus', event);\n },\n\n onBlur (event) {\n this.hasFocus = false;\n this.$emit('blur', event);\n },\n\n onInput (event) {\n this.$emit('input', event);\n },\n },\n};\n</script>\n\n<style lang=\"less\">\n.dt-message-input--remaining-char-tooltip {\n margin-top: auto;\n margin-bottom: auto;\n}\n.dt-message-input--remaining-char {\n font-size: 1.2rem;\n}\n\n.message-input-button__disabled {\n background-color: unset;\n color: var(--theme-sidebar-icon-color);\n cursor: default;\n}\n\n.dt-message-input--cancel-button {\n margin-right: var(--dt-space-300);\n}\n</style>\n"],"names":["_sfc_main","DtButton","DtEmojiPicker","DtIcon","DtInput","DtPopover","DtRichTextEditor","DtTooltip","autoFocus","RICH_TEXT_EDITOR_AUTOFOCUS_TYPES","outputFormat","RICH_TEXT_EDITOR_OUTPUT_FORMATS","emojiPickerProps","prop","newValue","e","dt","files","skinTone","emoji","event","_a","_hoisted_1","_hoisted_2","_hoisted_3","_createElementBlock","_normalizeClass","$data","_cache","$event","_ctx","$options","args","_createElementVNode","$props","_createVNode","_component_dt_rich_text_editor","_mergeProps","_renderSlot","_createBlock","_component_dt_tooltip","_component_dt_button","_component_dt_icon","_component_dt_input","_component_dt_popover","open","_component_dt_emoji_picker","_toDisplayString","_hoisted_4"],"mappings":";;;;;AAqOA,MAAKA,IAAU;AAAA,EACb,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,UAAAC;AAAA,mBACAC;AAAAA,IACA,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,WAAAC;AAAA,EACD;AAAA,EAED,QAAQ,CAAE;AAAA,EAEV,cAAc;AAAA,EAEd,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,YAAY;AAAA,MACV,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA,IAKD,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA,IAKD,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOD,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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CX,WAAU;AAAA,UACT,UAAUN,EAAQ;AAAA,UAClB,SAASA,EAAQ,SAAC;AAAA,UAClB,MAAI,CAAGH,EAAc,kBAAIJ,EAAe;AAAA,UACxC,QAAQ,CAAO,GAAA,EAAA;AAAA;UAEL,UAET,MAiCY;AAAA,YAjCZQ,EAiCYM,GAAA;AAAA,cAhCV,WAAQ;AAAA,cACR,MAAK;AAAA,cACL,MAAK;AAAA,cACL,YAAW;AAAA,cACV,OAAKf,EAAA;AAAA;;+DAAsHK,EAAc;AAAA;;cAMzI,cAAYG,EAAQ,SAAC;AAAA,cACrB,iBAAeH,EAAc;AAAA,cAC7B,SAAOA,EAAM;AAAA,cACb,uCAAYJ,EAAe,kBAAA;AAAA,cAC3B,uCAAYA,EAAe,kBAAA;AAAA,cAC3B,kCAAOA,EAAe,kBAAA;AAAA,cACtB,iCAAMA,EAAe,kBAAA;AAAA;yBAWtB,MAIW;AAAA,gBAHHO,EAAA,SAAS,aAEfT,EAA0B,KAAAuB,GAAAD,EAApBb,EAAQ,SAAC,IAAI,GAAA,CAAA;;;;cAXbA,EAAA,SAAS;sBACd;AAAA,sBAED,MAGE;AAAA,kBAHFC,EAGEO,GAAA;AAAA,oBAFC,MAAMR,EAAQ,SAAC;AAAA,oBAChB,MAAK;AAAA;;;;;;;;;;;;;"}
|
|
@@ -94,4 +94,5 @@ img.ProseMirror-separator {
|
|
|
94
94
|
`,Kp="️",qp="";let hn=null,fn=null;function Wp(n){n===void 0&&(n=[]);const e={};se.groups=e;const t=new se;hn==null&&(hn=So(Fp)),fn==null&&(fn=So(zp)),S(t,"'",Yn),S(t,"{",Kt),S(t,"}",qt),S(t,"[",Ln),S(t,"]",Bn),S(t,"(",_n),S(t,")",Fn),S(t,"<",zn),S(t,">",Hn),S(t,"(",Vn),S(t,")",$n),S(t,"「",jn),S(t,"」",Kn),S(t,"『",qn),S(t,"』",Wn),S(t,"<",Un),S(t,">",Jn),S(t,"&",Gn),S(t,"*",Xn),S(t,"@",He),S(t,"`",Zn),S(t,"^",er),S(t,":",$e),S(t,",",Qi),S(t,"$",tr),S(t,".",Se),S(t,"=",nr),S(t,"!",Zi),S(t,"-",xe),S(t,"%",rr),S(t,"|",ir),S(t,"+",sr),S(t,"#",or),S(t,"?",lr),S(t,'"',es),S(t,"/",Ce),S(t,";",ts),S(t,"~",Wt),S(t,"_",ar),S(t,"\\",Qn);const r=ue(t,Yr,Yi,{[Si]:!0});ue(r,Yr,r);const i=ue(t,mt,Ae,{[xi]:!0});ue(i,mt,i);const s=ue(t,Jr,Ti,{[Ci]:!0});ue(s,mt),ue(s,Jr,s);const o=ue(t,bo,Sa,{[go]:!0});S(t,ko,Xi,{[go]:!0}),S(o,ko),ue(o,bo,o);const l=ue(t,Gr,xa,{[ka]:!0});ue(l,Gr,l),S(l,Kp,l);const a=S(l,qp);ue(a,Gr,l);const c=[[mt,i]],d=[[mt,null],[Jr,s]];for(let u=0;u<hn.length;u++)_e(t,hn[u],Mi,Ae,c);for(let u=0;u<fn.length;u++)_e(t,fn[u],wi,Ti,d);it(Mi,{tld:!0,ascii:!0},e),it(wi,{utld:!0,alpha:!0},e),_e(t,"file",Sn,Ae,c),_e(t,"mailto",Sn,Ae,c),_e(t,"http",bt,Ae,c),_e(t,"https",bt,Ae,c),_e(t,"ftp",bt,Ae,c),_e(t,"ftps",bt,Ae,c),it(Sn,{scheme:!0,ascii:!0},e),it(bt,{slashscheme:!0,ascii:!0},e),n=n.sort((u,h)=>u[0]>h[0]?1:-1);for(let u=0;u<n.length;u++){const h=n[u][0],p=n[u][1]?{[Hp]:!0}:{[Vp]:!0};h.indexOf("-")>=0?p[Ei]=!0:mt.test(h)?Yr.test(h)?p[kn]=!0:p[xi]=!0:p[Si]=!0,yo(t,h,h,p)}return yo(t,"localhost",rn,{ascii:!0}),t.jd=new se(cr),{start:t,tokens:Nt({groups:e},Ca)}}function Up(n,e){const t=Jp(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let l=n,a=null,c=0,d=null,u=-1,h=-1;for(;o<r&&(a=l.go(t[o]));)l=a,l.accepts()?(u=0,h=0,d=l):u>=0&&(u+=t[o].length,h++),c+=t[o].length,s+=t[o].length,o++;s-=u,o-=h,c-=u,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function Jp(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function _e(n,e,t,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];n.j[a]?s=n.j[a]:(s=new se(r),s.jr=i.slice(),n.j[a]=s),n=s}return s=new se(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function So(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const sn={defaultProtocol:"http",events:null,format:xo,formatHref:xo,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ns(n,e){e===void 0&&(e=null);let t=Nt({},sn);n&&(t=Nt(t,n instanceof ns?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}ns.prototype={o:sn,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:sn[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function xo(n){return n}function Ea(n,e){this.t="token",this.v=n,this.tk=e}Ea.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=sn.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),d&&Nt(o,d),{tagName:i,attributes:o,content:s,eventListeners:u}}};function Mr(n,e){class t extends Ea{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Co=Mr("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Eo=Mr("text"),Gp=Mr("nl"),pn=Mr("url",{isLink:!0,toHref(n){return n===void 0&&(n=sn.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==rn&&n[1].t===$e}}),he=n=>new se(n);function Yp(n){let{groups:e}=n;const t=e.domain.concat([Gn,Xn,He,Qn,Zn,er,tr,nr,xe,Yi,rr,ir,sr,or,Ce,cr,Wt,ar]),r=[Yn,$e,Qi,Se,Zi,lr,es,ts,zn,Hn,Kt,qt,Bn,Ln,_n,Fn,Vn,$n,jn,Kn,qn,Wn,Un,Jn],i=[Gn,Yn,Xn,Qn,Zn,er,tr,nr,xe,Kt,qt,rr,ir,sr,or,lr,Ce,cr,Wt,ar],s=he(),o=S(s,Wt);A(o,i,o),A(o,e.domain,o);const l=he(),a=he(),c=he();A(s,e.domain,l),A(s,e.scheme,a),A(s,e.slashscheme,c),A(l,i,o),A(l,e.domain,l);const d=S(l,He);S(o,He,d),S(a,He,d),S(c,He,d);const u=S(o,Se);A(u,i,o),A(u,e.domain,o);const h=he();A(d,e.domain,h),A(h,e.domain,h);const f=S(h,Se);A(f,e.domain,h);const p=he(Co);A(f,e.tld,p),A(f,e.utld,p),S(d,rn,p);const g=S(h,xe);A(g,e.domain,h),A(p,e.domain,h),S(p,Se,f),S(p,xe,g);const y=S(p,$e);A(y,e.numeric,Co);const b=S(l,xe),C=S(l,Se);A(b,e.domain,l),A(C,i,o),A(C,e.domain,l);const M=he(pn);A(C,e.tld,M),A(C,e.utld,M),A(M,e.domain,l),A(M,i,o),S(M,Se,C),S(M,xe,b),S(M,He,d);const P=S(M,$e),L=he(pn);A(P,e.numeric,L);const T=he(pn),B=he();A(T,t,T),A(T,r,B),A(B,t,T),A(B,r,B),S(M,Ce,T),S(L,Ce,T);const R=S(a,$e),w=S(c,$e),J=S(w,Ce),ge=S(J,Ce);A(a,e.domain,l),S(a,Se,C),S(a,xe,b),A(c,e.domain,l),S(c,Se,C),S(c,xe,b),A(R,e.domain,T),S(R,Ce,T),A(ge,e.domain,T),A(ge,t,T),S(ge,Ce,T);const et=[[Kt,qt],[Ln,Bn],[_n,Fn],[zn,Hn],[Vn,$n],[jn,Kn],[qn,Wn],[Un,Jn]];for(let It=0;It<et.length;It++){const[Re,Pe]=et[It],Le=S(T,Re);S(B,Re,Le),S(Le,Pe,T);const le=he(pn);A(Le,t,le);const Be=he();A(Le,r),A(le,t,le),A(le,r,Be),A(Be,t,le),A(Be,r,Be),S(le,Pe,T),S(Be,Pe,T)}return S(s,rn,M),S(s,Xi,Gp),{start:s,tokens:Ca}}function Xp(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let l=n,a=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(a=l.go(t[i].t));)o.push(t[i++]);for(;i<r&&(c=a||l.go(t[i].t));)a=null,l=c,l.accepts()?(h=0,u=l):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Xr(Eo,e,o)),o=[]),i-=h,d-=h;const f=u.t,p=t.slice(i-d,i);s.push(Xr(f,e,p))}}return o.length>0&&s.push(Xr(Eo,e,o)),s}function Xr(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const Qp=typeof console<"u"&&console&&console.warn||(()=>{}),Zp="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",F={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function em(){se.groups={},F.scanner=null,F.parser=null,F.tokenQueue=[],F.pluginQueue=[],F.customSchemes=[],F.initialized=!1}function To(n,e){if(e===void 0&&(e=!1),F.initialized&&Qp(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Zp}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
95
95
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
96
96
|
2. Cannot start or end with "-"
|
|
97
|
-
3. "-" cannot repeat`);F.customSchemes.push([n,e])}function tm(){F.scanner=Wp(F.customSchemes);for(let n=0;n<F.tokenQueue.length;n++)F.tokenQueue[n][1]({scanner:F.scanner});F.parser=Yp(F.scanner.tokens);for(let n=0;n<F.pluginQueue.length;n++)F.pluginQueue[n][1]({scanner:F.scanner,parser:F.parser});F.initialized=!0}function nm(n){return F.initialized||tm(),Xp(F.parser.start,n,Up(F.scanner.start,n))}function rs(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new ns(t),i=nm(n),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}function rm(n){return new U({key:new ee("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=ca(t.doc,[...e]);if(ha(l).forEach(({newRange:c})=>{const d=da(r.doc,c,f=>f.isTextblock);let u,h;if(d.length>1?(u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):d.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")),u&&h){const f=h.split(" ").filter(y=>y!=="");if(f.length<=0)return!1;const p=f[f.length-1],g=u.pos+h.lastIndexOf(p);if(!p)return!1;rs(p).filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate?n.validate(y.value):!0).forEach(y=>{Tr(y.from,y.to,r.doc).some(b=>b.mark.type===n.type)||o.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function im(n){return new U({key:new ee("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||r.target.nodeName!=="A")return!1;const l=ua(e.state,n.type.name),a=r.target,c=(i=a==null?void 0:a.href)!==null&&i!==void 0?i:l.href,d=(s=a==null?void 0:a.target)!==null&&s!==void 0?s:l.target;return a&&c?(e.editable&&window.open(c,d),!0):!1}}})}function sm(n){return new U({key:new ee("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=rs(l).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}const om=me.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){To(n);return}To(n.scheme,n.optionalSlashes)})},onDestroy(){em()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",z(this.options.HTMLAttributes,{...n,href:""}),0]:["a",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[At({find:(n,e)=>{var t;const r=(t=e==null?void 0:e.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),i=[];if(r){const s=new DOMParser().parseFromString(r,"text/html"),o=s.querySelectorAll("a");o.length&&[...o].forEach(l=>i.push({text:l.innerText,data:{href:l.getAttribute("href")},index:s.body.innerText.indexOf(l.innerText)+l.innerText.length}))}if(n){const s=rs(n).filter(o=>o.isLink);s.length&&s.forEach(o=>i.push({text:o.value,data:{href:o.href},index:o.start}))}return i},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(rm({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(im({type:this.type})),this.options.linkOnPaste&&n.push(sm({editor:this.editor,type:this.type})),n}}),lm=Q.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",z(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),am=Q.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",z(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Mo=me.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",z(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Er(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),wo=/^(\d+)\.\s$/,cm=Q.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",z(this.options.HTMLAttributes,t),0]:["ol",z(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(am.name,this.editor.getAttributes(Mo.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=nn({find:wo,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=nn({find:wo,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mo.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),dm=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,um=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,hm=me.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){const n={};return Ui()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[tn({find:dm,type:this.type})]},addPasteRules(){return[At({find:um,type:this.type})]}}),fm=me.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),pm=Q.create({name:"text",group:"inline"}),mm=de.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),gm={name:"EmojiComponent",components:{NodeViewWrapper:ga,DtEmoji:X.DtEmoji},props:ya};function ym(n,e,t,r,i,s){const o=m.resolveComponent("dt-emoji"),l=m.resolveComponent("node-view-wrapper");return m.openBlock(),m.createBlock(l,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:m.withCtx(()=>[m.createVNode(o,{size:"500",code:n.node.attrs.code},null,8,["code"])]),_:1})}const bm=v._export_sfc(gm,[["render",ym]]);function km(n){var e;const{char:t,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:o}=n,l=up(t),a=new RegExp(`\\s${l}$`),c=s?"^":"",d=r?new RegExp(`${c}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${c}(?:^)?${l}[^\\s${l}]*`,"gm"),u=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!u)return null;const h=o.pos-u.length,f=Array.from(u.matchAll(d)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const p=f.input.slice(Math.max(0,f.index-1),f.index),g=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(p);if(i!==null&&!g)return null;const y=h+f.index;let b=y+f[0].length;return r&&a.test(u.slice(b-1,b+1))&&(f[0]+=" ",b+=1),y<o.pos&&b>=o.pos?{range:{from:y,to:b},query:f[0].slice(t.length),text:f[0]}:null}const Sm=new ee("suggestion");function Ta({pluginKey:n=Sm,editor:e,char:t="@",allowSpaces:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:o="span",decorationClass:l="suggestion",command:a=()=>null,items:c=()=>[],render:d=()=>({}),allow:u=()=>!0}){let h;const f=d==null?void 0:d(),p=new U({key:n,view(){return{update:async(g,y)=>{var b,C,M,P,L,T,B;const R=(b=this.key)===null||b===void 0?void 0:b.getState(y),w=(C=this.key)===null||C===void 0?void 0:C.getState(g.state),J=R.active&&w.active&&R.range.from!==w.range.from,ge=!R.active&&w.active,et=R.active&&!w.active,It=!ge&&!et&&R.query!==w.query,Re=ge||J,Pe=It&&!J,Le=et||J;if(!Re&&!Pe&&!Le)return;const le=Le&&!Re?R:w,Be=g.dom.querySelector(`[data-decoration-id="${le.decorationId}"]`);h={editor:e,range:le.range,query:le.query,text:le.text,items:[],command:Rt=>{a({editor:e,range:le.range,props:Rt})},decorationNode:Be,clientRect:Be?()=>{var Rt;const{decorationId:va}=(Rt=this.key)===null||Rt===void 0?void 0:Rt.getState(e.state),wr=g.dom.querySelector(`[data-decoration-id="${va}"]`);return(wr==null?void 0:wr.getBoundingClientRect())||null}:null},Re&&((M=f==null?void 0:f.onBeforeStart)===null||M===void 0||M.call(f,h)),Pe&&((P=f==null?void 0:f.onBeforeUpdate)===null||P===void 0||P.call(f,h)),(Pe||Re)&&(h.items=await c({editor:e,query:le.query})),Le&&((L=f==null?void 0:f.onExit)===null||L===void 0||L.call(f,h)),Pe&&((T=f==null?void 0:f.onUpdate)===null||T===void 0||T.call(f,h)),Re&&((B=f==null?void 0:f.onStart)===null||B===void 0||B.call(f,h))},destroy:()=>{var g;h&&((g=f==null?void 0:f.onExit)===null||g===void 0||g.call(f,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,y,b,C){const{isEditable:M}=e,{composing:P}=e.view,{selection:L}=g,{empty:T,from:B}=L,R={...y};if(R.composing=P,M&&(T||e.view.composing)){(B<y.range.from||B>y.range.to)&&!P&&!y.composing&&(R.active=!1);const w=km({char:t,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:L.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;w&&u({editor:e,state:C,range:w.range})?(R.active=!0,R.decorationId=y.decorationId?y.decorationId:J,R.range=w.range,R.query=w.query,R.text=w.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(g,y){var b;const{active:C,range:M}=p.getState(g.state);return C&&((b=f==null?void 0:f.onKeyDown)===null||b===void 0?void 0:b.call(f,{view:g,event:y,range:M}))||!1},decorations(g){const{active:y,range:b,decorationId:C}=p.getState(g);return y?H.create(g.doc,[ce.inline(b.from,b.to,{nodeName:o,class:l,"data-decoration-id":C})]):null}}});return p}const xm={name:"SuggestionList",components:{DtListItem:$o},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),n.stopPropagation(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},scrollActiveElementIntoView(){const n=this.$refs.suggestionList.querySelector(".dt-list-item--highlighted");n&&n.scrollIntoView({behaviour:"smooth",block:"center"})},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];switch(this.itemType){case"emoji":this.command(e);return;case"mention":this.command({name:e.name,id:e.contactId,avatarSrc:e.avatarSrc});break}}}},Cm={class:"d-popover__dialog"},Em={ref:"suggestionList",class:"dt-suggestion-list"};function Tm(n,e,t,r,i,s){const o=m.resolveComponent("dt-list-item");return m.openBlock(),m.createElementBlock("div",Cm,[m.withDirectives(m.createElementVNode("ul",Em,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(t.items,(l,a)=>(m.openBlock(),m.createBlock(o,{key:l.id,class:m.normalizeClass(["dt-suggestion-list--item",{"dt-list-item--highlighted":a===i.selectedIndex}]),"navigation-type":"arrow-keys",onClick:c=>s.selectItem(a),onKeydown:m.withModifiers(s.onKeyDown,["prevent","stop"])},{default:m.withCtx(()=>[(m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.itemComponent),{item:l},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[m.vShow,t.items.length]])])}const Ma=v._export_sfc(xm,[["render",Tm]]),Mm={name:"EmojiSuggestion",components:{DtEmoji:X.DtEmoji,DtStack:Ai},props:{item:{type:Object,required:!0}}};function wm(n,e,t,r,i,s){const o=m.resolveComponent("dt-emoji"),l=m.resolveComponent("dt-stack");return m.openBlock(),m.createBlock(l,{direction:"row",gap:"400"},{default:m.withCtx(()=>[m.createVNode(o,{size:"200",code:t.item.code},null,8,["code"]),m.createTextVNode(" "+m.toDisplayString(t.item.code),1)]),_:1})}const Om=v._export_sfc(Mm,[["render",wm]]),vm={items:({query:n})=>n.length<2?[]:Object.values(X.emojisIndexed).filter(function(r){return!!r.shortname.substring(1,r.shortname.length-1).startsWith(n.toLowerCase())}).map(r=>({id:r.unicode_character,code:r.shortname})),command:({editor:n,range:e,props:t})=>{var s,o;const r=n.view.state.selection.$to.nodeAfter;((s=r==null?void 0:r.text)==null?void 0:s.startsWith(" "))&&(e.to+=1),n.chain().focus().insertContentAt(e,[{type:"emoji",attrs:t},{type:"text",text:" "}]).run(),(o=window.getSelection())==null||o.collapseToEnd()},render:()=>{let n,e;return{onStart:t=>{n=new Gi(Ma,{props:{itemComponent:m.markRaw(Om),itemType:"emoji",...t},editor:t.editor}),t.clientRect&&(e=v.tippy("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",contentElement:null,zIndex:650}))},onUpdate(t){n.updateProps(t),t.clientRect&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var r;return t.event.key==="Escape"?(e[0].hide(),!0):(r=n.ref)==null?void 0:r.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},Am=new ee("emoji"),Nm=/:\w+:$/,Dm=/:\w+:/g,Im=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/,Rm=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g,Oo=n=>{if(n&&X.codeToEmojiData(n[0]))return{index:n.index,text:n[0],match:n}},Pm=n=>[...n.matchAll(Dm)].filter(t=>X.codeToEmojiData(t[0])).map(t=>({index:t.index,text:t[0],match:t})),Lm=Q.create({addOptions(){return{HTMLAttributes:{},suggestion:{char:":",pluginKey:Am}}},name:"emoji",group:"inline",inline:!0,selectable:!0,addNodeView(){return ba(bm)},addAttributes(){return{code:{default:null},id:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:n}){return n.attrs.code},renderHTML({HTMLAttributes:n}){return["emoji-component",z(this.options.HTMLAttributes,n)]},addInputRules(){return[co({find:n=>{const e=n.match(Nm);return Oo(e)},type:this.type,getAttributes(n){return{code:n[0]}}}),co({find:n=>{const e=n.match(Im);return Oo(e)},type:this.type,getAttributes(n){const e=X.shortcodeToEmojiData(n[0]).unicode_output;return{code:String.fromCodePoint(parseInt(e,16)),label:"emoji"}}})]},addPasteRules(){return[ho({find:Pm,type:this.type,getAttributes(n){return{code:n[0]}}}),ho({find:Rm,type:this.type,getAttributes(n){return{code:n[0]}}})]},addProseMirrorPlugins(){return[Ta({editor:this.editor,...this.options.suggestion,...vm})]}});function Bm(n,e,t=()=>!0){const r=[];e.lastIndex=0;let i;for(;i=e.exec(n);)t(n,i)&&r.push(i);return r}function _m(n,e){return!["#","@"].includes(n.charAt(e.index))&&!["#","@"].includes(n.charAt(e.index-1))}function Fm(n){const e=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return n.replace(e,"")}function zm(n,e){const t=n.slice(0,e+1).search(/\S+\s*$/),r=n.slice(e).search(/\s/);if(r<0){const i=n.slice(t);return{text:i,from:t,to:t+i.length}}return{text:n.slice(t,r+e),from:t,to:r+e}}function Oi(n,e,t,r){const i=zm(n,e);if(r.lastIndex=0,!r.test(i.text))return i;const s=t==="left"?i.from-1:i.to+1;return s<=0||s>=n.length||s===e?i:Oi(n,s,t,r)}function Hm(n,e,t,r){const i=Math.max(n.from-1,0),s=Math.min(n.to+1,e.content.size),o=Tr(i,s,e);for(const l of o)l.mark.type===r&&t.removeMark(l.from,l.to,r)}const vo=v.getPhoneNumberRegex(1,15);function Ao(n,e,t,r,i,s){if(!n)return;let o=t-e-1;o=o<0?0:o;const l=r-e,a=Oi(n,o,"left",vo),c=Oi(n,l,"right",vo),d=n.slice(a.from,c.to);Bm(d,v.linkRegex,_m).forEach(h=>{const f=Fm(h[0]),p=e+a.from+h.index+1,g=p+f.length;i.addMark(p,g,s.create())})}function Vm(n){let e=!1;return new U({key:new ee("autolink"),appendTransaction:(t,r,i)=>{const s=t.some(d=>d.docChanged)&&!r.doc.eq(i.doc);if(e&&!s)return;const{tr:o}=i,{textContent:l}=i.doc;e||Ao(l,0,0,l.length,o,n.type),e=!0;const a=ca(r.doc,[...t]);return ha(a).forEach(({oldRange:d,newRange:u})=>{Hm(u,i.doc,o,n.type),da(i.doc,u,f=>f.isTextblock).forEach(({node:f,pos:p})=>{Ao(f.textContent,p,d.from,u.to,o,n.type)})}),o}})}const $m={class:"d-link d-c-text d-d-inline-block",rel:"noopener noreferrer nofollow"},jm=me.create({name:"Link",renderHTML({HTMLAttributes:n}){return["a",z(this.options.HTMLAttributes,n,$m),0]},renderText({node:n}){return n.attrs.text},addProseMirrorPlugins(){return[Vm({type:this.type})]}}),Km=new ee("mention"),qm=Q.create({name:"mention",addOptions(){return{HTMLAttributes:{},renderLabel({options:n,node:e}){var t;return`${n.suggestion.char}${(t=e.attrs.label)!==null&&t!==void 0?t:e.attrs.id}`},suggestion:{char:"@",pluginKey:Km,command:({editor:n,range:e,props:t})=>{var r,i;const s=n.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),n.chain().focus().insertContentAt(e,[{type:this.name,attrs:t},{type:"text",text:" "}]).run(),(i=window.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:n,range:e})=>{const t=n.doc.resolve(e.from),r=n.schema.nodes[this.name];return!!t.parent.type.contentMatch.matchType(r)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){return["span",z({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n})]},renderText({node:n}){return this.options.renderLabel({options:this.options,node:n})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:i,anchor:s}=r;return i?(e.doc.nodesBetween(s-1,s,(o,l)=>{if(o.type.name===this.name)return t=!0,n.insertText(this.options.suggestion.char||"",l,l+o.nodeSize),!1}),t):!1})}},addProseMirrorPlugins(){return[Ta({editor:this.editor,...this.options.suggestion})]}}),Wm={name:"MentionComponent",components:{NodeViewWrapper:ga,DtLink:_o},props:ya,computed:{text(){return"@"+this.$props.node.attrs.name}}};function Um(n,e,t,r,i,s){const o=m.resolveComponent("dt-link"),l=m.resolveComponent("node-view-wrapper");return m.openBlock(),m.createBlock(l,{class:"d-d-inline-block"},{default:m.withCtx(()=>[m.createVNode(o,{kind:"mention"},{default:m.withCtx(()=>[m.createTextVNode(m.toDisplayString(s.text),1)]),_:1})]),_:1})}const Jm=v._export_sfc(Wm,[["render",Um]]),Gm=qm.extend({addNodeView(){return ba(Jm)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""}}},renderText({node:n}){return"@ "+n.attrs.name},renderHTML({HTMLAttributes:n}){return["mention-component",z(this.options.HTMLAttributes,n),0]}}),wa=["text","json","html"],Oa=["start","end","all"],Ym=["https","http","ftp","ftps","sftp","mailto"],Xm={name:"MentionSuggestion",components:{DtAvatar:Bo,DtStack:Ai},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc}}};function Qm(n,e,t,r,i,s){const o=m.resolveComponent("dt-avatar"),l=m.resolveComponent("dt-stack");return m.openBlock(),m.createBlock(l,{direction:"row",gap:"400"},{default:m.withCtx(()=>[m.createVNode(o,{"full-name":s.name,"image-src":s.avatarSrc,"image-alt":"",size:"xs"},null,8,["full-name","image-src"]),m.createTextVNode(" "+m.toDisplayString(s.name),1)]),_:1})}const Zm=v._export_sfc(Xm,[["render",Qm]]),eg={render:()=>{let n,e;return{onStart:t=>{n=new Gi(Ma,{props:{itemComponent:m.markRaw(Zm),itemType:"mention",...t},editor:t.editor}),t.clientRect&&(e=v.tippy("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(t){n.updateProps(t),t.clientRect&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var r;return t.event.key==="Escape"?(e[0].hide(),!0):(r=n.ref)==null?void 0:r.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},tg={name:"DtRichTextEditor",components:{EditorContent:mp},props:{modelValue:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(n){return typeof n=="string"?Oa.includes(n):!0}},outputFormat:{type:String,default:"text",validator(n){return wa.includes(n)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null}},emits:["input","update:modelValue","blur","focus"],data(){return{editor:null,popoverOpened:!1}},computed:{extensions(){const n=[bp,Np,Ip,Cp,_p,lm,Tp,hm,pm,fm];if(this.link&&n.push(this.getExtension(jm,this.link)),n.push(Mp.configure({placeholder:this.placeholder})),this.allowLineBreaks||n.push(Ep.extend({addKeyboardShortcuts(){return{Enter:()=>!0,"Shift-Enter":()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])}}})),n.push(om.extend({inclusive:!1}).configure({autolink:!0,protocols:Ym})),this.mentionSuggestion){const e={...this.mentionSuggestion,...eg};n.push(Gm.configure({suggestion:e}))}return n.push(Lm),n.push(mm.configure({types:["paragraph"],defaultAlignment:"left"})),n.push(xp.configure({HTMLAttributes:{class:"dt-rich-text-editor--code-block"}})),n.push(cm.configure({itemTypeName:"listItem"})),n},inputAttrs(){const n={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(n["aria-readonly"]=!0),n}},watch:{editable(n){this.editor.setEditable(n),this.updateEditorAttributes({"aria-readonly":!n})},inputClass(n){this.updateEditorAttributes({class:n})},inputAriaLabel(n){this.updateEditorAttributes({"aria-label":n})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(n){let e=this.getOutput();this.outputFormat==="json"&&(n=JSON.stringify(n),e=JSON.stringify(e)),n!==e&&this.editor.commands.setContent(n,!1)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},methods:{createEditor(){this.editor=new pp({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,editorProps:{attributes:{...this.inputAttrs,class:this.inputClass}}}),this.addEditorListeners()},destroyEditor(){this.editor.destroy()},addEditorListeners(){this.editor.on("update",()=>{const n=this.getOutput();this.$emit("input",n),this.$emit("update:modelValue",n)}),this.editor.on("focus",({event:n})=>{this.$emit("focus",n)}),this.editor.on("blur",({event:n})=>{this.$emit("blur",n)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"text":default:return this.editor.getText()}},getExtension(n,e){var t;return typeof e=="boolean"?n:(t=n.configure)==null?void 0:t.call(n,e)},updateEditorAttributes(n){this.editor.setOptions({editorProps:{attributes:n}})},focusEditor(){this.editor.commands.focus()}}};function ng(n,e,t,r,i,s){const o=m.resolveComponent("editor-content");return m.openBlock(),m.createBlock(o,{editor:i.editor,"data-qa":"dt-rich-text-editor",class:"dt-rich-text-editor"},null,8,["editor"])}const rg=v._export_sfc(tg,[["render",ng]]);exports.AVATAR_COLORS=Lo;exports.AVATAR_GROUP_VALIDATOR=Zr;exports.AVATAR_ICON_SIZES=Po;exports.AVATAR_KIND_MODIFIERS=Io;exports.AVATAR_PRESENCE_SIZE_MODIFIERS=Ro;exports.AVATAR_PRESENCE_STATES=Qr;exports.AVATAR_SIZE_MODIFIERS=mn;exports.DT_STACK_DIRECTION=Ge;exports.DT_STACK_GAP=dr;exports.DT_STACK_RESPONSIVE_BREAKPOINTS=vi;exports.DtAvatar=Bo;exports.DtItemLayout=ei;exports.DtLink=_o;exports.DtListItem=$o;exports.DtPopover=fc;exports.DtPresence=Do;exports.DtRichTextEditor=rg;exports.DtStack=Ai;exports.LIST_ITEM_NAVIGATION_TYPES=Lt;exports.LIST_ITEM_TYPES=gn;exports.Modal=Vo;exports.PRESENCE_STATES=kt;exports.PRESENCE_STATES_LIST=No;exports.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES=Oa;exports.RICH_TEXT_EDITOR_OUTPUT_FORMATS=wa;exports.SrOnlyCloseButton=zo;exports.SrOnlyCloseButtonMixin=Fo;
|
|
97
|
+
3. "-" cannot repeat`);F.customSchemes.push([n,e])}function tm(){F.scanner=Wp(F.customSchemes);for(let n=0;n<F.tokenQueue.length;n++)F.tokenQueue[n][1]({scanner:F.scanner});F.parser=Yp(F.scanner.tokens);for(let n=0;n<F.pluginQueue.length;n++)F.pluginQueue[n][1]({scanner:F.scanner,parser:F.parser});F.initialized=!0}function nm(n){return F.initialized||tm(),Xp(F.parser.start,n,Up(F.scanner.start,n))}function rs(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new ns(t),i=nm(n),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}function rm(n){return new U({key:new ee("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=ca(t.doc,[...e]);if(ha(l).forEach(({newRange:c})=>{const d=da(r.doc,c,f=>f.isTextblock);let u,h;if(d.length>1?(u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):d.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")),u&&h){const f=h.split(" ").filter(y=>y!=="");if(f.length<=0)return!1;const p=f[f.length-1],g=u.pos+h.lastIndexOf(p);if(!p)return!1;rs(p).filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate?n.validate(y.value):!0).forEach(y=>{Tr(y.from,y.to,r.doc).some(b=>b.mark.type===n.type)||o.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function im(n){return new U({key:new ee("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||r.target.nodeName!=="A")return!1;const l=ua(e.state,n.type.name),a=r.target,c=(i=a==null?void 0:a.href)!==null&&i!==void 0?i:l.href,d=(s=a==null?void 0:a.target)!==null&&s!==void 0?s:l.target;return a&&c?(e.editable&&window.open(c,d),!0):!1}}})}function sm(n){return new U({key:new ee("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=rs(l).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}const om=me.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){To(n);return}To(n.scheme,n.optionalSlashes)})},onDestroy(){em()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",z(this.options.HTMLAttributes,{...n,href:""}),0]:["a",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[At({find:(n,e)=>{var t;const r=(t=e==null?void 0:e.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),i=[];if(r){const s=new DOMParser().parseFromString(r,"text/html"),o=s.querySelectorAll("a");o.length&&[...o].forEach(l=>i.push({text:l.innerText,data:{href:l.getAttribute("href")},index:s.body.innerText.indexOf(l.innerText)+l.innerText.length}))}if(n){const s=rs(n).filter(o=>o.isLink);s.length&&s.forEach(o=>i.push({text:o.value,data:{href:o.href},index:o.start}))}return i},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(rm({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(im({type:this.type})),this.options.linkOnPaste&&n.push(sm({editor:this.editor,type:this.type})),n}}),lm=Q.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",z(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),am=Q.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",z(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Mo=me.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",z(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Er(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),wo=/^(\d+)\.\s$/,cm=Q.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",z(this.options.HTMLAttributes,t),0]:["ol",z(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(am.name,this.editor.getAttributes(Mo.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=nn({find:wo,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=nn({find:wo,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mo.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),dm=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,um=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,hm=me.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){const n={};return Ui()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[tn({find:dm,type:this.type})]},addPasteRules(){return[At({find:um,type:this.type})]}}),fm=me.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),pm=Q.create({name:"text",group:"inline"}),mm=de.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),gm={name:"EmojiComponent",components:{NodeViewWrapper:ga,DtEmoji:X.DtEmoji},props:ya};function ym(n,e,t,r,i,s){const o=m.resolveComponent("dt-emoji"),l=m.resolveComponent("node-view-wrapper");return m.openBlock(),m.createBlock(l,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:m.withCtx(()=>[m.createVNode(o,{size:"500",code:n.node.attrs.code},null,8,["code"])]),_:1})}const bm=v._export_sfc(gm,[["render",ym]]);function km(n){var e;const{char:t,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:o}=n,l=up(t),a=new RegExp(`\\s${l}$`),c=s?"^":"",d=r?new RegExp(`${c}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${c}(?:^)?${l}[^\\s${l}]*`,"gm"),u=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!u)return null;const h=o.pos-u.length,f=Array.from(u.matchAll(d)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const p=f.input.slice(Math.max(0,f.index-1),f.index),g=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(p);if(i!==null&&!g)return null;const y=h+f.index;let b=y+f[0].length;return r&&a.test(u.slice(b-1,b+1))&&(f[0]+=" ",b+=1),y<o.pos&&b>=o.pos?{range:{from:y,to:b},query:f[0].slice(t.length),text:f[0]}:null}const Sm=new ee("suggestion");function Ta({pluginKey:n=Sm,editor:e,char:t="@",allowSpaces:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:o="span",decorationClass:l="suggestion",command:a=()=>null,items:c=()=>[],render:d=()=>({}),allow:u=()=>!0}){let h;const f=d==null?void 0:d(),p=new U({key:n,view(){return{update:async(g,y)=>{var b,C,M,P,L,T,B;const R=(b=this.key)===null||b===void 0?void 0:b.getState(y),w=(C=this.key)===null||C===void 0?void 0:C.getState(g.state),J=R.active&&w.active&&R.range.from!==w.range.from,ge=!R.active&&w.active,et=R.active&&!w.active,It=!ge&&!et&&R.query!==w.query,Re=ge||J,Pe=It&&!J,Le=et||J;if(!Re&&!Pe&&!Le)return;const le=Le&&!Re?R:w,Be=g.dom.querySelector(`[data-decoration-id="${le.decorationId}"]`);h={editor:e,range:le.range,query:le.query,text:le.text,items:[],command:Rt=>{a({editor:e,range:le.range,props:Rt})},decorationNode:Be,clientRect:Be?()=>{var Rt;const{decorationId:va}=(Rt=this.key)===null||Rt===void 0?void 0:Rt.getState(e.state),wr=g.dom.querySelector(`[data-decoration-id="${va}"]`);return(wr==null?void 0:wr.getBoundingClientRect())||null}:null},Re&&((M=f==null?void 0:f.onBeforeStart)===null||M===void 0||M.call(f,h)),Pe&&((P=f==null?void 0:f.onBeforeUpdate)===null||P===void 0||P.call(f,h)),(Pe||Re)&&(h.items=await c({editor:e,query:le.query})),Le&&((L=f==null?void 0:f.onExit)===null||L===void 0||L.call(f,h)),Pe&&((T=f==null?void 0:f.onUpdate)===null||T===void 0||T.call(f,h)),Re&&((B=f==null?void 0:f.onStart)===null||B===void 0||B.call(f,h))},destroy:()=>{var g;h&&((g=f==null?void 0:f.onExit)===null||g===void 0||g.call(f,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,y,b,C){const{isEditable:M}=e,{composing:P}=e.view,{selection:L}=g,{empty:T,from:B}=L,R={...y};if(R.composing=P,M&&(T||e.view.composing)){(B<y.range.from||B>y.range.to)&&!P&&!y.composing&&(R.active=!1);const w=km({char:t,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:L.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;w&&u({editor:e,state:C,range:w.range})?(R.active=!0,R.decorationId=y.decorationId?y.decorationId:J,R.range=w.range,R.query=w.query,R.text=w.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(g,y){var b;const{active:C,range:M}=p.getState(g.state);return C&&((b=f==null?void 0:f.onKeyDown)===null||b===void 0?void 0:b.call(f,{view:g,event:y,range:M}))||!1},decorations(g){const{active:y,range:b,decorationId:C}=p.getState(g);return y?H.create(g.doc,[ce.inline(b.from,b.to,{nodeName:o,class:l,"data-decoration-id":C})]):null}}});return p}const xm={name:"SuggestionList",components:{DtListItem:$o},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"||n.key==="Tab"?(n.preventDefault(),this.selectHandler(),n.stopPropagation(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},scrollActiveElementIntoView(){const n=this.$refs.suggestionList.querySelector(".dt-list-item--highlighted");n&&n.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];switch(this.itemType){case"emoji":this.command(e);return;case"mention":this.command({name:e.name,id:e.id,avatarSrc:e.avatarSrc});break}}}},Cm={class:"d-popover__dialog"},Em={ref:"suggestionList",class:"dt-suggestion-list"};function Tm(n,e,t,r,i,s){const o=m.resolveComponent("dt-list-item");return m.openBlock(),m.createElementBlock("div",Cm,[m.withDirectives(m.createElementVNode("ul",Em,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(t.items,(l,a)=>(m.openBlock(),m.createBlock(o,{key:l.id,class:m.normalizeClass(["dt-suggestion-list--item",{"dt-list-item--highlighted":a===i.selectedIndex}]),"navigation-type":"arrow-keys",onClick:c=>s.selectItem(a),onKeydown:m.withModifiers(s.onKeyDown,["prevent","stop"])},{default:m.withCtx(()=>[(m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.itemComponent),{item:l},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[m.vShow,t.items.length]])])}const Ma=v._export_sfc(xm,[["render",Tm]]),Mm={name:"EmojiSuggestion",components:{DtEmoji:X.DtEmoji,DtStack:Ai},props:{item:{type:Object,required:!0}}};function wm(n,e,t,r,i,s){const o=m.resolveComponent("dt-emoji"),l=m.resolveComponent("dt-stack");return m.openBlock(),m.createBlock(l,{direction:"row",gap:"400"},{default:m.withCtx(()=>[m.createVNode(o,{size:"200",code:t.item.code},null,8,["code"]),m.createTextVNode(" "+m.toDisplayString(t.item.code),1)]),_:1})}const Om=v._export_sfc(Mm,[["render",wm]]),vm={items:({query:n})=>n.length<2?[]:Object.values(X.emojisIndexed).filter(function(r){return!!r.shortname.substring(1,r.shortname.length-1).startsWith(n.toLowerCase())}).map(r=>({id:r.unicode_character,code:r.shortname})),command:({editor:n,range:e,props:t})=>{var s,o;const r=n.view.state.selection.$to.nodeAfter;((s=r==null?void 0:r.text)==null?void 0:s.startsWith(" "))&&(e.to+=1),n.chain().focus().insertContentAt(e,[{type:"emoji",attrs:t},{type:"text",text:" "}]).run(),(o=window.getSelection())==null||o.collapseToEnd()},render:()=>{let n,e;return{onStart:t=>{n=new Gi(Ma,{props:{itemComponent:m.markRaw(Om),itemType:"emoji",...t},editor:t.editor}),t.clientRect&&(e=v.tippy("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",contentElement:null,zIndex:650}))},onUpdate(t){n.updateProps(t),t.clientRect&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var r;return t.event.key==="Escape"?(e[0].hide(),!0):(r=n.ref)==null?void 0:r.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},Am=new ee("emoji"),Nm=/:\w+:$/,Dm=/:\w+:/g,Im=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/,Rm=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g,Oo=n=>{if(n&&X.codeToEmojiData(n[0]))return{index:n.index,text:n[0],match:n}},Pm=n=>[...n.matchAll(Dm)].filter(t=>X.codeToEmojiData(t[0])).map(t=>({index:t.index,text:t[0],match:t})),Lm=Q.create({addOptions(){return{HTMLAttributes:{},suggestion:{char:":",pluginKey:Am}}},name:"emoji",group:"inline",inline:!0,selectable:!0,addNodeView(){return ba(bm)},addAttributes(){return{code:{default:null},id:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:n}){return n.attrs.code},renderHTML({HTMLAttributes:n}){return["emoji-component",z(this.options.HTMLAttributes,n)]},addInputRules(){return[co({find:n=>{const e=n.match(Nm);return Oo(e)},type:this.type,getAttributes(n){return{code:n[0]}}}),co({find:n=>{const e=n.match(Im);return Oo(e)},type:this.type,getAttributes(n){const e=X.shortcodeToEmojiData(n[0]).unicode_output;return{code:String.fromCodePoint(parseInt(e,16)),label:"emoji"}}})]},addPasteRules(){return[ho({find:Pm,type:this.type,getAttributes(n){return{code:n[0]}}}),ho({find:Rm,type:this.type,getAttributes(n){return{code:n[0]}}})]},addProseMirrorPlugins(){return[Ta({editor:this.editor,...this.options.suggestion,...vm})]}});function Bm(n,e,t=()=>!0){const r=[];e.lastIndex=0;let i;for(;i=e.exec(n);)t(n,i)&&r.push(i);return r}function _m(n,e){return!["#","@"].includes(n.charAt(e.index))&&!["#","@"].includes(n.charAt(e.index-1))}function Fm(n){const e=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return n.replace(e,"")}function zm(n,e){const t=n.slice(0,e+1).search(/\S+\s*$/),r=n.slice(e).search(/\s/);if(r<0){const i=n.slice(t);return{text:i,from:t,to:t+i.length}}return{text:n.slice(t,r+e),from:t,to:r+e}}function Oi(n,e,t,r){const i=zm(n,e);if(r.lastIndex=0,!r.test(i.text))return i;const s=t==="left"?i.from-1:i.to+1;return s<=0||s>=n.length||s===e?i:Oi(n,s,t,r)}function Hm(n,e,t,r){const i=Math.max(n.from-1,0),s=Math.min(n.to+1,e.content.size),o=Tr(i,s,e);for(const l of o)l.mark.type===r&&t.removeMark(l.from,l.to,r)}const vo=v.getPhoneNumberRegex(1,15);function Ao(n,e,t,r,i,s){if(!n)return;let o=t-e-1;o=o<0?0:o;const l=r-e,a=Oi(n,o,"left",vo),c=Oi(n,l,"right",vo),d=n.slice(a.from,c.to);Bm(d,v.linkRegex,_m).forEach(h=>{const f=Fm(h[0]),p=e+a.from+h.index+1,g=p+f.length;i.addMark(p,g,s.create())})}function Vm(n){let e=!1;return new U({key:new ee("autolink"),appendTransaction:(t,r,i)=>{const s=t.some(d=>d.docChanged)&&!r.doc.eq(i.doc);if(e&&!s)return;const{tr:o}=i,{textContent:l}=i.doc;e||Ao(l,0,0,l.length,o,n.type),e=!0;const a=ca(r.doc,[...t]);return ha(a).forEach(({oldRange:d,newRange:u})=>{Hm(u,i.doc,o,n.type),da(i.doc,u,f=>f.isTextblock).forEach(({node:f,pos:p})=>{Ao(f.textContent,p,d.from,u.to,o,n.type)})}),o}})}const $m={class:"d-link d-c-text d-d-inline-block",rel:"noopener noreferrer nofollow"},jm=me.create({name:"Link",renderHTML({HTMLAttributes:n}){return["a",z(this.options.HTMLAttributes,n,$m),0]},renderText({node:n}){return n.attrs.text},addProseMirrorPlugins(){return[Vm({type:this.type})]}}),Km=new ee("mention"),qm=Q.create({name:"mention",addOptions(){return{HTMLAttributes:{},renderLabel({options:n,node:e}){var t;return`${n.suggestion.char}${(t=e.attrs.label)!==null&&t!==void 0?t:e.attrs.id}`},suggestion:{char:"@",pluginKey:Km,command:({editor:n,range:e,props:t})=>{var r,i;const s=n.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),n.chain().focus().insertContentAt(e,[{type:this.name,attrs:t},{type:"text",text:" "}]).run(),(i=window.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:n,range:e})=>{const t=n.doc.resolve(e.from),r=n.schema.nodes[this.name];return!!t.parent.type.contentMatch.matchType(r)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){return["span",z({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n})]},renderText({node:n}){return this.options.renderLabel({options:this.options,node:n})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:i,anchor:s}=r;return i?(e.doc.nodesBetween(s-1,s,(o,l)=>{if(o.type.name===this.name)return t=!0,n.insertText(this.options.suggestion.char||"",l,l+o.nodeSize),!1}),t):!1})}},addProseMirrorPlugins(){return[Ta({editor:this.editor,...this.options.suggestion})]}}),Wm={name:"MentionComponent",components:{NodeViewWrapper:ga,DtLink:_o},props:ya,computed:{text(){return"@"+this.$props.node.attrs.name}}};function Um(n,e,t,r,i,s){const o=m.resolveComponent("dt-link"),l=m.resolveComponent("node-view-wrapper");return m.openBlock(),m.createBlock(l,{class:"d-d-inline-block"},{default:m.withCtx(()=>[m.createVNode(o,{kind:"mention"},{default:m.withCtx(()=>[m.createTextVNode(m.toDisplayString(s.text),1)]),_:1})]),_:1})}const Jm=v._export_sfc(Wm,[["render",Um]]),Gm=qm.extend({addNodeView(){return ba(Jm)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""}}},renderText({node:n}){return`@${n.attrs.id}`},renderHTML({HTMLAttributes:n}){return["mention-component",z(this.options.HTMLAttributes,n),0]}}),wa=["text","json","html"],Oa=["start","end","all"],Ym=["https","http","ftp","ftps","sftp","mailto"],Xm={name:"MentionSuggestion",components:{DtAvatar:Bo,DtStack:Ai},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc}}};function Qm(n,e,t,r,i,s){const o=m.resolveComponent("dt-avatar"),l=m.resolveComponent("dt-stack");return m.openBlock(),m.createBlock(l,{direction:"row",gap:"400"},{default:m.withCtx(()=>[m.createVNode(o,{"full-name":s.name,"image-src":s.avatarSrc,"image-alt":s.name,size:"xs"},null,8,["full-name","image-src","image-alt"]),m.createTextVNode(" "+m.toDisplayString(s.name),1)]),_:1})}const Zm=v._export_sfc(Xm,[["render",Qm]]),eg={allowSpaces:!0,render:()=>{let n,e;return{onStart:t=>{n=new Gi(Ma,{props:{itemComponent:m.markRaw(Zm),itemType:"mention",...t},editor:t.editor}),t.clientRect&&(e=v.tippy("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(t){n.updateProps(t),t.clientRect&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){return t.event.key==="Escape"?(e[0].hide(),!0):n==null?void 0:n.ref.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},tg={name:"DtRichTextEditor",components:{EditorContent:mp},props:{modelValue:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(n){return typeof n=="string"?Oa.includes(n):!0}},outputFormat:{type:String,default:"text",validator(n){return wa.includes(n)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null}},emits:["input","update:modelValue","blur","focus"],data(){return{editor:null,popoverOpened:!1}},computed:{extensions(){const n=[bp,Np,Ip,Cp,_p,lm,Tp,hm,pm,fm];if(this.link&&n.push(this.getExtension(jm,this.link)),n.push(Mp.configure({placeholder:this.placeholder})),this.allowLineBreaks||n.push(Ep.extend({addKeyboardShortcuts(){return{Enter:()=>!0,"Shift-Enter":()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])}}})),n.push(om.extend({inclusive:!1}).configure({autolink:!0,protocols:Ym})),this.mentionSuggestion){const e={...this.mentionSuggestion,...eg};n.push(Gm.configure({suggestion:e}))}return n.push(Lm),n.push(mm.configure({types:["paragraph"],defaultAlignment:"left"})),n.push(xp.configure({HTMLAttributes:{class:"dt-rich-text-editor--code-block"}})),n.push(cm.configure({itemTypeName:"listItem"})),n},inputAttrs(){const n={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(n["aria-readonly"]=!0),n}},watch:{editable(n){this.editor.setEditable(n),this.updateEditorAttributes({"aria-readonly":!n})},inputClass(n){this.updateEditorAttributes({class:n})},inputAriaLabel(n){this.updateEditorAttributes({"aria-label":n})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(n){let e=this.getOutput();this.outputFormat==="json"&&(n=JSON.stringify(n),e=JSON.stringify(e)),n!==e&&this.editor.commands.setContent(n,!1)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},methods:{createEditor(){this.editor=new pp({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,editorProps:{attributes:{...this.inputAttrs,class:this.inputClass}}}),this.addEditorListeners()},destroyEditor(){this.editor.destroy()},addEditorListeners(){this.editor.on("update",()=>{const n=this.getOutput();this.$emit("input",n),this.$emit("update:modelValue",n)}),this.editor.on("focus",({event:n})=>{this.$emit("focus",n)}),this.editor.on("blur",({event:n})=>{this.$emit("blur",n)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"text":default:return this.editor.getText()}},getExtension(n,e){var t;return typeof e=="boolean"?n:(t=n.configure)==null?void 0:t.call(n,e)},updateEditorAttributes(n){this.editor.setOptions({editorProps:{attributes:n}})},focusEditor(){this.editor.commands.focus()}}};function ng(n,e,t,r,i,s){const o=m.resolveComponent("editor-content");return m.openBlock(),m.createBlock(o,{editor:i.editor,"data-qa":"dt-rich-text-editor",class:"dt-rich-text-editor"},null,8,["editor"])}const rg=v._export_sfc(tg,[["render",ng]]);exports.AVATAR_COLORS=Lo;exports.AVATAR_GROUP_VALIDATOR=Zr;exports.AVATAR_ICON_SIZES=Po;exports.AVATAR_KIND_MODIFIERS=Io;exports.AVATAR_PRESENCE_SIZE_MODIFIERS=Ro;exports.AVATAR_PRESENCE_STATES=Qr;exports.AVATAR_SIZE_MODIFIERS=mn;exports.DT_STACK_DIRECTION=Ge;exports.DT_STACK_GAP=dr;exports.DT_STACK_RESPONSIVE_BREAKPOINTS=vi;exports.DtAvatar=Bo;exports.DtItemLayout=ei;exports.DtLink=_o;exports.DtListItem=$o;exports.DtPopover=fc;exports.DtPresence=Do;exports.DtRichTextEditor=rg;exports.DtStack=Ai;exports.LIST_ITEM_NAVIGATION_TYPES=Lt;exports.LIST_ITEM_TYPES=gn;exports.Modal=Vo;exports.PRESENCE_STATES=kt;exports.PRESENCE_STATES_LIST=No;exports.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES=Oa;exports.RICH_TEXT_EDITOR_OUTPUT_FORMATS=wa;exports.SrOnlyCloseButton=zo;exports.SrOnlyCloseButtonMixin=Fo;
|
|
98
|
+
//# sourceMappingURL=rich_text_editor-B2jQbDxj.cjs.map
|