@dialpad/dialtone-vue 2.133.0 → 2.135.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-ODod4Oj_.js +175 -0
  2. package/dist/chunks/index-ODod4Oj_.js.map +1 -0
  3. package/dist/chunks/index-anN_sx1F.js +169 -0
  4. package/dist/chunks/index-anN_sx1F.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 +6 -3
  29. package/dist/lib/breadcrumbs.cjs.map +1 -1
  30. package/dist/lib/breadcrumbs.js +6 -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 +142 -0
  79. package/dist/lib/empty-state.cjs.map +1 -0
  80. package/dist/lib/empty-state.js +142 -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 +43 -0
  97. package/dist/lib/illustration.cjs.map +1 -0
  98. package/dist/lib/illustration.js +43 -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 +14 -8
  109. package/dist/lib/message-input.cjs.map +1 -1
  110. package/dist/lib/message-input.js +14 -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 -200
  121. package/dist/lib/rich-text-editor.cjs.map +1 -1
  122. package/dist/lib/rich-text-editor.js +64 -200
  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 +9 -8
  131. package/dist/lib/tooltip.cjs.map +1 -1
  132. package/dist/lib/tooltip.js +9 -8
  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 +3 -10
  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 +3 -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 +23 -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 +4 -2
  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
@@ -20,7 +20,7 @@ const TextAlign = require("@tiptap/extension-text-align");
20
20
  const core = require("@tiptap/core");
21
21
  const _pluginVue2_normalizer = require("../chunks/_plugin-vue2_normalizer-1aBeR4AK.js");
22
22
  const lib_emoji = require("./emoji.cjs");
23
- const common_emoji = require("../common/emoji.cjs");
23
+ const common_emoji = require("../chunks/index-anN_sx1F.js");
24
24
  const state = require("@tiptap/pm/state");
25
25
  const Suggestion = require("@tiptap/suggestion");
26
26
  const dialtoneEmojis = require("@dialpad/dialtone-emojis");
@@ -33,7 +33,6 @@ const lib_link = require("./link.cjs");
33
33
  const lib_avatar = require("./avatar.cjs");
34
34
  const DtIconHash = require("@dialpad/dialtone-icons/vue2/hash");
35
35
  const DtIconLock = require("@dialpad/dialtone-icons/vue2/lock");
36
- const emojiRegex = require("emoji-regex");
37
36
  require("./skeleton.cjs");
38
37
  require("../chunks/icon_constants-QYpmdE0R.js");
39
38
  require("@dialpad/dialtone-icons/icons.json");
@@ -45,7 +44,7 @@ require("@dialpad/dialtone-icons/vue2");
45
44
  require("../chunks/stack_constants-SMzMWnAQ.js");
46
45
  require("../common/constants.cjs");
47
46
  require("vue");
48
- require("../chunks/link_constants-Huj7D_hm.js");
47
+ require("../chunks/link_constants-x8NwdqmA.js");
49
48
  require("./presence.cjs");
50
49
  const _sfc_main$9 = {
51
50
  name: "EmojiComponent",
@@ -230,7 +229,7 @@ const suggestionOptions = {
230
229
  return false;
231
230
  });
232
231
  return filteredEmoji.map((item) => {
233
- return { id: item.unicode_character, code: item.shortname };
232
+ return { code: item.shortname };
234
233
  });
235
234
  },
236
235
  command: ({ editor, range, props }) => {
@@ -277,7 +276,6 @@ const suggestionOptions = {
277
276
  interactive: true,
278
277
  trigger: "manual",
279
278
  placement: "top-start",
280
- contentElement: null,
281
279
  zIndex: 650
282
280
  });
283
281
  },
@@ -307,8 +305,7 @@ const suggestionOptions = {
307
305
  };
308
306
  const EmojiPluginKey = new state.PluginKey("emoji");
309
307
  const inputShortCodeRegex = new RegExp("(^| |(?<=:))(:\\w+:)$");
310
- const inputUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/;
311
- const pasteUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g;
308
+ const inputUnicodeRegex = new RegExp(common_emoji.emojiPattern + "$");
312
309
  const inputRuleMatch = (match) => {
313
310
  if (match && common_emoji.codeToEmojiData(match[0])) {
314
311
  const text = match[2] || match[0];
@@ -348,9 +345,6 @@ const Emoji = core.Node.create({
348
345
  return {
349
346
  code: {
350
347
  default: null
351
- },
352
- id: {
353
- default: null
354
348
  }
355
349
  };
356
350
  },
@@ -393,11 +387,9 @@ const Emoji = core.Node.create({
393
387
  },
394
388
  type: this.type,
395
389
  getAttributes(attrs) {
396
- const unicode = common_emoji.codeToEmojiData(attrs[0]).unicode_output;
397
- const emoji = String.fromCodePoint(parseInt(unicode, 16));
390
+ const emoji = common_emoji.codeToEmojiData(attrs[0]).shortname;
398
391
  return {
399
- code: emoji,
400
- label: "emoji"
392
+ code: emoji
401
393
  };
402
394
  }
403
395
  })
@@ -415,7 +407,7 @@ const Emoji = core.Node.create({
415
407
  }
416
408
  }),
417
409
  core.nodePasteRule({
418
- find: pasteUnicodeRegex,
410
+ find: common_emoji.emojiRegex,
419
411
  type: this.type,
420
412
  getAttributes(attrs) {
421
413
  return {
@@ -574,8 +566,8 @@ const defaultAttributes = {
574
566
  class: "d-link d-c-text d-d-inline-block d-wb-break-all",
575
567
  rel: "noopener noreferrer nofollow"
576
568
  };
577
- const Link = core.Mark.create({
578
- name: "Link",
569
+ const CustomLink = core.Mark.create({
570
+ name: "CustomLink",
579
571
  renderHTML({ HTMLAttributes }) {
580
572
  return [
581
573
  "a",
@@ -625,34 +617,7 @@ var __component__$6 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
625
617
  null
626
618
  );
627
619
  const MentionComponent = __component__$6.exports;
628
- const mentionRegex = /@([\w.-]+)[^\w.-]?/g;
629
- const mentionPasteMatch = (text, suggestions) => {
630
- const matches = [...text.matchAll(mentionRegex)];
631
- return matches.filter((match) => suggestions.some(({ id }) => id === match[1].trim())).map((match) => {
632
- let mention = match[1];
633
- if (!mention.endsWith(" "))
634
- mention += " ";
635
- return {
636
- index: match.index,
637
- text: mention,
638
- match
639
- };
640
- });
641
- };
642
- const mentionInputMatch = (text, suggestions) => {
643
- const match = text.match(/@([\w.-]+)[^\w.-]$/);
644
- if (!match || !suggestions.some(({ id }) => id === match[1]))
645
- return;
646
- return {
647
- index: match.index,
648
- text: match[0],
649
- match
650
- };
651
- };
652
620
  const MentionPlugin = Mention.extend({
653
- name: "mention",
654
- group: "inline",
655
- inline: true,
656
621
  addNodeView() {
657
622
  return vue2.VueNodeViewRenderer(MentionComponent);
658
623
  },
@@ -680,33 +645,7 @@ const MentionPlugin = Mention.extend({
680
645
  return `@${node.attrs.id}`;
681
646
  },
682
647
  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
- ];
648
+ return ["mention-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
710
649
  }
711
650
  }).configure({
712
651
  suggestion: {
@@ -743,34 +682,8 @@ var __component__$5 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
743
682
  null
744
683
  );
745
684
  const ChannelComponent = __component__$5.exports;
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
685
  const ChannelPlugin = Mention.extend({
771
686
  name: "channel",
772
- group: "inline",
773
- inline: true,
774
687
  addNodeView() {
775
688
  return vue2.VueNodeViewRenderer(ChannelComponent);
776
689
  },
@@ -798,33 +711,7 @@ const ChannelPlugin = Mention.extend({
798
711
  return `#${node.attrs.id}`;
799
712
  },
800
713
  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
- ];
714
+ return ["channel-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
828
715
  }
829
716
  }).configure({
830
717
  suggestion: {
@@ -1309,7 +1196,7 @@ const _sfc_main = {
1309
1196
  */
1310
1197
  outputFormat: {
1311
1198
  type: String,
1312
- default: "text",
1199
+ default: "html",
1313
1200
  validator(outputFormat) {
1314
1201
  return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);
1315
1202
  }
@@ -1322,12 +1209,29 @@ const _sfc_main = {
1322
1209
  default: ""
1323
1210
  },
1324
1211
  /**
1325
- * 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.
1326
1215
  */
1327
1216
  link: {
1328
1217
  type: [Boolean, Object],
1329
1218
  default: false
1330
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
+ },
1331
1235
  /**
1332
1236
  * suggestion object containing the items query function.
1333
1237
  * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion
@@ -1416,6 +1320,13 @@ const _sfc_main = {
1416
1320
  allowUnderline: {
1417
1321
  type: Boolean,
1418
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
1419
1330
  }
1420
1331
  },
1421
1332
  emits: [
@@ -1463,7 +1374,16 @@ const _sfc_main = {
1463
1374
  extensions() {
1464
1375
  const extensions = [Document, Paragraph, Text];
1465
1376
  if (this.link) {
1466
- 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));
1467
1387
  }
1468
1388
  if (this.allowBlockquote) {
1469
1389
  extensions.push(Blockquote);
@@ -1474,9 +1394,7 @@ const _sfc_main = {
1474
1394
  if (this.allowBulletList) {
1475
1395
  extensions.push(BulletList);
1476
1396
  extensions.push(ListItem);
1477
- extensions.push(OrderedList.configure({
1478
- itemTypeName: "listItem"
1479
- }));
1397
+ extensions.push(OrderedList);
1480
1398
  }
1481
1399
  if (this.allowItalic) {
1482
1400
  extensions.push(Italic);
@@ -1487,10 +1405,13 @@ const _sfc_main = {
1487
1405
  if (this.allowUnderline) {
1488
1406
  extensions.push(Underline);
1489
1407
  }
1490
- extensions.push(
1491
- Placeholder.configure({ placeholder: this.placeholder })
1492
- );
1408
+ if (this.placeholder) {
1409
+ extensions.push(
1410
+ Placeholder.configure({ placeholder: this.placeholder })
1411
+ );
1412
+ }
1493
1413
  if (!this.allowLineBreaks) {
1414
+ const self = this;
1494
1415
  extensions.push(
1495
1416
  HardBreak.extend({
1496
1417
  addKeyboardShortcuts() {
@@ -1498,6 +1419,7 @@ const _sfc_main = {
1498
1419
  Enter: () => true,
1499
1420
  "Shift-Enter": () => this.editor.commands.first(({ commands }) => [
1500
1421
  () => commands.newlineInCode(),
1422
+ () => self.allowBulletList && commands.splitListItem("listItem"),
1501
1423
  () => commands.createParagraphNear(),
1502
1424
  () => commands.liftEmptyBlock(),
1503
1425
  () => commands.splitBlock()
@@ -1507,10 +1429,6 @@ const _sfc_main = {
1507
1429
  })
1508
1430
  );
1509
1431
  }
1510
- extensions.push(TipTapLink.extend({ inclusive: false }).configure({
1511
- autolink: true,
1512
- protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
1513
- }));
1514
1432
  if (this.mentionSuggestion) {
1515
1433
  const suggestionObject = { ...this.mentionSuggestion, ...mentionSuggestion };
1516
1434
  extensions.push(MentionPlugin.configure({ suggestion: suggestionObject }));
@@ -1528,11 +1446,13 @@ const _sfc_main = {
1528
1446
  types: ["paragraph"],
1529
1447
  defaultAlignment: "left"
1530
1448
  }));
1531
- extensions.push(CodeBlock.configure({
1532
- HTMLAttributes: {
1533
- class: "dt-rich-text-editor--code-block"
1534
- }
1535
- }));
1449
+ if (this.allowCodeblock) {
1450
+ extensions.push(CodeBlock.configure({
1451
+ HTMLAttributes: {
1452
+ class: "dt-rich-text-editor--code-block"
1453
+ }
1454
+ }));
1455
+ }
1536
1456
  return extensions;
1537
1457
  },
1538
1458
  inputAttrs() {
@@ -1576,8 +1496,7 @@ const _sfc_main = {
1576
1496
  if (newValue === currentValue) {
1577
1497
  return;
1578
1498
  }
1579
- this.internalValue = newValue;
1580
- this.insertContent();
1499
+ this.editor.commands.setContent(newValue, false);
1581
1500
  }
1582
1501
  },
1583
1502
  created() {
@@ -1593,6 +1512,7 @@ const _sfc_main = {
1593
1512
  createEditor() {
1594
1513
  this.editor = new vue2.Editor({
1595
1514
  autofocus: this.autoFocus,
1515
+ content: this.value,
1596
1516
  editable: this.editable,
1597
1517
  extensions: this.extensions,
1598
1518
  editorProps: {
@@ -1602,64 +1522,8 @@ const _sfc_main = {
1602
1522
  }
1603
1523
  }
1604
1524
  });
1605
- this.insertContent();
1606
1525
  this.addEditorListeners();
1607
1526
  },
1608
- /**
1609
- * This function is necessary as tiptap doesn't render the content passed
1610
- * directly through `editor.commands.setContent` the content passed down to it
1611
- * should be already parsed. So We're parsing the elements into it's corresponding
1612
- * HTML version before setting it.
1613
- */
1614
- insertContent() {
1615
- this.parseMentions();
1616
- this.parseChannels();
1617
- this.parseEmojis();
1618
- this.editor.commands.setContent(this.internalValue, true);
1619
- },
1620
- parseEmojis() {
1621
- const matches = new Set(
1622
- [...this.value.matchAll(emojiRegex()), ...this.value.matchAll(common_emoji.emojiShortCodeRegex)].map((match) => match[0].trim())
1623
- );
1624
- if (!matches)
1625
- return;
1626
- matches.forEach((match) => {
1627
- const emoji = common_emoji.codeToEmojiData(match);
1628
- if (!emoji)
1629
- return;
1630
- this.internalValue = this.internalValue.replace(new RegExp(`${match}`, "g"), `<emoji-component code="${emoji.shortname}"></emoji-component>`);
1631
- });
1632
- },
1633
- parseChannels() {
1634
- if (!this.channelSuggestion)
1635
- return;
1636
- const suggestions = this.channelSuggestion.items({ query: "" });
1637
- const matches = [...this.value.matchAll(channelRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
1638
- if (!matches)
1639
- return;
1640
- matches.forEach((match) => {
1641
- const channel = suggestions.find(({ id }) => id === match[1]);
1642
- this.internalValue = this.internalValue.replace(
1643
- `#${match[1]}`,
1644
- /** The space at the beginning is important as tiptap removes that while rendering.
1645
- * So if multiple mentions, channels or emojis are next to each other it will fail
1646
- */
1647
- ` <channel-component name="${channel.name}" id="${channel.id}"></channel-component>`
1648
- );
1649
- });
1650
- },
1651
- parseMentions() {
1652
- if (!this.mentionSuggestion)
1653
- return;
1654
- const suggestions = this.mentionSuggestion.items({ query: "" });
1655
- const matches = [...this.value.matchAll(mentionRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
1656
- if (!matches)
1657
- return;
1658
- matches.forEach((match) => {
1659
- const mention = suggestions.find(({ id }) => id === match[1]);
1660
- this.internalValue = this.internalValue.replace(`@${match[1]}`, ` <mention-component name="${mention.name}" id="${mention.id}"></mention-component>`);
1661
- });
1662
- },
1663
1527
  destroyEditor() {
1664
1528
  this.editor.destroy();
1665
1529
  },