@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.
- package/dist/chunks/index-ODod4Oj_.js +175 -0
- package/dist/chunks/index-ODod4Oj_.js.map +1 -0
- package/dist/chunks/index-anN_sx1F.js +169 -0
- package/dist/chunks/index-anN_sx1F.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 +6 -3
- package/dist/lib/breadcrumbs.cjs.map +1 -1
- package/dist/lib/breadcrumbs.js +6 -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 +142 -0
- package/dist/lib/empty-state.cjs.map +1 -0
- package/dist/lib/empty-state.js +142 -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 +43 -0
- package/dist/lib/illustration.cjs.map +1 -0
- package/dist/lib/illustration.js +43 -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 +14 -8
- package/dist/lib/message-input.cjs.map +1 -1
- package/dist/lib/message-input.js +14 -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 -200
- package/dist/lib/rich-text-editor.cjs.map +1 -1
- package/dist/lib/rich-text-editor.js +64 -200
- 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 +9 -8
- package/dist/lib/tooltip.cjs.map +1 -1
- package/dist/lib/tooltip.js +9 -8
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/style.css +15 -11
- package/dist/types/common/emoji/index.d.ts +3 -10
- 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 +3 -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 +23 -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 +4 -2
- 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
|
@@ -18,7 +18,7 @@ import TextAlign from "@tiptap/extension-text-align";
|
|
|
18
18
|
import { Node, mergeAttributes, nodeInputRule, nodePasteRule, getMarksBetween, combineTransactionSteps, getChangedRanges, findChildrenInRange, Mark } from "@tiptap/core";
|
|
19
19
|
import { normalizeComponent } from "../chunks/_plugin-vue2_normalizer-sOSkiPF3.js";
|
|
20
20
|
import { DtEmoji } from "./emoji.js";
|
|
21
|
-
import { codeToEmojiData, emojiShortCodeRegex } from "../
|
|
21
|
+
import { codeToEmojiData, emojiRegex, emojiPattern, emojiShortCodeRegex } from "../chunks/index-ODod4Oj_.js";
|
|
22
22
|
import { PluginKey, Plugin } from "@tiptap/pm/state";
|
|
23
23
|
import Suggestion from "@tiptap/suggestion";
|
|
24
24
|
import { emojisIndexed } from "@dialpad/dialtone-emojis";
|
|
@@ -31,7 +31,6 @@ import { DtLink } from "./link.js";
|
|
|
31
31
|
import { DtAvatar } from "./avatar.js";
|
|
32
32
|
import DtIconHash from "@dialpad/dialtone-icons/vue2/hash";
|
|
33
33
|
import DtIconLock from "@dialpad/dialtone-icons/vue2/lock";
|
|
34
|
-
import emojiRegex from "emoji-regex";
|
|
35
34
|
import "./skeleton.js";
|
|
36
35
|
import "../chunks/icon_constants-Dy4MEUJL.js";
|
|
37
36
|
import "@dialpad/dialtone-icons/icons.json";
|
|
@@ -43,7 +42,7 @@ import "@dialpad/dialtone-icons/vue2";
|
|
|
43
42
|
import "../chunks/stack_constants-HraCekPm.js";
|
|
44
43
|
import "../common/constants.js";
|
|
45
44
|
import "vue";
|
|
46
|
-
import "../chunks/link_constants-
|
|
45
|
+
import "../chunks/link_constants-AfTWrr-n.js";
|
|
47
46
|
import "./presence.js";
|
|
48
47
|
const _sfc_main$9 = {
|
|
49
48
|
name: "EmojiComponent",
|
|
@@ -228,7 +227,7 @@ const suggestionOptions = {
|
|
|
228
227
|
return false;
|
|
229
228
|
});
|
|
230
229
|
return filteredEmoji.map((item) => {
|
|
231
|
-
return {
|
|
230
|
+
return { code: item.shortname };
|
|
232
231
|
});
|
|
233
232
|
},
|
|
234
233
|
command: ({ editor, range, props }) => {
|
|
@@ -275,7 +274,6 @@ const suggestionOptions = {
|
|
|
275
274
|
interactive: true,
|
|
276
275
|
trigger: "manual",
|
|
277
276
|
placement: "top-start",
|
|
278
|
-
contentElement: null,
|
|
279
277
|
zIndex: 650
|
|
280
278
|
});
|
|
281
279
|
},
|
|
@@ -305,8 +303,7 @@ const suggestionOptions = {
|
|
|
305
303
|
};
|
|
306
304
|
const EmojiPluginKey = new PluginKey("emoji");
|
|
307
305
|
const inputShortCodeRegex = new RegExp("(^| |(?<=:))(:\\w+:)$");
|
|
308
|
-
const inputUnicodeRegex =
|
|
309
|
-
const pasteUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g;
|
|
306
|
+
const inputUnicodeRegex = new RegExp(emojiPattern + "$");
|
|
310
307
|
const inputRuleMatch = (match) => {
|
|
311
308
|
if (match && codeToEmojiData(match[0])) {
|
|
312
309
|
const text = match[2] || match[0];
|
|
@@ -346,9 +343,6 @@ const Emoji = Node.create({
|
|
|
346
343
|
return {
|
|
347
344
|
code: {
|
|
348
345
|
default: null
|
|
349
|
-
},
|
|
350
|
-
id: {
|
|
351
|
-
default: null
|
|
352
346
|
}
|
|
353
347
|
};
|
|
354
348
|
},
|
|
@@ -391,11 +385,9 @@ const Emoji = Node.create({
|
|
|
391
385
|
},
|
|
392
386
|
type: this.type,
|
|
393
387
|
getAttributes(attrs) {
|
|
394
|
-
const
|
|
395
|
-
const emoji = String.fromCodePoint(parseInt(unicode, 16));
|
|
388
|
+
const emoji = codeToEmojiData(attrs[0]).shortname;
|
|
396
389
|
return {
|
|
397
|
-
code: emoji
|
|
398
|
-
label: "emoji"
|
|
390
|
+
code: emoji
|
|
399
391
|
};
|
|
400
392
|
}
|
|
401
393
|
})
|
|
@@ -413,7 +405,7 @@ const Emoji = Node.create({
|
|
|
413
405
|
}
|
|
414
406
|
}),
|
|
415
407
|
nodePasteRule({
|
|
416
|
-
find:
|
|
408
|
+
find: emojiRegex,
|
|
417
409
|
type: this.type,
|
|
418
410
|
getAttributes(attrs) {
|
|
419
411
|
return {
|
|
@@ -572,8 +564,8 @@ const defaultAttributes = {
|
|
|
572
564
|
class: "d-link d-c-text d-d-inline-block d-wb-break-all",
|
|
573
565
|
rel: "noopener noreferrer nofollow"
|
|
574
566
|
};
|
|
575
|
-
const
|
|
576
|
-
name: "
|
|
567
|
+
const CustomLink = Mark.create({
|
|
568
|
+
name: "CustomLink",
|
|
577
569
|
renderHTML({ HTMLAttributes }) {
|
|
578
570
|
return [
|
|
579
571
|
"a",
|
|
@@ -623,34 +615,7 @@ var __component__$6 = /* @__PURE__ */ normalizeComponent(
|
|
|
623
615
|
null
|
|
624
616
|
);
|
|
625
617
|
const MentionComponent = __component__$6.exports;
|
|
626
|
-
const mentionRegex = /@([\w.-]+)[^\w.-]?/g;
|
|
627
|
-
const mentionPasteMatch = (text, suggestions) => {
|
|
628
|
-
const matches = [...text.matchAll(mentionRegex)];
|
|
629
|
-
return matches.filter((match) => suggestions.some(({ id }) => id === match[1].trim())).map((match) => {
|
|
630
|
-
let mention = match[1];
|
|
631
|
-
if (!mention.endsWith(" "))
|
|
632
|
-
mention += " ";
|
|
633
|
-
return {
|
|
634
|
-
index: match.index,
|
|
635
|
-
text: mention,
|
|
636
|
-
match
|
|
637
|
-
};
|
|
638
|
-
});
|
|
639
|
-
};
|
|
640
|
-
const mentionInputMatch = (text, suggestions) => {
|
|
641
|
-
const match = text.match(/@([\w.-]+)[^\w.-]$/);
|
|
642
|
-
if (!match || !suggestions.some(({ id }) => id === match[1]))
|
|
643
|
-
return;
|
|
644
|
-
return {
|
|
645
|
-
index: match.index,
|
|
646
|
-
text: match[0],
|
|
647
|
-
match
|
|
648
|
-
};
|
|
649
|
-
};
|
|
650
618
|
const MentionPlugin = Mention.extend({
|
|
651
|
-
name: "mention",
|
|
652
|
-
group: "inline",
|
|
653
|
-
inline: true,
|
|
654
619
|
addNodeView() {
|
|
655
620
|
return VueNodeViewRenderer(MentionComponent);
|
|
656
621
|
},
|
|
@@ -678,33 +643,7 @@ const MentionPlugin = Mention.extend({
|
|
|
678
643
|
return `@${node.attrs.id}`;
|
|
679
644
|
},
|
|
680
645
|
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
|
-
];
|
|
646
|
+
return ["mention-component", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
708
647
|
}
|
|
709
648
|
}).configure({
|
|
710
649
|
suggestion: {
|
|
@@ -741,34 +680,8 @@ var __component__$5 = /* @__PURE__ */ normalizeComponent(
|
|
|
741
680
|
null
|
|
742
681
|
);
|
|
743
682
|
const ChannelComponent = __component__$5.exports;
|
|
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
683
|
const ChannelPlugin = Mention.extend({
|
|
769
684
|
name: "channel",
|
|
770
|
-
group: "inline",
|
|
771
|
-
inline: true,
|
|
772
685
|
addNodeView() {
|
|
773
686
|
return VueNodeViewRenderer(ChannelComponent);
|
|
774
687
|
},
|
|
@@ -796,33 +709,7 @@ const ChannelPlugin = Mention.extend({
|
|
|
796
709
|
return `#${node.attrs.id}`;
|
|
797
710
|
},
|
|
798
711
|
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
|
-
];
|
|
712
|
+
return ["channel-component", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
826
713
|
}
|
|
827
714
|
}).configure({
|
|
828
715
|
suggestion: {
|
|
@@ -1307,7 +1194,7 @@ const _sfc_main = {
|
|
|
1307
1194
|
*/
|
|
1308
1195
|
outputFormat: {
|
|
1309
1196
|
type: String,
|
|
1310
|
-
default: "
|
|
1197
|
+
default: "html",
|
|
1311
1198
|
validator(outputFormat) {
|
|
1312
1199
|
return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);
|
|
1313
1200
|
}
|
|
@@ -1320,12 +1207,29 @@ const _sfc_main = {
|
|
|
1320
1207
|
default: ""
|
|
1321
1208
|
},
|
|
1322
1209
|
/**
|
|
1323
|
-
* Enables the Link extension and optionally passes configurations to it
|
|
1210
|
+
* Enables the TipTap Link extension and optionally passes configurations to it
|
|
1211
|
+
*
|
|
1212
|
+
* It is not recommended to use this and the custom link extension at the same time.
|
|
1324
1213
|
*/
|
|
1325
1214
|
link: {
|
|
1326
1215
|
type: [Boolean, Object],
|
|
1327
1216
|
default: false
|
|
1328
1217
|
},
|
|
1218
|
+
/**
|
|
1219
|
+
* Enables the Custom Link extension and optionally passes configurations to it
|
|
1220
|
+
*
|
|
1221
|
+
* It is not recommended to use this and the built in TipTap link extension at the same time.
|
|
1222
|
+
*
|
|
1223
|
+
* The custom link does some additional things on top of the built in TipTap link
|
|
1224
|
+
* extension such as styling phone numbers and IP adresses as links, and allows you
|
|
1225
|
+
* to linkify text without having to type a space after the link. Currently it is missing some
|
|
1226
|
+
* functionality such as editing links and will likely require more work to be fully usable,
|
|
1227
|
+
* so it is recommended to use the built in TipTap link for now.
|
|
1228
|
+
*/
|
|
1229
|
+
customLink: {
|
|
1230
|
+
type: [Boolean, Object],
|
|
1231
|
+
default: false
|
|
1232
|
+
},
|
|
1329
1233
|
/**
|
|
1330
1234
|
* suggestion object containing the items query function.
|
|
1331
1235
|
* The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion
|
|
@@ -1414,6 +1318,13 @@ const _sfc_main = {
|
|
|
1414
1318
|
allowUnderline: {
|
|
1415
1319
|
type: Boolean,
|
|
1416
1320
|
default: true
|
|
1321
|
+
},
|
|
1322
|
+
/**
|
|
1323
|
+
* Whether the input allows codeblock to be introduced in the text.
|
|
1324
|
+
*/
|
|
1325
|
+
allowCodeblock: {
|
|
1326
|
+
type: Boolean,
|
|
1327
|
+
default: true
|
|
1417
1328
|
}
|
|
1418
1329
|
},
|
|
1419
1330
|
emits: [
|
|
@@ -1461,7 +1372,16 @@ const _sfc_main = {
|
|
|
1461
1372
|
extensions() {
|
|
1462
1373
|
const extensions = [Document, Paragraph, Text];
|
|
1463
1374
|
if (this.link) {
|
|
1464
|
-
extensions.push(
|
|
1375
|
+
extensions.push(TipTapLink.extend({ inclusive: false }).configure({
|
|
1376
|
+
HTMLAttributes: {
|
|
1377
|
+
class: "d-link d-wb-break-all"
|
|
1378
|
+
},
|
|
1379
|
+
autolink: true,
|
|
1380
|
+
protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
|
|
1381
|
+
}));
|
|
1382
|
+
}
|
|
1383
|
+
if (this.customLink) {
|
|
1384
|
+
extensions.push(this.getExtension(CustomLink, this.customLink));
|
|
1465
1385
|
}
|
|
1466
1386
|
if (this.allowBlockquote) {
|
|
1467
1387
|
extensions.push(Blockquote);
|
|
@@ -1472,9 +1392,7 @@ const _sfc_main = {
|
|
|
1472
1392
|
if (this.allowBulletList) {
|
|
1473
1393
|
extensions.push(BulletList);
|
|
1474
1394
|
extensions.push(ListItem);
|
|
1475
|
-
extensions.push(OrderedList
|
|
1476
|
-
itemTypeName: "listItem"
|
|
1477
|
-
}));
|
|
1395
|
+
extensions.push(OrderedList);
|
|
1478
1396
|
}
|
|
1479
1397
|
if (this.allowItalic) {
|
|
1480
1398
|
extensions.push(Italic);
|
|
@@ -1485,10 +1403,13 @@ const _sfc_main = {
|
|
|
1485
1403
|
if (this.allowUnderline) {
|
|
1486
1404
|
extensions.push(Underline);
|
|
1487
1405
|
}
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1406
|
+
if (this.placeholder) {
|
|
1407
|
+
extensions.push(
|
|
1408
|
+
Placeholder.configure({ placeholder: this.placeholder })
|
|
1409
|
+
);
|
|
1410
|
+
}
|
|
1491
1411
|
if (!this.allowLineBreaks) {
|
|
1412
|
+
const self = this;
|
|
1492
1413
|
extensions.push(
|
|
1493
1414
|
HardBreak.extend({
|
|
1494
1415
|
addKeyboardShortcuts() {
|
|
@@ -1496,6 +1417,7 @@ const _sfc_main = {
|
|
|
1496
1417
|
Enter: () => true,
|
|
1497
1418
|
"Shift-Enter": () => this.editor.commands.first(({ commands }) => [
|
|
1498
1419
|
() => commands.newlineInCode(),
|
|
1420
|
+
() => self.allowBulletList && commands.splitListItem("listItem"),
|
|
1499
1421
|
() => commands.createParagraphNear(),
|
|
1500
1422
|
() => commands.liftEmptyBlock(),
|
|
1501
1423
|
() => commands.splitBlock()
|
|
@@ -1505,10 +1427,6 @@ const _sfc_main = {
|
|
|
1505
1427
|
})
|
|
1506
1428
|
);
|
|
1507
1429
|
}
|
|
1508
|
-
extensions.push(TipTapLink.extend({ inclusive: false }).configure({
|
|
1509
|
-
autolink: true,
|
|
1510
|
-
protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
|
|
1511
|
-
}));
|
|
1512
1430
|
if (this.mentionSuggestion) {
|
|
1513
1431
|
const suggestionObject = { ...this.mentionSuggestion, ...mentionSuggestion };
|
|
1514
1432
|
extensions.push(MentionPlugin.configure({ suggestion: suggestionObject }));
|
|
@@ -1526,11 +1444,13 @@ const _sfc_main = {
|
|
|
1526
1444
|
types: ["paragraph"],
|
|
1527
1445
|
defaultAlignment: "left"
|
|
1528
1446
|
}));
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1447
|
+
if (this.allowCodeblock) {
|
|
1448
|
+
extensions.push(CodeBlock.configure({
|
|
1449
|
+
HTMLAttributes: {
|
|
1450
|
+
class: "dt-rich-text-editor--code-block"
|
|
1451
|
+
}
|
|
1452
|
+
}));
|
|
1453
|
+
}
|
|
1534
1454
|
return extensions;
|
|
1535
1455
|
},
|
|
1536
1456
|
inputAttrs() {
|
|
@@ -1574,8 +1494,7 @@ const _sfc_main = {
|
|
|
1574
1494
|
if (newValue === currentValue) {
|
|
1575
1495
|
return;
|
|
1576
1496
|
}
|
|
1577
|
-
this.
|
|
1578
|
-
this.insertContent();
|
|
1497
|
+
this.editor.commands.setContent(newValue, false);
|
|
1579
1498
|
}
|
|
1580
1499
|
},
|
|
1581
1500
|
created() {
|
|
@@ -1591,6 +1510,7 @@ const _sfc_main = {
|
|
|
1591
1510
|
createEditor() {
|
|
1592
1511
|
this.editor = new Editor({
|
|
1593
1512
|
autofocus: this.autoFocus,
|
|
1513
|
+
content: this.value,
|
|
1594
1514
|
editable: this.editable,
|
|
1595
1515
|
extensions: this.extensions,
|
|
1596
1516
|
editorProps: {
|
|
@@ -1600,64 +1520,8 @@ const _sfc_main = {
|
|
|
1600
1520
|
}
|
|
1601
1521
|
}
|
|
1602
1522
|
});
|
|
1603
|
-
this.insertContent();
|
|
1604
1523
|
this.addEditorListeners();
|
|
1605
1524
|
},
|
|
1606
|
-
/**
|
|
1607
|
-
* This function is necessary as tiptap doesn't render the content passed
|
|
1608
|
-
* directly through `editor.commands.setContent` the content passed down to it
|
|
1609
|
-
* should be already parsed. So We're parsing the elements into it's corresponding
|
|
1610
|
-
* HTML version before setting it.
|
|
1611
|
-
*/
|
|
1612
|
-
insertContent() {
|
|
1613
|
-
this.parseMentions();
|
|
1614
|
-
this.parseChannels();
|
|
1615
|
-
this.parseEmojis();
|
|
1616
|
-
this.editor.commands.setContent(this.internalValue, true);
|
|
1617
|
-
},
|
|
1618
|
-
parseEmojis() {
|
|
1619
|
-
const matches = new Set(
|
|
1620
|
-
[...this.value.matchAll(emojiRegex()), ...this.value.matchAll(emojiShortCodeRegex)].map((match) => match[0].trim())
|
|
1621
|
-
);
|
|
1622
|
-
if (!matches)
|
|
1623
|
-
return;
|
|
1624
|
-
matches.forEach((match) => {
|
|
1625
|
-
const emoji = codeToEmojiData(match);
|
|
1626
|
-
if (!emoji)
|
|
1627
|
-
return;
|
|
1628
|
-
this.internalValue = this.internalValue.replace(new RegExp(`${match}`, "g"), `<emoji-component code="${emoji.shortname}"></emoji-component>`);
|
|
1629
|
-
});
|
|
1630
|
-
},
|
|
1631
|
-
parseChannels() {
|
|
1632
|
-
if (!this.channelSuggestion)
|
|
1633
|
-
return;
|
|
1634
|
-
const suggestions = this.channelSuggestion.items({ query: "" });
|
|
1635
|
-
const matches = [...this.value.matchAll(channelRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
|
|
1636
|
-
if (!matches)
|
|
1637
|
-
return;
|
|
1638
|
-
matches.forEach((match) => {
|
|
1639
|
-
const channel = suggestions.find(({ id }) => id === match[1]);
|
|
1640
|
-
this.internalValue = this.internalValue.replace(
|
|
1641
|
-
`#${match[1]}`,
|
|
1642
|
-
/** The space at the beginning is important as tiptap removes that while rendering.
|
|
1643
|
-
* So if multiple mentions, channels or emojis are next to each other it will fail
|
|
1644
|
-
*/
|
|
1645
|
-
` <channel-component name="${channel.name}" id="${channel.id}"></channel-component>`
|
|
1646
|
-
);
|
|
1647
|
-
});
|
|
1648
|
-
},
|
|
1649
|
-
parseMentions() {
|
|
1650
|
-
if (!this.mentionSuggestion)
|
|
1651
|
-
return;
|
|
1652
|
-
const suggestions = this.mentionSuggestion.items({ query: "" });
|
|
1653
|
-
const matches = [...this.value.matchAll(mentionRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
|
|
1654
|
-
if (!matches)
|
|
1655
|
-
return;
|
|
1656
|
-
matches.forEach((match) => {
|
|
1657
|
-
const mention = suggestions.find(({ id }) => id === match[1]);
|
|
1658
|
-
this.internalValue = this.internalValue.replace(`@${match[1]}`, ` <mention-component name="${mention.name}" id="${mention.id}"></mention-component>`);
|
|
1659
|
-
});
|
|
1660
|
-
},
|
|
1661
1525
|
destroyEditor() {
|
|
1662
1526
|
this.editor.destroy();
|
|
1663
1527
|
},
|