@dialpad/dialtone-vue 3.184.2 → 3.185.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/component-documentation.json +1 -1
  2. package/dist/dialtone-vue.cjs +1 -1
  3. package/dist/dialtone-vue.js +208 -206
  4. package/dist/dialtone-vue.js.map +1 -1
  5. package/dist/lib/list-item/list-item.cjs +1 -1
  6. package/dist/lib/list-item/list-item.cjs.map +1 -1
  7. package/dist/lib/list-item/list-item.js +35 -30
  8. package/dist/lib/list-item/list-item.js.map +1 -1
  9. package/dist/lib/loader/index.cjs +2 -0
  10. package/dist/lib/loader/index.cjs.map +1 -0
  11. package/dist/lib/loader/index.js +5 -0
  12. package/dist/lib/loader/index.js.map +1 -0
  13. package/dist/lib/loader/loader.cjs +2 -0
  14. package/dist/lib/loader/loader.cjs.map +1 -0
  15. package/dist/lib/loader/loader.js +48 -0
  16. package/dist/lib/loader/loader.js.map +1 -0
  17. package/dist/lib/message-input/message-input.cjs +1 -1
  18. package/dist/lib/message-input/message-input.cjs.map +1 -1
  19. package/dist/lib/message-input/message-input.js +90 -68
  20. package/dist/lib/message-input/message-input.js.map +1 -1
  21. package/dist/lib/rich-text-editor/rich-text-editor.cjs +8 -4
  22. package/dist/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  23. package/dist/lib/rich-text-editor/rich-text-editor.js +339 -244
  24. package/dist/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  25. package/dist/types/components/list_item/list_item.vue.d.ts +10 -2
  26. package/dist/types/components/loader/index.d.ts +2 -0
  27. package/dist/types/components/loader/index.d.ts.map +1 -0
  28. package/dist/types/components/loader/loader.vue.d.ts +26 -0
  29. package/dist/types/components/loader/loader.vue.d.ts.map +1 -0
  30. package/dist/types/components/rich_text_editor/extensions/slash_command/slash_command.d.ts.map +1 -1
  31. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +21 -1
  32. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  33. package/dist/types/components/toggle/toggle.vue.d.ts +1 -1
  34. package/dist/types/index.d.ts +1 -0
  35. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  36. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
- import { NodeViewWrapper as R, nodeViewProps as L, VueRenderer as v, VueNodeViewRenderer as $, EditorContent as G, BubbleMenu as Q, Editor as Z } from "../../node_modules/@tiptap/vue-3.js";
2
- import { Node as ee, mergeAttributes as x, InputRule as te, nodePasteRule as B, getMarksBetween as ne, combineTransactionSteps as oe, getChangedRanges as ie, findChildrenInRange as re, Mark as se, nodeInputRule as ae, Extension as le } from "@tiptap/core";
1
+ import { NodeViewWrapper as L, nodeViewProps as v, VueRenderer as R, VueNodeViewRenderer as $, EditorContent as G, BubbleMenu as Q, Editor as Z } from "../../node_modules/@tiptap/vue-3.js";
2
+ import { Node as ee, mergeAttributes as b, InputRule as te, nodePasteRule as D, getMarksBetween as ne, combineTransactionSteps as oe, getChangedRanges as re, findChildrenInRange as ie, Mark as se, nodeInputRule as ae, Extension as le } from "@tiptap/core";
3
3
  import ce from "@tiptap/extension-blockquote";
4
4
  import de from "@tiptap/extension-code-block";
5
5
  import ue from "@tiptap/extension-code";
@@ -10,33 +10,33 @@ import fe from "@tiptap/extension-placeholder";
10
10
  import pe from "@tiptap/extension-bold";
11
11
  import ge from "@tiptap/extension-bullet-list";
12
12
  import _e from "@tiptap/extension-italic";
13
- import we from "@tiptap/extension-link";
14
- import ye from "@tiptap/extension-list-item";
13
+ import ye from "@tiptap/extension-link";
14
+ import we from "@tiptap/extension-list-item";
15
15
  import ke from "@tiptap/extension-ordered-list";
16
- import be from "@tiptap/extension-strike";
17
- import xe from "@tiptap/extension-underline";
16
+ import xe from "@tiptap/extension-strike";
17
+ import be from "@tiptap/extension-underline";
18
18
  import Ce from "@tiptap/extension-text";
19
- import Ee from "@tiptap/extension-text-align";
20
- import Se from "@tiptap/extension-history";
21
- import Te from "@tiptap/extension-text-style";
22
- import Re from "@tiptap/extension-color";
23
- import Le from "@tiptap/extension-font-family";
24
- import { PluginKey as E, Plugin as ve } from "@tiptap/pm/state";
19
+ import Te from "@tiptap/extension-text-align";
20
+ import Ee from "@tiptap/extension-history";
21
+ import Se from "@tiptap/extension-text-style";
22
+ import Le from "@tiptap/extension-color";
23
+ import ve from "@tiptap/extension-font-family";
24
+ import { PluginKey as T, Plugin as Re } from "@tiptap/pm/state";
25
25
  import $e from "@tiptap/suggestion";
26
- import { emojiPattern as z } from "regex-combined-emojis";
27
- import { resolveComponent as d, openBlock as l, createBlock as m, withCtx as u, createVNode as f, createElementBlock as _, withDirectives as Ie, createElementVNode as y, Fragment as Me, renderList as Oe, normalizeClass as W, withModifiers as Ae, resolveDynamicComponent as De, vShow as je, createTextVNode as k, toDisplayString as p, markRaw as I, createCommentVNode as b, mergeProps as Be } from "vue";
26
+ import { emojiPattern as W } from "regex-combined-emojis";
27
+ import { resolveComponent as d, openBlock as l, createBlock as m, withCtx as u, createVNode as f, createElementBlock as _, withDirectives as Me, createElementVNode as w, Fragment as Oe, renderList as Ie, normalizeClass as z, withModifiers as Pe, resolveDynamicComponent as Be, vShow as Ae, createTextVNode as k, toDisplayString as p, markRaw as M, createCommentVNode as x, mergeProps as De } from "vue";
28
28
  import { _ as g } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
29
29
  import X from "../emoji/emoji.js";
30
- import { stringToUnicode as Pe, codeToEmojiData as H, emojiRegex as He, emojiShortCodeRegex as Fe } from "../../common/emoji/index.js";
31
- import { emojisIndexed as Ve } from "@dialpad/dialtone-emojis";
32
- import Ke from "../list-item/list-item.js";
33
- import M from "../stack/stack.js";
34
- import O from "tippy.js";
35
- import { linkRegex as qe, getPhoneNumberRegex as Ne, returnFirstEl as V, warnIfUnmounted as Ue } from "../../common/utils/index.js";
36
- import ze from "@tiptap/extension-image";
37
- import F from "@tiptap/extension-mention";
30
+ import { stringToUnicode as je, codeToEmojiData as H, emojiRegex as He, emojiShortCodeRegex as Ne } from "../../common/emoji/index.js";
31
+ import { emojisIndexed as Fe } from "@dialpad/dialtone-emojis";
32
+ import Ve from "../list-item/list-item.js";
33
+ import O from "../stack/stack.js";
34
+ import I from "tippy.js";
35
+ import { linkRegex as qe, getPhoneNumberRegex as Ke, returnFirstEl as F, warnIfUnmounted as Ue } from "../../common/utils/index.js";
36
+ import We from "@tiptap/extension-image";
37
+ import N from "@tiptap/extension-mention";
38
38
  import J from "../link/link.js";
39
- import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as We, RICH_TEXT_EDITOR_OUTPUT_FORMATS as Xe, RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as K } from "./rich-text-editor-constants.js";
39
+ import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as ze, RICH_TEXT_EDITOR_OUTPUT_FORMATS as Xe, RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as V } from "./rich-text-editor-constants.js";
40
40
  import Je from "../avatar/avatar.js";
41
41
  import Ye from "@dialpad/dialtone-icons/vue3/hash";
42
42
  import Ge from "@dialpad/dialtone-icons/vue3/lock";
@@ -46,12 +46,12 @@ const et = {
46
46
  compatConfig: { MODE: 3 },
47
47
  name: "EmojiComponent",
48
48
  components: {
49
- NodeViewWrapper: R,
49
+ NodeViewWrapper: L,
50
50
  DtEmoji: X
51
51
  },
52
- props: L
52
+ props: v
53
53
  };
54
- function tt(e, t, o, n, i, r) {
54
+ function tt(e, t, o, n, r, i) {
55
55
  const s = d("dt-emoji"), a = d("node-view-wrapper");
56
56
  return l(), m(a, { class: "d-d-inline-block d-va-bottom d-lh0" }, {
57
57
  default: u(() => [
@@ -67,7 +67,7 @@ const nt = /* @__PURE__ */ g(et, [["render", tt]]), ot = {
67
67
  compatConfig: { MODE: 3 },
68
68
  name: "SuggestionList",
69
69
  components: {
70
- DtListItem: Ke
70
+ DtListItem: Ve
71
71
  },
72
72
  props: {
73
73
  items: {
@@ -136,40 +136,40 @@ const nt = /* @__PURE__ */ g(et, [["render", tt]]), ot = {
136
136
  }
137
137
  }
138
138
  }
139
- }, it = { class: "d-popover__dialog d-suggestion-list__container" }, rt = {
139
+ }, rt = { class: "d-popover__dialog d-suggestion-list__container" }, it = {
140
140
  ref: "suggestionList",
141
141
  class: "d-suggestion-list"
142
142
  };
143
- function st(e, t, o, n, i, r) {
143
+ function st(e, t, o, n, r, i) {
144
144
  const s = d("dt-list-item");
145
- return l(), _("div", it, [
146
- Ie(y("ul", rt, [
147
- (l(!0), _(Me, null, Oe(o.items, (a, c) => (l(), m(s, {
145
+ return l(), _("div", rt, [
146
+ Me(w("ul", it, [
147
+ (l(!0), _(Oe, null, Ie(o.items, (a, c) => (l(), m(s, {
148
148
  key: a.id,
149
- class: W([
149
+ class: z([
150
150
  "d-suggestion-list__item",
151
- { "d-list-item--highlighted": c === i.selectedIndex }
151
+ { "d-list-item--highlighted": c === r.selectedIndex }
152
152
  ]),
153
153
  "navigation-type": "arrow-keys",
154
- onClick: (h) => r.selectItem(c),
155
- onKeydown: Ae(r.onKeyDown, ["prevent"])
154
+ onClick: (h) => i.selectItem(c),
155
+ onKeydown: Pe(i.onKeyDown, ["prevent"])
156
156
  }, {
157
157
  default: u(() => [
158
- (l(), m(De(o.itemComponent), { item: a }, null, 8, ["item"]))
158
+ (l(), m(Be(o.itemComponent), { item: a }, null, 8, ["item"]))
159
159
  ]),
160
160
  _: 2
161
161
  }, 1032, ["class", "onClick", "onKeydown"]))), 128))
162
162
  ], 512), [
163
- [je, o.items.length]
163
+ [Ae, o.items.length]
164
164
  ])
165
165
  ]);
166
166
  }
167
- const A = /* @__PURE__ */ g(ot, [["render", st]]), at = {
167
+ const P = /* @__PURE__ */ g(ot, [["render", st]]), at = {
168
168
  compatConfig: { MODE: 3 },
169
169
  name: "EmojiSuggestion",
170
170
  components: {
171
171
  DtEmoji: X,
172
- DtStack: M
172
+ DtStack: O
173
173
  },
174
174
  props: {
175
175
  item: {
@@ -178,7 +178,7 @@ const A = /* @__PURE__ */ g(ot, [["render", st]]), at = {
178
178
  }
179
179
  }
180
180
  };
181
- function lt(e, t, o, n, i, r) {
181
+ function lt(e, t, o, n, r, i) {
182
182
  const s = d("dt-emoji"), a = d("dt-stack");
183
183
  return l(), m(a, {
184
184
  direction: "row",
@@ -194,7 +194,7 @@ function lt(e, t, o, n, i, r) {
194
194
  _: 1
195
195
  });
196
196
  }
197
- const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
197
+ const ct = /* @__PURE__ */ g(at, [["render", lt]]), B = {
198
198
  name: "hideOnEsc",
199
199
  defaultValue: !0,
200
200
  fn({ hide: e }) {
@@ -214,19 +214,19 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
214
214
  items: ({ query: e }) => {
215
215
  if (e.length < 2)
216
216
  return [];
217
- const t = Object.values(Ve);
217
+ const t = Object.values(Fe);
218
218
  return e = e.toLowerCase(), t.filter(
219
219
  (n) => [
220
220
  n.name,
221
221
  n.shortname.replaceAll(":", ""),
222
222
  ...n.keywords
223
- ].some((i) => i.startsWith(e))
223
+ ].some((r) => r.startsWith(e))
224
224
  ).splice(0, dt).map((n) => ({ code: n.shortname }));
225
225
  },
226
226
  command: ({ editor: e, range: t, props: o }) => {
227
- var r, s;
227
+ var i, s;
228
228
  const n = e.view.state.selection.$to.nodeAfter;
229
- ((r = n == null ? void 0 : n.text) == null ? void 0 : r.startsWith(" ")) && (t.to += 1), e.chain().focus().insertContentAt(t, [
229
+ ((i = n == null ? void 0 : n.text) == null ? void 0 : i.startsWith(" ")) && (t.to += 1), e.chain().focus().insertContentAt(t, [
230
230
  {
231
231
  type: "emoji",
232
232
  attrs: o
@@ -237,14 +237,14 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
237
237
  let e, t, o = !1;
238
238
  return {
239
239
  onStart: (n) => {
240
- e = new v(A, {
240
+ e = new R(P, {
241
241
  props: {
242
- itemComponent: I(ct),
242
+ itemComponent: M(ct),
243
243
  itemType: "emoji",
244
244
  ...n
245
245
  },
246
246
  editor: n.editor
247
- }), n.clientRect && (t = O("body", {
247
+ }), n.clientRect && (t = I("body", {
248
248
  getReferenceClientRect: n.clientRect,
249
249
  appendTo: () => document.body,
250
250
  content: e.element,
@@ -259,7 +259,7 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
259
259
  trigger: "manual",
260
260
  placement: "top-start",
261
261
  zIndex: 650,
262
- plugins: [D]
262
+ plugins: [B]
263
263
  }), n.items.length > 0 && (t == null || t[0].show()));
264
264
  },
265
265
  onUpdate(n) {
@@ -268,19 +268,19 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
268
268
  });
269
269
  },
270
270
  onKeyDown(n) {
271
- var i;
271
+ var r;
272
272
  if (o)
273
- return (i = e == null ? void 0 : e.ref) == null ? void 0 : i.onKeyDown(n);
273
+ return (r = e == null ? void 0 : e.ref) == null ? void 0 : r.onKeyDown(n);
274
274
  },
275
275
  onExit() {
276
276
  t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
277
277
  }
278
278
  };
279
279
  }
280
- }, mt = /(:\w+:)$/, ht = new RegExp(z + "$"), ft = (e) => {
280
+ }, mt = /(:\w+:)$/, ht = new RegExp(W + "$"), ft = (e) => {
281
281
  if (e && H(e[0]))
282
282
  return { text: e[2] || e[0] };
283
- }, pt = (e) => [...e.matchAll(Fe)].filter((o) => H(o[0])).map((o) => ({
283
+ }, pt = (e) => [...e.matchAll(Ne)].filter((o) => H(o[0])).map((o) => ({
284
284
  index: o.index,
285
285
  text: o[0],
286
286
  match: o
@@ -313,10 +313,10 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
313
313
  ];
314
314
  },
315
315
  renderText({ node: e }) {
316
- return Pe(H(e.attrs.code).unicode_output);
316
+ return je(H(e.attrs.code).unicode_output);
317
317
  },
318
318
  renderHTML({ HTMLAttributes: e }) {
319
- return ["emoji-component", x(this.options.HTMLAttributes, e)];
319
+ return ["emoji-component", b(this.options.HTMLAttributes, e)];
320
320
  },
321
321
  addInputRules() {
322
322
  return [
@@ -326,7 +326,7 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
326
326
  if (t)
327
327
  return ft(t);
328
328
  },
329
- handler: ({ state: e, range: t, match: o, commands: n, chain: i, can: r }) => {
329
+ handler: ({ state: e, range: t, match: o, commands: n, chain: r, can: i }) => {
330
330
  const { tr: s } = e, a = t.from, c = t.to;
331
331
  s.replaceWith(a, c, this.type.create({ code: o[0] }));
332
332
  }
@@ -335,7 +335,7 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
335
335
  },
336
336
  addPasteRules() {
337
337
  return [
338
- B({
338
+ D({
339
339
  find: pt,
340
340
  type: this.type,
341
341
  getAttributes(e) {
@@ -344,7 +344,7 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
344
344
  };
345
345
  }
346
346
  }),
347
- B({
347
+ D({
348
348
  find: He,
349
349
  type: this.type,
350
350
  getAttributes(e) {
@@ -359,7 +359,7 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
359
359
  return [
360
360
  $e({
361
361
  char: ":",
362
- pluginKey: new E("emoji"),
362
+ pluginKey: new T("emoji"),
363
363
  editor: this.editor,
364
364
  ...this.options.suggestion,
365
365
  ...ut
@@ -370,8 +370,8 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
370
370
  return {
371
371
  Backspace: () => this.editor.commands.command(({ tr: e, state: t }) => {
372
372
  let o = !1;
373
- const { selection: n } = t, { empty: i, anchor: r } = n;
374
- return i ? (t.doc.nodesBetween(r - 1, r, (s, a) => {
373
+ const { selection: n } = t, { empty: r, anchor: i } = n;
374
+ return r ? (t.doc.nodesBetween(i - 1, i, (s, a) => {
375
375
  if (s.type.name === this.name)
376
376
  return o = !0, e.insertText("", a, a + s.nodeSize), !1;
377
377
  }), o) : !1;
@@ -382,15 +382,15 @@ const ct = /* @__PURE__ */ g(at, [["render", lt]]), D = {
382
382
  function _t(e, t, o = () => !0) {
383
383
  const n = [];
384
384
  t.lastIndex = 0;
385
- let i;
386
- for (; i = t.exec(e); )
387
- o(e, i) && n.push(i);
385
+ let r;
386
+ for (; r = t.exec(e); )
387
+ o(e, r) && n.push(r);
388
388
  return n;
389
389
  }
390
- function wt(e, t) {
390
+ function yt(e, t) {
391
391
  return !["#", "@"].includes(e.charAt(t.index)) && !["#", "@"].includes(e.charAt(t.index - 1));
392
392
  }
393
- function yt(e) {
393
+ function wt(e) {
394
394
  const t = new RegExp(
395
395
  "(?:" + [
396
396
  `[!?.,:;'"]`,
@@ -403,11 +403,11 @@ function yt(e) {
403
403
  function kt(e, t) {
404
404
  const o = e.slice(0, t + 1).search(/\S+\s*$/), n = e.slice(t).search(/\s/);
405
405
  if (n < 0) {
406
- const i = e.slice(o);
406
+ const r = e.slice(o);
407
407
  return {
408
- text: i,
408
+ text: r,
409
409
  from: o,
410
- to: o + i.length
410
+ to: o + r.length
411
411
  };
412
412
  }
413
413
  return {
@@ -416,65 +416,65 @@ function kt(e, t) {
416
416
  to: n + t
417
417
  };
418
418
  }
419
- function P(e, t, o, n) {
420
- const i = kt(e, t);
421
- if (n.lastIndex = 0, !n.test(i.text))
422
- return i;
423
- const r = o === "left" ? i.from - 1 : i.to + 1;
424
- return r <= 0 || r >= e.length || r === t ? i : P(e, r, o, n);
419
+ function j(e, t, o, n) {
420
+ const r = kt(e, t);
421
+ if (n.lastIndex = 0, !n.test(r.text))
422
+ return r;
423
+ const i = o === "left" ? r.from - 1 : r.to + 1;
424
+ return i <= 0 || i >= e.length || i === t ? r : j(e, i, o, n);
425
425
  }
426
- function bt(e, t, o, n) {
427
- const i = Math.max(e.from - 1, 0), r = Math.min(e.to + 1, t.content.size), s = ne(i, r, t);
426
+ function xt(e, t, o, n) {
427
+ const r = Math.max(e.from - 1, 0), i = Math.min(e.to + 1, t.content.size), s = ne(r, i, t);
428
428
  for (const a of s)
429
429
  a.mark.type === n && o.removeMark(a.from, a.to, n);
430
430
  }
431
- const q = Ne(1, 15);
432
- function N(e, t, o, n, i, r) {
431
+ const q = Ke(1, 15);
432
+ function K(e, t, o, n, r, i) {
433
433
  if (!e)
434
434
  return;
435
435
  let s = o - t - 1;
436
436
  s = s < 0 ? 0 : s;
437
- const a = n - t, c = P(
437
+ const a = n - t, c = j(
438
438
  e,
439
439
  s,
440
440
  "left",
441
441
  q
442
- ), h = P(
442
+ ), h = j(
443
443
  e,
444
444
  a,
445
445
  "right",
446
446
  q
447
- ), w = e.slice(c.from, h.to);
448
- _t(w, qe, wt).forEach((j) => {
449
- const C = yt(j[0]), T = t + c.from + j.index + 1, Y = T + C.length;
450
- i.addMark(T, Y, r.create());
447
+ ), y = e.slice(c.from, h.to);
448
+ _t(y, qe, yt).forEach((A) => {
449
+ const C = wt(A[0]), S = t + c.from + A.index + 1, Y = S + C.length;
450
+ r.addMark(S, Y, i.create());
451
451
  });
452
452
  }
453
- function xt(e) {
453
+ function bt(e) {
454
454
  let t = !1;
455
- return new ve({
456
- key: new E("autolink"),
457
- appendTransaction: (o, n, i) => {
458
- const r = o.some((w) => w.docChanged) && !n.doc.eq(i.doc);
459
- if (t && !r)
455
+ return new Re({
456
+ key: new T("autolink"),
457
+ appendTransaction: (o, n, r) => {
458
+ const i = o.some((y) => y.docChanged) && !n.doc.eq(r.doc);
459
+ if (t && !i)
460
460
  return;
461
- const { tr: s } = i, { textContent: a } = i.doc;
462
- t || N(a, 0, 0, a.length, s, e.type), t = !0;
461
+ const { tr: s } = r, { textContent: a } = r.doc;
462
+ t || K(a, 0, 0, a.length, s, e.type), t = !0;
463
463
  const c = oe(
464
464
  n.doc,
465
465
  [...o]
466
466
  );
467
- return ie(c).forEach(({ oldRange: w, newRange: S }) => {
468
- bt(S, i.doc, s, e.type), re(
469
- i.doc,
470
- S,
467
+ return re(c).forEach(({ oldRange: y, newRange: E }) => {
468
+ xt(E, r.doc, s, e.type), ie(
469
+ r.doc,
470
+ E,
471
471
  (C) => C.isTextblock
472
- ).forEach(({ node: C, pos: T }) => {
473
- N(
472
+ ).forEach(({ node: C, pos: S }) => {
473
+ K(
474
474
  C.textContent,
475
- T,
476
- w.from,
477
- S.to,
475
+ S,
476
+ y.from,
477
+ E.to,
478
478
  s,
479
479
  e.type
480
480
  );
@@ -486,12 +486,12 @@ function xt(e) {
486
486
  const Ct = {
487
487
  class: "d-link d-c-text d-d-inline-block d-wb-break-all",
488
488
  rel: "noopener noreferrer nofollow"
489
- }, Et = se.create({
489
+ }, Tt = se.create({
490
490
  name: "CustomLink",
491
491
  renderHTML({ HTMLAttributes: e }) {
492
492
  return [
493
493
  "a",
494
- x(
494
+ b(
495
495
  this.options.HTMLAttributes,
496
496
  e,
497
497
  Ct
@@ -503,10 +503,10 @@ const Ct = {
503
503
  },
504
504
  addProseMirrorPlugins() {
505
505
  return [
506
- xt({ type: this.type })
506
+ bt({ type: this.type })
507
507
  ];
508
508
  }
509
- }), St = ze.extend({
509
+ }), Et = We.extend({
510
510
  name: "ConfigurableImage",
511
511
  addAttributes() {
512
512
  return {
@@ -530,34 +530,34 @@ const Ct = {
530
530
  }
531
531
  };
532
532
  }
533
- }).configure({ inline: !0, allowBase64: !0 }), Tt = U.extend({
533
+ }).configure({ inline: !0, allowBase64: !0 }), St = U.extend({
534
534
  parseHTML() {
535
535
  return [{ tag: "div" }];
536
536
  },
537
537
  renderHTML({ HTMLAttributes: e }) {
538
- return ["div", x(this.options.HTMLAttributes, e), 0];
538
+ return ["div", b(this.options.HTMLAttributes, e), 0];
539
539
  }
540
- }), Rt = {
540
+ }), Lt = {
541
541
  compatConfig: { MODE: 3 },
542
542
  name: "MentionComponent",
543
543
  components: {
544
- NodeViewWrapper: R,
544
+ NodeViewWrapper: L,
545
545
  DtLink: J
546
546
  },
547
- props: L,
547
+ props: v,
548
548
  computed: {
549
549
  text() {
550
550
  return "@" + this.$props.node.attrs.name;
551
551
  }
552
552
  }
553
553
  };
554
- function Lt(e, t, o, n, i, r) {
554
+ function vt(e, t, o, n, r, i) {
555
555
  const s = d("dt-link"), a = d("node-view-wrapper");
556
556
  return l(), m(a, { class: "d-d-inline-block" }, {
557
557
  default: u(() => [
558
558
  f(s, { kind: "mention" }, {
559
559
  default: u(() => [
560
- k(p(r.text), 1)
560
+ k(p(i.text), 1)
561
561
  ]),
562
562
  _: 1
563
563
  })
@@ -565,9 +565,9 @@ function Lt(e, t, o, n, i, r) {
565
565
  _: 1
566
566
  });
567
567
  }
568
- const vt = /* @__PURE__ */ g(Rt, [["render", Lt]]), $t = F.extend({
568
+ const Rt = /* @__PURE__ */ g(Lt, [["render", vt]]), $t = N.extend({
569
569
  addNodeView() {
570
- return $(vt);
570
+ return $(Rt);
571
571
  },
572
572
  parseHTML() {
573
573
  return [
@@ -593,34 +593,34 @@ const vt = /* @__PURE__ */ g(Rt, [["render", Lt]]), $t = F.extend({
593
593
  return `@${e.attrs.id}`;
594
594
  },
595
595
  renderHTML({ HTMLAttributes: e }) {
596
- return ["mention-component", x(this.options.HTMLAttributes, e)];
596
+ return ["mention-component", b(this.options.HTMLAttributes, e)];
597
597
  }
598
598
  }).configure({
599
599
  suggestion: {
600
600
  char: "@",
601
- pluginKey: new E("mentionSuggestion")
601
+ pluginKey: new T("mentionSuggestion")
602
602
  }
603
- }), It = {
603
+ }), Mt = {
604
604
  compatConfig: { MODE: 3 },
605
605
  name: "ChannelComponent",
606
606
  components: {
607
- NodeViewWrapper: R,
607
+ NodeViewWrapper: L,
608
608
  DtLink: J
609
609
  },
610
- props: L,
610
+ props: v,
611
611
  computed: {
612
612
  text() {
613
613
  return "#" + this.$props.node.attrs.name;
614
614
  }
615
615
  }
616
616
  };
617
- function Mt(e, t, o, n, i, r) {
617
+ function Ot(e, t, o, n, r, i) {
618
618
  const s = d("dt-link"), a = d("node-view-wrapper");
619
619
  return l(), m(a, { class: "d-d-inline-block" }, {
620
620
  default: u(() => [
621
621
  f(s, { kind: "mention" }, {
622
622
  default: u(() => [
623
- k(p(r.text), 1)
623
+ k(p(i.text), 1)
624
624
  ]),
625
625
  _: 1
626
626
  })
@@ -628,10 +628,10 @@ function Mt(e, t, o, n, i, r) {
628
628
  _: 1
629
629
  });
630
630
  }
631
- const Ot = /* @__PURE__ */ g(It, [["render", Mt]]), At = F.extend({
631
+ const It = /* @__PURE__ */ g(Mt, [["render", Ot]]), Pt = N.extend({
632
632
  name: "channel",
633
633
  addNodeView() {
634
- return $(Ot);
634
+ return $(It);
635
635
  },
636
636
  parseHTML() {
637
637
  return [
@@ -657,20 +657,22 @@ const Ot = /* @__PURE__ */ g(It, [["render", Mt]]), At = F.extend({
657
657
  return `#${e.attrs.id}`;
658
658
  },
659
659
  renderHTML({ HTMLAttributes: e }) {
660
- return ["channel-component", x(this.options.HTMLAttributes, e)];
660
+ return ["channel-component", b(this.options.HTMLAttributes, e)];
661
661
  }
662
662
  }).configure({
663
663
  suggestion: {
664
664
  char: "#",
665
- pluginKey: new E("channelSuggestion")
665
+ pluginKey: new T("channelSuggestion")
666
666
  }
667
- }), Dt = {
667
+ }), Bt = {
668
668
  compatConfig: { MODE: 3 },
669
669
  name: "SlashCommandsComponent",
670
670
  components: {
671
- NodeViewWrapper: R
671
+ NodeViewWrapper: L
672
+ },
673
+ props: {
674
+ ...v
672
675
  },
673
- props: L,
674
676
  emits: ["selected-command"],
675
677
  computed: {
676
678
  text() {
@@ -678,31 +680,47 @@ const Ot = /* @__PURE__ */ g(It, [["render", Mt]]), At = F.extend({
678
680
  }
679
681
  },
680
682
  created() {
681
- this.$parent.$emit("selected-command", this.$props.node.attrs.command);
683
+ var o, n, r;
684
+ const e = this.$props.node.attrs.command;
685
+ this.$emit("selected-command", e);
686
+ const t = (r = (n = (o = this.editor) == null ? void 0 : o.storage) == null ? void 0 : n["slash-commands"]) == null ? void 0 : r.onSelectedCommand;
687
+ t && typeof t == "function" && t(e);
682
688
  }
683
689
  };
684
- function jt(e, t, o, n, i, r) {
690
+ function At(e, t, o, n, r, i) {
685
691
  const s = d("node-view-wrapper");
686
692
  return l(), m(s, { class: "d-d-inline-block" }, {
687
693
  default: u(() => [
688
- k(p(r.text), 1)
694
+ k(p(i.text), 1)
689
695
  ]),
690
696
  _: 1
691
697
  });
692
698
  }
693
- const Bt = /* @__PURE__ */ g(Dt, [["render", jt]]), Pt = (e, t) => [...e.matchAll(t)].map((n) => {
694
- let i = n[2];
695
- return i.endsWith(" ") || (i += " "), {
699
+ const Dt = /* @__PURE__ */ g(Bt, [["render", At]]), jt = (e, t) => [...e.matchAll(t)].map((n) => {
700
+ let r = n[2];
701
+ return r.endsWith(" ") || (r += " "), {
696
702
  index: n.index,
697
- text: i,
703
+ text: r,
698
704
  match: n
699
705
  };
700
- }), Ht = F.extend({
706
+ }), Ht = N.extend({
701
707
  name: "slash-commands",
702
708
  group: "inline",
703
709
  inline: !0,
710
+ addOptions() {
711
+ var e;
712
+ return {
713
+ ...(e = this.parent) == null ? void 0 : e.call(this),
714
+ onSelectedCommand: null
715
+ };
716
+ },
717
+ addStorage() {
718
+ return {
719
+ onSelectedCommand: this.options.onSelectedCommand
720
+ };
721
+ },
704
722
  addNodeView() {
705
- return $(Bt);
723
+ return $(Dt);
706
724
  },
707
725
  parseHTML() {
708
726
  return [
@@ -728,7 +746,7 @@ const Bt = /* @__PURE__ */ g(Dt, [["render", jt]]), Pt = (e, t) => [...e.matchAl
728
746
  return `/${e.attrs.command}`;
729
747
  },
730
748
  renderHTML({ HTMLAttributes: e }) {
731
- return ["command-component", x(this.options.HTMLAttributes, e)];
749
+ return ["command-component", b(this.options.HTMLAttributes, e)];
732
750
  },
733
751
  addInputRules() {
734
752
  var o;
@@ -747,8 +765,8 @@ const Bt = /* @__PURE__ */ g(Dt, [["render", jt]]), Pt = (e, t) => [...e.matchAl
747
765
  var o;
748
766
  const e = (o = this.options.suggestion) == null ? void 0 : o.items({ query: "" }).map((n) => n.command), t = new RegExp(`^((?:\\/)(${e.join("|")})) ?$`, "g");
749
767
  return [
750
- B({
751
- find: (n) => Pt(n, t),
768
+ D({
769
+ find: (n) => jt(n, t),
752
770
  type: this.type,
753
771
  getAttributes(n) {
754
772
  return { command: n[0].trim() };
@@ -759,14 +777,14 @@ const Bt = /* @__PURE__ */ g(Dt, [["render", jt]]), Pt = (e, t) => [...e.matchAl
759
777
  }).configure({
760
778
  suggestion: {
761
779
  char: "/",
762
- pluginKey: new E("slashCommandSuggestion")
780
+ pluginKey: new T("slashCommandSuggestion")
763
781
  }
764
- }), Ft = {
782
+ }), Nt = {
765
783
  compatConfig: { MODE: 3 },
766
784
  name: "MentionSuggestion",
767
785
  components: {
768
786
  DtAvatar: Je,
769
- DtStack: M
787
+ DtStack: O
770
788
  },
771
789
  props: {
772
790
  item: {
@@ -802,14 +820,14 @@ const Bt = /* @__PURE__ */ g(Dt, [["render", jt]]), Pt = (e, t) => [...e.matchAl
802
820
  return this.item.showDetails;
803
821
  }
804
822
  }
805
- }, Vt = { class: "d-mention-suggestion__name" }, Kt = {
823
+ }, Ft = { class: "d-mention-suggestion__name" }, Vt = {
806
824
  key: 1,
807
825
  class: "d-mention-suggestion__divider"
808
826
  }, qt = {
809
827
  key: 2,
810
828
  class: "d-mention-suggestion__status"
811
829
  };
812
- function Nt(e, t, o, n, i, r) {
830
+ function Kt(e, t, o, n, r, i) {
813
831
  const s = d("dt-avatar"), a = d("dt-stack");
814
832
  return l(), m(a, {
815
833
  direction: "row",
@@ -818,11 +836,11 @@ function Nt(e, t, o, n, i, r) {
818
836
  }, {
819
837
  default: u(() => [
820
838
  f(s, {
821
- "full-name": r.name,
822
- "image-src": r.avatarSrc,
823
- "image-alt": r.name,
824
- "show-presence": r.showDetails,
825
- presence: r.presence,
839
+ "full-name": i.name,
840
+ "image-src": i.avatarSrc,
841
+ "image-alt": i.name,
842
+ "show-presence": i.showDetails,
843
+ presence: i.presence,
826
844
  size: "sm"
827
845
  }, null, 8, ["full-name", "image-src", "image-alt", "show-presence", "presence"]),
828
846
  f(a, {
@@ -830,23 +848,23 @@ function Nt(e, t, o, n, i, r) {
830
848
  gap: "100"
831
849
  }, {
832
850
  default: u(() => [
833
- y("span", Vt, p(r.name), 1),
834
- r.showDetails ? (l(), m(a, {
851
+ w("span", Ft, p(i.name), 1),
852
+ i.showDetails ? (l(), m(a, {
835
853
  key: 0,
836
854
  direction: "row",
837
855
  gap: "300",
838
856
  class: "d-label--sm-plain"
839
857
  }, {
840
858
  default: u(() => [
841
- r.presenceText ? (l(), _("span", {
859
+ i.presenceText ? (l(), _("span", {
842
860
  key: 0,
843
- class: W(["d-mention-suggestion__presence", [r.presenceFontColorClass]])
844
- }, p(r.presenceText), 3)) : b("", !0),
845
- r.status && r.presenceText ? (l(), _("div", Kt, " • ")) : b("", !0),
846
- r.status ? (l(), _("div", qt, p(r.status), 1)) : b("", !0)
861
+ class: z(["d-mention-suggestion__presence", [i.presenceFontColorClass]])
862
+ }, p(i.presenceText), 3)) : x("", !0),
863
+ i.status && i.presenceText ? (l(), _("div", Vt, " • ")) : x("", !0),
864
+ i.status ? (l(), _("div", qt, p(i.status), 1)) : x("", !0)
847
865
  ]),
848
866
  _: 1
849
- })) : b("", !0)
867
+ })) : x("", !0)
850
868
  ]),
851
869
  _: 1
852
870
  })
@@ -854,7 +872,7 @@ function Nt(e, t, o, n, i, r) {
854
872
  _: 1
855
873
  });
856
874
  }
857
- const Ut = /* @__PURE__ */ g(Ft, [["render", Nt]]), zt = {
875
+ const Ut = /* @__PURE__ */ g(Nt, [["render", Kt]]), Wt = {
858
876
  // This function comes from the user and passed to the editor directly.
859
877
  // This will also activate the mention plugin on the editor
860
878
  // items: ({ query }) => { return [] },
@@ -863,14 +881,14 @@ const Ut = /* @__PURE__ */ g(Ft, [["render", Nt]]), zt = {
863
881
  let e, t, o = !1;
864
882
  return {
865
883
  onStart: (n) => {
866
- e = new v(A, {
884
+ e = new R(P, {
867
885
  props: {
868
- itemComponent: I(Ut),
886
+ itemComponent: M(Ut),
869
887
  itemType: "mention",
870
888
  ...n
871
889
  },
872
890
  editor: n.editor
873
- }), n.clientRect && (t = O("body", {
891
+ }), n.clientRect && (t = I("body", {
874
892
  getReferenceClientRect: n.clientRect,
875
893
  appendTo: () => document.body,
876
894
  content: e.element,
@@ -885,7 +903,7 @@ const Ut = /* @__PURE__ */ g(Ft, [["render", Nt]]), zt = {
885
903
  trigger: "manual",
886
904
  placement: "top-start",
887
905
  zIndex: 650,
888
- plugins: [D]
906
+ plugins: [B]
889
907
  }), n.items.length > 0 && (t == null || t[0].show()));
890
908
  },
891
909
  onUpdate(n) {
@@ -894,20 +912,20 @@ const Ut = /* @__PURE__ */ g(Ft, [["render", Nt]]), zt = {
894
912
  }));
895
913
  },
896
914
  onKeyDown(n) {
897
- var i;
915
+ var r;
898
916
  if (o)
899
- return (i = e == null ? void 0 : e.ref) == null ? void 0 : i.onKeyDown(n);
917
+ return (r = e == null ? void 0 : e.ref) == null ? void 0 : r.onKeyDown(n);
900
918
  },
901
919
  onExit() {
902
920
  t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
903
921
  }
904
922
  };
905
923
  }
906
- }, Wt = {
924
+ }, zt = {
907
925
  compatConfig: { MODE: 3 },
908
926
  name: "ChannelSuggestion",
909
927
  components: {
910
- DtStack: M,
928
+ DtStack: O,
911
929
  DtIconHash: Ye,
912
930
  DtIconLock: Ge
913
931
  },
@@ -923,7 +941,7 @@ const Ut = /* @__PURE__ */ g(Ft, [["render", Nt]]), zt = {
923
941
  }
924
942
  }
925
943
  };
926
- function Xt(e, t, o, n, i, r) {
944
+ function Xt(e, t, o, n, r, i) {
927
945
  const s = d("dt-icon-hash"), a = d("dt-icon-lock"), c = d("dt-stack");
928
946
  return l(), m(c, {
929
947
  direction: "row",
@@ -937,12 +955,12 @@ function Xt(e, t, o, n, i, r) {
937
955
  key: 0,
938
956
  size: "300"
939
957
  })),
940
- y("span", null, p(r.name), 1)
958
+ w("span", null, p(i.name), 1)
941
959
  ]),
942
960
  _: 1
943
961
  });
944
962
  }
945
- const Jt = /* @__PURE__ */ g(Wt, [["render", Xt]]), Yt = {
963
+ const Jt = /* @__PURE__ */ g(zt, [["render", Xt]]), Yt = {
946
964
  // This function comes from the user and passed to the editor directly.
947
965
  // This will also activate the mention plugin on the editor
948
966
  // items: ({ query }) => { return [] },
@@ -951,14 +969,14 @@ const Jt = /* @__PURE__ */ g(Wt, [["render", Xt]]), Yt = {
951
969
  let e, t, o = !1;
952
970
  return {
953
971
  onStart: (n) => {
954
- e = new v(A, {
972
+ e = new R(P, {
955
973
  props: {
956
- itemComponent: I(Jt),
974
+ itemComponent: M(Jt),
957
975
  itemType: "channel",
958
976
  ...n
959
977
  },
960
978
  editor: n.editor
961
- }), n.clientRect && (t = O("body", {
979
+ }), n.clientRect && (t = I("body", {
962
980
  getReferenceClientRect: n.clientRect,
963
981
  appendTo: () => document.body,
964
982
  content: e.element,
@@ -973,7 +991,7 @@ const Jt = /* @__PURE__ */ g(Wt, [["render", Xt]]), Yt = {
973
991
  trigger: "manual",
974
992
  placement: "top-start",
975
993
  zIndex: 650,
976
- plugins: [D]
994
+ plugins: [B]
977
995
  }), n.items.length > 0 && (t == null || t[0].show()));
978
996
  },
979
997
  onUpdate(n) {
@@ -982,9 +1000,9 @@ const Jt = /* @__PURE__ */ g(Wt, [["render", Xt]]), Yt = {
982
1000
  }));
983
1001
  },
984
1002
  onKeyDown(n) {
985
- var i;
1003
+ var r;
986
1004
  if (o)
987
- return (i = e == null ? void 0 : e.ref) == null ? void 0 : i.onKeyDown(n);
1005
+ return (r = e == null ? void 0 : e.ref) == null ? void 0 : r.onKeyDown(n);
988
1006
  },
989
1007
  onExit() {
990
1008
  t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
@@ -1012,13 +1030,13 @@ const Jt = /* @__PURE__ */ g(Wt, [["render", Xt]]), Yt = {
1012
1030
  }
1013
1031
  }
1014
1032
  }, Qt = { class: "d-body--md-compact" }, Zt = { key: 0 }, en = { class: "d-body--sm d-fc-tertiary" };
1015
- function tn(e, t, o, n, i, r) {
1033
+ function tn(e, t, o, n, r, i) {
1016
1034
  return l(), _("div", null, [
1017
- y("div", Qt, [
1018
- y("span", null, "/" + p(r.command), 1),
1019
- r.parametersExample ? (l(), _("span", Zt, p(r.parametersExample), 1)) : b("", !0)
1035
+ w("div", Qt, [
1036
+ w("span", null, "/" + p(i.command), 1),
1037
+ i.parametersExample ? (l(), _("span", Zt, p(i.parametersExample), 1)) : x("", !0)
1020
1038
  ]),
1021
- y("div", en, p(r.description), 1)
1039
+ w("div", en, p(i.description), 1)
1022
1040
  ]);
1023
1041
  }
1024
1042
  const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
@@ -1031,15 +1049,15 @@ const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
1031
1049
  let e, t, o = !1;
1032
1050
  return {
1033
1051
  onStart: (n) => {
1034
- e = new v(A, {
1052
+ e = new R(P, {
1035
1053
  parent: void 0,
1036
1054
  props: {
1037
- itemComponent: I(nn),
1055
+ itemComponent: M(nn),
1038
1056
  itemType: "slash-command",
1039
1057
  ...n
1040
1058
  },
1041
1059
  editor: n.editor
1042
- }), n.clientRect && (t = O("body", {
1060
+ }), n.clientRect && (t = I("body", {
1043
1061
  getReferenceClientRect: n.clientRect,
1044
1062
  appendTo: () => document.body,
1045
1063
  content: e.element,
@@ -1054,7 +1072,7 @@ const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
1054
1072
  trigger: "manual",
1055
1073
  placement: "top-start",
1056
1074
  zIndex: 650,
1057
- plugins: [D]
1075
+ plugins: [B]
1058
1076
  }), n.items.length > 0 && (t == null || t[0].show()));
1059
1077
  },
1060
1078
  onUpdate(n) {
@@ -1063,9 +1081,9 @@ const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
1063
1081
  }));
1064
1082
  },
1065
1083
  onKeyDown(n) {
1066
- var i;
1084
+ var r;
1067
1085
  if (o)
1068
- return (i = e == null ? void 0 : e.ref) == null ? void 0 : i.onKeyDown(n);
1086
+ return (r = e == null ? void 0 : e.ref) == null ? void 0 : r.onKeyDown(n);
1069
1087
  },
1070
1088
  onExit() {
1071
1089
  t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
@@ -1079,7 +1097,7 @@ const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
1079
1097
  EditorContent: G,
1080
1098
  BubbleMenu: Q,
1081
1099
  DtButton: Ze,
1082
- DtStack: M
1100
+ DtStack: O
1083
1101
  },
1084
1102
  props: {
1085
1103
  /**
@@ -1104,6 +1122,14 @@ const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
1104
1122
  type: Boolean,
1105
1123
  default: !1
1106
1124
  },
1125
+ /**
1126
+ * When this option is false the editor will only ever paste plain text, no rich text formatting will be applied,
1127
+ * and any HTML will be rendered as text.
1128
+ */
1129
+ pasteRichText: {
1130
+ type: Boolean,
1131
+ default: !0
1132
+ },
1107
1133
  /**
1108
1134
  * Whether the input allows for line breaks to be introduced in the text by pressing enter. If this is disabled,
1109
1135
  * line breaks can still be entered by pressing shift+enter.
@@ -1143,7 +1169,7 @@ const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
1143
1169
  type: [Boolean, String, Number],
1144
1170
  default: !1,
1145
1171
  validator(e) {
1146
- return typeof e == "string" ? We.includes(e) : !0;
1172
+ return typeof e == "string" ? ze.includes(e) : !0;
1147
1173
  }
1148
1174
  },
1149
1175
  /**
@@ -1401,7 +1427,13 @@ const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
1401
1427
  * @event selected
1402
1428
  * @type {String}
1403
1429
  */
1404
- "selected"
1430
+ "selected",
1431
+ /**
1432
+ * Event fired when a slash command is selected
1433
+ * @event selected-command
1434
+ * @type {String}
1435
+ */
1436
+ "selected-command"
1405
1437
  ],
1406
1438
  data() {
1407
1439
  return {
@@ -1409,7 +1441,7 @@ const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
1409
1441
  tippyOptions: {
1410
1442
  appendTo: () => {
1411
1443
  var e;
1412
- return (e = V(this.$refs.editor.$el).getRootNode()) == null ? void 0 : e.querySelector("body");
1444
+ return (e = F(this.$refs.editor.$el).getRootNode()) == null ? void 0 : e.querySelector("body");
1413
1445
  },
1414
1446
  placement: "top-start"
1415
1447
  }
@@ -1429,48 +1461,53 @@ const nn = /* @__PURE__ */ g(Gt, [["render", tn]]), on = {
1429
1461
  },
1430
1462
  // eslint-disable-next-line complexity
1431
1463
  extensions() {
1432
- const e = [me, Ce, Se, he];
1433
- e.push(this.useDivTags ? Tt : U), this.allowBlockquote && e.push(ce), this.allowBold && e.push(pe), this.allowBulletList && (e.push(ge), e.push(ye.extend({
1464
+ const e = [me, Ce, Ee, he];
1465
+ e.push(this.useDivTags ? St : U), this.allowBlockquote && e.push(ce), this.allowBold && e.push(pe), this.allowBulletList && (e.push(ge), e.push(we.extend({
1434
1466
  renderText({ node: n }) {
1435
1467
  return n.textContent;
1436
1468
  }
1437
- })), e.push(ke)), this.allowItalic && e.push(_e), this.allowStrike && e.push(be), this.allowUnderline && e.push(xe), this.placeholder && e.push(
1469
+ })), e.push(ke)), this.allowItalic && e.push(_e), this.allowStrike && e.push(xe), this.allowUnderline && e.push(be), this.placeholder && e.push(
1438
1470
  fe.configure({ placeholder: this.placeholder })
1439
1471
  );
1440
1472
  const t = this, o = le.create({
1441
1473
  addKeyboardShortcuts() {
1442
1474
  return {
1443
- "Shift-Enter": ({ editor: n }) => t.allowLineBreaks ? !1 : (n.commands.first(({ commands: i }) => [
1444
- () => i.newlineInCode(),
1445
- () => t.allowBulletList && i.splitListItem("listItem"),
1446
- () => i.createParagraphNear(),
1447
- () => i.liftEmptyBlock(),
1448
- () => i.splitBlock()
1475
+ "Shift-Enter": ({ editor: n }) => t.allowLineBreaks ? !1 : (n.commands.first(({ commands: r }) => [
1476
+ () => r.newlineInCode(),
1477
+ () => t.allowBulletList && r.splitListItem("listItem"),
1478
+ () => r.createParagraphNear(),
1479
+ () => r.liftEmptyBlock(),
1480
+ () => r.splitBlock()
1449
1481
  ]), !0),
1450
1482
  Enter: () => t.allowLineBreaks ? !1 : (t.$emit("enter"), !0)
1451
1483
  };
1452
1484
  }
1453
1485
  });
1454
- if (e.push(o), this.link && e.push(we.extend({ inclusive: !1 }).configure({
1486
+ if (e.push(o), this.link && e.push(ye.extend({ inclusive: !1 }).configure({
1455
1487
  HTMLAttributes: {
1456
1488
  class: "d-link d-wb-break-all"
1457
1489
  },
1458
1490
  openOnClick: !1,
1459
1491
  autolink: !0,
1460
- protocols: K
1461
- })), this.customLink && e.push(this.getExtension(Et, this.customLink)), this.mentionSuggestion) {
1462
- const n = { ...this.mentionSuggestion, ...zt };
1492
+ protocols: V
1493
+ })), this.customLink && e.push(this.getExtension(Tt, this.customLink)), this.mentionSuggestion) {
1494
+ const n = { ...this.mentionSuggestion, ...Wt };
1463
1495
  e.push($t.configure({ suggestion: n }));
1464
1496
  }
1465
1497
  if (this.channelSuggestion) {
1466
1498
  const n = { ...this.channelSuggestion, ...Yt };
1467
- e.push(At.configure({ suggestion: n }));
1499
+ e.push(Pt.configure({ suggestion: n }));
1468
1500
  }
1469
1501
  if (this.slashCommandSuggestion) {
1470
1502
  const n = { ...this.slashCommandSuggestion, ...on };
1471
- e.push(Ht.configure({ suggestion: n }));
1503
+ e.push(Ht.configure({
1504
+ suggestion: n,
1505
+ onSelectedCommand: (r) => {
1506
+ this.$emit("selected-command", r);
1507
+ }
1508
+ }));
1472
1509
  }
1473
- return e.push(gt), e.push(Ee.configure({
1510
+ return e.push(gt), e.push(Te.configure({
1474
1511
  types: ["paragraph"]
1475
1512
  })), this.allowCode && e.push(ue), this.allowCodeblock && e.push(de.extend({
1476
1513
  renderText({ node: n }) {
@@ -1482,7 +1519,7 @@ ${n.textContent}
1482
1519
  HTMLAttributes: {
1483
1520
  class: "d-rich-text-editor__code-block"
1484
1521
  }
1485
- })), this.allowInlineImages && e.push(St), (this.allowFontFamily || this.allowFontColor) && (e.push(Te), this.allowFontColor && e.push(Re), this.allowFontFamily && e.push(Le)), this.additionalExtensions.length && e.push(...this.additionalExtensions), e;
1522
+ })), this.allowInlineImages && e.push(Et), (this.allowFontFamily || this.allowFontColor) && (e.push(Se), this.allowFontColor && e.push(Le), this.allowFontFamily && e.push(ve)), this.additionalExtensions.length && e.push(...this.additionalExtensions), e;
1486
1523
  },
1487
1524
  inputAttrs() {
1488
1525
  const e = {
@@ -1522,7 +1559,7 @@ ${n.textContent}
1522
1559
  this.destroyEditor();
1523
1560
  },
1524
1561
  mounted() {
1525
- Ue(V(this.$el), this.$options.name), this.processValue(this.modelValue, !1);
1562
+ Ue(F(this.$el), this.$options.name), this.processValue(this.modelValue, !1);
1526
1563
  },
1527
1564
  methods: {
1528
1565
  createEditor() {
@@ -1531,23 +1568,17 @@ ${n.textContent}
1531
1568
  content: this.modelValue,
1532
1569
  editable: this.editable,
1533
1570
  extensions: this.extensions,
1571
+ parseOptions: {
1572
+ preserveWhitespace: "full"
1573
+ },
1534
1574
  editorProps: {
1535
1575
  attributes: {
1536
1576
  ...this.inputAttrs,
1537
1577
  class: this.inputClass
1538
1578
  },
1539
- handlePaste: (e, t) => {
1540
- if (!this.link && !this.customLink) {
1541
- const o = /^https?:\/\//;
1542
- if (!(t != null && t.clipboardData))
1543
- return !1;
1544
- const n = t.clipboardData.getData("text");
1545
- if (!o.test(n) || !t.clipboardData.getData("text/html"))
1546
- return !1;
1547
- const i = n.replace(/\n/g, "<br>").replace(/ {2}/g, "&nbsp;&nbsp;");
1548
- return this.editor.chain().focus().insertContent(i).run(), !0;
1549
- }
1550
- return !1;
1579
+ handlePaste: (e, t, o) => {
1580
+ const n = t.clipboardData || window.clipboardData, r = n.getData("text/plain"), i = n.getData("text/html");
1581
+ return this.processPasteData(e, r, i);
1551
1582
  },
1552
1583
  // Moves the <br /> tags inside the previous closing tag to avoid
1553
1584
  // Prosemirror wrapping them within another </p> tag.
@@ -1557,7 +1588,7 @@ ${n.textContent}
1557
1588
  }
1558
1589
  }), this.addEditorListeners();
1559
1590
  },
1560
- bubbleMenuShouldShow({ editor: e, view: t, state: o, oldState: n, from: i, to: r }) {
1591
+ bubbleMenuShouldShow({ editor: e, view: t, state: o, oldState: n, from: r, to: i }) {
1561
1592
  return e.isActive("link");
1562
1593
  },
1563
1594
  /**
@@ -1567,8 +1598,8 @@ ${n.textContent}
1567
1598
  */
1568
1599
  getSelectedLinkText(e) {
1569
1600
  var a, c, h;
1570
- const { view: t, state: o } = e, { from: n, to: i } = t.state.selection, r = o.doc.textBetween(n, i, ""), s = this.editor.state.doc.nodeAt(n);
1571
- return s && ((h = (c = (a = s.marks) == null ? void 0 : a.at(0)) == null ? void 0 : c.type) == null ? void 0 : h.name) === "link" ? s.textContent : r;
1601
+ const { view: t, state: o } = e, { from: n, to: r } = t.state.selection, i = o.doc.textBetween(n, r, ""), s = this.editor.state.doc.nodeAt(n);
1602
+ return s && ((h = (c = (a = s.marks) == null ? void 0 : a.at(0)) == null ? void 0 : c.type) == null ? void 0 : h.name) === "link" ? s.textContent : i;
1572
1603
  },
1573
1604
  editLink() {
1574
1605
  const e = this.getSelectedLinkText(this.editor), t = {
@@ -1588,13 +1619,13 @@ ${n.textContent}
1588
1619
  window.open(e, "_blank");
1589
1620
  },
1590
1621
  // eslint-disable-next-line complexity
1591
- setLink(e, t, o, n = K, i) {
1622
+ setLink(e, t, o, n = V, r) {
1592
1623
  var a, c, h;
1593
1624
  if (!e) {
1594
1625
  this.removeLink();
1595
1626
  return;
1596
1627
  }
1597
- n.find((w) => w.test(e)) || (e = `${i}${e}`), this.editor.chain().focus().extendMarkRange("link").run();
1628
+ n.find((y) => y.test(e)) || (e = `${r}${e}`), this.editor.chain().focus().extendMarkRange("link").run();
1598
1629
  const s = (h = (c = (a = this.editor) == null ? void 0 : a.view) == null ? void 0 : c.state) == null ? void 0 : h.selection;
1599
1630
  this.editor.chain().focus().insertContent(t).setTextSelection({ from: s.from, to: s.from + t.length }).setLink({ href: e, class: o.class }).run();
1600
1631
  },
@@ -1603,15 +1634,79 @@ ${n.textContent}
1603
1634
  const o = this.getOutput();
1604
1635
  if (!(t && Qe(e, o))) {
1605
1636
  if (typeof e == "string" && this.outputFormat === "text") {
1606
- const n = new RegExp(`(${z})`, "g");
1637
+ const n = new RegExp(`(${W})`, "g");
1607
1638
  e = e == null ? void 0 : e.replace(n, '<emoji-component code="$1"></emoji-component>');
1608
1639
  }
1609
- this.editor.commands.setContent(e, !1);
1640
+ this.editor.commands.setContent(e, !1, { preserveWhitespace: "full" });
1610
1641
  }
1611
1642
  },
1612
1643
  destroyEditor() {
1613
1644
  this.editor.destroy();
1614
1645
  },
1646
+ insertPlainTextWithHardBreaks(e, t) {
1647
+ const { tr: o } = e.state, { from: n, to: r } = e.state.selection;
1648
+ o.deleteRange(n, r);
1649
+ const i = t.split(/\r?\n/);
1650
+ let s = n;
1651
+ for (let a = 0; a < i.length; a++)
1652
+ a > 0 && (o.insert(s, e.state.schema.nodes.hardBreak.create()), s++), o.insertText(i[a], s), s += i[a].length;
1653
+ e.dispatch(o);
1654
+ },
1655
+ shouldPreserveLineBreaks(e, t) {
1656
+ return this.pasteRichText ? !t && e && this.hasBlankLines(e) : !!e;
1657
+ },
1658
+ processPasteData(e, t, o) {
1659
+ if (this.shouldPreserveLineBreaks(t, o))
1660
+ return this.insertPlainTextWithHardBreaks(e, t), !0;
1661
+ if (this.shouldHandlePreformattedHTML(o)) {
1662
+ const n = this.extractPreformattedText(o);
1663
+ if (n && n.includes(`
1664
+ `))
1665
+ return this.insertPlainTextWithHardBreaks(e, n), !0;
1666
+ }
1667
+ return !1;
1668
+ },
1669
+ shouldHandlePreformattedHTML(e) {
1670
+ return this.pasteRichText && e && this.containsPreformattedContent(e);
1671
+ },
1672
+ containsPreformattedContent(e) {
1673
+ const t = document.createElement("div");
1674
+ t.innerHTML = e;
1675
+ const o = t.querySelectorAll("*");
1676
+ for (const n of o)
1677
+ if (this.hasPreWhitespace(n) && this.hasLineBreaks(n))
1678
+ return !0;
1679
+ return !1;
1680
+ },
1681
+ hasPreWhitespace(e) {
1682
+ const t = e.getAttribute("style") || "", o = e.style.whiteSpace || "", n = o === "pre" || o === "pre-wrap", r = t.includes("white-space: pre");
1683
+ return n || r;
1684
+ },
1685
+ hasLineBreaks(e) {
1686
+ return e.textContent && e.textContent.includes(`
1687
+ `);
1688
+ },
1689
+ hasBlankLines(e) {
1690
+ return e.includes(`
1691
+
1692
+ `) || /\n\s*\n/.test(e);
1693
+ },
1694
+ extractPreformattedText(e) {
1695
+ const t = document.createElement("div");
1696
+ return t.innerHTML = e, this.walkAndExtractText(t);
1697
+ },
1698
+ walkAndExtractText(e) {
1699
+ let t = "";
1700
+ if (e.nodeType === Node.TEXT_NODE)
1701
+ t += e.textContent;
1702
+ else if (e.nodeType === Node.ELEMENT_NODE)
1703
+ if (this.hasPreWhitespace(e))
1704
+ t += e.textContent;
1705
+ else
1706
+ for (const o of e.childNodes)
1707
+ t += this.walkAndExtractText(o);
1708
+ return t;
1709
+ },
1615
1710
  triggerInputChangeEvents() {
1616
1711
  const e = this.getOutput();
1617
1712
  this.$emit("input", e), this.$emit("update:modelValue", e);
@@ -1633,7 +1728,7 @@ ${n.textContent}
1633
1728
  }), this.editor.on("update", () => {
1634
1729
  var e, t;
1635
1730
  if (this.preventTyping && ((t = (e = this.editor.view) == null ? void 0 : e.input) == null ? void 0 : t.lastKeyCode) !== 8) {
1636
- this.editor.commands.setContent(this.value, !1);
1731
+ this.editor.commands.setContent(this.modelValue, !1);
1637
1732
  return;
1638
1733
  }
1639
1734
  this.triggerInputChangeEvents();
@@ -1677,18 +1772,18 @@ ${n.textContent}
1677
1772
  }
1678
1773
  }
1679
1774
  }, sn = { class: "d-popover__dialog" };
1680
- function an(e, t, o, n, i, r) {
1775
+ function an(e, t, o, n, r, i) {
1681
1776
  const s = d("dt-button"), a = d("dt-stack"), c = d("bubble-menu"), h = d("editor-content");
1682
1777
  return l(), _("div", null, [
1683
- i.editor && o.link && !o.hideLinkBubbleMenu ? (l(), m(c, {
1778
+ r.editor && o.link && !o.hideLinkBubbleMenu ? (l(), m(c, {
1684
1779
  key: 0,
1685
- editor: i.editor,
1686
- "should-show": r.bubbleMenuShouldShow,
1687
- "tippy-options": i.tippyOptions,
1780
+ editor: r.editor,
1781
+ "should-show": i.bubbleMenuShouldShow,
1782
+ "tippy-options": r.tippyOptions,
1688
1783
  style: { visibility: "visible" }
1689
1784
  }, {
1690
1785
  default: u(() => [
1691
- y("div", sn, [
1786
+ w("div", sn, [
1692
1787
  f(a, {
1693
1788
  direction: "row",
1694
1789
  class: "d-rich-text-editor-bubble-menu__button-stack",
@@ -1698,7 +1793,7 @@ function an(e, t, o, n, i, r) {
1698
1793
  f(s, {
1699
1794
  kind: "muted",
1700
1795
  importance: "clear",
1701
- onClick: r.editLink
1796
+ onClick: i.editLink
1702
1797
  }, {
1703
1798
  default: u(() => [
1704
1799
  k(" Edit ")
@@ -1708,7 +1803,7 @@ function an(e, t, o, n, i, r) {
1708
1803
  f(s, {
1709
1804
  kind: "muted",
1710
1805
  importance: "clear",
1711
- onClick: r.openLink
1806
+ onClick: i.openLink
1712
1807
  }, {
1713
1808
  default: u(() => [
1714
1809
  k(" Open link ")
@@ -1718,7 +1813,7 @@ function an(e, t, o, n, i, r) {
1718
1813
  f(s, {
1719
1814
  kind: "danger",
1720
1815
  importance: "clear",
1721
- onClick: r.removeLink
1816
+ onClick: i.removeLink
1722
1817
  }, {
1723
1818
  default: u(() => [
1724
1819
  k(" Remove ")
@@ -1731,13 +1826,13 @@ function an(e, t, o, n, i, r) {
1731
1826
  ])
1732
1827
  ]),
1733
1828
  _: 1
1734
- }, 8, ["editor", "should-show", "tippy-options"])) : b("", !0),
1735
- f(h, Be({
1829
+ }, 8, ["editor", "should-show", "tippy-options"])) : x("", !0),
1830
+ f(h, De({
1736
1831
  ref: "editor",
1737
- editor: i.editor,
1832
+ editor: r.editor,
1738
1833
  class: "d-rich-text-editor",
1739
1834
  "data-qa": "dt-rich-text-editor"
1740
- }, r.attrs), null, 16, ["editor"])
1835
+ }, i.attrs), null, 16, ["editor"])
1741
1836
  ]);
1742
1837
  }
1743
1838
  const Qn = /* @__PURE__ */ g(rn, [["render", an]]);