@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
@@ -21,7 +21,7 @@ const core = require("@tiptap/core");
21
21
  const vue = require("vue");
22
22
  const _pluginVue_exportHelper = require("../chunks/_plugin-vue_export-helper-fhnQq0tA.js");
23
23
  const lib_emoji = require("./emoji.cjs");
24
- const common_emoji = require("../common/emoji.cjs");
24
+ const common_emoji = require("../chunks/index-lu2o2f4r.js");
25
25
  const state = require("@tiptap/pm/state");
26
26
  const Suggestion = require("@tiptap/suggestion");
27
27
  const dialtoneEmojis = require("@dialpad/dialtone-emojis");
@@ -34,7 +34,6 @@ const lib_link = require("./link.cjs");
34
34
  const lib_avatar = require("./avatar.cjs");
35
35
  const DtIconHash = require("@dialpad/dialtone-icons/vue3/hash");
36
36
  const DtIconLock = require("@dialpad/dialtone-icons/vue3/lock");
37
- const emojiRegex = require("emoji-regex");
38
37
  require("./skeleton.cjs");
39
38
  require("../chunks/icon_constants-QYpmdE0R.js");
40
39
  require("@dialpad/dialtone-icons/icons.json");
@@ -44,7 +43,7 @@ require("./icon.cjs");
44
43
  require("@dialpad/dialtone-icons/vue3");
45
44
  require("../chunks/stack_constants-SMzMWnAQ.js");
46
45
  require("../common/constants.cjs");
47
- require("../chunks/link_constants-Huj7D_hm.js");
46
+ require("../chunks/link_constants-x8NwdqmA.js");
48
47
  require("./presence.cjs");
49
48
  const _sfc_main$9 = {
50
49
  name: "EmojiComponent",
@@ -234,7 +233,7 @@ const suggestionOptions = {
234
233
  return false;
235
234
  });
236
235
  return filteredEmoji.map((item) => {
237
- return { id: item.unicode_character, code: item.shortname };
236
+ return { code: item.shortname };
238
237
  });
239
238
  },
240
239
  command: ({ editor, range, props }) => {
@@ -280,7 +279,6 @@ const suggestionOptions = {
280
279
  interactive: true,
281
280
  trigger: "manual",
282
281
  placement: "top-start",
283
- contentElement: null,
284
282
  zIndex: 650
285
283
  });
286
284
  },
@@ -310,8 +308,7 @@ const suggestionOptions = {
310
308
  };
311
309
  const EmojiPluginKey = new state.PluginKey("emoji");
312
310
  const inputShortCodeRegex = new RegExp("(^| |(?<=:))(:\\w+:)$");
313
- const inputUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/;
314
- const pasteUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g;
311
+ const inputUnicodeRegex = new RegExp(common_emoji.emojiPattern + "$");
315
312
  const inputRuleMatch = (match) => {
316
313
  if (match && common_emoji.codeToEmojiData(match[0])) {
317
314
  const text = match[2] || match[0];
@@ -351,9 +348,6 @@ const Emoji = core.Node.create({
351
348
  return {
352
349
  code: {
353
350
  default: null
354
- },
355
- id: {
356
- default: null
357
351
  }
358
352
  };
359
353
  },
@@ -396,11 +390,9 @@ const Emoji = core.Node.create({
396
390
  },
397
391
  type: this.type,
398
392
  getAttributes(attrs) {
399
- const unicode = common_emoji.codeToEmojiData(attrs[0]).unicode_output;
400
- const emoji = String.fromCodePoint(parseInt(unicode, 16));
393
+ const emoji = common_emoji.codeToEmojiData(attrs[0]).shortname;
401
394
  return {
402
- code: emoji,
403
- label: "emoji"
395
+ code: emoji
404
396
  };
405
397
  }
406
398
  })
@@ -418,7 +410,7 @@ const Emoji = core.Node.create({
418
410
  }
419
411
  }),
420
412
  core.nodePasteRule({
421
- find: pasteUnicodeRegex,
413
+ find: common_emoji.emojiRegex,
422
414
  type: this.type,
423
415
  getAttributes(attrs) {
424
416
  return {
@@ -577,8 +569,8 @@ const defaultAttributes = {
577
569
  class: "d-link d-c-text d-d-inline-block d-wb-break-all",
578
570
  rel: "noopener noreferrer nofollow"
579
571
  };
580
- const Link = core.Mark.create({
581
- name: "Link",
572
+ const CustomLink = core.Mark.create({
573
+ name: "CustomLink",
582
574
  renderHTML({ HTMLAttributes }) {
583
575
  return [
584
576
  "a",
@@ -628,30 +620,6 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
628
620
  });
629
621
  }
630
622
  const MentionComponent = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
631
- const mentionRegex = /@([\w.-]+)[^\w.-]?/g;
632
- const mentionPasteMatch = (text, suggestions) => {
633
- const matches = [...text.matchAll(mentionRegex)];
634
- return matches.filter((match) => suggestions.some(({ id }) => id === match[1].trim())).map((match) => {
635
- let mention = match[1];
636
- if (!mention.endsWith(" "))
637
- mention += " ";
638
- return {
639
- index: match.index,
640
- text: mention,
641
- match
642
- };
643
- });
644
- };
645
- const mentionInputMatch = (text, suggestions) => {
646
- const match = text.match(/@([\w.-]+)[^\w.-]$/);
647
- if (!match || !suggestions.some(({ id }) => id === match[1]))
648
- return;
649
- return {
650
- index: match.index,
651
- text: match[0],
652
- match
653
- };
654
- };
655
623
  const MentionPlugin = Mention.extend({
656
624
  addNodeView() {
657
625
  return vue3.VueNodeViewRenderer(MentionComponent);
@@ -680,33 +648,7 @@ const MentionPlugin = Mention.extend({
680
648
  return `@${node.attrs.id}`;
681
649
  },
682
650
  renderHTML({ HTMLAttributes }) {
683
- return ["mention-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
684
- },
685
- addInputRules() {
686
- var _a;
687
- const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
688
- return [
689
- core.nodeInputRule({
690
- find: (text) => mentionInputMatch(text, suggestions),
691
- type: this.type,
692
- getAttributes(attrs) {
693
- return suggestions.find(({ id }) => id === attrs[0].replace("@", "").trim());
694
- }
695
- })
696
- ];
697
- },
698
- addPasteRules() {
699
- var _a;
700
- const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
701
- return [
702
- core.nodePasteRule({
703
- find: (text) => mentionPasteMatch(text, suggestions),
704
- type: this.type,
705
- getAttributes(attrs) {
706
- return suggestions.find(({ id }) => id === attrs[0].trim());
707
- }
708
- })
709
- ];
651
+ return ["mention-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
710
652
  }
711
653
  }).configure({
712
654
  suggestion: {
@@ -743,34 +685,8 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
743
685
  });
744
686
  }
745
687
  const ChannelComponent = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
746
- const channelRegex = /#([\w-]+)[^\w-]?/g;
747
- const channelPasteMatch = (text, suggestions) => {
748
- const matches = [...text.matchAll(channelRegex)];
749
- return matches.filter((match) => suggestions.some(({ id }) => id === match[1].trim())).map((match) => {
750
- let channel = match[1];
751
- if (!channel.endsWith(" "))
752
- channel += " ";
753
- return {
754
- index: match.index,
755
- text: channel,
756
- match
757
- };
758
- });
759
- };
760
- const channelInputMatch = (text, suggestions) => {
761
- const match = text.match(/#([\w-]+)[^\w-]$/);
762
- if (!match || !suggestions.some(({ id }) => id === match[1]))
763
- return;
764
- return {
765
- index: match.index,
766
- text: match[0],
767
- match
768
- };
769
- };
770
688
  const ChannelPlugin = Mention.extend({
771
689
  name: "channel",
772
- group: "inline",
773
- inline: true,
774
690
  addNodeView() {
775
691
  return vue3.VueNodeViewRenderer(ChannelComponent);
776
692
  },
@@ -798,33 +714,7 @@ const ChannelPlugin = Mention.extend({
798
714
  return `#${node.attrs.id}`;
799
715
  },
800
716
  renderHTML({ HTMLAttributes }) {
801
- return ["channel-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
802
- },
803
- addInputRules() {
804
- var _a;
805
- const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
806
- return [
807
- core.nodeInputRule({
808
- find: (text) => channelInputMatch(text, suggestions),
809
- type: this.type,
810
- getAttributes(attrs) {
811
- return suggestions.find(({ id }) => id === attrs[0].replace("#", "").trim());
812
- }
813
- })
814
- ];
815
- },
816
- addPasteRules() {
817
- var _a;
818
- const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
819
- return [
820
- core.nodePasteRule({
821
- find: (text) => channelPasteMatch(text, suggestions),
822
- type: this.type,
823
- getAttributes(attrs) {
824
- return suggestions.find(({ id }) => id === attrs[0].trim());
825
- }
826
- })
827
- ];
717
+ return ["channel-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
828
718
  }
829
719
  }).configure({
830
720
  suggestion: {
@@ -1308,7 +1198,7 @@ const _sfc_main = {
1308
1198
  */
1309
1199
  outputFormat: {
1310
1200
  type: String,
1311
- default: "text",
1201
+ default: "html",
1312
1202
  validator(outputFormat) {
1313
1203
  return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);
1314
1204
  }
@@ -1321,12 +1211,29 @@ const _sfc_main = {
1321
1211
  default: ""
1322
1212
  },
1323
1213
  /**
1324
- * Enables the Link extension and optionally passes configurations to it
1214
+ * Enables the TipTap Link extension and optionally passes configurations to it
1215
+ *
1216
+ * It is not recommended to use this and the custom link extension at the same time.
1325
1217
  */
1326
1218
  link: {
1327
1219
  type: [Boolean, Object],
1328
1220
  default: false
1329
1221
  },
1222
+ /**
1223
+ * Enables the Custom Link extension and optionally passes configurations to it
1224
+ *
1225
+ * It is not recommended to use this and the built in TipTap link extension at the same time.
1226
+ *
1227
+ * The custom link does some additional things on top of the built in TipTap link
1228
+ * extension such as styling phone numbers and IP adresses as links, and allows you
1229
+ * to linkify text without having to type a space after the link. Currently it is missing some
1230
+ * functionality such as editing links and will likely require more work to be fully usable,
1231
+ * so it is recommended to use the built in TipTap link for now.
1232
+ */
1233
+ customLink: {
1234
+ type: [Boolean, Object],
1235
+ default: false
1236
+ },
1330
1237
  /**
1331
1238
  * suggestion object containing the items query function.
1332
1239
  * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion
@@ -1415,6 +1322,13 @@ const _sfc_main = {
1415
1322
  allowUnderline: {
1416
1323
  type: Boolean,
1417
1324
  default: true
1325
+ },
1326
+ /**
1327
+ * Whether the input allows codeblock to be introduced in the text.
1328
+ */
1329
+ allowCodeblock: {
1330
+ type: Boolean,
1331
+ default: true
1418
1332
  }
1419
1333
  },
1420
1334
  emits: [
@@ -1462,7 +1376,16 @@ const _sfc_main = {
1462
1376
  extensions() {
1463
1377
  const extensions = [Document, Paragraph, Text];
1464
1378
  if (this.link) {
1465
- extensions.push(this.getExtension(Link, this.link));
1379
+ extensions.push(TipTapLink.extend({ inclusive: false }).configure({
1380
+ HTMLAttributes: {
1381
+ class: "d-link d-wb-break-all"
1382
+ },
1383
+ autolink: true,
1384
+ protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
1385
+ }));
1386
+ }
1387
+ if (this.customLink) {
1388
+ extensions.push(this.getExtension(CustomLink, this.customLink));
1466
1389
  }
1467
1390
  if (this.allowBlockquote) {
1468
1391
  extensions.push(Blockquote);
@@ -1473,9 +1396,7 @@ const _sfc_main = {
1473
1396
  if (this.allowBulletList) {
1474
1397
  extensions.push(BulletList);
1475
1398
  extensions.push(ListItem);
1476
- extensions.push(OrderedList.configure({
1477
- itemTypeName: "listItem"
1478
- }));
1399
+ extensions.push(OrderedList);
1479
1400
  }
1480
1401
  if (this.allowItalic) {
1481
1402
  extensions.push(Italic);
@@ -1486,10 +1407,13 @@ const _sfc_main = {
1486
1407
  if (this.allowUnderline) {
1487
1408
  extensions.push(Underline);
1488
1409
  }
1489
- extensions.push(
1490
- Placeholder.configure({ placeholder: this.placeholder })
1491
- );
1410
+ if (this.placeholder) {
1411
+ extensions.push(
1412
+ Placeholder.configure({ placeholder: this.placeholder })
1413
+ );
1414
+ }
1492
1415
  if (!this.allowLineBreaks) {
1416
+ const self = this;
1493
1417
  extensions.push(
1494
1418
  HardBreak.extend({
1495
1419
  addKeyboardShortcuts() {
@@ -1497,6 +1421,7 @@ const _sfc_main = {
1497
1421
  Enter: () => true,
1498
1422
  "Shift-Enter": () => this.editor.commands.first(({ commands }) => [
1499
1423
  () => commands.newlineInCode(),
1424
+ () => self.allowBulletList && commands.splitListItem("listItem"),
1500
1425
  () => commands.createParagraphNear(),
1501
1426
  () => commands.liftEmptyBlock(),
1502
1427
  () => commands.splitBlock()
@@ -1506,10 +1431,6 @@ const _sfc_main = {
1506
1431
  })
1507
1432
  );
1508
1433
  }
1509
- extensions.push(TipTapLink.extend({ inclusive: false }).configure({
1510
- autolink: true,
1511
- protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
1512
- }));
1513
1434
  if (this.mentionSuggestion) {
1514
1435
  const suggestionObject = { ...this.mentionSuggestion, ...mentionSuggestion };
1515
1436
  extensions.push(MentionPlugin.configure({ suggestion: suggestionObject }));
@@ -1527,11 +1448,13 @@ const _sfc_main = {
1527
1448
  types: ["paragraph"],
1528
1449
  defaultAlignment: "left"
1529
1450
  }));
1530
- extensions.push(CodeBlock.configure({
1531
- HTMLAttributes: {
1532
- class: "dt-rich-text-editor--code-block"
1533
- }
1534
- }));
1451
+ if (this.allowCodeblock) {
1452
+ extensions.push(CodeBlock.configure({
1453
+ HTMLAttributes: {
1454
+ class: "dt-rich-text-editor--code-block"
1455
+ }
1456
+ }));
1457
+ }
1535
1458
  return extensions;
1536
1459
  },
1537
1460
  inputAttrs() {
@@ -1575,8 +1498,7 @@ const _sfc_main = {
1575
1498
  if (newValue === currentValue) {
1576
1499
  return;
1577
1500
  }
1578
- this.internalValue = newValue;
1579
- this.insertContent();
1501
+ this.editor.commands.setContent(newValue, false);
1580
1502
  }
1581
1503
  },
1582
1504
  created() {
@@ -1592,6 +1514,7 @@ const _sfc_main = {
1592
1514
  createEditor() {
1593
1515
  this.editor = new vue3.Editor({
1594
1516
  autofocus: this.autoFocus,
1517
+ content: this.modelValue,
1595
1518
  editable: this.editable,
1596
1519
  extensions: this.extensions,
1597
1520
  editorProps: {
@@ -1601,64 +1524,8 @@ const _sfc_main = {
1601
1524
  }
1602
1525
  }
1603
1526
  });
1604
- this.insertContent();
1605
1527
  this.addEditorListeners();
1606
1528
  },
1607
- /**
1608
- * This function is necessary as tiptap doesn't render the content passed
1609
- * directly through `editor.commands.setContent` the content passed down to it
1610
- * should be already parsed. So We're parsing the elements into it's corresponding
1611
- * HTML version before setting it.
1612
- */
1613
- insertContent() {
1614
- this.parseMentions();
1615
- this.parseChannels();
1616
- this.parseEmojis();
1617
- this.editor.commands.setContent(this.internalValue, true);
1618
- },
1619
- parseEmojis() {
1620
- const matches = new Set(
1621
- [...this.modelValue.matchAll(emojiRegex()), ...this.modelValue.matchAll(common_emoji.emojiShortCodeRegex)].map((match) => match[0].trim())
1622
- );
1623
- if (!matches)
1624
- return;
1625
- matches.forEach((match) => {
1626
- const emoji = common_emoji.codeToEmojiData(match);
1627
- if (!emoji)
1628
- return;
1629
- this.internalValue = this.internalValue.replace(new RegExp(`${match}`, "g"), `<emoji-component code="${emoji.shortname}"></emoji-component>`);
1630
- });
1631
- },
1632
- parseChannels() {
1633
- if (!this.channelSuggestion)
1634
- return;
1635
- const suggestions = this.channelSuggestion.items({ query: "" });
1636
- const matches = [...this.modelValue.matchAll(channelRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
1637
- if (!matches)
1638
- return;
1639
- matches.forEach((match) => {
1640
- const channel = suggestions.find(({ id }) => id === match[1]);
1641
- this.internalValue = this.internalValue.replace(
1642
- `#${match[1]}`,
1643
- /** The space at the beginning is important as tiptap removes that while rendering.
1644
- * So if multiple mentions, channels or emojis are next to each other it will fail
1645
- */
1646
- ` <channel-component name="${channel.name}" id="${channel.id}"></channel-component>`
1647
- );
1648
- });
1649
- },
1650
- parseMentions() {
1651
- if (!this.mentionSuggestion)
1652
- return;
1653
- const suggestions = this.mentionSuggestion.items({ query: "" });
1654
- const matches = [...this.modelValue.matchAll(mentionRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
1655
- if (!matches)
1656
- return;
1657
- matches.forEach((match) => {
1658
- const mention = suggestions.find(({ id }) => id === match[1]);
1659
- this.internalValue = this.internalValue.replace(`@${match[1]}`, ` <mention-component name="${mention.name}" id="${mention.id}"></mention-component>`);
1660
- });
1661
- },
1662
1529
  destroyEditor() {
1663
1530
  this.editor.destroy();
1664
1531
  },