@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.
- package/dist/chunks/index-GVD15GIB.js +175 -0
- package/dist/chunks/index-GVD15GIB.js.map +1 -0
- package/dist/chunks/index-lu2o2f4r.js +169 -0
- package/dist/chunks/index-lu2o2f4r.js.map +1 -0
- package/dist/chunks/link_constants-AfTWrr-n.js +35 -0
- package/dist/chunks/link_constants-AfTWrr-n.js.map +1 -0
- package/dist/chunks/link_constants-x8NwdqmA.js +34 -0
- package/dist/chunks/link_constants-x8NwdqmA.js.map +1 -0
- package/dist/common/emoji.cjs +40 -163
- package/dist/common/emoji.cjs.map +1 -1
- package/dist/common/emoji.js +3 -146
- package/dist/common/emoji.js.map +1 -1
- package/dist/component-documentation.json +1 -1
- package/dist/dialtone-vue.cjs +10 -3
- package/dist/dialtone-vue.cjs.map +1 -1
- package/dist/dialtone-vue.js +10 -3
- package/dist/dialtone-vue.js.map +1 -1
- package/dist/lib/attachment-carousel.cjs +1 -1
- package/dist/lib/attachment-carousel.js +1 -1
- package/dist/lib/avatar.cjs.map +1 -1
- package/dist/lib/avatar.js.map +1 -1
- package/dist/lib/badge.cjs +21 -1
- package/dist/lib/badge.cjs.map +1 -1
- package/dist/lib/badge.js +21 -1
- package/dist/lib/badge.js.map +1 -1
- package/dist/lib/banner.cjs +1 -1
- package/dist/lib/banner.js +1 -1
- package/dist/lib/breadcrumbs.cjs +7 -3
- package/dist/lib/breadcrumbs.cjs.map +1 -1
- package/dist/lib/breadcrumbs.js +7 -3
- package/dist/lib/breadcrumbs.js.map +1 -1
- package/dist/lib/button.cjs +1 -1
- package/dist/lib/button.js +1 -1
- package/dist/lib/callbar-button-with-popover.cjs +1 -1
- package/dist/lib/callbar-button-with-popover.js +1 -1
- package/dist/lib/callbar-button.cjs +2 -2
- package/dist/lib/callbar-button.cjs.map +1 -1
- package/dist/lib/callbar-button.js +2 -2
- package/dist/lib/callbar-button.js.map +1 -1
- package/dist/lib/chip.cjs +1 -1
- package/dist/lib/chip.js +1 -1
- package/dist/lib/collapsible.cjs +1 -1
- package/dist/lib/collapsible.js +1 -1
- package/dist/lib/combobox-multi-select.cjs +1 -1
- package/dist/lib/combobox-multi-select.js +1 -1
- package/dist/lib/combobox-with-popover.cjs +1 -1
- package/dist/lib/combobox-with-popover.js +1 -1
- package/dist/lib/contact-centers-row.cjs +2 -3
- package/dist/lib/contact-centers-row.cjs.map +1 -1
- package/dist/lib/contact-centers-row.js +2 -3
- package/dist/lib/contact-centers-row.js.map +1 -1
- package/dist/lib/contact-row.cjs +2 -3
- package/dist/lib/contact-row.cjs.map +1 -1
- package/dist/lib/contact-row.js +2 -3
- package/dist/lib/contact-row.js.map +1 -1
- package/dist/lib/datepicker.cjs +1 -1
- package/dist/lib/datepicker.js +1 -1
- package/dist/lib/dropdown.cjs +1 -1
- package/dist/lib/dropdown.js +1 -1
- package/dist/lib/editor.cjs +3 -4
- package/dist/lib/editor.cjs.map +1 -1
- package/dist/lib/editor.js +3 -4
- package/dist/lib/editor.js.map +1 -1
- package/dist/lib/emoji-picker.cjs +1 -1
- package/dist/lib/emoji-picker.js +1 -1
- package/dist/lib/emoji-row.cjs +2 -3
- package/dist/lib/emoji-row.cjs.map +1 -1
- package/dist/lib/emoji-row.js +2 -3
- package/dist/lib/emoji-row.js.map +1 -1
- package/dist/lib/emoji-text-wrapper.cjs +1 -2
- package/dist/lib/emoji-text-wrapper.cjs.map +1 -1
- package/dist/lib/emoji-text-wrapper.js +1 -2
- package/dist/lib/emoji-text-wrapper.js.map +1 -1
- package/dist/lib/emoji.cjs +1 -2
- package/dist/lib/emoji.cjs.map +1 -1
- package/dist/lib/emoji.js +1 -2
- package/dist/lib/emoji.js.map +1 -1
- package/dist/lib/empty-state.cjs +136 -0
- package/dist/lib/empty-state.cjs.map +1 -0
- package/dist/lib/empty-state.js +136 -0
- package/dist/lib/empty-state.js.map +1 -0
- package/dist/lib/feed-pill.cjs +1 -1
- package/dist/lib/feed-pill.js +1 -1
- package/dist/lib/general-row.cjs +4 -5
- package/dist/lib/general-row.cjs.map +1 -1
- package/dist/lib/general-row.js +4 -5
- package/dist/lib/general-row.js.map +1 -1
- package/dist/lib/group-row.cjs +2 -3
- package/dist/lib/group-row.cjs.map +1 -1
- package/dist/lib/group-row.js +2 -3
- package/dist/lib/group-row.js.map +1 -1
- package/dist/lib/grouped-chip.cjs +1 -1
- package/dist/lib/grouped-chip.js +1 -1
- package/dist/lib/hovercard.cjs +1 -1
- package/dist/lib/hovercard.js +1 -1
- package/dist/lib/illustration.cjs +32 -0
- package/dist/lib/illustration.cjs.map +1 -0
- package/dist/lib/illustration.js +32 -0
- package/dist/lib/illustration.js.map +1 -0
- package/dist/lib/image-viewer.cjs +1 -1
- package/dist/lib/image-viewer.js +1 -1
- package/dist/lib/ivr-node.cjs +1 -1
- package/dist/lib/ivr-node.js +1 -1
- package/dist/lib/link.cjs +20 -6
- package/dist/lib/link.cjs.map +1 -1
- package/dist/lib/link.js +20 -6
- package/dist/lib/link.js.map +1 -1
- package/dist/lib/message-input.cjs +15 -8
- package/dist/lib/message-input.cjs.map +1 -1
- package/dist/lib/message-input.js +15 -8
- package/dist/lib/message-input.js.map +1 -1
- package/dist/lib/modal.cjs +1 -1
- package/dist/lib/modal.js +1 -1
- package/dist/lib/notice.cjs +1 -1
- package/dist/lib/notice.js +1 -1
- package/dist/lib/pagination.cjs +1 -1
- package/dist/lib/pagination.js +1 -1
- package/dist/lib/popover.cjs +1 -1
- package/dist/lib/popover.js +1 -1
- package/dist/lib/rich-text-editor.cjs +64 -197
- package/dist/lib/rich-text-editor.cjs.map +1 -1
- package/dist/lib/rich-text-editor.js +64 -197
- package/dist/lib/rich-text-editor.js.map +1 -1
- package/dist/lib/settings-menu-button.cjs +1 -1
- package/dist/lib/settings-menu-button.js +1 -1
- package/dist/lib/tabs.cjs +1 -1
- package/dist/lib/tabs.js +1 -1
- package/dist/lib/toast.cjs +1 -1
- package/dist/lib/toast.js +1 -1
- package/dist/lib/tooltip.cjs +13 -16
- package/dist/lib/tooltip.cjs.map +1 -1
- package/dist/lib/tooltip.js +14 -17
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/style.css +15 -11
- package/dist/types/common/emoji/index.d.ts +1 -0
- package/dist/types/common/emoji/index.d.ts.map +1 -1
- package/dist/types/common/storybook_utils.d.ts +6 -0
- package/dist/types/common/storybook_utils.d.ts.map +1 -1
- package/dist/types/components/badge/badge.vue.d.ts +32 -0
- package/dist/types/components/badge/badge.vue.d.ts.map +1 -1
- package/dist/types/components/breadcrumbs/breadcrumb_item.vue.d.ts +2 -1
- package/dist/types/components/breadcrumbs/breadcrumb_item.vue.d.ts.map +1 -1
- package/dist/types/components/empty_state/empty_state.vue.d.ts +12 -0
- package/dist/types/components/empty_state/empty_state.vue.d.ts.map +1 -0
- package/dist/types/components/empty_state/empty_state_constants.d.ts +10 -0
- package/dist/types/components/empty_state/empty_state_constants.d.ts.map +1 -0
- package/dist/types/components/empty_state/index.d.ts +3 -0
- package/dist/types/components/empty_state/index.d.ts.map +1 -0
- package/dist/types/components/illustration/illustration.vue.d.ts +8 -0
- package/dist/types/components/illustration/illustration.vue.d.ts.map +1 -0
- package/dist/types/components/illustration/illustration_constants.d.ts +6 -0
- package/dist/types/components/illustration/illustration_constants.d.ts.map +1 -0
- package/dist/types/components/illustration/index.d.ts +3 -0
- package/dist/types/components/illustration/index.d.ts.map +1 -0
- package/dist/types/components/link/link.vue.d.ts +24 -4
- package/dist/types/components/link/link.vue.d.ts.map +1 -1
- package/dist/types/components/link/link_constants.d.ts +2 -2
- package/dist/types/components/link/link_constants.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/extensions/channels/channel.d.ts +0 -1
- package/dist/types/components/rich_text_editor/extensions/channels/channel.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/extensions/custom_link/autolink.d.ts.map +1 -0
- package/dist/types/components/rich_text_editor/extensions/custom_link/custom_link.d.ts +3 -0
- package/dist/types/components/rich_text_editor/extensions/custom_link/custom_link.d.ts.map +1 -0
- package/dist/types/components/rich_text_editor/extensions/custom_link/index.d.ts +3 -0
- package/dist/types/components/rich_text_editor/extensions/custom_link/index.d.ts.map +1 -0
- package/dist/types/components/rich_text_editor/extensions/custom_link/utils.d.ts.map +1 -0
- package/dist/types/components/rich_text_editor/extensions/emoji/emoji.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts +0 -1
- package/dist/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/extensions/mentions/mention.d.ts +0 -1
- package/dist/types/components/rich_text_editor/extensions/mentions/mention.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/mention_suggestion.d.ts +2 -2
- package/dist/types/components/rich_text_editor/mention_suggestion.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +52 -12
- package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/types/components/toggle/toggle.vue.d.ts +1 -1
- package/dist/types/components/tooltip/tooltip.vue.d.ts +3 -4
- package/dist/types/components/tooltip/tooltip.vue.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +15 -0
- package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/types/recipes/leftbar/general_row/general_row_constants.d.ts +1 -1
- package/package.json +6 -6
- package/dist/chunks/link_constants-Huj7D_hm.js +0 -22
- package/dist/chunks/link_constants-Huj7D_hm.js.map +0 -1
- package/dist/chunks/link_constants-nWVlXQBs.js +0 -23
- package/dist/chunks/link_constants-nWVlXQBs.js.map +0 -1
- package/dist/types/components/rich_text_editor/extensions/link/autolink.d.ts.map +0 -1
- package/dist/types/components/rich_text_editor/extensions/link/index.d.ts +0 -4
- package/dist/types/components/rich_text_editor/extensions/link/index.d.ts.map +0 -1
- package/dist/types/components/rich_text_editor/extensions/link/link.d.ts +0 -3
- package/dist/types/components/rich_text_editor/extensions/link/link.d.ts.map +0 -1
- package/dist/types/components/rich_text_editor/extensions/link/utils.d.ts.map +0 -1
- /package/dist/types/components/rich_text_editor/extensions/{link → custom_link}/autolink.d.ts +0 -0
- /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("../
|
|
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-
|
|
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 {
|
|
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 =
|
|
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
|
|
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:
|
|
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
|
|
581
|
-
name: "
|
|
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: "
|
|
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(
|
|
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
|
|
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
|
-
|
|
1490
|
-
|
|
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
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
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.
|
|
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
|
},
|