@dialpad/dialtone-vue 3.127.0 → 3.129.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/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 +3 -2
- package/dist/dialtone-vue.cjs.map +1 -1
- package/dist/dialtone-vue.js +4 -3
- package/dist/dialtone-vue.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/button.cjs +11 -2
- package/dist/lib/button.cjs.map +1 -1
- package/dist/lib/button.js +12 -3
- package/dist/lib/button.js.map +1 -1
- package/dist/lib/contact-centers-row.cjs +1 -2
- package/dist/lib/contact-centers-row.cjs.map +1 -1
- package/dist/lib/contact-centers-row.js +1 -2
- package/dist/lib/contact-centers-row.js.map +1 -1
- package/dist/lib/contact-row.cjs +1 -2
- package/dist/lib/contact-row.cjs.map +1 -1
- package/dist/lib/contact-row.js +1 -2
- package/dist/lib/contact-row.js.map +1 -1
- package/dist/lib/editor.cjs +1 -2
- package/dist/lib/editor.cjs.map +1 -1
- package/dist/lib/editor.js +1 -2
- package/dist/lib/editor.js.map +1 -1
- package/dist/lib/emoji-picker.cjs +50 -18
- package/dist/lib/emoji-picker.cjs.map +1 -1
- package/dist/lib/emoji-picker.js +51 -19
- package/dist/lib/emoji-picker.js.map +1 -1
- package/dist/lib/emoji-row.cjs +1 -2
- package/dist/lib/emoji-row.cjs.map +1 -1
- package/dist/lib/emoji-row.js +1 -2
- 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/general-row.cjs +3 -4
- package/dist/lib/general-row.cjs.map +1 -1
- package/dist/lib/general-row.js +3 -4
- package/dist/lib/general-row.js.map +1 -1
- package/dist/lib/group-row.cjs +1 -2
- package/dist/lib/group-row.cjs.map +1 -1
- package/dist/lib/group-row.js +1 -2
- package/dist/lib/group-row.js.map +1 -1
- package/dist/lib/link.cjs +1 -0
- package/dist/lib/link.cjs.map +1 -1
- package/dist/lib/link.js +2 -1
- package/dist/lib/message-input.cjs +1 -2
- package/dist/lib/message-input.cjs.map +1 -1
- package/dist/lib/message-input.js +1 -2
- package/dist/lib/message-input.js.map +1 -1
- package/dist/lib/rich-text-editor.cjs +11 -177
- package/dist/lib/rich-text-editor.cjs.map +1 -1
- package/dist/lib/rich-text-editor.js +11 -177
- package/dist/lib/rich-text-editor.js.map +1 -1
- package/dist/lib/tooltip.cjs +31 -40
- package/dist/lib/tooltip.cjs.map +1 -1
- package/dist/lib/tooltip.js +32 -41
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/types/common/emoji/index.d.ts +1 -0
- package/dist/types/common/emoji/index.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/button/button.vue.d.ts +21 -2
- package/dist/types/components/button/button.vue.d.ts.map +1 -1
- package/dist/types/components/emoji_picker/modules/emoji_search.vue.d.ts.map +1 -1
- package/dist/types/components/link/index.d.ts +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/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 +0 -10
- package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/types/components/tooltip/tooltip.vue.d.ts +10 -12
- package/dist/types/components/tooltip/tooltip.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
|
@@ -42,8 +42,7 @@ import "@tiptap/extension-text";
|
|
|
42
42
|
import "@tiptap/extension-text-align";
|
|
43
43
|
import "@tiptap/core";
|
|
44
44
|
import "./emoji.js";
|
|
45
|
-
import "../
|
|
46
|
-
import "emoji-regex";
|
|
45
|
+
import "../chunks/index-GVD15GIB.js";
|
|
47
46
|
import "./skeleton.js";
|
|
48
47
|
import "@tiptap/pm/state";
|
|
49
48
|
import "@tiptap/suggestion";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-input.js","sources":["../../recipes/conversation_view/message_input/message_input.vue"],"sourcesContent":["<!-- eslint-disable vue/no-restricted-class -->\n<template>\n <div\n data-qa=\"dt-message-input\"\n role=\"presentation\"\n :class=\"['d-d-flex', 'd-fd-column', 'd-bar8', 'd-baw1', 'd-ba', 'd-c-text',\n { 'd-bc-bold d-bs-sm': hasFocus, 'd-bc-default': !hasFocus }]\"\n @click=\"$refs.richTextEditor?.focusEditor()\"\n @drag-enter=\"onDrag\"\n @drag-over=\"onDrag\"\n @drop=\"onDrop\"\n @keydown.enter.exact=\"onSend\"\n @paste=\"onPaste\"\n >\n <!-- Some wrapper to restrict the height and show the scrollbar -->\n <div\n class=\"d-of-auto d-mx16 d-mt8 d-mb4\"\n :style=\"{ 'max-height': maxHeight }\"\n >\n <dt-rich-text-editor\n ref=\"richTextEditor\"\n v-model=\"internalInputValue\"\n :allow-blockquote=\"allowBlockquote\"\n :allow-bold=\"allowBold\"\n :allow-bullet-list=\"allowBulletList\"\n :allow-codeblock=\"allowCodeblock\"\n :allow-italic=\"allowItalic\"\n :allow-strike=\"allowStrike\"\n :allow-underline=\"allowUnderline\"\n :editable=\"editable\"\n :input-aria-label=\"inputAriaLabel\"\n :input-class=\"inputClass\"\n :output-format=\"outputFormat\"\n :auto-focus=\"autoFocus\"\n :link=\"link\"\n :placeholder=\"placeholder\"\n :mention-suggestion=\"mentionSuggestion\"\n :channel-suggestion=\"channelSuggestion\"\n :slash-command-suggestion=\"slashCommandSuggestion\"\n v-bind=\"$attrs\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n @input=\"onInput($event)\"\n @selected-command=\"onSelectedCommand\"\n />\n </div>\n <!-- @slot Slot for attachment carousel -->\n <slot name=\"middle\" />\n <!-- Section for the bottom UI -->\n <section class=\"d-d-flex d-jc-space-between d-mx8 d-my4\">\n <!-- Left content -->\n <div class=\"d-d-flex\">\n <dt-tooltip\n v-if=\"showImagePicker\"\n placement=\"top-start\"\n :message=\"showImagePicker.tooltipLabel\"\n :offset=\"[-4, 12]\"\n >\n <template #anchor>\n <dt-button\n data-qa=\"dt-message-input-image-btn\"\n size=\"sm\"\n circle\n :kind=\"imagePickerFocus ? 'default' : 'muted'\"\n importance=\"clear\"\n :aria-label=\"showImagePicker.ariaLabel\"\n @click=\"onSelectImage\"\n @mouseenter=\"imagePickerFocus = true\"\n @mouseleave=\"imagePickerFocus = false\"\n @focus=\"imagePickerFocus = true\"\n @blur=\"imagePickerFocus = false\"\n >\n <template #icon>\n <dt-icon\n name=\"image\"\n size=\"300\"\n />\n </template>\n </dt-button>\n <dt-input\n ref=\"messageInputImageUpload\"\n data-qa=\"dt-message-input-image-input\"\n accept=\"image/*, video/*\"\n type=\"file\"\n class=\"d-ps-absolute\"\n multiple\n hidden\n @input=\"onImageUpload\"\n />\n </template>\n </dt-tooltip>\n <dt-popover\n v-if=\"showEmojiPicker\"\n v-model:open=\"emojiPickerOpened\"\n data-qa=\"dt-message-input-emoji-picker-popover\"\n initial-focus-element=\"#searchInput\"\n padding=\"none\"\n >\n <template #anchor=\"{ attrs }\">\n <dt-button\n v-dt-tooltip=\"emojiTooltipMessage\"\n v-bind=\"attrs\"\n data-qa=\"dt-message-input-emoji-picker-btn\"\n size=\"sm\"\n circle\n :kind=\"emojiPickerHovered ? 'default' : 'muted'\"\n importance=\"clear\"\n :aria-label=\"emojiButtonAriaLabel\"\n @click=\"toggleEmojiPicker\"\n @mouseenter=\"emojiPickerFocus = true\"\n @mouseleave=\"emojiPickerFocus = false\"\n @focus=\"emojiPickerFocus = true\"\n @blur=\"emojiPickerFocus = false\"\n >\n <template #icon>\n <dt-icon\n :name=\"!emojiPickerHovered ? 'satisfied' : 'very-satisfied'\"\n size=\"300\"\n />\n </template>\n </dt-button>\n </template>\n <template\n #content=\"{ close }\"\n >\n <dt-emoji-picker\n v-bind=\"emojiPickerProps\"\n @skin-tone=\"onSkinTone\"\n @selected-emoji=\"(emoji) => { close(); onSelectEmoji(emoji); }\"\n />\n </template>\n </dt-popover>\n <!-- @slot Slot for emojiGiphy picker -->\n <slot name=\"emojiGiphyPicker\" />\n </div>\n <!-- Right content -->\n <div class=\"d-d-flex\">\n <!-- Optionally displayed remaining character counter -->\n <dt-tooltip\n v-if=\"Boolean(showCharacterLimit)\"\n class=\"dt-message-input--remaining-char-tooltip\"\n placement=\"top-end\"\n :enabled=\"characterLimitTooltipEnabled\"\n :message=\"showCharacterLimit.message\"\n :offset=\"[10, 8]\"\n >\n <template #anchor>\n <p\n v-show=\"displayCharacterLimitWarning\"\n class=\"d-fc-error d-mr16 dt-message-input--remaining-char\"\n data-qa=\"dt-message-input-character-limit\"\n >\n {{ showCharacterLimit.count - inputLength }}\n </p>\n </template>\n </dt-tooltip>\n\n <!-- Cancel button for edit mode -->\n <dt-button\n v-if=\"showCancel\"\n data-qa=\"dt-message-input-cancel-button\"\n class=\"dt-message-input--cancel-button\"\n size=\"sm\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"showCancel.ariaLabel\"\n @click=\"onCancel\"\n >\n <p>{{ showCancel.text }}</p>\n </dt-button>\n\n <!-- Send button -->\n <dt-tooltip\n v-if=\"showSend\"\n placement=\"top-end\"\n :enabled=\"!showSend\"\n :message=\"showSend.tooltipLabel\"\n :show=\"!isSendDisabled && sendButtonFocus\"\n :offset=\"[6, 8]\"\n >\n <template #anchor>\n <!-- Right positioned UI - send button -->\n <dt-button\n data-qa=\"dt-message-input-send-btn\"\n size=\"sm\"\n kind=\"default\"\n importance=\"primary\"\n :class=\"[\n {\n 'message-input-button__disabled d-fc-muted': isSendDisabled,\n 'd-btn--circle': showSend.icon,\n },\n ]\"\n :aria-label=\"showSend.ariaLabel\"\n :aria-disabled=\"isSendDisabled\"\n @click=\"onSend\"\n @mouseenter=\"sendButtonFocus = true\"\n @mouseleave=\"sendButtonFocus = false\"\n @focus=\"sendButtonFocus = true\"\n @blur=\"sendButtonFocus = false\"\n >\n <template\n v-if=\"showSend.icon\"\n #icon\n >\n <dt-icon\n :name=\"showSend.icon\"\n size=\"300\"\n />\n </template>\n <template\n v-if=\"showSend.text\"\n >\n <p>{{ showSend.text }}</p>\n </template>\n </dt-button>\n </template>\n </dt-tooltip>\n </div>\n </section>\n </div>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport {\n DtRichTextEditor,\n RICH_TEXT_EDITOR_OUTPUT_FORMATS,\n RICH_TEXT_EDITOR_AUTOFOCUS_TYPES,\n} from '@/components/rich_text_editor';\nimport { DtButton } from '@/components/button';\nimport { DtIcon } from '@/components/icon';\nimport { DtEmojiPicker } from '@/components/emoji_picker';\nimport { DtPopover } from '@/components/popover';\nimport { DtInput } from '@/components/input';\nimport { DtTooltip } from '@/components/tooltip';\n\nexport default {\n name: 'DtRecipeMessageInput',\n\n components: {\n DtButton,\n DtEmojiPicker,\n DtIcon,\n DtInput,\n DtPopover,\n DtRichTextEditor,\n DtTooltip,\n },\n\n mixins: [],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Value of the input. The object format should match TipTap's JSON\n * document structure: https://tiptap.dev/guide/output#option-1-json\n */\n modelValue: {\n type: [Object, String],\n default: '',\n },\n\n /**\n * Whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Descriptive label for the input element\n */\n inputAriaLabel: {\n type: String,\n required: true,\n default: '',\n },\n\n /**\n * Additional class name for the input element. Only accepts a String value\n * because this is passed to the editor via options. For multiple classes,\n * join them into one string, e.g. \"d-p8 d-hmx96\"\n */\n inputClass: {\n type: String,\n default: '',\n },\n\n /**\n * Whether the input should receive focus after the component has been\n * mounted. Either one of `start`, `end`, `all` or a Boolean or a Number.\n * - `start` Sets the focus to the beginning of the input\n * - `end` Sets the focus to the end of the input\n * - `all` Selects the whole contents of the input\n * - `Number` Sets the focus to a specific position in the input\n * - `true` Defaults to `start`\n * - `false` Disables autofocus\n * @values true, false, start, end, all, number\n */\n autoFocus: {\n type: [Boolean, String, Number],\n default: false,\n validator (autoFocus) {\n if (typeof autoFocus === 'string') {\n return RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(autoFocus);\n }\n return true;\n },\n },\n\n /**\n * The output format that the editor uses when emitting the \"@input\" event.\n * One of `text`, `json`, `html`. See https://tiptap.dev/guide/output for\n * examples.\n * @values text, json, html\n */\n outputFormat: {\n type: String,\n default: 'text',\n validator (outputFormat) {\n return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);\n },\n },\n\n /**\n * Enables the Link extension and optionally passes configurations to it\n */\n link: {\n type: [Boolean, Object],\n default: true,\n },\n\n /**\n * Placeholder text\n */\n placeholder: {\n type: String,\n default: '',\n },\n\n /**\n * Disable Send Button\n */\n disableSend: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Content area needs to dynamically adjust height based on the conversation area height.\n * can be vh|px|rem|em|%\n */\n maxHeight: {\n type: String,\n default: 'unset',\n },\n\n // Emoji picker props\n showEmojiPicker: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Props to pass into the emoji picker.\n */\n emojiPickerProps: {\n type: Object,\n default: () => ({}),\n validate (emojiPickerProps) {\n return [\n 'searchNoResultsLabel',\n 'searchResultsLabel',\n 'searchPlaceholderLabel',\n 'skinSelectorButtonTooltipLabel',\n 'tabSetLabels',\n ].every(prop => emojiPickerProps[prop] != null);\n },\n },\n\n /**\n * Emoji button tooltip label\n */\n emojiTooltipMessage: {\n type: String,\n default: 'Emoji',\n },\n\n // Aria label for buttons\n /**\n * Emoji button aria label\n */\n emojiButtonAriaLabel: {\n type: String,\n default: 'emoji button',\n },\n\n /**\n * Enable character Limit warning\n */\n showCharacterLimit: {\n type: [Boolean, Object],\n default: () => ({ count: 1500, warning: 500, message: '' }),\n },\n\n showImagePicker: {\n type: [Boolean, Object],\n default: () => ({ tooltipLabel: 'Attach Image', ariaLabel: 'image button' }),\n },\n\n /**\n * Send button defaults.\n */\n showSend: {\n type: [Boolean, Object],\n default: () => ({ icon: 'send' }),\n },\n\n /**\n * Cancel button defaults.\n */\n showCancel: {\n type: [Boolean, Object],\n default: () => ({ text: 'Cancel' }),\n },\n\n /**\n * suggestion object containing the items query function.\n * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion\n *\n * The only required key is the items function which is used to query the contacts for suggestion.\n * items({ query }) => { return [ContactObject]; }\n * ContactObject format:\n * { name: string, avatarSrc: string, id: string }\n *\n * When null, it does not add the plugin.\n */\n mentionSuggestion: {\n type: Object,\n default: null,\n },\n\n /**\n * suggestion object containing the items query function.\n * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion\n *\n * The only required key is the items function which is used to query the channels for suggestion.\n * items({ query }) => { return [ChannelObject]; }\n * ChannelObject format:\n * { name: string, id: string, locked: boolean }\n *\n * When null, it does not add the plugin. Setting locked to true will display a lock rather than hash.\n */\n channelSuggestion: {\n type: Object,\n default: null,\n },\n\n /**\n * suggestion object containing the items query function.\n * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion\n *\n * The only required key is the items function which is used to query the slash commands for suggestion.\n * items({ query }) => { return [SlashCommandObject]; }\n * SlashCommandObject format:\n * { command: string, description: string, parametersExample?: string }\n * The \"parametersExample\" parameter is optional, and describes an example\n * of the parameters that command can take.\n *\n * When null, it does not add the plugin.\n */\n slashCommandSuggestion: {\n type: Object,\n default: null,\n },\n\n /**\n * Whether the input allows for block quote.\n */\n allowBlockquote: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for bold to be introduced in the text.\n */\n allowBold: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for bullet list to be introduced in the text.\n */\n allowBulletList: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for italic to be introduced in the text.\n */\n allowItalic: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for strike to be introduced in the text.\n */\n allowStrike: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for underline to be introduced in the text.\n */\n allowUnderline: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows codeblock to be introduced in the text.\n */\n allowCodeblock: {\n type: Boolean,\n default: true,\n },\n },\n\n emits: [\n /**\n * Fires when send button is clicked\n *\n * @event submit\n * @type {String}\n */\n 'submit',\n\n /**\n * Fires when media is selected from image button\n *\n * @event select-media\n * @type {Array}\n */\n 'select-media',\n\n /**\n * Fires when media is dropped into the message input\n *\n * @event add-media\n * @type {Array}\n */\n 'add-media',\n\n /**\n * Fires when media is pasted into the message input\n *\n * @event paste-media\n * @type {Array}\n */\n 'paste-media',\n\n /**\n * Fires when cancel button is pressed (only on edit mode)\n *\n * @event cancel\n * @type {Boolean}\n */\n 'cancel',\n\n /**\n * Fires when skin tone is selected from the emoji picker\n *\n * @event skin-tone\n * @type {String}\n */\n 'skin-tone',\n\n /**\n * Fires when emoji is selected from the emoji picker\n *\n * @event selected-emoji\n * @type {String}\n */\n 'selected-emoji',\n\n /**\n * Fires when a slash command is selected\n *\n * @event selected-command\n * @type {String}\n */\n 'selected-command',\n\n /**\n * Native focus event\n * @event input\n * @type {String|JSON}\n */\n 'focus',\n\n /**\n * Native blur event\n * @event input\n * @type {String|JSON}\n */\n 'blur',\n\n /**\n * Native input event\n * @event input\n * @type {String|JSON}\n */\n 'input',\n\n /**\n * Event to sync the value with the parent\n * @event update:modelValue\n * @type {String|JSON}\n */\n 'update:modelValue',\n ],\n\n data () {\n return {\n internalInputValue: this.modelValue, // internal input content\n hasFocus: false,\n imagePickerFocus: false,\n emojiPickerFocus: false,\n sendButtonFocus: false,\n emojiPickerOpened: false,\n };\n },\n\n computed: {\n inputLength () {\n return this.internalInputValue.length;\n },\n\n displayCharacterLimitWarning () {\n return Boolean(this.showCharacterLimit) &&\n ((this.showCharacterLimit.count - this.inputLength) <= this.showCharacterLimit.warning);\n },\n\n characterLimitTooltipEnabled () {\n return this.showCharacterLimit.message && (this.showCharacterLimit.count - this.inputLength < 0);\n },\n\n isSendDisabled () {\n return this.disableSend ||\n (this.showCharacterLimit && this.inputLength > this.showCharacterLimit.count);\n },\n\n computedCloseButtonProps () {\n return {\n ariaLabel: 'Close',\n };\n },\n\n emojiPickerHovered () {\n return this.emojiPickerFocus || this.emojiPickerOpened;\n },\n },\n\n watch: {\n modelValue (newValue) {\n this.internalInputValue = newValue;\n },\n\n emojiPickerOpened (newValue) {\n if (!newValue) {\n this.$refs.richTextEditor?.focusEditor();\n }\n },\n },\n\n methods: {\n onDrag (e) {\n e.stopPropagation();\n e.preventDefault();\n },\n\n onDrop (e) {\n e.stopPropagation();\n e.preventDefault();\n\n const dt = e.dataTransfer;\n const files = Array.from(dt.files);\n this.$emit('add-media', files);\n },\n\n onPaste (e) {\n if (e.clipboardData.files.length) {\n e.stopPropagation();\n e.preventDefault();\n const files = [...e.clipboardData.files];\n this.$emit('paste-media', files);\n }\n },\n\n onSkinTone (skinTone) {\n this.$emit('skin-tone', skinTone);\n },\n\n onSelectEmoji (emoji) {\n if (!emoji) {\n return;\n }\n\n // Insert emoji into the editor\n this.$refs.richTextEditor.editor.commands.insertContent({\n type: 'emoji',\n attrs: {\n code: emoji.shortname,\n },\n });\n this.$emit('selected-emoji', emoji);\n },\n\n onSelectedCommand (command) {\n this.$emit('selected-command', command);\n },\n\n onSelectImage () {\n this.$refs.messageInputImageUpload.$refs.input.click();\n },\n\n onImageUpload () {\n this.$emit('select-media', this.$refs.messageInputImageUpload.$refs.input.files);\n },\n\n toggleEmojiPicker () {\n this.emojiPickerOpened = !this.emojiPickerOpened;\n },\n\n onSend () {\n if (this.isSendDisabled) {\n return;\n }\n this.$emit('submit', this.internalInputValue);\n },\n\n onCancel () {\n this.$emit('cancel');\n },\n\n onFocus (event) {\n this.hasFocus = true;\n this.$refs.richTextEditor?.focusEditor();\n this.$emit('focus', event);\n },\n\n onBlur (event) {\n this.hasFocus = false;\n this.$emit('blur', event);\n },\n\n onInput (event) {\n this.$emit('input', event);\n this.$emit('update:modelValue', event);\n },\n },\n};\n</script>\n\n<style lang=\"less\">\n.dt-message-input--remaining-char-tooltip {\n margin-top: auto;\n margin-bottom: auto;\n}\n.dt-message-input--remaining-char {\n font-size: 1.2rem;\n}\n\n.message-input-button__disabled {\n background-color: unset;\n color: var(--theme-sidebar-icon-color);\n cursor: default;\n}\n\n.dt-message-input--cancel-button {\n margin-right: var(--dt-space-300);\n}\n</style>\n"],"names":["DtEmojiPicker","_createElementBlock","_normalizeClass","_createElementVNode","_createVNode","_mergeProps","_renderSlot","_createBlock","_withCtx","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;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kBAAA;AAAA,cACtB,gDAAM,MAAe,kBAAA;AAAA;+BAWtB,MAIW;AAAA,gBAHH,OAAA,SAAS,qBAEfD,mBAA0B,KAAA,YAAAQ,gBAApB,OAAQ,SAAC,IAAI,GAAA,CAAA;;;;cAXb,OAAA,SAAS;sBACd;AAAA,4BAED,MAGE;AAAA,kBAHFL,YAGE,oBAAA;AAAA,oBAFC,MAAM,OAAQ,SAAC;AAAA,oBAChB,MAAK;AAAA;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"message-input.js","sources":["../../recipes/conversation_view/message_input/message_input.vue"],"sourcesContent":["<!-- eslint-disable vue/no-restricted-class -->\n<template>\n <div\n data-qa=\"dt-message-input\"\n role=\"presentation\"\n :class=\"['d-d-flex', 'd-fd-column', 'd-bar8', 'd-baw1', 'd-ba', 'd-c-text',\n { 'd-bc-bold d-bs-sm': hasFocus, 'd-bc-default': !hasFocus }]\"\n @click=\"$refs.richTextEditor?.focusEditor()\"\n @drag-enter=\"onDrag\"\n @drag-over=\"onDrag\"\n @drop=\"onDrop\"\n @keydown.enter.exact=\"onSend\"\n @paste=\"onPaste\"\n >\n <!-- Some wrapper to restrict the height and show the scrollbar -->\n <div\n class=\"d-of-auto d-mx16 d-mt8 d-mb4\"\n :style=\"{ 'max-height': maxHeight }\"\n >\n <dt-rich-text-editor\n ref=\"richTextEditor\"\n v-model=\"internalInputValue\"\n :allow-blockquote=\"allowBlockquote\"\n :allow-bold=\"allowBold\"\n :allow-bullet-list=\"allowBulletList\"\n :allow-codeblock=\"allowCodeblock\"\n :allow-italic=\"allowItalic\"\n :allow-strike=\"allowStrike\"\n :allow-underline=\"allowUnderline\"\n :editable=\"editable\"\n :input-aria-label=\"inputAriaLabel\"\n :input-class=\"inputClass\"\n :output-format=\"outputFormat\"\n :auto-focus=\"autoFocus\"\n :link=\"link\"\n :placeholder=\"placeholder\"\n :mention-suggestion=\"mentionSuggestion\"\n :channel-suggestion=\"channelSuggestion\"\n :slash-command-suggestion=\"slashCommandSuggestion\"\n v-bind=\"$attrs\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n @input=\"onInput($event)\"\n @selected-command=\"onSelectedCommand\"\n />\n </div>\n <!-- @slot Slot for attachment carousel -->\n <slot name=\"middle\" />\n <!-- Section for the bottom UI -->\n <section class=\"d-d-flex d-jc-space-between d-mx8 d-my4\">\n <!-- Left content -->\n <div class=\"d-d-flex\">\n <dt-tooltip\n v-if=\"showImagePicker\"\n placement=\"top-start\"\n :message=\"showImagePicker.tooltipLabel\"\n :offset=\"[-4, 12]\"\n >\n <template #anchor>\n <dt-button\n data-qa=\"dt-message-input-image-btn\"\n size=\"sm\"\n circle\n :kind=\"imagePickerFocus ? 'default' : 'muted'\"\n importance=\"clear\"\n :aria-label=\"showImagePicker.ariaLabel\"\n @click=\"onSelectImage\"\n @mouseenter=\"imagePickerFocus = true\"\n @mouseleave=\"imagePickerFocus = false\"\n @focus=\"imagePickerFocus = true\"\n @blur=\"imagePickerFocus = false\"\n >\n <template #icon>\n <dt-icon\n name=\"image\"\n size=\"300\"\n />\n </template>\n </dt-button>\n <dt-input\n ref=\"messageInputImageUpload\"\n data-qa=\"dt-message-input-image-input\"\n accept=\"image/*, video/*\"\n type=\"file\"\n class=\"d-ps-absolute\"\n multiple\n hidden\n @input=\"onImageUpload\"\n />\n </template>\n </dt-tooltip>\n <dt-popover\n v-if=\"showEmojiPicker\"\n v-model:open=\"emojiPickerOpened\"\n data-qa=\"dt-message-input-emoji-picker-popover\"\n initial-focus-element=\"#searchInput\"\n padding=\"none\"\n >\n <template #anchor=\"{ attrs }\">\n <dt-button\n v-dt-tooltip=\"emojiTooltipMessage\"\n v-bind=\"attrs\"\n data-qa=\"dt-message-input-emoji-picker-btn\"\n size=\"sm\"\n circle\n :kind=\"emojiPickerHovered ? 'default' : 'muted'\"\n importance=\"clear\"\n :aria-label=\"emojiButtonAriaLabel\"\n @click=\"toggleEmojiPicker\"\n @mouseenter=\"emojiPickerFocus = true\"\n @mouseleave=\"emojiPickerFocus = false\"\n @focus=\"emojiPickerFocus = true\"\n @blur=\"emojiPickerFocus = false\"\n >\n <template #icon>\n <dt-icon\n :name=\"!emojiPickerHovered ? 'satisfied' : 'very-satisfied'\"\n size=\"300\"\n />\n </template>\n </dt-button>\n </template>\n <template\n #content=\"{ close }\"\n >\n <dt-emoji-picker\n v-bind=\"emojiPickerProps\"\n @skin-tone=\"onSkinTone\"\n @selected-emoji=\"(emoji) => { close(); onSelectEmoji(emoji); }\"\n />\n </template>\n </dt-popover>\n <!-- @slot Slot for emojiGiphy picker -->\n <slot name=\"emojiGiphyPicker\" />\n </div>\n <!-- Right content -->\n <div class=\"d-d-flex\">\n <!-- Optionally displayed remaining character counter -->\n <dt-tooltip\n v-if=\"Boolean(showCharacterLimit)\"\n class=\"dt-message-input--remaining-char-tooltip\"\n placement=\"top-end\"\n :enabled=\"characterLimitTooltipEnabled\"\n :message=\"showCharacterLimit.message\"\n :offset=\"[10, 8]\"\n >\n <template #anchor>\n <p\n v-show=\"displayCharacterLimitWarning\"\n class=\"d-fc-error d-mr16 dt-message-input--remaining-char\"\n data-qa=\"dt-message-input-character-limit\"\n >\n {{ showCharacterLimit.count - inputLength }}\n </p>\n </template>\n </dt-tooltip>\n\n <!-- Cancel button for edit mode -->\n <dt-button\n v-if=\"showCancel\"\n data-qa=\"dt-message-input-cancel-button\"\n class=\"dt-message-input--cancel-button\"\n size=\"sm\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"showCancel.ariaLabel\"\n @click=\"onCancel\"\n >\n <p>{{ showCancel.text }}</p>\n </dt-button>\n\n <!-- Send button -->\n <dt-tooltip\n v-if=\"showSend\"\n placement=\"top-end\"\n :enabled=\"!showSend\"\n :message=\"showSend.tooltipLabel\"\n :show=\"!isSendDisabled && sendButtonFocus\"\n :offset=\"[6, 8]\"\n >\n <template #anchor>\n <!-- Right positioned UI - send button -->\n <dt-button\n data-qa=\"dt-message-input-send-btn\"\n size=\"sm\"\n kind=\"default\"\n importance=\"primary\"\n :class=\"[\n {\n 'message-input-button__disabled d-fc-muted': isSendDisabled,\n 'd-btn--circle': showSend.icon,\n },\n ]\"\n :aria-label=\"showSend.ariaLabel\"\n :aria-disabled=\"isSendDisabled\"\n @click=\"onSend\"\n @mouseenter=\"sendButtonFocus = true\"\n @mouseleave=\"sendButtonFocus = false\"\n @focus=\"sendButtonFocus = true\"\n @blur=\"sendButtonFocus = false\"\n >\n <template\n v-if=\"showSend.icon\"\n #icon\n >\n <dt-icon\n :name=\"showSend.icon\"\n size=\"300\"\n />\n </template>\n <template\n v-if=\"showSend.text\"\n >\n <p>{{ showSend.text }}</p>\n </template>\n </dt-button>\n </template>\n </dt-tooltip>\n </div>\n </section>\n </div>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport {\n DtRichTextEditor,\n RICH_TEXT_EDITOR_OUTPUT_FORMATS,\n RICH_TEXT_EDITOR_AUTOFOCUS_TYPES,\n} from '@/components/rich_text_editor';\nimport { DtButton } from '@/components/button';\nimport { DtIcon } from '@/components/icon';\nimport { DtEmojiPicker } from '@/components/emoji_picker';\nimport { DtPopover } from '@/components/popover';\nimport { DtInput } from '@/components/input';\nimport { DtTooltip } from '@/components/tooltip';\n\nexport default {\n name: 'DtRecipeMessageInput',\n\n components: {\n DtButton,\n DtEmojiPicker,\n DtIcon,\n DtInput,\n DtPopover,\n DtRichTextEditor,\n DtTooltip,\n },\n\n mixins: [],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Value of the input. The object format should match TipTap's JSON\n * document structure: https://tiptap.dev/guide/output#option-1-json\n */\n modelValue: {\n type: [Object, String],\n default: '',\n },\n\n /**\n * Whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Descriptive label for the input element\n */\n inputAriaLabel: {\n type: String,\n required: true,\n default: '',\n },\n\n /**\n * Additional class name for the input element. Only accepts a String value\n * because this is passed to the editor via options. For multiple classes,\n * join them into one string, e.g. \"d-p8 d-hmx96\"\n */\n inputClass: {\n type: String,\n default: '',\n },\n\n /**\n * Whether the input should receive focus after the component has been\n * mounted. Either one of `start`, `end`, `all` or a Boolean or a Number.\n * - `start` Sets the focus to the beginning of the input\n * - `end` Sets the focus to the end of the input\n * - `all` Selects the whole contents of the input\n * - `Number` Sets the focus to a specific position in the input\n * - `true` Defaults to `start`\n * - `false` Disables autofocus\n * @values true, false, start, end, all, number\n */\n autoFocus: {\n type: [Boolean, String, Number],\n default: false,\n validator (autoFocus) {\n if (typeof autoFocus === 'string') {\n return RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(autoFocus);\n }\n return true;\n },\n },\n\n /**\n * The output format that the editor uses when emitting the \"@input\" event.\n * One of `text`, `json`, `html`. See https://tiptap.dev/guide/output for\n * examples.\n * @values text, json, html\n */\n outputFormat: {\n type: String,\n default: 'text',\n validator (outputFormat) {\n return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);\n },\n },\n\n /**\n * Enables the Link extension and optionally passes configurations to it\n */\n link: {\n type: [Boolean, Object],\n default: true,\n },\n\n /**\n * Placeholder text\n */\n placeholder: {\n type: String,\n default: '',\n },\n\n /**\n * Disable Send Button\n */\n disableSend: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Content area needs to dynamically adjust height based on the conversation area height.\n * can be vh|px|rem|em|%\n */\n maxHeight: {\n type: String,\n default: 'unset',\n },\n\n // Emoji picker props\n showEmojiPicker: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Props to pass into the emoji picker.\n */\n emojiPickerProps: {\n type: Object,\n default: () => ({}),\n validate (emojiPickerProps) {\n return [\n 'searchNoResultsLabel',\n 'searchResultsLabel',\n 'searchPlaceholderLabel',\n 'skinSelectorButtonTooltipLabel',\n 'tabSetLabels',\n ].every(prop => emojiPickerProps[prop] != null);\n },\n },\n\n /**\n * Emoji button tooltip label\n */\n emojiTooltipMessage: {\n type: String,\n default: 'Emoji',\n },\n\n // Aria label for buttons\n /**\n * Emoji button aria label\n */\n emojiButtonAriaLabel: {\n type: String,\n default: 'emoji button',\n },\n\n /**\n * Enable character Limit warning\n */\n showCharacterLimit: {\n type: [Boolean, Object],\n default: () => ({ count: 1500, warning: 500, message: '' }),\n },\n\n showImagePicker: {\n type: [Boolean, Object],\n default: () => ({ tooltipLabel: 'Attach Image', ariaLabel: 'image button' }),\n },\n\n /**\n * Send button defaults.\n */\n showSend: {\n type: [Boolean, Object],\n default: () => ({ icon: 'send' }),\n },\n\n /**\n * Cancel button defaults.\n */\n showCancel: {\n type: [Boolean, Object],\n default: () => ({ text: 'Cancel' }),\n },\n\n /**\n * suggestion object containing the items query function.\n * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion\n *\n * The only required key is the items function which is used to query the contacts for suggestion.\n * items({ query }) => { return [ContactObject]; }\n * ContactObject format:\n * { name: string, avatarSrc: string, id: string }\n *\n * When null, it does not add the plugin.\n */\n mentionSuggestion: {\n type: Object,\n default: null,\n },\n\n /**\n * suggestion object containing the items query function.\n * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion\n *\n * The only required key is the items function which is used to query the channels for suggestion.\n * items({ query }) => { return [ChannelObject]; }\n * ChannelObject format:\n * { name: string, id: string, locked: boolean }\n *\n * When null, it does not add the plugin. Setting locked to true will display a lock rather than hash.\n */\n channelSuggestion: {\n type: Object,\n default: null,\n },\n\n /**\n * suggestion object containing the items query function.\n * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion\n *\n * The only required key is the items function which is used to query the slash commands for suggestion.\n * items({ query }) => { return [SlashCommandObject]; }\n * SlashCommandObject format:\n * { command: string, description: string, parametersExample?: string }\n * The \"parametersExample\" parameter is optional, and describes an example\n * of the parameters that command can take.\n *\n * When null, it does not add the plugin.\n */\n slashCommandSuggestion: {\n type: Object,\n default: null,\n },\n\n /**\n * Whether the input allows for block quote.\n */\n allowBlockquote: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for bold to be introduced in the text.\n */\n allowBold: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for bullet list to be introduced in the text.\n */\n allowBulletList: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for italic to be introduced in the text.\n */\n allowItalic: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for strike to be introduced in the text.\n */\n allowStrike: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows for underline to be introduced in the text.\n */\n allowUnderline: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the input allows codeblock to be introduced in the text.\n */\n allowCodeblock: {\n type: Boolean,\n default: true,\n },\n },\n\n emits: [\n /**\n * Fires when send button is clicked\n *\n * @event submit\n * @type {String}\n */\n 'submit',\n\n /**\n * Fires when media is selected from image button\n *\n * @event select-media\n * @type {Array}\n */\n 'select-media',\n\n /**\n * Fires when media is dropped into the message input\n *\n * @event add-media\n * @type {Array}\n */\n 'add-media',\n\n /**\n * Fires when media is pasted into the message input\n *\n * @event paste-media\n * @type {Array}\n */\n 'paste-media',\n\n /**\n * Fires when cancel button is pressed (only on edit mode)\n *\n * @event cancel\n * @type {Boolean}\n */\n 'cancel',\n\n /**\n * Fires when skin tone is selected from the emoji picker\n *\n * @event skin-tone\n * @type {String}\n */\n 'skin-tone',\n\n /**\n * Fires when emoji is selected from the emoji picker\n *\n * @event selected-emoji\n * @type {String}\n */\n 'selected-emoji',\n\n /**\n * Fires when a slash command is selected\n *\n * @event selected-command\n * @type {String}\n */\n 'selected-command',\n\n /**\n * Native focus event\n * @event input\n * @type {String|JSON}\n */\n 'focus',\n\n /**\n * Native blur event\n * @event input\n * @type {String|JSON}\n */\n 'blur',\n\n /**\n * Native input event\n * @event input\n * @type {String|JSON}\n */\n 'input',\n\n /**\n * Event to sync the value with the parent\n * @event update:modelValue\n * @type {String|JSON}\n */\n 'update:modelValue',\n ],\n\n data () {\n return {\n internalInputValue: this.modelValue, // internal input content\n hasFocus: false,\n imagePickerFocus: false,\n emojiPickerFocus: false,\n sendButtonFocus: false,\n emojiPickerOpened: false,\n };\n },\n\n computed: {\n inputLength () {\n return this.internalInputValue.length;\n },\n\n displayCharacterLimitWarning () {\n return Boolean(this.showCharacterLimit) &&\n ((this.showCharacterLimit.count - this.inputLength) <= this.showCharacterLimit.warning);\n },\n\n characterLimitTooltipEnabled () {\n return this.showCharacterLimit.message && (this.showCharacterLimit.count - this.inputLength < 0);\n },\n\n isSendDisabled () {\n return this.disableSend ||\n (this.showCharacterLimit && this.inputLength > this.showCharacterLimit.count);\n },\n\n computedCloseButtonProps () {\n return {\n ariaLabel: 'Close',\n };\n },\n\n emojiPickerHovered () {\n return this.emojiPickerFocus || this.emojiPickerOpened;\n },\n },\n\n watch: {\n modelValue (newValue) {\n this.internalInputValue = newValue;\n },\n\n emojiPickerOpened (newValue) {\n if (!newValue) {\n this.$refs.richTextEditor?.focusEditor();\n }\n },\n },\n\n methods: {\n onDrag (e) {\n e.stopPropagation();\n e.preventDefault();\n },\n\n onDrop (e) {\n e.stopPropagation();\n e.preventDefault();\n\n const dt = e.dataTransfer;\n const files = Array.from(dt.files);\n this.$emit('add-media', files);\n },\n\n onPaste (e) {\n if (e.clipboardData.files.length) {\n e.stopPropagation();\n e.preventDefault();\n const files = [...e.clipboardData.files];\n this.$emit('paste-media', files);\n }\n },\n\n onSkinTone (skinTone) {\n this.$emit('skin-tone', skinTone);\n },\n\n onSelectEmoji (emoji) {\n if (!emoji) {\n return;\n }\n\n // Insert emoji into the editor\n this.$refs.richTextEditor.editor.commands.insertContent({\n type: 'emoji',\n attrs: {\n code: emoji.shortname,\n },\n });\n this.$emit('selected-emoji', emoji);\n },\n\n onSelectedCommand (command) {\n this.$emit('selected-command', command);\n },\n\n onSelectImage () {\n this.$refs.messageInputImageUpload.$refs.input.click();\n },\n\n onImageUpload () {\n this.$emit('select-media', this.$refs.messageInputImageUpload.$refs.input.files);\n },\n\n toggleEmojiPicker () {\n this.emojiPickerOpened = !this.emojiPickerOpened;\n },\n\n onSend () {\n if (this.isSendDisabled) {\n return;\n }\n this.$emit('submit', this.internalInputValue);\n },\n\n onCancel () {\n this.$emit('cancel');\n },\n\n onFocus (event) {\n this.hasFocus = true;\n this.$refs.richTextEditor?.focusEditor();\n this.$emit('focus', event);\n },\n\n onBlur (event) {\n this.hasFocus = false;\n this.$emit('blur', event);\n },\n\n onInput (event) {\n this.$emit('input', event);\n this.$emit('update:modelValue', event);\n },\n },\n};\n</script>\n\n<style lang=\"less\">\n.dt-message-input--remaining-char-tooltip {\n margin-top: auto;\n margin-bottom: auto;\n}\n.dt-message-input--remaining-char {\n font-size: 1.2rem;\n}\n\n.message-input-button__disabled {\n background-color: unset;\n color: var(--theme-sidebar-icon-color);\n cursor: default;\n}\n\n.dt-message-input--cancel-button {\n margin-right: var(--dt-space-300);\n}\n</style>\n"],"names":["DtEmojiPicker","_createElementBlock","_normalizeClass","_createElementVNode","_createVNode","_mergeProps","_renderSlot","_createBlock","_withCtx","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6OA,MAAK,YAAU;AAAA,EACb,MAAM;AAAA,EAEN,YAAY;AAAA,IACV;AAAA,mBACAA;AAAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EAED,QAAQ,CAAE;AAAA,EAEV,cAAc;AAAA,EAEd,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,YAAY;AAAA,MACV,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA,IAKD,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA,IAKD,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOD,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SA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B,OAAU,WAAC,IAAI,GAAA,CAAA;AAAA;;;QAKf,OAAQ,yBADhBF,YA6Ca,uBAAA;AAAA;UA3CX,WAAU;AAAA,UACT,UAAU,OAAQ;AAAA,UAClB,SAAS,OAAQ,SAAC;AAAA,UAClB,MAAI,CAAG,SAAc,kBAAI,MAAe;AAAA,UACxC,QAAQ,CAAM,GAAA,CAAA;AAAA;UAEJ,gBAET,MAiCY;AAAA,YAjCZH,YAiCY,sBAAA;AAAA,cAhCV,WAAQ;AAAA,cACR,MAAK;AAAA,cACL,MAAK;AAAA,cACL,YAAW;AAAA,cACV,OAAKF,eAAA;AAAA;+DAAqF,SAAc;AAAA,kBAAqC,iBAAA,OAAA,SAAS;AAAA;;cAMtJ,cAAY,OAAQ,SAAC;AAAA,cACrB,iBAAe,SAAc;AAAA,cAC7B,SAAO,SAAM;AAAA,cACb,sDAAY,MAAe,kBAAA;AAAA,cAC3B,sDAAY,MAAe,kBAAA;AAAA,cAC3B,iDAAO,MAAe,kBAAA;AAAA,cACtB,gDAAM,MAAe,kBAAA;AAAA;+BAWtB,MAIW;AAAA,gBAHH,OAAA,SAAS,qBAEfD,mBAA0B,KAAA,YAAAQ,gBAApB,OAAQ,SAAC,IAAI,GAAA,CAAA;;;;cAXb,OAAA,SAAS;sBACd;AAAA,4BAED,MAGE;AAAA,kBAHFL,YAGE,oBAAA;AAAA,oBAFC,MAAM,OAAQ,SAAC;AAAA,oBAChB,MAAK;AAAA;;;;;;;;;;;;;"}
|
|
@@ -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");
|
|
@@ -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 {
|
|
@@ -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
|
}
|
|
@@ -1608,8 +1498,7 @@ const _sfc_main = {
|
|
|
1608
1498
|
if (newValue === currentValue) {
|
|
1609
1499
|
return;
|
|
1610
1500
|
}
|
|
1611
|
-
this.
|
|
1612
|
-
this.insertContent();
|
|
1501
|
+
this.editor.commands.setContent(newValue, false);
|
|
1613
1502
|
}
|
|
1614
1503
|
},
|
|
1615
1504
|
created() {
|
|
@@ -1625,6 +1514,7 @@ const _sfc_main = {
|
|
|
1625
1514
|
createEditor() {
|
|
1626
1515
|
this.editor = new vue3.Editor({
|
|
1627
1516
|
autofocus: this.autoFocus,
|
|
1517
|
+
content: this.modelValue,
|
|
1628
1518
|
editable: this.editable,
|
|
1629
1519
|
extensions: this.extensions,
|
|
1630
1520
|
editorProps: {
|
|
@@ -1634,64 +1524,8 @@ const _sfc_main = {
|
|
|
1634
1524
|
}
|
|
1635
1525
|
}
|
|
1636
1526
|
});
|
|
1637
|
-
this.insertContent();
|
|
1638
1527
|
this.addEditorListeners();
|
|
1639
1528
|
},
|
|
1640
|
-
/**
|
|
1641
|
-
* This function is necessary as tiptap doesn't render the content passed
|
|
1642
|
-
* directly through `editor.commands.setContent` the content passed down to it
|
|
1643
|
-
* should be already parsed. So We're parsing the elements into it's corresponding
|
|
1644
|
-
* HTML version before setting it.
|
|
1645
|
-
*/
|
|
1646
|
-
insertContent() {
|
|
1647
|
-
this.parseMentions();
|
|
1648
|
-
this.parseChannels();
|
|
1649
|
-
this.parseEmojis();
|
|
1650
|
-
this.editor.commands.setContent(this.internalValue, true);
|
|
1651
|
-
},
|
|
1652
|
-
parseEmojis() {
|
|
1653
|
-
const matches = new Set(
|
|
1654
|
-
[...this.modelValue.matchAll(emojiRegex()), ...this.modelValue.matchAll(common_emoji.emojiShortCodeRegex)].map((match) => match[0].trim())
|
|
1655
|
-
);
|
|
1656
|
-
if (!matches)
|
|
1657
|
-
return;
|
|
1658
|
-
matches.forEach((match) => {
|
|
1659
|
-
const emoji = common_emoji.codeToEmojiData(match);
|
|
1660
|
-
if (!emoji)
|
|
1661
|
-
return;
|
|
1662
|
-
this.internalValue = this.internalValue.replace(new RegExp(`${match}`, "g"), `<emoji-component code="${emoji.shortname}"></emoji-component>`);
|
|
1663
|
-
});
|
|
1664
|
-
},
|
|
1665
|
-
parseChannels() {
|
|
1666
|
-
if (!this.channelSuggestion)
|
|
1667
|
-
return;
|
|
1668
|
-
const suggestions = this.channelSuggestion.items({ query: "" });
|
|
1669
|
-
const matches = [...this.modelValue.matchAll(channelRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
|
|
1670
|
-
if (!matches)
|
|
1671
|
-
return;
|
|
1672
|
-
matches.forEach((match) => {
|
|
1673
|
-
const channel = suggestions.find(({ id }) => id === match[1]);
|
|
1674
|
-
this.internalValue = this.internalValue.replace(
|
|
1675
|
-
`#${match[1]}`,
|
|
1676
|
-
/** The space at the beginning is important as tiptap removes that while rendering.
|
|
1677
|
-
* So if multiple mentions, channels or emojis are next to each other it will fail
|
|
1678
|
-
*/
|
|
1679
|
-
` <channel-component name="${channel.name}" id="${channel.id}"></channel-component>`
|
|
1680
|
-
);
|
|
1681
|
-
});
|
|
1682
|
-
},
|
|
1683
|
-
parseMentions() {
|
|
1684
|
-
if (!this.mentionSuggestion)
|
|
1685
|
-
return;
|
|
1686
|
-
const suggestions = this.mentionSuggestion.items({ query: "" });
|
|
1687
|
-
const matches = [...this.modelValue.matchAll(mentionRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
|
|
1688
|
-
if (!matches)
|
|
1689
|
-
return;
|
|
1690
|
-
matches.forEach((match) => {
|
|
1691
|
-
const mention = suggestions.find(({ id }) => id === match[1]);
|
|
1692
|
-
this.internalValue = this.internalValue.replace(`@${match[1]}`, ` <mention-component name="${mention.name}" id="${mention.id}"></mention-component>`);
|
|
1693
|
-
});
|
|
1694
|
-
},
|
|
1695
1529
|
destroyEditor() {
|
|
1696
1530
|
this.editor.destroy();
|
|
1697
1531
|
},
|