@dialpad/dialtone 9.32.0 → 9.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/css/dialtone.css +2 -2
  2. package/dist/tokens/css/variables-dark.css +1 -1
  3. package/dist/tokens/css/variables-expressive-dark.css +1 -1
  4. package/dist/tokens/css/variables-expressive-light.css +1 -1
  5. package/dist/tokens/css/variables-expressive-sm-dark.css +1 -1
  6. package/dist/tokens/css/variables-expressive-sm-light.css +1 -1
  7. package/dist/tokens/css/variables-light.css +1 -1
  8. package/dist/tokens/css/variables-tmo-dark.css +1 -1
  9. package/dist/tokens/css/variables-tmo-light.css +1 -1
  10. package/dist/tokens/less/variables-dark.less +1 -1
  11. package/dist/tokens/less/variables-expressive-dark.less +1 -1
  12. package/dist/tokens/less/variables-expressive-light.less +1 -1
  13. package/dist/tokens/less/variables-expressive-sm-dark.less +1 -1
  14. package/dist/tokens/less/variables-expressive-sm-light.less +1 -1
  15. package/dist/tokens/less/variables-light.less +1 -1
  16. package/dist/tokens/less/variables-tmo-dark.less +1 -1
  17. package/dist/tokens/less/variables-tmo-light.less +1 -1
  18. package/dist/vue2/common/utils.cjs +8 -1
  19. package/dist/vue2/common/utils.cjs.map +1 -1
  20. package/dist/vue2/common/utils.js +8 -1
  21. package/dist/vue2/common/utils.js.map +1 -1
  22. package/dist/vue2/lib/message-input.cjs +37 -3
  23. package/dist/vue2/lib/message-input.cjs.map +1 -1
  24. package/dist/vue2/lib/message-input.js +37 -3
  25. package/dist/vue2/lib/message-input.js.map +1 -1
  26. package/dist/vue2/lib/rich-text-editor.cjs +462 -66
  27. package/dist/vue2/lib/rich-text-editor.cjs.map +1 -1
  28. package/dist/vue2/lib/rich-text-editor.js +463 -67
  29. package/dist/vue2/lib/rich-text-editor.js.map +1 -1
  30. package/dist/vue2/types/common/utils/index.d.ts.map +1 -1
  31. package/dist/vue2/types/components/rich_text_editor/extensions/channels/channel.d.ts +2 -1
  32. package/dist/vue2/types/components/rich_text_editor/extensions/channels/channel.d.ts.map +1 -1
  33. package/dist/vue2/types/components/rich_text_editor/extensions/emoji/emoji.d.ts +1 -0
  34. package/dist/vue2/types/components/rich_text_editor/extensions/emoji/emoji.d.ts.map +1 -1
  35. package/dist/vue2/types/components/rich_text_editor/extensions/mentions/mention.d.ts +2 -1
  36. package/dist/vue2/types/components/rich_text_editor/extensions/mentions/mention.d.ts.map +1 -1
  37. package/dist/vue2/types/components/rich_text_editor/extensions/slash_command/SlashCommandComponent.vue.d.ts +47 -0
  38. package/dist/vue2/types/components/rich_text_editor/extensions/slash_command/SlashCommandComponent.vue.d.ts.map +1 -0
  39. package/dist/vue2/types/components/rich_text_editor/extensions/slash_command/SlashCommandSuggestion.vue.d.ts +17 -0
  40. package/dist/vue2/types/components/rich_text_editor/extensions/slash_command/SlashCommandSuggestion.vue.d.ts.map +1 -0
  41. package/dist/vue2/types/components/rich_text_editor/extensions/slash_command/slash_command.d.ts +2 -0
  42. package/dist/vue2/types/components/rich_text_editor/extensions/slash_command/slash_command.d.ts.map +1 -0
  43. package/dist/vue2/types/components/rich_text_editor/extensions/slash_command/suggestion.d.ts +12 -0
  44. package/dist/vue2/types/components/rich_text_editor/extensions/slash_command/suggestion.d.ts.map +1 -0
  45. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts +48 -1
  46. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  47. package/dist/vue2/types/components/rich_text_editor/slash_command_suggestion.d.ts +15 -0
  48. package/dist/vue2/types/components/rich_text_editor/slash_command_suggestion.d.ts.map +1 -0
  49. package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts +38 -2
  50. package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  51. package/dist/vue3/common/utils.cjs +8 -1
  52. package/dist/vue3/common/utils.cjs.map +1 -1
  53. package/dist/vue3/common/utils.js +8 -1
  54. package/dist/vue3/common/utils.js.map +1 -1
  55. package/dist/vue3/lib/message-input.cjs +8 -1
  56. package/dist/vue3/lib/message-input.cjs.map +1 -1
  57. package/dist/vue3/lib/message-input.js +8 -1
  58. package/dist/vue3/lib/message-input.js.map +1 -1
  59. package/dist/vue3/lib/rich-text-editor.cjs +172 -10
  60. package/dist/vue3/lib/rich-text-editor.cjs.map +1 -1
  61. package/dist/vue3/lib/rich-text-editor.js +173 -11
  62. package/dist/vue3/lib/rich-text-editor.js.map +1 -1
  63. package/dist/vue3/types/common/utils/index.d.ts.map +1 -1
  64. package/dist/vue3/types/components/rich_text_editor/extensions/channels/channel.d.ts +2 -1
  65. package/dist/vue3/types/components/rich_text_editor/extensions/channels/channel.d.ts.map +1 -1
  66. package/dist/vue3/types/components/rich_text_editor/extensions/emoji/emoji.d.ts +1 -0
  67. package/dist/vue3/types/components/rich_text_editor/extensions/emoji/emoji.d.ts.map +1 -1
  68. package/dist/vue3/types/components/rich_text_editor/extensions/mentions/mention.d.ts +2 -1
  69. package/dist/vue3/types/components/rich_text_editor/extensions/mentions/mention.d.ts.map +1 -1
  70. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +12 -1
  71. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  72. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +3 -2
  73. package/package.json +23 -23
@@ -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-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 v-bind=\"$attrs\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n @input=\"onInput($event)\"\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, -4]\"\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 data-qa=\"dt-message-input-emoji-picker-popover\"\n :open=\"emojiPickerOpened\"\n initial-focus-element=\"#searchInput\"\n padding=\"none\"\n @opened=\"(open) => { emojiPickerOpened = open }\"\n >\n <template #anchor>\n <dt-tooltip\n :message=\"emojiTooltipMessage\"\n :offset=\"[0, -4]\"\n >\n <template #anchor>\n <dt-button\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 :offset=\"[0, 0]\"\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 </dt-tooltip>\n </template>\n <template #content>\n <dt-emoji-picker\n v-bind=\"emojiPickerProps\"\n @skin-tone=\"onSkinTone\"\n @selected-emoji=\"onSelectEmoji\"\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: false,\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 * 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 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 * 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 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\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 this.emojiPickerOpened = false;\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.emojiPickerOpened = false;\n this.$emit('selected-emoji', emoji);\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 },\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","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+OA,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,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AAM;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,YAAAO,gBAApB,OAAQ,SAAC,IAAI,GAAA,CAAA;;;;cAXb,OAAA,SAAS;sBACd;AAAA,4BAED,MAGE;AAAA,kBAHFJ,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-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 v-bind=\"$attrs\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n @input=\"onInput($event)\"\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, -4]\"\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 data-qa=\"dt-message-input-emoji-picker-popover\"\n :open=\"emojiPickerOpened\"\n initial-focus-element=\"#searchInput\"\n padding=\"none\"\n @opened=\"(open) => { emojiPickerOpened = open }\"\n >\n <template #anchor>\n <dt-tooltip\n :message=\"emojiTooltipMessage\"\n :offset=\"[0, -4]\"\n >\n <template #anchor>\n <dt-button\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 :offset=\"[0, 0]\"\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 </dt-tooltip>\n </template>\n <template #content>\n <dt-emoji-picker\n v-bind=\"emojiPickerProps\"\n @skin-tone=\"onSkinTone\"\n @selected-emoji=\"onSelectEmoji\"\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: false,\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 * 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 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 * 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\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 this.emojiPickerOpened = false;\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.emojiPickerOpened = false;\n this.$emit('selected-emoji', emoji);\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","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+OA,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,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAaD,WAAW;AAAA,MACT,MAAM,CAAC,SAAS,QAAQ,MAAM;AAAA,MAC9B,SAAS;AAAA,MACT,UAAW,WAAW;AACpB,YAAI,OAAO,cAAc,UAAU;AACjC,iBAAO,iCAAiC,SAAS,SAAS;AAAA,QAC5D;AACA,eAAO;AAAA,MACR;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQD,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAW,cAAc;AACvB,eAAO,gCAAgC,SAAS,YAAY;AAAA,MAC7D;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BAAA;AAAA,oBAFC,MAAM,OAAQ,SAAC;AAAA,oBAChB,MAAK;AAAA;;;;;;;;;;;;;"}
@@ -34,10 +34,10 @@ 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");
37
38
  require("./skeleton.cjs");
38
39
  require("../chunks/icon_constants-QYpmdE0R.js");
39
40
  require("@dialpad/dialtone-icons/icons.json");
40
- require("emoji-regex");
41
41
  require("../chunks/list_item_constants-EiqkqZvP.js");
42
42
  require("./item-layout.cjs");
43
43
  require("./icon.cjs");
@@ -307,7 +307,7 @@ const suggestionOptions = {
307
307
  };
308
308
  const EmojiPluginKey = new state.PluginKey("emoji");
309
309
  const inputShortCodeRegex = /:\w+:$/;
310
- const pasteShortCodeRegex = /:\w+:/g;
310
+ const emojiShortCodeRegex = /:\w+:/g;
311
311
  const inputUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/;
312
312
  const pasteUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g;
313
313
  const inputRuleMatch = (match) => {
@@ -320,7 +320,7 @@ const inputRuleMatch = (match) => {
320
320
  }
321
321
  };
322
322
  const shortCodePasteMatch = (text) => {
323
- const matches = [...text.matchAll(pasteShortCodeRegex)];
323
+ const matches = [...text.matchAll(emojiShortCodeRegex)];
324
324
  return matches.filter((match) => common_emoji.codeToEmojiData(match[0])).map((match) => ({
325
325
  index: match.index,
326
326
  text: match[0],
@@ -389,7 +389,7 @@ const Emoji = core.Node.create({
389
389
  },
390
390
  type: this.type,
391
391
  getAttributes(attrs) {
392
- const unicode = common_emoji.shortcodeToEmojiData(attrs[0]).unicode_output;
392
+ const unicode = common_emoji.codeToEmojiData(attrs[0]).unicode_output;
393
393
  const emoji = String.fromCodePoint(parseInt(unicode, 16));
394
394
  return {
395
395
  code: emoji,
@@ -621,6 +621,30 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
621
621
  });
622
622
  }
623
623
  const MentionComponent = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
624
+ const mentionRegex = /@([\w.-]+)[^\w.-]?/g;
625
+ const mentionPasteMatch = (text, suggestions) => {
626
+ const matches = [...text.matchAll(mentionRegex)];
627
+ return matches.filter((match) => suggestions.some(({ id }) => id === match[1].trim())).map((match) => {
628
+ let mention = match[1];
629
+ if (!mention.endsWith(" "))
630
+ mention += " ";
631
+ return {
632
+ index: match.index,
633
+ text: mention,
634
+ match
635
+ };
636
+ });
637
+ };
638
+ const mentionInputMatch = (text, suggestions) => {
639
+ const match = text.match(/@([\w.-]+)[^\w.-]$/);
640
+ if (!match || !suggestions.some(({ id }) => id === match[1]))
641
+ return;
642
+ return {
643
+ index: match.index,
644
+ text: match[0],
645
+ match
646
+ };
647
+ };
624
648
  const MentionPlugin = Mention.extend({
625
649
  addNodeView() {
626
650
  return vue3.VueNodeViewRenderer(MentionComponent);
@@ -649,7 +673,38 @@ const MentionPlugin = Mention.extend({
649
673
  return `@${node.attrs.id}`;
650
674
  },
651
675
  renderHTML({ HTMLAttributes }) {
652
- return ["mention-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
676
+ return ["mention-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
677
+ },
678
+ addInputRules() {
679
+ var _a;
680
+ const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
681
+ return [
682
+ core.nodeInputRule({
683
+ find: (text) => mentionInputMatch(text, suggestions),
684
+ type: this.type,
685
+ getAttributes(attrs) {
686
+ return suggestions.find(({ id }) => id === attrs[0].replace("@", "").trim());
687
+ }
688
+ })
689
+ ];
690
+ },
691
+ addPasteRules() {
692
+ var _a;
693
+ const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
694
+ return [
695
+ core.nodePasteRule({
696
+ find: (text) => mentionPasteMatch(text, suggestions),
697
+ type: this.type,
698
+ getAttributes(attrs) {
699
+ return suggestions.find(({ id }) => id === attrs[0].trim());
700
+ }
701
+ })
702
+ ];
703
+ }
704
+ }).configure({
705
+ suggestion: {
706
+ char: "@",
707
+ pluginKey: new state.PluginKey("mentionSuggestion")
653
708
  }
654
709
  });
655
710
  const _sfc_main$3 = {
@@ -681,8 +736,34 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
681
736
  });
682
737
  }
683
738
  const ChannelComponent = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
739
+ const channelRegex = /#([\w-]+)[^\w-]?/g;
740
+ const channelPasteMatch = (text, suggestions) => {
741
+ const matches = [...text.matchAll(channelRegex)];
742
+ return matches.filter((match) => suggestions.some(({ id }) => id === match[1].trim())).map((match) => {
743
+ let channel = match[1];
744
+ if (!channel.endsWith(" "))
745
+ channel += " ";
746
+ return {
747
+ index: match.index,
748
+ text: channel,
749
+ match
750
+ };
751
+ });
752
+ };
753
+ const channelInputMatch = (text, suggestions) => {
754
+ const match = text.match(/#([\w-]+)[^\w-]$/);
755
+ if (!match || !suggestions.some(({ id }) => id === match[1]))
756
+ return;
757
+ return {
758
+ index: match.index,
759
+ text: match[0],
760
+ match
761
+ };
762
+ };
684
763
  const ChannelPlugin = Mention.extend({
685
764
  name: "channel",
765
+ group: "inline",
766
+ inline: true,
686
767
  addNodeView() {
687
768
  return vue3.VueNodeViewRenderer(ChannelComponent);
688
769
  },
@@ -710,7 +791,33 @@ const ChannelPlugin = Mention.extend({
710
791
  return `#${node.attrs.id}`;
711
792
  },
712
793
  renderHTML({ HTMLAttributes }) {
713
- return ["channel-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
794
+ return ["channel-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
795
+ },
796
+ addInputRules() {
797
+ var _a;
798
+ const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
799
+ return [
800
+ core.nodeInputRule({
801
+ find: (text) => channelInputMatch(text, suggestions),
802
+ type: this.type,
803
+ getAttributes(attrs) {
804
+ return suggestions.find(({ id }) => id === attrs[0].replace("#", "").trim());
805
+ }
806
+ })
807
+ ];
808
+ },
809
+ addPasteRules() {
810
+ var _a;
811
+ const suggestions = (_a = this.options.suggestion) == null ? void 0 : _a.items({ query: "" });
812
+ return [
813
+ core.nodePasteRule({
814
+ find: (text) => channelPasteMatch(text, suggestions),
815
+ type: this.type,
816
+ getAttributes(attrs) {
817
+ return suggestions.find(({ id }) => id === attrs[0].trim());
818
+ }
819
+ })
820
+ ];
714
821
  }
715
822
  }).configure({
716
823
  suggestion: {
@@ -1100,7 +1207,7 @@ const _sfc_main = {
1100
1207
  "input",
1101
1208
  /**
1102
1209
  * Event to sync the value with the parent
1103
- * @event input
1210
+ * @event update:value
1104
1211
  * @type {String|JSON}
1105
1212
  */
1106
1213
  "update:modelValue",
@@ -1120,7 +1227,8 @@ const _sfc_main = {
1120
1227
  data() {
1121
1228
  return {
1122
1229
  editor: null,
1123
- popoverOpened: false
1230
+ popoverOpened: false,
1231
+ internalValue: this.modelValue
1124
1232
  };
1125
1233
  },
1126
1234
  computed: {
@@ -1237,7 +1345,8 @@ const _sfc_main = {
1237
1345
  if (newValue === currentValue) {
1238
1346
  return;
1239
1347
  }
1240
- this.editor.commands.setContent(newValue, false);
1348
+ this.internalValue = newValue;
1349
+ this.insertContent();
1241
1350
  }
1242
1351
  },
1243
1352
  created() {
@@ -1250,7 +1359,6 @@ const _sfc_main = {
1250
1359
  createEditor() {
1251
1360
  this.editor = new vue3.Editor({
1252
1361
  autofocus: this.autoFocus,
1253
- content: this.modelValue,
1254
1362
  editable: this.editable,
1255
1363
  extensions: this.extensions,
1256
1364
  editorProps: {
@@ -1260,8 +1368,62 @@ const _sfc_main = {
1260
1368
  }
1261
1369
  }
1262
1370
  });
1371
+ this.insertContent();
1263
1372
  this.addEditorListeners();
1264
1373
  },
1374
+ /**
1375
+ * This function is necessary as tiptap doesn't render the content passed
1376
+ * directly through `editor.commands.setContent` the content passed down to it
1377
+ * should be already parsed. So We're parsing the elements into it's corresponding
1378
+ * HTML version before setting it.
1379
+ */
1380
+ insertContent() {
1381
+ this.parseMentions();
1382
+ this.parseChannels();
1383
+ this.parseEmojis();
1384
+ this.editor.commands.setContent(this.internalValue, true);
1385
+ },
1386
+ parseEmojis() {
1387
+ const matches = [...this.modelValue.matchAll(emojiRegex()), ...this.modelValue.matchAll(emojiShortCodeRegex)];
1388
+ if (!matches)
1389
+ return;
1390
+ matches.forEach((match) => {
1391
+ const emoji = common_emoji.codeToEmojiData(match[0]);
1392
+ if (!emoji)
1393
+ return;
1394
+ this.internalValue = this.internalValue.replace(new RegExp(` ${match[0]}`), ` <emoji-component code="${emoji.shortname}"></emoji-component>`);
1395
+ });
1396
+ },
1397
+ parseChannels() {
1398
+ if (!this.channelSuggestion)
1399
+ return;
1400
+ const suggestions = this.channelSuggestion.items({ query: "" });
1401
+ const matches = [...this.modelValue.matchAll(channelRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
1402
+ if (!matches)
1403
+ return;
1404
+ matches.forEach((match) => {
1405
+ const channel = suggestions.find(({ id }) => id === match[1]);
1406
+ this.internalValue = this.internalValue.replace(
1407
+ `#${match[1]}`,
1408
+ /** The space at the beginning is important as tiptap removes that while rendering.
1409
+ * So if multiple mentions, channels or emojis are next to each other it will fail
1410
+ */
1411
+ ` <channel-component name="${channel.name}" id="${channel.id}"></channel-component>`
1412
+ );
1413
+ });
1414
+ },
1415
+ parseMentions() {
1416
+ if (!this.mentionSuggestion)
1417
+ return;
1418
+ const suggestions = this.mentionSuggestion.items({ query: "" });
1419
+ const matches = [...this.modelValue.matchAll(mentionRegex)].filter((match) => suggestions.some(({ id }) => id === match[1]));
1420
+ if (!matches)
1421
+ return;
1422
+ matches.forEach((match) => {
1423
+ const mention = suggestions.find(({ id }) => id === match[1]);
1424
+ this.internalValue = this.internalValue.replace(`@${match[1]}`, ` <mention-component name="${mention.name}" id="${mention.id}"></mention-component>`);
1425
+ });
1426
+ },
1265
1427
  destroyEditor() {
1266
1428
  this.editor.destroy();
1267
1429
  },