@dialpad/dialtone-vue 3.126.0 → 3.128.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.
Files changed (195) hide show
  1. package/dist/chunks/index-GVD15GIB.js +175 -0
  2. package/dist/chunks/index-GVD15GIB.js.map +1 -0
  3. package/dist/chunks/index-lu2o2f4r.js +169 -0
  4. package/dist/chunks/index-lu2o2f4r.js.map +1 -0
  5. package/dist/chunks/link_constants-AfTWrr-n.js +35 -0
  6. package/dist/chunks/link_constants-AfTWrr-n.js.map +1 -0
  7. package/dist/chunks/link_constants-x8NwdqmA.js +34 -0
  8. package/dist/chunks/link_constants-x8NwdqmA.js.map +1 -0
  9. package/dist/common/emoji.cjs +40 -163
  10. package/dist/common/emoji.cjs.map +1 -1
  11. package/dist/common/emoji.js +3 -146
  12. package/dist/common/emoji.js.map +1 -1
  13. package/dist/component-documentation.json +1 -1
  14. package/dist/dialtone-vue.cjs +10 -3
  15. package/dist/dialtone-vue.cjs.map +1 -1
  16. package/dist/dialtone-vue.js +10 -3
  17. package/dist/dialtone-vue.js.map +1 -1
  18. package/dist/lib/attachment-carousel.cjs +1 -1
  19. package/dist/lib/attachment-carousel.js +1 -1
  20. package/dist/lib/avatar.cjs.map +1 -1
  21. package/dist/lib/avatar.js.map +1 -1
  22. package/dist/lib/badge.cjs +21 -1
  23. package/dist/lib/badge.cjs.map +1 -1
  24. package/dist/lib/badge.js +21 -1
  25. package/dist/lib/badge.js.map +1 -1
  26. package/dist/lib/banner.cjs +1 -1
  27. package/dist/lib/banner.js +1 -1
  28. package/dist/lib/breadcrumbs.cjs +7 -3
  29. package/dist/lib/breadcrumbs.cjs.map +1 -1
  30. package/dist/lib/breadcrumbs.js +7 -3
  31. package/dist/lib/breadcrumbs.js.map +1 -1
  32. package/dist/lib/button.cjs +1 -1
  33. package/dist/lib/button.js +1 -1
  34. package/dist/lib/callbar-button-with-popover.cjs +1 -1
  35. package/dist/lib/callbar-button-with-popover.js +1 -1
  36. package/dist/lib/callbar-button.cjs +2 -2
  37. package/dist/lib/callbar-button.cjs.map +1 -1
  38. package/dist/lib/callbar-button.js +2 -2
  39. package/dist/lib/callbar-button.js.map +1 -1
  40. package/dist/lib/chip.cjs +1 -1
  41. package/dist/lib/chip.js +1 -1
  42. package/dist/lib/collapsible.cjs +1 -1
  43. package/dist/lib/collapsible.js +1 -1
  44. package/dist/lib/combobox-multi-select.cjs +1 -1
  45. package/dist/lib/combobox-multi-select.js +1 -1
  46. package/dist/lib/combobox-with-popover.cjs +1 -1
  47. package/dist/lib/combobox-with-popover.js +1 -1
  48. package/dist/lib/contact-centers-row.cjs +2 -3
  49. package/dist/lib/contact-centers-row.cjs.map +1 -1
  50. package/dist/lib/contact-centers-row.js +2 -3
  51. package/dist/lib/contact-centers-row.js.map +1 -1
  52. package/dist/lib/contact-row.cjs +2 -3
  53. package/dist/lib/contact-row.cjs.map +1 -1
  54. package/dist/lib/contact-row.js +2 -3
  55. package/dist/lib/contact-row.js.map +1 -1
  56. package/dist/lib/datepicker.cjs +1 -1
  57. package/dist/lib/datepicker.js +1 -1
  58. package/dist/lib/dropdown.cjs +1 -1
  59. package/dist/lib/dropdown.js +1 -1
  60. package/dist/lib/editor.cjs +3 -4
  61. package/dist/lib/editor.cjs.map +1 -1
  62. package/dist/lib/editor.js +3 -4
  63. package/dist/lib/editor.js.map +1 -1
  64. package/dist/lib/emoji-picker.cjs +1 -1
  65. package/dist/lib/emoji-picker.js +1 -1
  66. package/dist/lib/emoji-row.cjs +2 -3
  67. package/dist/lib/emoji-row.cjs.map +1 -1
  68. package/dist/lib/emoji-row.js +2 -3
  69. package/dist/lib/emoji-row.js.map +1 -1
  70. package/dist/lib/emoji-text-wrapper.cjs +1 -2
  71. package/dist/lib/emoji-text-wrapper.cjs.map +1 -1
  72. package/dist/lib/emoji-text-wrapper.js +1 -2
  73. package/dist/lib/emoji-text-wrapper.js.map +1 -1
  74. package/dist/lib/emoji.cjs +1 -2
  75. package/dist/lib/emoji.cjs.map +1 -1
  76. package/dist/lib/emoji.js +1 -2
  77. package/dist/lib/emoji.js.map +1 -1
  78. package/dist/lib/empty-state.cjs +136 -0
  79. package/dist/lib/empty-state.cjs.map +1 -0
  80. package/dist/lib/empty-state.js +136 -0
  81. package/dist/lib/empty-state.js.map +1 -0
  82. package/dist/lib/feed-pill.cjs +1 -1
  83. package/dist/lib/feed-pill.js +1 -1
  84. package/dist/lib/general-row.cjs +4 -5
  85. package/dist/lib/general-row.cjs.map +1 -1
  86. package/dist/lib/general-row.js +4 -5
  87. package/dist/lib/general-row.js.map +1 -1
  88. package/dist/lib/group-row.cjs +2 -3
  89. package/dist/lib/group-row.cjs.map +1 -1
  90. package/dist/lib/group-row.js +2 -3
  91. package/dist/lib/group-row.js.map +1 -1
  92. package/dist/lib/grouped-chip.cjs +1 -1
  93. package/dist/lib/grouped-chip.js +1 -1
  94. package/dist/lib/hovercard.cjs +1 -1
  95. package/dist/lib/hovercard.js +1 -1
  96. package/dist/lib/illustration.cjs +32 -0
  97. package/dist/lib/illustration.cjs.map +1 -0
  98. package/dist/lib/illustration.js +32 -0
  99. package/dist/lib/illustration.js.map +1 -0
  100. package/dist/lib/image-viewer.cjs +1 -1
  101. package/dist/lib/image-viewer.js +1 -1
  102. package/dist/lib/ivr-node.cjs +1 -1
  103. package/dist/lib/ivr-node.js +1 -1
  104. package/dist/lib/link.cjs +20 -6
  105. package/dist/lib/link.cjs.map +1 -1
  106. package/dist/lib/link.js +20 -6
  107. package/dist/lib/link.js.map +1 -1
  108. package/dist/lib/message-input.cjs +15 -8
  109. package/dist/lib/message-input.cjs.map +1 -1
  110. package/dist/lib/message-input.js +15 -8
  111. package/dist/lib/message-input.js.map +1 -1
  112. package/dist/lib/modal.cjs +1 -1
  113. package/dist/lib/modal.js +1 -1
  114. package/dist/lib/notice.cjs +1 -1
  115. package/dist/lib/notice.js +1 -1
  116. package/dist/lib/pagination.cjs +1 -1
  117. package/dist/lib/pagination.js +1 -1
  118. package/dist/lib/popover.cjs +1 -1
  119. package/dist/lib/popover.js +1 -1
  120. package/dist/lib/rich-text-editor.cjs +64 -197
  121. package/dist/lib/rich-text-editor.cjs.map +1 -1
  122. package/dist/lib/rich-text-editor.js +64 -197
  123. package/dist/lib/rich-text-editor.js.map +1 -1
  124. package/dist/lib/settings-menu-button.cjs +1 -1
  125. package/dist/lib/settings-menu-button.js +1 -1
  126. package/dist/lib/tabs.cjs +1 -1
  127. package/dist/lib/tabs.js +1 -1
  128. package/dist/lib/toast.cjs +1 -1
  129. package/dist/lib/toast.js +1 -1
  130. package/dist/lib/tooltip.cjs +13 -16
  131. package/dist/lib/tooltip.cjs.map +1 -1
  132. package/dist/lib/tooltip.js +14 -17
  133. package/dist/lib/tooltip.js.map +1 -1
  134. package/dist/style.css +15 -11
  135. package/dist/types/common/emoji/index.d.ts +1 -0
  136. package/dist/types/common/emoji/index.d.ts.map +1 -1
  137. package/dist/types/common/storybook_utils.d.ts +6 -0
  138. package/dist/types/common/storybook_utils.d.ts.map +1 -1
  139. package/dist/types/components/badge/badge.vue.d.ts +32 -0
  140. package/dist/types/components/badge/badge.vue.d.ts.map +1 -1
  141. package/dist/types/components/breadcrumbs/breadcrumb_item.vue.d.ts +2 -1
  142. package/dist/types/components/breadcrumbs/breadcrumb_item.vue.d.ts.map +1 -1
  143. package/dist/types/components/empty_state/empty_state.vue.d.ts +12 -0
  144. package/dist/types/components/empty_state/empty_state.vue.d.ts.map +1 -0
  145. package/dist/types/components/empty_state/empty_state_constants.d.ts +10 -0
  146. package/dist/types/components/empty_state/empty_state_constants.d.ts.map +1 -0
  147. package/dist/types/components/empty_state/index.d.ts +3 -0
  148. package/dist/types/components/empty_state/index.d.ts.map +1 -0
  149. package/dist/types/components/illustration/illustration.vue.d.ts +8 -0
  150. package/dist/types/components/illustration/illustration.vue.d.ts.map +1 -0
  151. package/dist/types/components/illustration/illustration_constants.d.ts +6 -0
  152. package/dist/types/components/illustration/illustration_constants.d.ts.map +1 -0
  153. package/dist/types/components/illustration/index.d.ts +3 -0
  154. package/dist/types/components/illustration/index.d.ts.map +1 -0
  155. package/dist/types/components/link/link.vue.d.ts +24 -4
  156. package/dist/types/components/link/link.vue.d.ts.map +1 -1
  157. package/dist/types/components/link/link_constants.d.ts +2 -2
  158. package/dist/types/components/link/link_constants.d.ts.map +1 -1
  159. package/dist/types/components/rich_text_editor/extensions/channels/channel.d.ts +0 -1
  160. package/dist/types/components/rich_text_editor/extensions/channels/channel.d.ts.map +1 -1
  161. package/dist/types/components/rich_text_editor/extensions/custom_link/autolink.d.ts.map +1 -0
  162. package/dist/types/components/rich_text_editor/extensions/custom_link/custom_link.d.ts +3 -0
  163. package/dist/types/components/rich_text_editor/extensions/custom_link/custom_link.d.ts.map +1 -0
  164. package/dist/types/components/rich_text_editor/extensions/custom_link/index.d.ts +3 -0
  165. package/dist/types/components/rich_text_editor/extensions/custom_link/index.d.ts.map +1 -0
  166. package/dist/types/components/rich_text_editor/extensions/custom_link/utils.d.ts.map +1 -0
  167. package/dist/types/components/rich_text_editor/extensions/emoji/emoji.d.ts.map +1 -1
  168. package/dist/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts +0 -1
  169. package/dist/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts.map +1 -1
  170. package/dist/types/components/rich_text_editor/extensions/mentions/mention.d.ts +0 -1
  171. package/dist/types/components/rich_text_editor/extensions/mentions/mention.d.ts.map +1 -1
  172. package/dist/types/components/rich_text_editor/mention_suggestion.d.ts +2 -2
  173. package/dist/types/components/rich_text_editor/mention_suggestion.d.ts.map +1 -1
  174. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +52 -12
  175. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  176. package/dist/types/components/toggle/toggle.vue.d.ts +1 -1
  177. package/dist/types/components/tooltip/tooltip.vue.d.ts +3 -4
  178. package/dist/types/components/tooltip/tooltip.vue.d.ts.map +1 -1
  179. package/dist/types/index.d.ts +2 -0
  180. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +15 -0
  181. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  182. package/dist/types/recipes/leftbar/general_row/general_row_constants.d.ts +1 -1
  183. package/package.json +6 -6
  184. package/dist/chunks/link_constants-Huj7D_hm.js +0 -22
  185. package/dist/chunks/link_constants-Huj7D_hm.js.map +0 -1
  186. package/dist/chunks/link_constants-nWVlXQBs.js +0 -23
  187. package/dist/chunks/link_constants-nWVlXQBs.js.map +0 -1
  188. package/dist/types/components/rich_text_editor/extensions/link/autolink.d.ts.map +0 -1
  189. package/dist/types/components/rich_text_editor/extensions/link/index.d.ts +0 -4
  190. package/dist/types/components/rich_text_editor/extensions/link/index.d.ts.map +0 -1
  191. package/dist/types/components/rich_text_editor/extensions/link/link.d.ts +0 -3
  192. package/dist/types/components/rich_text_editor/extensions/link/link.d.ts.map +0 -1
  193. package/dist/types/components/rich_text_editor/extensions/link/utils.d.ts.map +0 -1
  194. /package/dist/types/components/rich_text_editor/extensions/{link → custom_link}/autolink.d.ts +0 -0
  195. /package/dist/types/components/rich_text_editor/extensions/{link → custom_link}/utils.d.ts +0 -0
@@ -19,7 +19,7 @@ import { Node, mergeAttributes, nodeInputRule, nodePasteRule, getMarksBetween, c
19
19
  import { resolveComponent, openBlock, createBlock, withCtx, createVNode, createElementBlock, withDirectives, createElementVNode, Fragment, renderList, normalizeClass, withModifiers, resolveDynamicComponent, vShow, createTextVNode, toDisplayString, markRaw, createCommentVNode } from "vue";
20
20
  import { _export_sfc } from "../chunks/_plugin-vue_export-helper-caHeSgYY.js";
21
21
  import { DtEmoji } from "./emoji.js";
22
- import { codeToEmojiData, emojiShortCodeRegex } from "../common/emoji.js";
22
+ import { codeToEmojiData, emojiRegex, emojiPattern, emojiShortCodeRegex } from "../chunks/index-GVD15GIB.js";
23
23
  import { PluginKey, Plugin } from "@tiptap/pm/state";
24
24
  import Suggestion from "@tiptap/suggestion";
25
25
  import { emojisIndexed } from "@dialpad/dialtone-emojis";
@@ -32,7 +32,6 @@ import { DtLink } from "./link.js";
32
32
  import { DtAvatar } from "./avatar.js";
33
33
  import DtIconHash from "@dialpad/dialtone-icons/vue3/hash";
34
34
  import DtIconLock from "@dialpad/dialtone-icons/vue3/lock";
35
- import emojiRegex from "emoji-regex";
36
35
  import "./skeleton.js";
37
36
  import "../chunks/icon_constants-Dy4MEUJL.js";
38
37
  import "@dialpad/dialtone-icons/icons.json";
@@ -42,7 +41,7 @@ import "./icon.js";
42
41
  import "@dialpad/dialtone-icons/vue3";
43
42
  import "../chunks/stack_constants-HraCekPm.js";
44
43
  import "../common/constants.js";
45
- import "../chunks/link_constants-nWVlXQBs.js";
44
+ import "../chunks/link_constants-AfTWrr-n.js";
46
45
  import "./presence.js";
47
46
  const _sfc_main$9 = {
48
47
  name: "EmojiComponent",
@@ -232,7 +231,7 @@ const suggestionOptions = {
232
231
  return false;
233
232
  });
234
233
  return filteredEmoji.map((item) => {
235
- return { id: item.unicode_character, code: item.shortname };
234
+ return { code: item.shortname };
236
235
  });
237
236
  },
238
237
  command: ({ editor, range, props }) => {
@@ -278,7 +277,6 @@ const suggestionOptions = {
278
277
  interactive: true,
279
278
  trigger: "manual",
280
279
  placement: "top-start",
281
- contentElement: null,
282
280
  zIndex: 650
283
281
  });
284
282
  },
@@ -308,8 +306,7 @@ const suggestionOptions = {
308
306
  };
309
307
  const EmojiPluginKey = new PluginKey("emoji");
310
308
  const inputShortCodeRegex = new RegExp("(^| |(?<=:))(:\\w+:)$");
311
- const inputUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/;
312
- const pasteUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g;
309
+ const inputUnicodeRegex = new RegExp(emojiPattern + "$");
313
310
  const inputRuleMatch = (match) => {
314
311
  if (match && codeToEmojiData(match[0])) {
315
312
  const text = match[2] || match[0];
@@ -349,9 +346,6 @@ const Emoji = Node.create({
349
346
  return {
350
347
  code: {
351
348
  default: null
352
- },
353
- id: {
354
- default: null
355
349
  }
356
350
  };
357
351
  },
@@ -394,11 +388,9 @@ const Emoji = Node.create({
394
388
  },
395
389
  type: this.type,
396
390
  getAttributes(attrs) {
397
- const unicode = codeToEmojiData(attrs[0]).unicode_output;
398
- const emoji = String.fromCodePoint(parseInt(unicode, 16));
391
+ const emoji = codeToEmojiData(attrs[0]).shortname;
399
392
  return {
400
- code: emoji,
401
- label: "emoji"
393
+ code: emoji
402
394
  };
403
395
  }
404
396
  })
@@ -416,7 +408,7 @@ const Emoji = Node.create({
416
408
  }
417
409
  }),
418
410
  nodePasteRule({
419
- find: pasteUnicodeRegex,
411
+ find: emojiRegex,
420
412
  type: this.type,
421
413
  getAttributes(attrs) {
422
414
  return {
@@ -575,8 +567,8 @@ const defaultAttributes = {
575
567
  class: "d-link d-c-text d-d-inline-block d-wb-break-all",
576
568
  rel: "noopener noreferrer nofollow"
577
569
  };
578
- const Link = Mark.create({
579
- name: "Link",
570
+ const CustomLink = Mark.create({
571
+ name: "CustomLink",
580
572
  renderHTML({ HTMLAttributes }) {
581
573
  return [
582
574
  "a",
@@ -626,30 +618,6 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
626
618
  });
627
619
  }
628
620
  const MentionComponent = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
629
- const mentionRegex = /@([\w.-]+)[^\w.-]?/g;
630
- const mentionPasteMatch = (text, suggestions) => {
631
- const matches = [...text.matchAll(mentionRegex)];
632
- return matches.filter((match) => suggestions.some(({ id }) => id === match[1].trim())).map((match) => {
633
- let mention = match[1];
634
- if (!mention.endsWith(" "))
635
- mention += " ";
636
- return {
637
- index: match.index,
638
- text: mention,
639
- match
640
- };
641
- });
642
- };
643
- const mentionInputMatch = (text, suggestions) => {
644
- const match = text.match(/@([\w.-]+)[^\w.-]$/);
645
- if (!match || !suggestions.some(({ id }) => id === match[1]))
646
- return;
647
- return {
648
- index: match.index,
649
- text: match[0],
650
- match
651
- };
652
- };
653
621
  const MentionPlugin = Mention.extend({
654
622
  addNodeView() {
655
623
  return VueNodeViewRenderer(MentionComponent);
@@ -678,33 +646,7 @@ const MentionPlugin = Mention.extend({
678
646
  return `@${node.attrs.id}`;
679
647
  },
680
648
  renderHTML({ HTMLAttributes }) {
681
- return ["mention-component", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
682
- },
683
- addInputRules() {
684
- var _a;
685
- const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
686
- return [
687
- nodeInputRule({
688
- find: (text) => mentionInputMatch(text, suggestions),
689
- type: this.type,
690
- getAttributes(attrs) {
691
- return suggestions.find(({ id }) => id === attrs[0].replace("@", "").trim());
692
- }
693
- })
694
- ];
695
- },
696
- addPasteRules() {
697
- var _a;
698
- const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
699
- return [
700
- nodePasteRule({
701
- find: (text) => mentionPasteMatch(text, suggestions),
702
- type: this.type,
703
- getAttributes(attrs) {
704
- return suggestions.find(({ id }) => id === attrs[0].trim());
705
- }
706
- })
707
- ];
649
+ return ["mention-component", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
708
650
  }
709
651
  }).configure({
710
652
  suggestion: {
@@ -741,34 +683,8 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
741
683
  });
742
684
  }
743
685
  const ChannelComponent = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
744
- const channelRegex = /#([\w-]+)[^\w-]?/g;
745
- const channelPasteMatch = (text, suggestions) => {
746
- const matches = [...text.matchAll(channelRegex)];
747
- return matches.filter((match) => suggestions.some(({ id }) => id === match[1].trim())).map((match) => {
748
- let channel = match[1];
749
- if (!channel.endsWith(" "))
750
- channel += " ";
751
- return {
752
- index: match.index,
753
- text: channel,
754
- match
755
- };
756
- });
757
- };
758
- const channelInputMatch = (text, suggestions) => {
759
- const match = text.match(/#([\w-]+)[^\w-]$/);
760
- if (!match || !suggestions.some(({ id }) => id === match[1]))
761
- return;
762
- return {
763
- index: match.index,
764
- text: match[0],
765
- match
766
- };
767
- };
768
686
  const ChannelPlugin = Mention.extend({
769
687
  name: "channel",
770
- group: "inline",
771
- inline: true,
772
688
  addNodeView() {
773
689
  return VueNodeViewRenderer(ChannelComponent);
774
690
  },
@@ -796,33 +712,7 @@ const ChannelPlugin = Mention.extend({
796
712
  return `#${node.attrs.id}`;
797
713
  },
798
714
  renderHTML({ HTMLAttributes }) {
799
- return ["channel-component", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
800
- },
801
- addInputRules() {
802
- var _a;
803
- const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
804
- return [
805
- nodeInputRule({
806
- find: (text) => channelInputMatch(text, suggestions),
807
- type: this.type,
808
- getAttributes(attrs) {
809
- return suggestions.find(({ id }) => id === attrs[0].replace("#", "").trim());
810
- }
811
- })
812
- ];
813
- },
814
- addPasteRules() {
815
- var _a;
816
- const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
817
- return [
818
- nodePasteRule({
819
- find: (text) => channelPasteMatch(text, suggestions),
820
- type: this.type,
821
- getAttributes(attrs) {
822
- return suggestions.find(({ id }) => id === attrs[0].trim());
823
- }
824
- })
825
- ];
715
+ return ["channel-component", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
826
716
  }
827
717
  }).configure({
828
718
  suggestion: {
@@ -1306,7 +1196,7 @@ const _sfc_main = {
1306
1196
  */
1307
1197
  outputFormat: {
1308
1198
  type: String,
1309
- default: "text",
1199
+ default: "html",
1310
1200
  validator(outputFormat) {
1311
1201
  return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);
1312
1202
  }
@@ -1319,12 +1209,29 @@ const _sfc_main = {
1319
1209
  default: ""
1320
1210
  },
1321
1211
  /**
1322
- * Enables the Link extension and optionally passes configurations to it
1212
+ * Enables the TipTap Link extension and optionally passes configurations to it
1213
+ *
1214
+ * It is not recommended to use this and the custom link extension at the same time.
1323
1215
  */
1324
1216
  link: {
1325
1217
  type: [Boolean, Object],
1326
1218
  default: false
1327
1219
  },
1220
+ /**
1221
+ * Enables the Custom Link extension and optionally passes configurations to it
1222
+ *
1223
+ * It is not recommended to use this and the built in TipTap link extension at the same time.
1224
+ *
1225
+ * The custom link does some additional things on top of the built in TipTap link
1226
+ * extension such as styling phone numbers and IP adresses as links, and allows you
1227
+ * to linkify text without having to type a space after the link. Currently it is missing some
1228
+ * functionality such as editing links and will likely require more work to be fully usable,
1229
+ * so it is recommended to use the built in TipTap link for now.
1230
+ */
1231
+ customLink: {
1232
+ type: [Boolean, Object],
1233
+ default: false
1234
+ },
1328
1235
  /**
1329
1236
  * suggestion object containing the items query function.
1330
1237
  * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion
@@ -1413,6 +1320,13 @@ const _sfc_main = {
1413
1320
  allowUnderline: {
1414
1321
  type: Boolean,
1415
1322
  default: true
1323
+ },
1324
+ /**
1325
+ * Whether the input allows codeblock to be introduced in the text.
1326
+ */
1327
+ allowCodeblock: {
1328
+ type: Boolean,
1329
+ default: true
1416
1330
  }
1417
1331
  },
1418
1332
  emits: [
@@ -1460,7 +1374,16 @@ const _sfc_main = {
1460
1374
  extensions() {
1461
1375
  const extensions = [Document, Paragraph, Text];
1462
1376
  if (this.link) {
1463
- extensions.push(this.getExtension(Link, this.link));
1377
+ extensions.push(TipTapLink.extend({ inclusive: false }).configure({
1378
+ HTMLAttributes: {
1379
+ class: "d-link d-wb-break-all"
1380
+ },
1381
+ autolink: true,
1382
+ protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
1383
+ }));
1384
+ }
1385
+ if (this.customLink) {
1386
+ extensions.push(this.getExtension(CustomLink, this.customLink));
1464
1387
  }
1465
1388
  if (this.allowBlockquote) {
1466
1389
  extensions.push(Blockquote);
@@ -1471,9 +1394,7 @@ const _sfc_main = {
1471
1394
  if (this.allowBulletList) {
1472
1395
  extensions.push(BulletList);
1473
1396
  extensions.push(ListItem);
1474
- extensions.push(OrderedList.configure({
1475
- itemTypeName: "listItem"
1476
- }));
1397
+ extensions.push(OrderedList);
1477
1398
  }
1478
1399
  if (this.allowItalic) {
1479
1400
  extensions.push(Italic);
@@ -1484,10 +1405,13 @@ const _sfc_main = {
1484
1405
  if (this.allowUnderline) {
1485
1406
  extensions.push(Underline);
1486
1407
  }
1487
- extensions.push(
1488
- Placeholder.configure({ placeholder: this.placeholder })
1489
- );
1408
+ if (this.placeholder) {
1409
+ extensions.push(
1410
+ Placeholder.configure({ placeholder: this.placeholder })
1411
+ );
1412
+ }
1490
1413
  if (!this.allowLineBreaks) {
1414
+ const self = this;
1491
1415
  extensions.push(
1492
1416
  HardBreak.extend({
1493
1417
  addKeyboardShortcuts() {
@@ -1495,6 +1419,7 @@ const _sfc_main = {
1495
1419
  Enter: () => true,
1496
1420
  "Shift-Enter": () => this.editor.commands.first(({ commands }) => [
1497
1421
  () => commands.newlineInCode(),
1422
+ () => self.allowBulletList && commands.splitListItem("listItem"),
1498
1423
  () => commands.createParagraphNear(),
1499
1424
  () => commands.liftEmptyBlock(),
1500
1425
  () => commands.splitBlock()
@@ -1504,10 +1429,6 @@ const _sfc_main = {
1504
1429
  })
1505
1430
  );
1506
1431
  }
1507
- extensions.push(TipTapLink.extend({ inclusive: false }).configure({
1508
- autolink: true,
1509
- protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
1510
- }));
1511
1432
  if (this.mentionSuggestion) {
1512
1433
  const suggestionObject = { ...this.mentionSuggestion, ...mentionSuggestion };
1513
1434
  extensions.push(MentionPlugin.configure({ suggestion: suggestionObject }));
@@ -1525,11 +1446,13 @@ const _sfc_main = {
1525
1446
  types: ["paragraph"],
1526
1447
  defaultAlignment: "left"
1527
1448
  }));
1528
- extensions.push(CodeBlock.configure({
1529
- HTMLAttributes: {
1530
- class: "dt-rich-text-editor--code-block"
1531
- }
1532
- }));
1449
+ if (this.allowCodeblock) {
1450
+ extensions.push(CodeBlock.configure({
1451
+ HTMLAttributes: {
1452
+ class: "dt-rich-text-editor--code-block"
1453
+ }
1454
+ }));
1455
+ }
1533
1456
  return extensions;
1534
1457
  },
1535
1458
  inputAttrs() {
@@ -1573,8 +1496,7 @@ const _sfc_main = {
1573
1496
  if (newValue === currentValue) {
1574
1497
  return;
1575
1498
  }
1576
- this.internalValue = newValue;
1577
- this.insertContent();
1499
+ this.editor.commands.setContent(newValue, false);
1578
1500
  }
1579
1501
  },
1580
1502
  created() {
@@ -1590,6 +1512,7 @@ const _sfc_main = {
1590
1512
  createEditor() {
1591
1513
  this.editor = new Editor({
1592
1514
  autofocus: this.autoFocus,
1515
+ content: this.modelValue,
1593
1516
  editable: this.editable,
1594
1517
  extensions: this.extensions,
1595
1518
  editorProps: {
@@ -1599,64 +1522,8 @@ const _sfc_main = {
1599
1522
  }
1600
1523
  }
1601
1524
  });
1602
- this.insertContent();
1603
1525
  this.addEditorListeners();
1604
1526
  },
1605
- /**
1606
- * This function is necessary as tiptap doesn't render the content passed
1607
- * directly through `editor.commands.setContent` the content passed down to it
1608
- * should be already parsed. So We're parsing the elements into it's corresponding
1609
- * HTML version before setting it.
1610
- */
1611
- insertContent() {
1612
- this.parseMentions();
1613
- this.parseChannels();
1614
- this.parseEmojis();
1615
- this.editor.commands.setContent(this.internalValue, true);
1616
- },
1617
- parseEmojis() {
1618
- const matches = new Set(
1619
- [...this.modelValue.matchAll(emojiRegex()), ...this.modelValue.matchAll(emojiShortCodeRegex)].map((match) => match[0].trim())
1620
- );
1621
- if (!matches)
1622
- return;
1623
- matches.forEach((match) => {
1624
- const emoji = codeToEmojiData(match);
1625
- if (!emoji)
1626
- return;
1627
- this.internalValue = this.internalValue.replace(new RegExp(`${match}`, "g"), `<emoji-component code="${emoji.shortname}"></emoji-component>`);
1628
- });
1629
- },
1630
- parseChannels() {
1631
- if (!this.channelSuggestion)
1632
- return;
1633
- const suggestions = this.channelSuggestion.items({ query: "" });
1634
- const matches = [...this.modelValue.matchAll(channelRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
1635
- if (!matches)
1636
- return;
1637
- matches.forEach((match) => {
1638
- const channel = suggestions.find(({ id }) => id === match[1]);
1639
- this.internalValue = this.internalValue.replace(
1640
- `#${match[1]}`,
1641
- /** The space at the beginning is important as tiptap removes that while rendering.
1642
- * So if multiple mentions, channels or emojis are next to each other it will fail
1643
- */
1644
- ` <channel-component name="${channel.name}" id="${channel.id}"></channel-component>`
1645
- );
1646
- });
1647
- },
1648
- parseMentions() {
1649
- if (!this.mentionSuggestion)
1650
- return;
1651
- const suggestions = this.mentionSuggestion.items({ query: "" });
1652
- const matches = [...this.modelValue.matchAll(mentionRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
1653
- if (!matches)
1654
- return;
1655
- matches.forEach((match) => {
1656
- const mention = suggestions.find(({ id }) => id === match[1]);
1657
- this.internalValue = this.internalValue.replace(`@${match[1]}`, ` <mention-component name="${mention.name}" id="${mention.id}"></mention-component>`);
1658
- });
1659
- },
1660
1527
  destroyEditor() {
1661
1528
  this.editor.destroy();
1662
1529
  },