@dialpad/dialtone 9.131.1 → 9.132.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 (52) hide show
  1. package/dist/css/dialtone-default-theme.css +1783 -5185
  2. package/dist/css/dialtone-default-theme.min.css +1 -1
  3. package/dist/css/dialtone-docs.json +1 -1
  4. package/dist/css/dialtone.css +622 -1999
  5. package/dist/css/dialtone.min.css +1 -1
  6. package/dist/tokens/doc.json +46028 -46028
  7. package/dist/vue2/common/emoji/index.cjs +1 -1
  8. package/dist/vue2/common/emoji/index.cjs.map +1 -1
  9. package/dist/vue2/common/emoji/index.js +25 -17
  10. package/dist/vue2/common/emoji/index.js.map +1 -1
  11. package/dist/vue2/component-documentation.json +1 -1
  12. package/dist/vue2/lib/emoji/emoji.cjs +1 -1
  13. package/dist/vue2/lib/emoji/emoji.cjs.map +1 -1
  14. package/dist/vue2/lib/emoji/emoji.js +16 -16
  15. package/dist/vue2/lib/emoji/emoji.js.map +1 -1
  16. package/dist/vue2/lib/message-input/message-input.cjs +1 -1
  17. package/dist/vue2/lib/message-input/message-input.cjs.map +1 -1
  18. package/dist/vue2/lib/message-input/message-input.js +14 -7
  19. package/dist/vue2/lib/message-input/message-input.js.map +1 -1
  20. package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs +7 -7
  21. package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  22. package/dist/vue2/lib/rich-text-editor/rich-text-editor.js +387 -402
  23. package/dist/vue2/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  24. package/dist/vue2/types/common/emoji/index.d.ts.map +1 -1
  25. package/dist/vue2/types/components/rich_text_editor/extensions/emoji/emoji.d.ts.map +1 -1
  26. package/dist/vue2/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts +1 -1
  27. package/dist/vue2/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts.map +1 -1
  28. package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts +1 -1
  29. package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  30. package/dist/vue3/common/emoji/index.cjs +1 -1
  31. package/dist/vue3/common/emoji/index.cjs.map +1 -1
  32. package/dist/vue3/common/emoji/index.js +39 -33
  33. package/dist/vue3/common/emoji/index.js.map +1 -1
  34. package/dist/vue3/component-documentation.json +1 -1
  35. package/dist/vue3/lib/emoji/emoji.cjs +1 -1
  36. package/dist/vue3/lib/emoji/emoji.cjs.map +1 -1
  37. package/dist/vue3/lib/emoji/emoji.js +17 -17
  38. package/dist/vue3/lib/emoji/emoji.js.map +1 -1
  39. package/dist/vue3/lib/message-input/message-input.cjs +1 -1
  40. package/dist/vue3/lib/message-input/message-input.cjs.map +1 -1
  41. package/dist/vue3/lib/message-input/message-input.js +59 -51
  42. package/dist/vue3/lib/message-input/message-input.js.map +1 -1
  43. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +3 -3
  44. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  45. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +125 -119
  46. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  47. package/dist/vue3/types/common/emoji/index.d.ts.map +1 -1
  48. package/dist/vue3/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts +1 -1
  49. package/dist/vue3/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts.map +1 -1
  50. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +2 -1
  51. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  52. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"message-input.js","sources":["../../../recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue","../../../recipes/conversation_view/message_input/extensions/meeting_pill/meeting_pill.js","../../../recipes/conversation_view/message_input/message_input.vue"],"sourcesContent":["<template>\n <node-view-wrapper class=\"d-recipe-message-input-meeting-pill\">\n <dt-item-layout\n class=\"d-recipe-message-input-meeting-pill__layout\"\n unstyled\n >\n <template #left>\n <div class=\"d-recipe-message-input-meeting-pill__icon\">\n <dt-icon-video\n size=\"400\"\n />\n </div>\n </template>\n {{ node.attrs.text }}\n <template #right>\n <div class=\"d-recipe-message-input-meeting-pill__close\">\n <dt-button\n circle\n importance=\"clear\"\n size=\"xs\"\n :aria-label=\"closeButtonTitle\"\n :title=\"closeButtonTitle\"\n @click=\"close\"\n >\n <template #icon>\n <dt-icon-close\n size=\"300\"\n />\n </template>\n </dt-button>\n </div>\n </template>\n </dt-item-layout>\n </node-view-wrapper>\n</template>\n\n<script>\nimport { NodeViewWrapper, nodeViewProps } from '@tiptap/vue-2';\nimport { DtItemLayout } from '@/components/item_layout';\nimport { DtIconClose, DtIconVideo } from '@dialpad/dialtone-icons/vue2';\nimport { DtButton } from '@/components/button';\nimport { DialtoneLocalization } from '@/localization';\n\nexport default {\n name: 'MeetingPill',\n\n components: {\n NodeViewWrapper,\n DtItemLayout,\n DtIconClose,\n DtButton,\n DtIconVideo,\n },\n\n props: nodeViewProps,\n\n emits: ['meeting-pill-close'],\n\n data () {\n return {\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n closeButtonTitle () {\n return this.i18n.$t('DIALTONE_CLOSE_BUTTON');\n },\n },\n\n methods: {\n close (e) {\n // Get the callback from extension storage\n const onCloseCallback = this.editor?.storage?.meetingPill?.onClose;\n\n if (onCloseCallback && typeof onCloseCallback === 'function') {\n onCloseCallback(e);\n }\n },\n },\n};\n</script>\n","import { mergeAttributes, Node } from '@tiptap/core';\nimport { VueNodeViewRenderer } from '@tiptap/vue-2';\nimport MeetingPill from './MeetingPill.vue';\n\nexport default Node.create({\n name: 'meetingPill',\n\n atom: true,\n group: 'inline',\n inline: true,\n\n addOptions () {\n return {\n onClose: () => {},\n };\n },\n\n addStorage () {\n return {\n onClose: this.options.onClose,\n };\n },\n\n addNodeView () {\n return VueNodeViewRenderer(MeetingPill);\n },\n\n addAttributes () {\n return {\n text: {\n default: 'Please pass in \"text\" attribute',\n },\n };\n },\n\n parseHTML () {\n return [\n {\n tag: 'meeting-pill',\n },\n ];\n },\n\n renderText () {\n return '/dpm';\n },\n\n renderHTML ({ HTMLAttributes }) {\n return ['meeting-pill', mergeAttributes(HTMLAttributes)];\n },\n});\n","<!-- eslint-disable max-lines -->\n<template>\n <div\n data-qa=\"dt-recipe-message-input\"\n role=\"presentation\"\n class=\"d-recipe-message-input\"\n @dragover.prevent\n @drop.prevent=\"onDrop\"\n @paste=\"onPaste\"\n @mousedown=\"onMousedown\"\n >\n <!-- @slot Renders above the input, but still within the borders. -->\n <slot name=\"top\" />\n\n <!-- set key to selectedText to force update. otherwise this component may not reflect the active selection -->\n <dt-recipe-message-input-topbar\n v-if=\"richText\"\n :key=\"selectedText\"\n :bold-button-options=\"boldButtonOptions\"\n :italic-button-options=\"italicButtonOptions\"\n :strike-button-options=\"strikeButtonOptions\"\n :bullet-list-button-options=\"bulletListButtonOptions\"\n :ordered-list-button-options=\"orderedListButtonOptions\"\n :block-quote-button-options=\"blockQuoteButtonOptions\"\n :code-button-options=\"codeButtonOptions\"\n :code-block-button-options=\"codeBlockButtonOptions\"\n :is-selection-active=\"isSelectionActive\"\n @click=\"handleTopbarClick\"\n >\n <template #link>\n <dt-recipe-message-input-link\n ref=\"link\"\n :open=\"linkDialogOpen\"\n :link-button-options=\"linkButtonOptions\"\n :is-selection-active=\"isSelectionActive\"\n @opened=\"linkDialogOpened\"\n @set-link=\"setLink\"\n @remove-link=\"removeLink\"\n />\n </template>\n </dt-recipe-message-input-topbar>\n <!-- Some wrapper to restrict the height and show the scrollbar -->\n <div\n v-dt-scrollbar\n class=\"d-recipe-message-input__editor-wrapper\"\n :style=\"{ 'max-height': maxHeight }\"\n >\n <dt-rich-text-editor\n ref=\"richTextEditor\"\n v-model=\"internalInputValue\"\n :editable=\"editable\"\n :input-aria-label=\"inputAriaLabel\"\n :input-class=\"inputClass\"\n :output-format=\"outputFormat\"\n :auto-focus=\"autoFocus\"\n :link=\"richText\"\n :placeholder=\"placeholder\"\n :prevent-typing=\"preventTyping\"\n :mention-suggestion=\"mentionSuggestion\"\n :channel-suggestion=\"channelSuggestion\"\n :slash-command-suggestion=\"slashCommandSuggestion\"\n :paste-rich-text=\"richText\"\n :allow-blockquote=\"richText\"\n :allow-bold=\"richText\"\n :allow-bullet-list=\"richText\"\n :allow-code=\"richText\"\n :allow-codeblock=\"richText\"\n :allow-italic=\"richText\"\n :allow-strike=\"richText\"\n :allow-underline=\"richText\"\n :additional-extensions=\"additionalExtensions\"\n :hide-link-bubble-menu=\"hideLinkBubbleMenu\"\n v-bind=\"$attrs\"\n @input=\"onInput\"\n @text-input=\"onTextInput\"\n @enter=\"onSend\"\n @selected=\"selectedText = $event\"\n @selected-command=\"$emit('selected-command', $event)\"\n @edit-link=\"initLinkDialog\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n v-on=\"$listeners\"\n />\n </div>\n <!-- @slot Slot for attachment carousel -->\n <slot name=\"middle\" />\n <!-- Section for the bottom UI -->\n <section class=\"d-recipe-message-input__bottom-section\">\n <!-- Left content -->\n <div class=\"d-recipe-message-input__bottom-section-left\">\n <dt-stack\n direction=\"row\"\n gap=\"200\"\n >\n <dt-button\n v-if=\"showImagePicker\"\n v-dt-tooltip:top-start=\"imagePickerButtonLabel\"\n data-qa=\"dt-recipe-message-input-image-btn\"\n size=\"sm\"\n class=\"d-recipe-message-input__button\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"imagePickerButtonLabel\"\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-image size=\"300\" />\n </template>\n </dt-button>\n <dt-input\n ref=\"messageInputImageUpload\"\n data-qa=\"dt-recipe-message-input-image-input\"\n accept=\"image/*, video/*\"\n type=\"file\"\n class=\"d-recipe-message-input__image-input\"\n multiple\n hidden\n @input=\"onImageUpload\"\n />\n <dt-popover\n v-if=\"showEmojiPicker\"\n open.sync=\"emojiPickerOpened\"\n data-qa=\"dt-recipe-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=\"emojiPickerButtonLabel\"\n v-bind=\"attrs\"\n data-qa=\"dt-recipe-message-input-emoji-picker-btn\"\n size=\"sm\"\n class=\"d-recipe-message-input__button\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"emojiPickerButtonLabel\"\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-very-satisfied\n v-if=\"emojiPickerHovered\"\n size=\"300\"\n />\n <dt-icon-satisfied\n v-else\n size=\"300\"\n />\n </template>\n </dt-button>\n </template>\n <template #content=\"{ close }\">\n <dt-emoji-picker\n v-bind=\"emojiPickerProps\"\n @add-emoji=\"$emit('add-emoji')\"\n @skin-tone=\"onSkinTone\"\n @selected-emoji=\"(emoji) => onSelectEmoji(emoji, close)\"\n />\n </template>\n </dt-popover>\n <!-- @slot Slot for emojiGiphy picker -->\n <slot name=\"emojiGiphyPicker\" />\n <!-- @slot Slot to add extra action icons next to default ones -->\n <slot name=\"customActionIcons\" />\n </dt-stack>\n </div>\n <!-- Right content -->\n <div class=\"d-recipe-message-input__bottom-section-right\">\n <dt-stack\n direction=\"row\"\n gap=\"300\"\n >\n <!-- @slot Slot for sms count -->\n <div class=\"d-recipe-message-input__sms-count\">\n <slot name=\"smsCount\" />\n </div>\n\n <!-- Optionally displayed remaining character counter -->\n <dt-tooltip\n v-if=\"Boolean(showCharacterLimit)\"\n class=\"d-recipe-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-recipe-message-input__remaining-char\"\n data-qa=\"dt-recipe-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 v-dt-tooltip=\"cancelButtonLabel\"\n data-qa=\"dt-recipe-message-input-cancel-button\"\n class=\"d-recipe-message-input__button d-recipe-message-input__cancel-button\"\n size=\"sm\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"cancelButtonLabel\"\n @click=\"onCancel\"\n >\n <p>{{ cancelButtonLabel }}</p>\n </dt-button>\n\n <!-- @slot Slot for sendButton picker -->\n <slot name=\"sendButton\">\n <!-- Send button -->\n <!-- Right positioned UI - send button -->\n <dt-button\n v-if=\"showSend\"\n v-dt-tooltip:top-end=\"sendButtonLabel\"\n data-qa=\"dt-recipe-message-input-send-btn\"\n size=\"sm\"\n kind=\"default\"\n importance=\"primary\"\n :class=\"[\n 'd-recipe-message-input__button d-recipe-message-input__send-button',\n {\n 'd-recipe-message-input__send-button--disabled': isSendDisabled,\n 'd-btn--icon-only': showSendIcon,\n },\n ]\"\n :aria-label=\"sendButtonLabel\"\n :aria-disabled=\"isSendDisabled\"\n @click=\"onSend\"\n >\n <template\n v-if=\"showSendIcon\"\n #icon\n >\n <!-- @slot Slot for send button icon -->\n <slot\n name=\"sendIcon\"\n :icon-size=\"sendIconSize\"\n >\n <dt-icon-send\n :size=\"sendIconSize\"\n />\n </slot>\n </template>\n <template\n v-if=\"showSend.text\"\n >\n <p>{{ showSend.text }}</p>\n </template>\n </dt-button>\n </slot>\n </dt-stack>\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 lastActiveNodes from './last_active_nodes';\nimport MeetingPill from './extensions/meeting_pill/meeting_pill';\nimport { DtButton } from '@/components/button';\nimport { DtEmojiPicker } from '@/components/emoji_picker';\nimport { DtPopover } from '@/components/popover';\nimport { DtInput } from '@/components/input';\nimport { DtTooltip } from '@/components/tooltip';\nimport { DtStack } from '@/components/stack';\nimport {\n DtIconImage, DtIconVerySatisfied, DtIconSatisfied, DtIconSend,\n} from '@dialpad/dialtone-icons/vue2';\nimport DtRecipeMessageInputTopbar from './message_input_topbar.vue';\nimport DtRecipeMessageInputLink from './message_input_link.vue';\nimport { DialtoneLocalization } from '@/localization';\n\nimport {\n EDITOR_SUPPORTED_LINK_PROTOCOLS,\n EDITOR_DEFAULT_LINK_PREFIX,\n} from '../editor/editor_constants.js';\n\nexport default {\n name: 'DtRecipeMessageInput',\n\n components: {\n DtButton,\n DtEmojiPicker,\n DtInput,\n DtPopover,\n DtRecipeMessageInputTopbar,\n DtRecipeMessageInputLink,\n DtRichTextEditor,\n DtTooltip,\n DtStack,\n DtIconImage,\n DtIconVerySatisfied,\n DtIconSatisfied,\n DtIconSend,\n },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Displays all the buttons for rich text formatting above the message input, and enables it within the editor.\n * Rich text formatting for the purposes of this component is defined as:\n *\n * bold, italic, strikethrough, lists, blockquotes, inline code tags, and code blocks.\n *\n * If you are sending a message to a phone rather than a Dialpad to Dialpad message, you should have this as false.\n */\n richText: {\n type: Boolean,\n default: true,\n },\n\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 value: {\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 * Prevents the user from typing any further. Deleting text will still work.\n */\n preventTyping: {\n type: Boolean,\n default: false,\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: 'json',\n validator (outputFormat) {\n return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);\n },\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 },\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: () => ({}),\n },\n\n /**\n * Send button defaults.\n * TODO (Dialtone 10):\n * - Change to `showSendButton`, boolean only.\n */\n showSend: {\n type: [Boolean, Object],\n default: () => ({}),\n },\n\n /**\n * TODO (Dialtone 10):\n * - Add a prop `iconOnly` default: true to control if localized send button text should be shown\n */\n\n /**\n * Cancel button defaults.\n * TODO (Dialtone 10): Change to `showCancelButton`, boolean only.\n */\n showCancel: {\n type: [Boolean, Object],\n default: () => ({}),\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 * descriptive text fields for the bold button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n boldButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + B',\n }),\n },\n\n /**\n * descriptive text fields for the italic button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n italicButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + I',\n }),\n },\n\n /**\n * descriptive text fields for the strikethrough button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n strikeButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Shift + S',\n }),\n },\n\n /**\n * descriptive text fields for the link button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n linkButtonOptions: {\n type: Object,\n default: () => ({\n // TODO: implement mod k\n keyboardShortcutText: 'Mod + K',\n linkPlaceholder: 'e.g. https://www.dialpad.com',\n }),\n },\n\n /**\n * descriptive text fields for the bullet list button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n bulletListButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Shift + 8',\n }),\n },\n\n /**\n * descriptive text fields for the ordered list button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n orderedListButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Shift + 7',\n }),\n },\n\n /**\n * descriptive text fields for the italic button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n blockQuoteButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Shift + B',\n }),\n },\n\n /**\n * descriptive text fields for the code button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n codeButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + E',\n }),\n },\n\n /**\n * descriptive text fields for the code block button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n codeBlockButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Alt + C',\n }),\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 * Fires when meeting pill is closed\n *\n * @event meeting-pill-close\n * @type {String}\n */\n 'meeting-pill-close',\n\n /**\n * Event to sync the value with the parent\n * @event update:value\n * @type {String|JSON}\n */\n 'update:value',\n\n /**\n * Emitted when input changes, returns text content only\n * @event text-input\n * @type {String}\n */\n 'text-input',\n\n /**\n * Emitted when the 'Add emoji' button is clicked\n * @event add-emoji\n * @type {Boolean}\n */\n 'add-emoji',\n ],\n\n data () {\n return {\n // If an ordered list is nested within an unordered list, we only want to show the currently selected list as\n // active. This function performs the logic to determine the farthest active node from the root.\n lastActiveNodes,\n additionalExtensions: [\n MeetingPill.configure({\n onClose: (event) => {\n this.$emit('meeting-pill-close', event);\n },\n }),\n ],\n\n internalInputValue: this.value, // internal input content\n imagePickerFocus: false,\n emojiPickerFocus: false,\n emojiPickerOpened: false,\n isFocused: false,\n linkOptions: {\n class: 'd-link d-c-text d-d-inline-block',\n },\n\n linkDialogOpen: false,\n selectedText: '',\n text: '',\n hideLinkBubbleMenu: false,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n showSendIcon () {\n return !this.showSend.text;\n },\n\n inputLength () {\n return this.text.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 emojiPickerHovered () {\n return this.emojiPickerFocus || this.emojiPickerOpened;\n },\n\n sendIconSize () {\n return '300';\n },\n\n sendButtonLabel () {\n return this.i18n.$t('DIALTONE_MESSAGE_INPUT_SEND_BUTTON_ARIA_LABEL');\n },\n\n imagePickerButtonLabel () {\n return this.i18n.$t('DIALTONE_MESSAGE_INPUT_IMAGE_PICKER_BUTTON_ARIA_LABEL');\n },\n\n emojiPickerButtonLabel () {\n return this.i18n.$t('DIALTONE_MESSAGE_INPUT_EMOJI_PICKER_BUTTON_ARIA_LABEL');\n },\n\n cancelButtonLabel () {\n return this.i18n.$t('DIALTONE_MESSAGE_INPUT_CANCEL_BUTTON_ARIA_LABEL');\n },\n },\n\n watch: {\n value (newValue) {\n this.internalInputValue = newValue;\n },\n\n emojiPickerOpened (newValue) {\n if (!newValue) {\n this.$refs.richTextEditor?.focusEditor();\n }\n },\n },\n\n created () {\n if (this.value && this.outputFormat === 'text') {\n this.internalInputValue = this.value.replace(/\\n/g, '<br>');\n } else {\n this.internalInputValue = this.value;\n }\n },\n\n methods: {\n linkDialogOpened (value) {\n this.linkDialogOpen = value;\n if (value === true) {\n this.initLinkDialog();\n } else {\n this.hideLinkBubbleMenu = false;\n this.$refs.richTextEditor?.focusEditor();\n }\n },\n\n handleTopbarClick (type) {\n const editor = this.$refs.richTextEditor?.editor;\n // Key is the name returned in the event, value is the name of the TipTap command function to run.\n const typeToCommandMap = {\n bold: () => editor?.chain().focus().toggleBold().run(),\n italic: () => editor?.chain().focus().toggleItalic().run(),\n strike: () => editor?.chain().focus().toggleStrike().run(),\n bulletList: () => editor?.chain().focus().toggleBulletList().run(),\n orderedList: () => editor?.chain().focus().toggleOrderedList().run(),\n blockquote: () => editor?.chain().focus().toggleBlockquote().run(),\n code: () => editor?.chain().focus().toggleCode().run(),\n codeBlock: () => editor?.chain().focus().toggleCodeBlock().run(),\n };\n\n if (editor && typeToCommandMap[type]) {\n typeToCommandMap[type]();\n }\n },\n\n // Checks if the node currently selected is active ex/ the bold button is active if the selected text is bold\n // eslint-disable-next-line complexity\n isSelectionActive (type) {\n if (['bulletList', 'orderedList'].includes(type)) {\n return this.lastActiveNodes(this.$refs.richTextEditor?.editor?.state, [{ type: 'bulletList' }, { type: 'orderedList' }]).includes(type) && this.isFocused;\n }\n return this.$refs.richTextEditor?.editor?.isActive(type) && this.isFocused;\n },\n\n initLinkDialog () {\n this.$refs.link.setInitialValues(this.selectedText, this.$refs.richTextEditor?.editor?.getAttributes('link')?.href);\n this.hideLinkBubbleMenu = true;\n this.linkDialogOpen = true;\n },\n\n removeLink () {\n this.$refs.richTextEditor?.removeLink();\n this.linkDialogOpen = false;\n },\n\n setLink (linkText, linkInput) {\n this.$refs.richTextEditor.setLink(\n linkInput, linkText, this.linkOptions, EDITOR_SUPPORTED_LINK_PROTOCOLS, EDITOR_DEFAULT_LINK_PREFIX,\n );\n this.linkDialogOpen = false;\n },\n\n // Mousedown instead of click because it fires before the blur event.\n onMousedown (e) {\n const isWithinInput = this.$refs.richTextEditor.$el.querySelector('.tiptap').contains(e.target);\n\n // If the click is not within the tiptap rich text editor input itself, but still within the wrapping div,\n // focus the editor.\n if (!isWithinInput) {\n // Prevent default prevents blurring the rich text editor input when it is already focused.\n e.preventDefault();\n this.$refs.richTextEditor.focusEditor();\n }\n },\n\n onDrop (e) {\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, close) {\n if (!emoji) {\n return;\n }\n\n if (!emoji.shift_key) {\n close();\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 image: emoji.image,\n name: emoji.name,\n },\n });\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 onInput (event) {\n this.$emit('update:value', event);\n },\n\n onTextInput (event) {\n this.text = event;\n this.$emit('text-input', event);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","NodeViewWrapper","DtItemLayout","DtIconClose","DtButton","DtIconVideo","nodeViewProps","DialtoneLocalization","e","onCloseCallback","_c","_b","_a","MeetingPill","Node","VueNodeViewRenderer","HTMLAttributes","mergeAttributes","DtEmojiPicker","DtInput","DtPopover","DtRecipeMessageInputTopbar","DtRecipeMessageInputLink","DtRichTextEditor","DtTooltip","DtStack","DtIconImage","DtIconVerySatisfied","DtIconSatisfied","DtIconSend","autoFocus","RICH_TEXT_EDITOR_AUTOFOCUS_TYPES","outputFormat","RICH_TEXT_EDITOR_OUTPUT_FORMATS","lastActiveNodes","event","newValue","value","type","editor","typeToCommandMap","_d","linkText","linkInput","EDITOR_SUPPORTED_LINK_PROTOCOLS","EDITOR_DEFAULT_LINK_PREFIX","dt","files","skinTone","emoji","close"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,EACA;AAAA,EAEA,OAAAC;AAAA,EAEA,OAAA,CAAA,oBAAA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,MAAA,IAAAC,EAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,UAAA;AAAA,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A,MAAA,KAAA,kBAGA,KAAA,MAAA,UAAA,KAAA,kBAAA;AAAA,IACA;AAAA,IAEA,WAAA;AACA,WAAA,MAAA,QAAA;AAAA,IACA;AAAA,IAEA,QAAAd,GAAA;AACA,WAAA,MAAA,gBAAAA,CAAA;AAAA,IACA;AAAA,IAEA,YAAAA,GAAA;AACA,WAAA,OAAAA,GACA,KAAA,MAAA,cAAAA,CAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"message-input.js","sources":["../../../recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue","../../../recipes/conversation_view/message_input/extensions/meeting_pill/meeting_pill.js","../../../recipes/conversation_view/message_input/message_input.vue"],"sourcesContent":["<template>\n <node-view-wrapper class=\"d-recipe-message-input-meeting-pill\">\n <dt-item-layout\n class=\"d-recipe-message-input-meeting-pill__layout\"\n unstyled\n >\n <template #left>\n <div class=\"d-recipe-message-input-meeting-pill__icon\">\n <dt-icon-video\n size=\"400\"\n />\n </div>\n </template>\n {{ node.attrs.text }}\n <template #right>\n <div class=\"d-recipe-message-input-meeting-pill__close\">\n <dt-button\n circle\n importance=\"clear\"\n size=\"xs\"\n :aria-label=\"closeButtonTitle\"\n :title=\"closeButtonTitle\"\n @click=\"close\"\n >\n <template #icon>\n <dt-icon-close\n size=\"300\"\n />\n </template>\n </dt-button>\n </div>\n </template>\n </dt-item-layout>\n </node-view-wrapper>\n</template>\n\n<script>\nimport { NodeViewWrapper, nodeViewProps } from '@tiptap/vue-2';\nimport { DtItemLayout } from '@/components/item_layout';\nimport { DtIconClose, DtIconVideo } from '@dialpad/dialtone-icons/vue2';\nimport { DtButton } from '@/components/button';\nimport { DialtoneLocalization } from '@/localization';\n\nexport default {\n name: 'MeetingPill',\n\n components: {\n NodeViewWrapper,\n DtItemLayout,\n DtIconClose,\n DtButton,\n DtIconVideo,\n },\n\n props: nodeViewProps,\n\n emits: ['meeting-pill-close'],\n\n data () {\n return {\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n closeButtonTitle () {\n return this.i18n.$t('DIALTONE_CLOSE_BUTTON');\n },\n },\n\n methods: {\n close (e) {\n // Get the callback from extension storage\n const onCloseCallback = this.editor?.storage?.meetingPill?.onClose;\n\n if (onCloseCallback && typeof onCloseCallback === 'function') {\n onCloseCallback(e);\n }\n },\n },\n};\n</script>\n","import { mergeAttributes, Node } from '@tiptap/core';\nimport { VueNodeViewRenderer } from '@tiptap/vue-2';\nimport MeetingPill from './MeetingPill.vue';\n\nexport default Node.create({\n name: 'meetingPill',\n\n atom: true,\n group: 'inline',\n inline: true,\n\n addOptions () {\n return {\n onClose: () => {},\n };\n },\n\n addStorage () {\n return {\n onClose: this.options.onClose,\n };\n },\n\n addNodeView () {\n return VueNodeViewRenderer(MeetingPill);\n },\n\n addAttributes () {\n return {\n text: {\n default: 'Please pass in \"text\" attribute',\n },\n };\n },\n\n parseHTML () {\n return [\n {\n tag: 'meeting-pill',\n },\n ];\n },\n\n renderText () {\n return '/dpm';\n },\n\n renderHTML ({ HTMLAttributes }) {\n return ['meeting-pill', mergeAttributes(HTMLAttributes)];\n },\n});\n","<!-- eslint-disable max-lines -->\n<template>\n <div\n data-qa=\"dt-recipe-message-input\"\n role=\"presentation\"\n class=\"d-recipe-message-input\"\n @dragover.prevent\n @drop.prevent=\"onDrop\"\n @paste=\"onPaste\"\n @mousedown=\"onMousedown\"\n >\n <!-- @slot Renders above the input, but still within the borders. -->\n <slot name=\"top\" />\n\n <!-- set key to selectedText to force update. otherwise this component may not reflect the active selection -->\n <dt-recipe-message-input-topbar\n v-if=\"richText\"\n :key=\"selectedText\"\n :bold-button-options=\"boldButtonOptions\"\n :italic-button-options=\"italicButtonOptions\"\n :strike-button-options=\"strikeButtonOptions\"\n :bullet-list-button-options=\"bulletListButtonOptions\"\n :ordered-list-button-options=\"orderedListButtonOptions\"\n :block-quote-button-options=\"blockQuoteButtonOptions\"\n :code-button-options=\"codeButtonOptions\"\n :code-block-button-options=\"codeBlockButtonOptions\"\n :is-selection-active=\"isSelectionActive\"\n @click=\"handleTopbarClick\"\n >\n <template #link>\n <dt-recipe-message-input-link\n ref=\"link\"\n :open=\"linkDialogOpen\"\n :link-button-options=\"linkButtonOptions\"\n :is-selection-active=\"isSelectionActive\"\n @opened=\"linkDialogOpened\"\n @set-link=\"setLink\"\n @remove-link=\"removeLink\"\n />\n </template>\n </dt-recipe-message-input-topbar>\n <!-- Some wrapper to restrict the height and show the scrollbar -->\n <div\n v-dt-scrollbar\n class=\"d-recipe-message-input__editor-wrapper\"\n :style=\"{ 'max-height': maxHeight }\"\n >\n <dt-rich-text-editor\n ref=\"richTextEditor\"\n v-model=\"internalInputValue\"\n :editable=\"editable\"\n :input-aria-label=\"inputAriaLabel\"\n :input-class=\"inputClass\"\n :output-format=\"outputFormat\"\n :auto-focus=\"autoFocus\"\n :link=\"richText\"\n :placeholder=\"placeholder\"\n :prevent-typing=\"preventTyping\"\n :mention-suggestion=\"mentionSuggestion\"\n :channel-suggestion=\"channelSuggestion\"\n :slash-command-suggestion=\"slashCommandSuggestion\"\n :paste-rich-text=\"richText\"\n :allow-blockquote=\"richText\"\n :allow-bold=\"richText\"\n :allow-bullet-list=\"richText\"\n :allow-code=\"richText\"\n :allow-codeblock=\"richText\"\n :allow-italic=\"richText\"\n :allow-strike=\"richText\"\n :allow-underline=\"richText\"\n :additional-extensions=\"additionalExtensions\"\n :hide-link-bubble-menu=\"hideLinkBubbleMenu\"\n v-bind=\"$attrs\"\n @input=\"onInput\"\n @text-input=\"onTextInput\"\n @enter=\"onSend\"\n @selected=\"selectedText = $event\"\n @selected-command=\"$emit('selected-command', $event)\"\n @edit-link=\"initLinkDialog\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n v-on=\"$listeners\"\n />\n </div>\n <!-- @slot Slot for attachment carousel -->\n <slot name=\"middle\" />\n <!-- Section for the bottom UI -->\n <section class=\"d-recipe-message-input__bottom-section\">\n <!-- Left content -->\n <div class=\"d-recipe-message-input__bottom-section-left\">\n <dt-stack\n direction=\"row\"\n gap=\"200\"\n >\n <dt-button\n v-if=\"showImagePicker\"\n v-dt-tooltip:top-start=\"imagePickerButtonLabel\"\n data-qa=\"dt-recipe-message-input-image-btn\"\n size=\"sm\"\n class=\"d-recipe-message-input__button\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"imagePickerButtonLabel\"\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-image size=\"300\" />\n </template>\n </dt-button>\n <dt-input\n ref=\"messageInputImageUpload\"\n data-qa=\"dt-recipe-message-input-image-input\"\n accept=\"image/*, video/*\"\n type=\"file\"\n class=\"d-recipe-message-input__image-input\"\n multiple\n hidden\n @input=\"onImageUpload\"\n />\n <dt-popover\n v-if=\"showEmojiPicker\"\n open.sync=\"emojiPickerOpened\"\n data-qa=\"dt-recipe-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=\"emojiPickerButtonLabel\"\n v-bind=\"attrs\"\n data-qa=\"dt-recipe-message-input-emoji-picker-btn\"\n size=\"sm\"\n class=\"d-recipe-message-input__button\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"emojiPickerButtonLabel\"\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-very-satisfied\n v-if=\"emojiPickerHovered\"\n size=\"300\"\n />\n <dt-icon-satisfied\n v-else\n size=\"300\"\n />\n </template>\n </dt-button>\n </template>\n <template #content=\"{ close }\">\n <dt-emoji-picker\n v-bind=\"emojiPickerProps\"\n @add-emoji=\"$emit('add-emoji')\"\n @skin-tone=\"onSkinTone\"\n @selected-emoji=\"(emoji) => onSelectEmoji(emoji, close)\"\n @scroll-bottom-reached=\"$emit('emoji-scroll-bottom-reached')\"\n />\n </template>\n </dt-popover>\n <!-- @slot Slot for emojiGiphy picker -->\n <slot name=\"emojiGiphyPicker\" />\n <!-- @slot Slot to add extra action icons next to default ones -->\n <slot name=\"customActionIcons\" />\n </dt-stack>\n </div>\n <!-- Right content -->\n <div class=\"d-recipe-message-input__bottom-section-right\">\n <dt-stack\n direction=\"row\"\n gap=\"300\"\n >\n <!-- @slot Slot for sms count -->\n <div class=\"d-recipe-message-input__sms-count\">\n <slot name=\"smsCount\" />\n </div>\n\n <!-- Optionally displayed remaining character counter -->\n <dt-tooltip\n v-if=\"Boolean(showCharacterLimit)\"\n class=\"d-recipe-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-recipe-message-input__remaining-char\"\n data-qa=\"dt-recipe-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 v-dt-tooltip=\"cancelButtonLabel\"\n data-qa=\"dt-recipe-message-input-cancel-button\"\n class=\"d-recipe-message-input__button d-recipe-message-input__cancel-button\"\n size=\"sm\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"cancelButtonLabel\"\n @click=\"onCancel\"\n >\n <p>{{ cancelButtonLabel }}</p>\n </dt-button>\n\n <!-- @slot Slot for sendButton picker -->\n <slot name=\"sendButton\">\n <!-- Send button -->\n <!-- Right positioned UI - send button -->\n <dt-button\n v-if=\"showSend\"\n v-dt-tooltip:top-end=\"sendButtonLabel\"\n data-qa=\"dt-recipe-message-input-send-btn\"\n size=\"sm\"\n kind=\"default\"\n importance=\"primary\"\n :class=\"[\n 'd-recipe-message-input__button d-recipe-message-input__send-button',\n {\n 'd-recipe-message-input__send-button--disabled': isSendDisabled,\n 'd-btn--icon-only': showSendIcon,\n },\n ]\"\n :aria-label=\"sendButtonLabel\"\n :aria-disabled=\"isSendDisabled\"\n @click=\"onSend\"\n >\n <template\n v-if=\"showSendIcon\"\n #icon\n >\n <!-- @slot Slot for send button icon -->\n <slot\n name=\"sendIcon\"\n :icon-size=\"sendIconSize\"\n >\n <dt-icon-send\n :size=\"sendIconSize\"\n />\n </slot>\n </template>\n <template\n v-if=\"showSend.text\"\n >\n <p>{{ showSend.text }}</p>\n </template>\n </dt-button>\n </slot>\n </dt-stack>\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 lastActiveNodes from './last_active_nodes';\nimport MeetingPill from './extensions/meeting_pill/meeting_pill';\nimport { DtButton } from '@/components/button';\nimport { DtEmojiPicker } from '@/components/emoji_picker';\nimport { DtPopover } from '@/components/popover';\nimport { DtInput } from '@/components/input';\nimport { DtTooltip } from '@/components/tooltip';\nimport { DtStack } from '@/components/stack';\nimport {\n DtIconImage, DtIconVerySatisfied, DtIconSatisfied, DtIconSend,\n} from '@dialpad/dialtone-icons/vue2';\nimport DtRecipeMessageInputTopbar from './message_input_topbar.vue';\nimport DtRecipeMessageInputLink from './message_input_link.vue';\nimport { DialtoneLocalization } from '@/localization';\n\nimport {\n EDITOR_SUPPORTED_LINK_PROTOCOLS,\n EDITOR_DEFAULT_LINK_PREFIX,\n} from '../editor/editor_constants.js';\n\nexport default {\n name: 'DtRecipeMessageInput',\n\n components: {\n DtButton,\n DtEmojiPicker,\n DtInput,\n DtPopover,\n DtRecipeMessageInputTopbar,\n DtRecipeMessageInputLink,\n DtRichTextEditor,\n DtTooltip,\n DtStack,\n DtIconImage,\n DtIconVerySatisfied,\n DtIconSatisfied,\n DtIconSend,\n },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Displays all the buttons for rich text formatting above the message input, and enables it within the editor.\n * Rich text formatting for the purposes of this component is defined as:\n *\n * bold, italic, strikethrough, lists, blockquotes, inline code tags, and code blocks.\n *\n * If you are sending a message to a phone rather than a Dialpad to Dialpad message, you should have this as false.\n */\n richText: {\n type: Boolean,\n default: true,\n },\n\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 value: {\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 * Prevents the user from typing any further. Deleting text will still work.\n */\n preventTyping: {\n type: Boolean,\n default: false,\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: 'json',\n validator (outputFormat) {\n return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);\n },\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 },\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: () => ({}),\n },\n\n /**\n * Send button defaults.\n * TODO (Dialtone 10):\n * - Change to `showSendButton`, boolean only.\n */\n showSend: {\n type: [Boolean, Object],\n default: () => ({}),\n },\n\n /**\n * TODO (Dialtone 10):\n * - Add a prop `iconOnly` default: true to control if localized send button text should be shown\n */\n\n /**\n * Cancel button defaults.\n * TODO (Dialtone 10): Change to `showCancelButton`, boolean only.\n */\n showCancel: {\n type: [Boolean, Object],\n default: () => ({}),\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 * descriptive text fields for the bold button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n boldButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + B',\n }),\n },\n\n /**\n * descriptive text fields for the italic button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n italicButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + I',\n }),\n },\n\n /**\n * descriptive text fields for the strikethrough button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n strikeButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Shift + S',\n }),\n },\n\n /**\n * descriptive text fields for the link button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n linkButtonOptions: {\n type: Object,\n default: () => ({\n // TODO: implement mod k\n keyboardShortcutText: 'Mod + K',\n linkPlaceholder: 'e.g. https://www.dialpad.com',\n }),\n },\n\n /**\n * descriptive text fields for the bullet list button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n bulletListButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Shift + 8',\n }),\n },\n\n /**\n * descriptive text fields for the ordered list button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n orderedListButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Shift + 7',\n }),\n },\n\n /**\n * descriptive text fields for the italic button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n blockQuoteButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Shift + B',\n }),\n },\n\n /**\n * descriptive text fields for the code button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n codeButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + E',\n }),\n },\n\n /**\n * descriptive text fields for the code block button\n *\n * object format:\n * { keyboardShortcutText: string }\n */\n codeBlockButtonOptions: {\n type: Object,\n default: () => ({\n keyboardShortcutText: 'Mod + Alt + C',\n }),\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 * Fires when meeting pill is closed\n *\n * @event meeting-pill-close\n * @type {String}\n */\n 'meeting-pill-close',\n\n /**\n * Event to sync the value with the parent\n * @event update:value\n * @type {String|JSON}\n */\n 'update:value',\n\n /**\n * Emitted when input changes, returns text content only\n * @event text-input\n * @type {String}\n */\n 'text-input',\n\n /**\n * Emitted when the 'Add emoji' button is clicked\n * @event add-emoji\n * @type {Boolean}\n */\n 'add-emoji',\n\n /**\n * Emitted when the emoji picker scroll reaches the bottom\n * @event emoji-scroll-bottom-reached\n */\n 'emoji-scroll-bottom-reached',\n ],\n\n data () {\n return {\n // If an ordered list is nested within an unordered list, we only want to show the currently selected list as\n // active. This function performs the logic to determine the farthest active node from the root.\n lastActiveNodes,\n additionalExtensions: [\n MeetingPill.configure({\n onClose: (event) => {\n this.$emit('meeting-pill-close', event);\n },\n }),\n ],\n\n internalInputValue: this.value, // internal input content\n imagePickerFocus: false,\n emojiPickerFocus: false,\n emojiPickerOpened: false,\n isFocused: false,\n linkOptions: {\n class: 'd-link d-c-text d-d-inline-block',\n },\n\n linkDialogOpen: false,\n selectedText: '',\n text: '',\n hideLinkBubbleMenu: false,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n showSendIcon () {\n return !this.showSend.text;\n },\n\n inputLength () {\n return this.text.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 emojiPickerHovered () {\n return this.emojiPickerFocus || this.emojiPickerOpened;\n },\n\n sendIconSize () {\n return '300';\n },\n\n sendButtonLabel () {\n return this.i18n.$t('DIALTONE_MESSAGE_INPUT_SEND_BUTTON_ARIA_LABEL');\n },\n\n imagePickerButtonLabel () {\n return this.i18n.$t('DIALTONE_MESSAGE_INPUT_IMAGE_PICKER_BUTTON_ARIA_LABEL');\n },\n\n emojiPickerButtonLabel () {\n return this.i18n.$t('DIALTONE_MESSAGE_INPUT_EMOJI_PICKER_BUTTON_ARIA_LABEL');\n },\n\n cancelButtonLabel () {\n return this.i18n.$t('DIALTONE_MESSAGE_INPUT_CANCEL_BUTTON_ARIA_LABEL');\n },\n },\n\n watch: {\n value (newValue) {\n this.internalInputValue = newValue;\n },\n\n emojiPickerOpened (newValue) {\n if (!newValue) {\n this.$refs.richTextEditor?.focusEditor();\n }\n },\n },\n\n created () {\n if (this.value && this.outputFormat === 'text') {\n this.internalInputValue = this.value.replace(/\\n/g, '<br>');\n } else {\n this.internalInputValue = this.value;\n }\n },\n\n methods: {\n linkDialogOpened (value) {\n this.linkDialogOpen = value;\n if (value === true) {\n this.initLinkDialog();\n } else {\n this.hideLinkBubbleMenu = false;\n this.$refs.richTextEditor?.focusEditor();\n }\n },\n\n handleTopbarClick (type) {\n const editor = this.$refs.richTextEditor?.editor;\n // Key is the name returned in the event, value is the name of the TipTap command function to run.\n const typeToCommandMap = {\n bold: () => editor?.chain().focus().toggleBold().run(),\n italic: () => editor?.chain().focus().toggleItalic().run(),\n strike: () => editor?.chain().focus().toggleStrike().run(),\n bulletList: () => editor?.chain().focus().toggleBulletList().run(),\n orderedList: () => editor?.chain().focus().toggleOrderedList().run(),\n blockquote: () => editor?.chain().focus().toggleBlockquote().run(),\n code: () => editor?.chain().focus().toggleCode().run(),\n codeBlock: () => editor?.chain().focus().toggleCodeBlock().run(),\n };\n\n if (editor && typeToCommandMap[type]) {\n typeToCommandMap[type]();\n }\n },\n\n // Checks if the node currently selected is active ex/ the bold button is active if the selected text is bold\n // eslint-disable-next-line complexity\n isSelectionActive (type) {\n if (['bulletList', 'orderedList'].includes(type)) {\n return this.lastActiveNodes(this.$refs.richTextEditor?.editor?.state, [{ type: 'bulletList' }, { type: 'orderedList' }]).includes(type) && this.isFocused;\n }\n return this.$refs.richTextEditor?.editor?.isActive(type) && this.isFocused;\n },\n\n initLinkDialog () {\n this.$refs.link.setInitialValues(this.selectedText, this.$refs.richTextEditor?.editor?.getAttributes('link')?.href);\n this.hideLinkBubbleMenu = true;\n this.linkDialogOpen = true;\n },\n\n removeLink () {\n this.$refs.richTextEditor?.removeLink();\n this.linkDialogOpen = false;\n },\n\n setLink (linkText, linkInput) {\n this.$refs.richTextEditor.setLink(\n linkInput, linkText, this.linkOptions, EDITOR_SUPPORTED_LINK_PROTOCOLS, EDITOR_DEFAULT_LINK_PREFIX,\n );\n this.linkDialogOpen = false;\n },\n\n // Mousedown instead of click because it fires before the blur event.\n onMousedown (e) {\n const isWithinInput = this.$refs.richTextEditor.$el.querySelector('.tiptap').contains(e.target);\n\n // If the click is not within the tiptap rich text editor input itself, but still within the wrapping div,\n // focus the editor.\n if (!isWithinInput) {\n // Prevent default prevents blurring the rich text editor input when it is already focused.\n e.preventDefault();\n this.$refs.richTextEditor.focusEditor();\n }\n },\n\n onDrop (e) {\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, close) {\n if (!emoji) {\n return;\n }\n\n if (!emoji.shift_key) {\n close();\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 image: emoji.image,\n name: emoji.name,\n },\n });\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 onInput (event) {\n this.$emit('update:value', event);\n },\n\n onTextInput (event) {\n this.text = event;\n this.$emit('text-input', event);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","NodeViewWrapper","DtItemLayout","DtIconClose","DtButton","DtIconVideo","nodeViewProps","DialtoneLocalization","e","onCloseCallback","_c","_b","_a","MeetingPill","Node","VueNodeViewRenderer","HTMLAttributes","mergeAttributes","DtEmojiPicker","DtInput","DtPopover","DtRecipeMessageInputTopbar","DtRecipeMessageInputLink","DtRichTextEditor","DtTooltip","DtStack","DtIconImage","DtIconVerySatisfied","DtIconSatisfied","DtIconSend","autoFocus","RICH_TEXT_EDITOR_AUTOFOCUS_TYPES","outputFormat","RICH_TEXT_EDITOR_OUTPUT_FORMATS","lastActiveNodes","event","newValue","value","type","editor","typeToCommandMap","_d","linkText","linkInput","EDITOR_SUPPORTED_LINK_PROTOCOLS","EDITOR_DEFAULT_LINK_PREFIX","dt","files","skinTone","emoji","close"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,EACA;AAAA,EAEA,OAAAC;AAAA,EAEA,OAAA,CAAA,oBAAA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,MAAA,IAAAC,EAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,UAAA;AAAA,IACA,mBAAA;AACA,aAAA,KAAA,KAAA,GAAA,uBAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA,IACA,MAAAC,GAAA;;AAEA,YAAAC,KAAAC,KAAAC,KAAAC,IAAA,KAAA,WAAA,gBAAAA,EAAA,YAAA,gBAAAD,EAAA,gBAAA,gBAAAD,EAAA;AAEA,MAAAD,KAAA,OAAAA,KAAA,cACAA,EAAAD,CAAA;AAAA,IAEA;AAAA,EACA;AACA;;;;;;;;;;;;;;;qBC5EAK,IAAeC,EAAK,OAAO;AAAA,EACzB,MAAM;AAAA,EAEN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EAER,aAAc;AACZ,WAAO;AAAA,MACL,SAAS,MAAM;AAAA,MAAC;AAAA,IACtB;AAAA,EACE;AAAA,EAEA,aAAc;AACZ,WAAO;AAAA,MACL,S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GACAA,EAAA,eAAA;AACA,cAAAuC,IAAA,CAAA,GAAAvC,EAAA,cAAA,KAAA;AACA,aAAA,MAAA,eAAAuC,CAAA;AAAA,MACA;AAAA,IACA;AAAA,IAEA,WAAAC,GAAA;AACA,WAAA,MAAA,aAAAA,CAAA;AAAA,IACA;AAAA,IAEA,cAAAC,GAAAC,GAAA;AACA,MAAAD,MAIAA,EAAA,aACAC,EAAA,GAIA,KAAA,MAAA,eAAA,OAAA,SAAA,cAAA;AAAA,QACA,MAAA;AAAA,QACA,OAAA;AAAA,UACA,MAAAD,EAAA;AAAA,UACA,OAAAA,EAAA;AAAA,UACA,MAAAA,EAAA;AAAA,QACA;AAAA,MACA,CAAA,GACA,KAAA,MAAA,kBAAAA,CAAA;AAAA,IACA;AAAA,IAEA,gBAAA;AACA,WAAA,MAAA,wBAAA,MAAA,MAAA,MAAA;AAAA,IACA;AAAA,IAEA,gBAAA;AACA,WAAA,MAAA,gBAAA,KAAA,MAAA,wBAAA,MAAA,MAAA,KAAA;AAAA,IACA;AAAA,IAEA,oBAAA;AACA,WAAA,oBAAA,CAAA,KAAA;AAAA,IACA;AAAA,IAEA,SAAA;AACA,MAAA,KAAA,kBAGA,KAAA,MAAA,UAAA,KAAA,kBAAA;AAAA,IACA;AAAA,IAEA,WAAA;AACA,WAAA,MAAA,QAAA;AAAA,IACA;AAAA,IAEA,QAAAd,GAAA;AACA,WAAA,MAAA,gBAAAA,CAAA;AAAA,IACA;AAAA,IAEA,YAAAA,GAAA;AACA,WAAA,OAAAA,GACA,KAAA,MAAA,cAAAA,CAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("../../node_modules/@tiptap/vue-2.cjs"),c=require("@tiptap/core"),q=require("@tiptap/extension-blockquote"),D=require("@tiptap/extension-code-block"),B=require("@tiptap/extension-code"),j=require("@tiptap/extension-document"),$=require("@tiptap/extension-paragraph"),M=require("@tiptap/extension-placeholder"),H=require("@tiptap/extension-hard-break"),N=require("@tiptap/extension-bold"),V=require("@tiptap/extension-bullet-list"),F=require("@tiptap/extension-italic"),K=require("@tiptap/extension-link"),W=require("@tiptap/extension-list-item"),U=require("@tiptap/extension-ordered-list"),z=require("@tiptap/extension-strike"),X=require("@tiptap/extension-underline"),J=require("@tiptap/extension-text"),Y=require("@tiptap/extension-text-align"),G=require("@tiptap/extension-history"),Q=require("@tiptap/extension-text-style"),Z=require("@tiptap/extension-color"),ee=require("@tiptap/extension-font-family"),p=require("@tiptap/pm/state"),te=require("@tiptap/suggestion"),I=require("regex-combined-emojis"),u=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),ne=require("../skeleton/skeleton.cjs"),P=require("../emoji/emoji.cjs"),f=require("../../common/emoji/index.cjs"),re=require("@dialpad/dialtone-emojis"),se=require("../list-item/list-item.cjs"),b=require("../stack/stack.cjs"),k=require("tippy.js"),E=require("../../common/utils/index.cjs"),ie=require("@tiptap/extension-image"),S=require("@tiptap/extension-mention"),A=require("../link/link.cjs"),y=require("./rich-text-editor-constants.cjs"),oe=require("../avatar/avatar.cjs"),ae=require("@dialpad/dialtone-icons/vue2/hash"),le=require("@dialpad/dialtone-icons/vue2/lock"),ce=require("deep-equal"),de=require("../../localization/index.cjs"),ue=require("../button/button.cjs"),me={name:"EmojiComponent",components:{NodeViewWrapper:l.NodeViewWrapper,DtEmoji:P.default,DtSkeleton:ne.default},props:l.nodeViewProps,data(){return{showSkeleton:!0}},methods:{handleImageLoad(){this.showSkeleton=!1},handleImageError:function(t){this.showSkeleton=!1,t.target.parentNode.remove()}}};var he=function(){var e=this,n=e._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block d-va-bottom d-lh0"},[e.node.attrs.code?n("dt-emoji",{attrs:{size:"500",code:e.node.attrs.code}}):[e.showSkeleton?n("dt-skeleton",{staticClass:"d-icon d-icon--size-500",attrs:{offset:0,"shape-option":{shape:"circle",size:"100%"}}}):e._e(),n("img",{directives:[{name:"show",rawName:"v-show",value:!e.showSkeleton,expression:"!showSkeleton"}],staticClass:"d-icon d-icon--size-500",attrs:{alt:e.node.attrs.name,"aria-label":e.node.attrs.name,title:e.node.attrs.name,src:e.node.attrs.image},on:{load:e.handleImageLoad,error:e.handleImageError}})]],2)},fe=[],pe=u.n(me,he,fe);const ge=pe.exports,_e={name:"SuggestionList",components:{DtListItem:se.default},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"||t.key==="Tab"?(this.selectHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},async scrollActiveElementIntoView(){await this.$nextTick();const t=this.$refs.suggestionList.querySelector(".d-list-item--highlighted");t&&t.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const e=this.items[t];switch(this.itemType){case"emoji":this.command(e);return;case"mention":this.command({name:e.name,id:e.id,avatarSrc:e.avatarSrc});break;case"channel":this.command({name:e.name,id:e.id});break;case"slash-command":this.command({command:e.command});break}}}};var we=function(){var e=this,n=e._self._c;return n("div",{staticClass:"d-popover__dialog d-suggestion-list__container"},[n("ul",{directives:[{name:"show",rawName:"v-show",value:e.items.length,expression:"items.length"}],ref:"suggestionList",staticClass:"d-suggestion-list"},e._l(e.items,function(r,s){return n("dt-list-item",{key:r.id,class:["d-suggestion-list__item",{"d-list-item--highlighted":s===e.selectedIndex}],attrs:{"navigation-type":"arrow-keys"},on:{click:function(o){return e.selectItem(s)},keydown:function(o){return o.preventDefault(),e.onKeyDown.apply(null,arguments)}}},[n(e.itemComponent,{tag:"component",attrs:{item:r}})],1)}),1)])},ye=[],be=u.n(_e,we,ye);const v=be.exports,ke={name:"EmojiSuggestion",components:{DtEmoji:P.default,DtStack:b.default},props:{item:{type:Object,required:!0}}};var ve=function(){var e=this,n=e._self._c;return n("dt-stack",{attrs:{direction:"row",gap:"400"}},[n("dt-emoji",{attrs:{size:"200",code:e.item.code}}),e._v(" "+e._s(e.item.code)+" ")],1)},xe=[],Te=u.n(ke,ve,xe);const Ce=Te.exports,x={name:"hideOnEsc",defaultValue:!0,fn({hide:t}){function e(n){n.keyCode===27&&t()}return{onShow(){document.addEventListener("keydown",e)},onHide(){document.removeEventListener("keydown",e)}}}},Ee=20,Se={items:({query:t})=>{if(t.length<2)return[];const e=Object.values(re.emojisIndexed);return t=t.toLowerCase(),e.filter(r=>[r.name,r.shortname.replaceAll(":",""),...r.keywords].some(s=>s.startsWith(t))).splice(0,Ee).map(r=>({code:r.shortname}))},command:({editor:t,range:e,props:n})=>{var o,i;const r=t.view.state.selection.$to.nodeAfter;((o=r==null?void 0:r.text)==null?void 0:o.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:"emoji",attrs:n}]).run(),(i=window.getSelection())==null||i.collapseToEnd()},render:()=>{let t,e,n=!1;return{onStart:r=>{t=new l.VueRenderer(v,{parent:void 0,propsData:{itemComponent:Ce,itemType:"emoji",...r},editor:r.editor}),r.clientRect&&(e=k("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[x]}),r.items.length>0&&(e==null||e[0].show()))},onUpdate(r){t==null||t.updateProps(r),r.items.length>0?e==null||e[0].show():e==null||e[0].hide(),e==null||e[0].setProps({getReferenceClientRect:r.clientRect})},onKeyDown(r){var s;if(n)return(s=t==null?void 0:t.ref)==null?void 0:s.onKeyDown(r)},onExit(){e==null||e[0].destroy(),e=null,t==null||t.destroy(),t=null}}}},Re=/(:\w+:)$/,Le=new RegExp(I.emojiPattern+"$"),$e=t=>{if(t&&f.codeToEmojiData(t[0]))return{text:t[2]||t[0]}},Ie=t=>[...t.matchAll(f.emojiShortCodeRegex)].filter(n=>f.codeToEmojiData(n[0])).map(n=>({index:n.index,text:n[0],match:n})),Pe=c.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return l.VueNodeViewRenderer(ge)},addAttributes(){return{code:{default:null},image:{default:null},name:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:t}){const{image:e,code:n}=t.attrs;if(e!==null)return e;{const r=f.codeToEmojiData(n);return f.stringToUnicode(r.unicode_output)}},renderHTML({HTMLAttributes:t}){return["emoji-component",c.mergeAttributes(this.options.HTMLAttributes,t)]},addInputRules(){return[new c.InputRule({find:t=>{const e=t.match(Re)||t.match(Le);if(e)return $e(e)},handler:({state:t,range:e,match:n})=>{const{tr:r}=t,s=e.from,o=e.to;r.replaceWith(s,o,this.type.create({code:n[0]}))}})]},addPasteRules(){return[c.nodePasteRule({find:Ie,type:this.type,getAttributes(t){return{code:t[0],image:t[1],name:t[2]}}}),c.nodePasteRule({find:f.emojiRegex,type:this.type,getAttributes(t){return{code:t[0],image:t[1],name:t[2]}}})]},addProseMirrorPlugins(){return[te({char:":",pluginKey:new p.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...Se})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:s,anchor:o}=r;return s?(e.doc.nodesBetween(o-1,o,(i,a)=>{if(i.type.name===this.name)return n=!0,t.insertText("",a,a+i.nodeSize),!1}),n):!1})}}});function Ae(t,e,n=()=>!0){const r=[];e.lastIndex=0;let s;for(;s=e.exec(t);)n(t,s)&&r.push(s);return r}function Oe(t,e){return!["#","@"].includes(t.charAt(e.index))&&!["#","@"].includes(t.charAt(e.index-1))}function qe(t){const e=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return t.replace(e,"")}function De(t,e){const n=t.slice(0,e+1).search(/\S+\s*$/),r=t.slice(e).search(/\s/);if(r<0){const s=t.slice(n);return{text:s,from:n,to:n+s.length}}return{text:t.slice(n,r+e),from:n,to:r+e}}function C(t,e,n,r){const s=De(t,e);if(r.lastIndex=0,!r.test(s.text))return s;const o=n==="left"?s.from-1:s.to+1;return o<=0||o>=t.length||o===e?s:C(t,o,n,r)}function Be(t,e,n,r){const s=Math.max(t.from-1,0),o=Math.min(t.to+1,e.content.size),i=c.getMarksBetween(s,o,e);for(const a of i)a.mark.type===r&&n.removeMark(a.from,a.to,r)}const R=E.getPhoneNumberRegex(1,15);function L(t,e,n,r,s,o){if(!t)return;let i=n-e-1;i=i<0?0:i;const a=r-e,d=C(t,i,"left",R),m=C(t,a,"right",R),h=t.slice(d.from,m.to);Ae(h,E.linkRegex,Oe).forEach(T=>{const g=qe(T[0]),w=e+d.from+T.index+1,O=w+g.length;s.addMark(w,O,o.create())})}function je(t){let e=!1;return new p.Plugin({key:new p.PluginKey("autolink"),appendTransaction:(n,r,s)=>{const o=n.some(h=>h.docChanged)&&!r.doc.eq(s.doc);if(e&&!o)return;const{tr:i}=s,{textContent:a}=s.doc;e||L(a,0,0,a.length,i,t.type),e=!0;const d=c.combineTransactionSteps(r.doc,[...n]);return c.getChangedRanges(d).forEach(({oldRange:h,newRange:_})=>{Be(_,s.doc,i,t.type),c.findChildrenInRange(s.doc,_,g=>g.isTextblock).forEach(({node:g,pos:w})=>{L(g.textContent,w,h.from,_.to,i,t.type)})}),i}})}const Me={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},He=c.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:t}){return["a",c.mergeAttributes(this.options.HTMLAttributes,t,Me)]},renderText({node:t}){return t.attrs.text},addProseMirrorPlugins(){return[je({type:this.type})]}}),Ne=ie.extend({name:"ConfigurableImage",addAttributes(){return{src:{default:""},alt:{default:void 0},title:{default:void 0},width:{default:void 0},height:{default:void 0},style:{default:void 0}}}}).configure({inline:!0,allowBase64:!0}),Ve=$.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:t}){return["div",c.mergeAttributes(this.options.HTMLAttributes,t),0]}}),Fe={name:"MentionComponent",components:{NodeViewWrapper:l.NodeViewWrapper,DtLink:A.default},props:l.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}}};var Ke=function(){var e=this,n=e._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[n("dt-link",{attrs:{kind:"mention"}},[e._v(" "+e._s(e.text)+" ")])],1)},We=[],Ue=u.n(Fe,Ke,We);const ze=Ue.exports,Xe=S.extend({addNodeView(){return l.VueNodeViewRenderer(ze)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""}}},renderText({node:t}){return`@${t.attrs.id}`},renderHTML({HTMLAttributes:t}){return["mention-component",c.mergeAttributes(this.options.HTMLAttributes,t)]}}).configure({suggestion:{char:"@",pluginKey:new p.PluginKey("mentionSuggestion")}}),Je={name:"ChannelComponent",components:{NodeViewWrapper:l.NodeViewWrapper,DtLink:A.default},props:l.nodeViewProps,computed:{text(){return"#"+this.$props.node.attrs.name}}};var Ye=function(){var e=this,n=e._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[n("dt-link",{attrs:{kind:"mention"}},[e._v(" "+e._s(e.text)+" ")])],1)},Ge=[],Qe=u.n(Je,Ye,Ge);const Ze=Qe.exports,et=S.extend({name:"channel",addNodeView(){return l.VueNodeViewRenderer(Ze)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1}}},renderText({node:t}){return`#${t.attrs.id}`},renderHTML({HTMLAttributes:t}){return["channel-component",c.mergeAttributes(this.options.HTMLAttributes,t)]}}).configure({suggestion:{char:"#",pluginKey:new p.PluginKey("channelSuggestion")}}),tt={name:"SlashCommandsComponent",components:{NodeViewWrapper:l.NodeViewWrapper},props:{...l.nodeViewProps},emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){var n,r,s;const t=this.$props.node.attrs.command;this.$emit("selected-command",t);const e=(s=(r=(n=this.editor)==null?void 0:n.storage)==null?void 0:r["slash-commands"])==null?void 0:s.onSelectedCommand;e&&typeof e=="function"&&e(t)}};var nt=function(){var e=this,n=e._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[e._v(" "+e._s(e.text)+" ")])},rt=[],st=u.n(tt,nt,rt);const it=st.exports,ot=(t,e)=>[...t.matchAll(e)].map(r=>{let s=r[2];return s.endsWith(" ")||(s+=" "),{index:r.index,text:s,match:r}}),at=S.extend({name:"slash-commands",group:"inline",inline:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return l.VueNodeViewRenderer(it)},parseHTML(){return[{tag:"command-component"}]},addAttributes(){return{command:{default:""},parametersExample:{default:""},description:{default:""}}},renderText({node:t}){return`/${t.attrs.command}`},renderHTML({HTMLAttributes:t}){return["command-component",c.mergeAttributes(this.options.HTMLAttributes,t)]},addInputRules(){var n;const t=(n=this.options.suggestion)==null?void 0:n.items({query:""}).map(r=>r.command),e=new RegExp(`^((?:\\/)(${t.join("|")})) $`);return[c.nodeInputRule({find:e,type:this.type,getAttributes(r){return{command:r[2]}}})]},addPasteRules(){var n;const t=(n=this.options.suggestion)==null?void 0:n.items({query:""}).map(r=>r.command),e=new RegExp(`^((?:\\/)(${t.join("|")})) ?$`,"g");return[c.nodePasteRule({find:r=>ot(r,e),type:this.type,getAttributes(r){return{command:r[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new p.PluginKey("slashCommandSuggestion")}}),lt={name:"MentionSuggestion",components:{DtAvatar:oe.default,DtStack:b.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:"d-recipe-contact-row--active",busy:"d-recipe-contact-row--busy",away:"d-recipe-contact-row--away",offline:"d-recipe-contact-row--busy"}[this.presence]},showDetails(){return this.item.showDetails}}};var ct=function(){var e=this,n=e._self._c;return n("dt-stack",{staticClass:"d-mention-suggestion__container",attrs:{direction:"row",gap:"400"}},[n("dt-avatar",{attrs:{"full-name":e.name,"image-src":e.avatarSrc,"image-alt":e.name,"show-presence":e.showDetails,presence:e.presence,size:"sm"}}),n("dt-stack",{staticClass:"d-mention-suggestion__details-container",attrs:{gap:"100"}},[n("span",{staticClass:"d-mention-suggestion__name"},[e._v(" "+e._s(e.name)+" ")]),e.showDetails?n("dt-stack",{staticClass:"d-label--sm-plain",attrs:{direction:"row",gap:"300"}},[e.presenceText?n("span",{staticClass:"d-mention-suggestion__presence",class:[e.presenceFontColorClass]},[e._v(" "+e._s(e.presenceText)+" ")]):e._e(),e.status&&e.presenceText?n("div",{staticClass:"d-mention-suggestion__divider"},[e._v(" • ")]):e._e(),e.status?n("div",{staticClass:"d-mention-suggestion__status"},[e._v(" "+e._s(e.status)+" ")]):e._e()]):e._e()],1)],1)},dt=[],ut=u.n(lt,ct,dt);const mt=ut.exports,ht={allowSpaces:!0,render:()=>{let t,e,n=!1;return{onStart:r=>{t=new l.VueRenderer(v,{parent:void 0,propsData:{itemComponent:mt,itemType:"mention",...r},editor:r.editor}),r.clientRect&&(e=k("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[x]}),r.items.length>0&&(e==null||e[0].show()))},onUpdate(r){t==null||t.updateProps(r),r.items.length>0?e==null||e[0].show():e==null||e[0].hide(),r.clientRect&&(e==null||e[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var s;if(n)return(s=t==null?void 0:t.ref)==null?void 0:s.onKeyDown(r)},onExit(){e==null||e[0].destroy(),e=null,t==null||t.destroy(),t=null}}}},ft={name:"ChannelSuggestion",components:{DtStack:b.default,DtIconHash:ae,DtIconLock:le},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};var pt=function(){var e=this,n=e._self._c;return n("dt-stack",{attrs:{direction:"row",gap:"400"}},[e.item.locked?n("dt-icon-lock",{attrs:{size:"300"}}):n("dt-icon-hash",{attrs:{size:"300"}}),n("span",[e._v(e._s(e.name))])],1)},gt=[],_t=u.n(ft,pt,gt);const wt=_t.exports,yt={allowSpaces:!0,render:()=>{let t,e,n=!1;return{onStart:r=>{t=new l.VueRenderer(v,{parent:void 0,propsData:{itemComponent:wt,itemType:"channel",...r},editor:r.editor}),r.clientRect&&(e=k("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[x]}),r.items.length>0&&(e==null||e[0].show()))},onUpdate(r){t==null||t.updateProps(r),r.items.length>0?e==null||e[0].show():e==null||e[0].hide(),r.clientRect&&(e==null||e[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var s;if(n)return(s=t==null?void 0:t.ref)==null?void 0:s.onKeyDown(r)},onExit(){e==null||e[0].destroy(),e=null,t==null||t.destroy(),t=null}}}},bt={name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}};var kt=function(){var e=this,n=e._self._c;return n("div",[n("div",{staticClass:"d-body--md-compact"},[n("span",[e._v("/"+e._s(e.command))]),e.parametersExample?n("span",[e._v(" "+e._s(e.parametersExample))]):e._e()]),n("div",{staticClass:"d-body--sm d-fc-tertiary"},[e._v(" "+e._s(e.description)+" ")])])},vt=[],xt=u.n(bt,kt,vt);const Tt=xt.exports,Ct={allowSpaces:!0,startOfLine:!0,render:()=>{let t,e,n=!1;return{onStart:r=>{t=new l.VueRenderer(v,{parent:void 0,propsData:{itemComponent:Tt,itemType:"slash-command",...r},editor:r.editor}),r.clientRect&&(e=k("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[x]}),r.items.length>0&&(e==null||e[0].show()))},onUpdate(r){t==null||t.updateProps(r),r.items.length>0?e==null||e[0].show():e==null||e[0].hide(),r.clientRect&&(e==null||e[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var s;if(n)return(s=t==null?void 0:t.ref)==null?void 0:s.onKeyDown(r)},onExit(){e==null||e[0].destroy(),e=null,t==null||t.destroy(),t=null}}}},Et={name:"DtRichTextEditor",components:{EditorContent:l.EditorContent,BubbleMenu:l.BubbleMenu,DtButton:ue.default,DtStack:b.default},props:{value:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},preventTyping:{type:Boolean,default:!1},pasteRichText:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(t){return typeof t=="string"?y.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(t):!0}},outputFormat:{type:String,default:"html",validator(t){return y.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(t)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},additionalExtensions:{type:Array,default:()=>[]},hideLinkBubbleMenu:{type:Boolean,default:!1},useDivTags:{type:Boolean,default:!1}},emits:["input","json-input","html-input","text-input","update:value","blur","focus","enter","edit-link","selected","selected-command"],data(){return{editor:null,tippyOptions:{appendTo:()=>{var t;return(t=this.$refs.editor.$el.getRootNode())==null?void 0:t.querySelector("body")},placement:"top-start"},i18n:new de.DialtoneLocalization}},computed:{editorListeners(){return{...this.$listeners,input:()=>{},focus:()=>{},blur:()=>{}}},extensions(){const t=[j,J,G,H];t.push(this.useDivTags?Ve:$),this.allowBold&&t.push(N),this.allowBlockquote&&t.push(q),this.allowBulletList&&(t.push(V),t.push(W.extend({renderText({node:r}){return r.textContent}})),t.push(U)),this.allowItalic&&t.push(F),this.allowStrike&&t.push(z),this.allowUnderline&&t.push(X),this.placeholder&&t.push(M.configure({placeholder:this.placeholder}));const e=this,n=c.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:r})=>e.allowLineBreaks?!1:(r.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>e.allowBulletList&&s.splitListItem("listItem"),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),!0),Enter:()=>e.allowLineBreaks?!1:(e.$emit("enter"),!0)}}});if(t.push(n),this.link&&t.push(K.extend({inclusive:!1,addKeyboardShortcuts(){return{"Mod-k":()=>(e.$emit("edit-link"),!0)}}}).configure({HTMLAttributes:{class:"d-link d-wb-break-all"},openOnClick:!1,autolink:!0,protocols:y.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&t.push(this.getExtension(He,this.customLink)),this.mentionSuggestion){const r={...this.mentionSuggestion,...ht};t.push(Xe.configure({suggestion:r}))}if(this.channelSuggestion){const r={...this.channelSuggestion,...yt};t.push(et.configure({suggestion:r}))}if(this.slashCommandSuggestion){const r={...this.slashCommandSuggestion,...Ct};t.push(at.configure({suggestion:r,onSelectedCommand:s=>{this.$emit("selected-command",s)}}))}return t.push(Pe),t.push(Y.configure({types:["paragraph"]})),this.allowCode&&t.push(B),this.allowCodeblock&&t.push(D.extend({renderText({node:r}){return`\`\`\`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("../../node_modules/@tiptap/vue-2.cjs"),l=require("@tiptap/core"),D=require("@tiptap/extension-blockquote"),B=require("@tiptap/extension-code-block"),q=require("@tiptap/extension-code"),j=require("@tiptap/extension-document"),$=require("@tiptap/extension-paragraph"),M=require("@tiptap/extension-placeholder"),H=require("@tiptap/extension-hard-break"),N=require("@tiptap/extension-bold"),V=require("@tiptap/extension-bullet-list"),F=require("@tiptap/extension-italic"),K=require("@tiptap/extension-link"),W=require("@tiptap/extension-list-item"),U=require("@tiptap/extension-ordered-list"),z=require("@tiptap/extension-strike"),X=require("@tiptap/extension-underline"),J=require("@tiptap/extension-text"),Y=require("@tiptap/extension-text-align"),G=require("@tiptap/extension-history"),Q=require("@tiptap/extension-text-style"),Z=require("@tiptap/extension-color"),ee=require("@tiptap/extension-font-family"),p=require("@tiptap/pm/state"),te=require("@tiptap/suggestion"),I=require("regex-combined-emojis"),u=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),P=require("../emoji/emoji.cjs"),f=require("../../common/emoji/index.cjs"),ne=require("../list-item/list-item.cjs"),b=require("../stack/stack.cjs"),v=require("tippy.js"),E=require("../../common/utils/index.cjs"),re=require("@tiptap/extension-image"),S=require("@tiptap/extension-mention"),A=require("../link/link.cjs"),w=require("./rich-text-editor-constants.cjs"),se=require("../avatar/avatar.cjs"),ie=require("@dialpad/dialtone-icons/vue2/hash"),oe=require("@dialpad/dialtone-icons/vue2/lock"),ae=require("deep-equal"),ce=require("../../localization/index.cjs"),le=require("../button/button.cjs"),de={name:"EmojiComponent",components:{NodeViewWrapper:c.NodeViewWrapper,DtEmoji:P.default},props:c.nodeViewProps};var ue=function(){var t=this,n=t._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block d-va-bottom d-lh0"},[n("dt-emoji",{attrs:{size:"500",code:t.node.attrs.code}})],1)},me=[],he=u.n(de,ue,me);const fe=he.exports,pe={name:"SuggestionList",components:{DtListItem:ne.default},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:e}){return e.key==="ArrowUp"?(this.upHandler(),!0):e.key==="ArrowDown"?(this.downHandler(),!0):e.key==="Enter"||e.key==="Tab"?(this.selectHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},async scrollActiveElementIntoView(){await this.$nextTick();const e=this.$refs.suggestionList.querySelector(".d-list-item--highlighted");e&&e.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){const t=this.items[e];switch(this.itemType){case"emoji":this.command(t);return;case"mention":this.command({name:t.name,id:t.id,avatarSrc:t.avatarSrc});break;case"channel":this.command({name:t.name,id:t.id});break;case"slash-command":this.command({command:t.command});break}}}};var ge=function(){var t=this,n=t._self._c;return n("div",{staticClass:"d-popover__dialog d-suggestion-list__container"},[n("ul",{directives:[{name:"show",rawName:"v-show",value:t.items.length,expression:"items.length"}],ref:"suggestionList",staticClass:"d-suggestion-list"},t._l(t.items,function(r,s){return n("dt-list-item",{key:r.id,class:["d-suggestion-list__item",{"d-list-item--highlighted":s===t.selectedIndex}],attrs:{"navigation-type":"arrow-keys"},on:{click:function(i){return t.selectItem(s)},keydown:function(i){return i.preventDefault(),t.onKeyDown.apply(null,arguments)}}},[n(t.itemComponent,{tag:"component",attrs:{item:r}})],1)}),1)])},_e=[],ye=u.n(pe,ge,_e);const x=ye.exports,we={name:"EmojiSuggestion",components:{DtEmoji:P.default,DtStack:b.default},props:{item:{type:Object,required:!0}}};var be=function(){var t=this,n=t._self._c;return n("dt-stack",{attrs:{direction:"row",gap:"400"}},[n("dt-emoji",{attrs:{size:"200",code:t.item.code}}),t._v(" "+t._s(t.item.code)+" ")],1)},ve=[],xe=u.n(we,be,ve);const ke=xe.exports,k={name:"hideOnEsc",defaultValue:!0,fn({hide:e}){function t(n){n.keyCode===27&&e()}return{onShow(){document.addEventListener("keydown",t)},onHide(){document.removeEventListener("keydown",t)}}}},Te=20,Ce=(e,t,n)=>{var a,d;const r=(a=e.shortname)==null?void 0:a.replaceAll(":",""),s=(d=t.shortname)==null?void 0:d.replaceAll(":",""),i=r.startsWith(n),o=s.startsWith(n);return i&&!o?-1:!i&&o?1:r.localeCompare(s)},Ee={items:({query:e})=>{if(e.length<2)return[];const t=Object.values(f.getEmojiData());return e=e.toLowerCase(),t.filter(r=>{var s;return[r.name,(s=r.shortname)==null?void 0:s.replaceAll(":",""),...r.keywords||[]].some(i=>i&&i.startsWith(e))}).splice(0,Te).sort((r,s)=>Ce(r,s,e)).map(r=>({code:r.shortname}))},command:({editor:e,range:t,props:n})=>{var i,o;const r=e.view.state.selection.$to.nodeAfter;((i=r==null?void 0:r.text)==null?void 0:i.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:"emoji",attrs:n}]).run(),(o=window.getSelection())==null||o.collapseToEnd()},render:()=>{let e,t,n=!1;return{onStart:r=>{e=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:ke,itemType:"emoji",...r},editor:r.editor}),r.clientRect&&(t=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[k]}),r.items.length>0&&(t==null||t[0].show()))},onUpdate(r){e==null||e.updateProps(r),r.items.length>0?t==null||t[0].show():t==null||t[0].hide(),t==null||t[0].setProps({getReferenceClientRect:r.clientRect})},onKeyDown(r){var s;if(n)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(r)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},Se=/(:\w+:)$/,Re=new RegExp(I.emojiPattern+"$"),Le=e=>{if(e&&f.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},$e=e=>[...e.matchAll(f.emojiShortCodeRegex)].filter(n=>f.codeToEmojiData(n[0])).map(n=>({index:n.index,text:n[0],match:n})),Ie=l.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return c.VueNodeViewRenderer(fe)},addAttributes(){return{code:{default:null},image:{default:null},name:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:e}){return f.stringToUnicode(f.codeToEmojiData(e.attrs.code).unicode_output)},renderHTML({HTMLAttributes:e}){return["emoji-component",l.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[new l.InputRule({find:e=>{const t=e.match(Se)||e.match(Re);if(t)return Le(t)},handler:({state:e,range:t,match:n})=>{const{tr:r}=e,s=t.from,i=t.to;r.replaceWith(s,i,this.type.create({code:n[0]}))}})]},addPasteRules(){return[l.nodePasteRule({find:$e,type:this.type,getAttributes(e){return{code:e[0],image:e[1],name:e[2]}}}),l.nodePasteRule({find:f.emojiRegex,type:this.type,getAttributes(e){return{code:e[0],image:e[1],name:e[2]}}})]},addProseMirrorPlugins(){return[te({char:":",pluginKey:new p.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...Ee})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1;const{selection:r}=t,{empty:s,anchor:i}=r;return s?(t.doc.nodesBetween(i-1,i,(o,a)=>{if(o.type.name===this.name)return n=!0,e.insertText("",a,a+o.nodeSize),!1}),n):!1})}}});function Pe(e,t,n=()=>!0){const r=[];t.lastIndex=0;let s;for(;s=t.exec(e);)n(e,s)&&r.push(s);return r}function Ae(e,t){return!["#","@"].includes(e.charAt(t.index))&&!["#","@"].includes(e.charAt(t.index-1))}function Oe(e){const t=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return e.replace(t,"")}function De(e,t){const n=e.slice(0,t+1).search(/\S+\s*$/),r=e.slice(t).search(/\s/);if(r<0){const s=e.slice(n);return{text:s,from:n,to:n+s.length}}return{text:e.slice(n,r+t),from:n,to:r+t}}function C(e,t,n,r){const s=De(e,t);if(r.lastIndex=0,!r.test(s.text))return s;const i=n==="left"?s.from-1:s.to+1;return i<=0||i>=e.length||i===t?s:C(e,i,n,r)}function Be(e,t,n,r){const s=Math.max(e.from-1,0),i=Math.min(e.to+1,t.content.size),o=l.getMarksBetween(s,i,t);for(const a of o)a.mark.type===r&&n.removeMark(a.from,a.to,r)}const R=E.getPhoneNumberRegex(1,15);function L(e,t,n,r,s,i){if(!e)return;let o=n-t-1;o=o<0?0:o;const a=r-t,d=C(e,o,"left",R),m=C(e,a,"right",R),h=e.slice(d.from,m.to);Pe(h,E.linkRegex,Ae).forEach(T=>{const g=Oe(T[0]),y=t+d.from+T.index+1,O=y+g.length;s.addMark(y,O,i.create())})}function qe(e){let t=!1;return new p.Plugin({key:new p.PluginKey("autolink"),appendTransaction:(n,r,s)=>{const i=n.some(h=>h.docChanged)&&!r.doc.eq(s.doc);if(t&&!i)return;const{tr:o}=s,{textContent:a}=s.doc;t||L(a,0,0,a.length,o,e.type),t=!0;const d=l.combineTransactionSteps(r.doc,[...n]);return l.getChangedRanges(d).forEach(({oldRange:h,newRange:_})=>{Be(_,s.doc,o,e.type),l.findChildrenInRange(s.doc,_,g=>g.isTextblock).forEach(({node:g,pos:y})=>{L(g.textContent,y,h.from,_.to,o,e.type)})}),o}})}const je={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},Me=l.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:e}){return["a",l.mergeAttributes(this.options.HTMLAttributes,e,je)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[qe({type:this.type})]}}),He=re.extend({name:"ConfigurableImage",addAttributes(){return{src:{default:""},alt:{default:void 0},title:{default:void 0},width:{default:void 0},height:{default:void 0},style:{default:void 0}}}}).configure({inline:!0,allowBase64:!0}),Ne=$.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",l.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Ve={name:"MentionComponent",components:{NodeViewWrapper:c.NodeViewWrapper,DtLink:A.default},props:c.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}}};var Fe=function(){var t=this,n=t._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[n("dt-link",{attrs:{kind:"mention"}},[t._v(" "+t._s(t.text)+" ")])],1)},Ke=[],We=u.n(Ve,Fe,Ke);const Ue=We.exports,ze=S.extend({addNodeView(){return c.VueNodeViewRenderer(Ue)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["mention-component",l.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"@",pluginKey:new p.PluginKey("mentionSuggestion")}}),Xe={name:"ChannelComponent",components:{NodeViewWrapper:c.NodeViewWrapper,DtLink:A.default},props:c.nodeViewProps,computed:{text(){return"#"+this.$props.node.attrs.name}}};var Je=function(){var t=this,n=t._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[n("dt-link",{attrs:{kind:"mention"}},[t._v(" "+t._s(t.text)+" ")])],1)},Ye=[],Ge=u.n(Xe,Je,Ye);const Qe=Ge.exports,Ze=S.extend({name:"channel",addNodeView(){return c.VueNodeViewRenderer(Qe)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["channel-component",l.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"#",pluginKey:new p.PluginKey("channelSuggestion")}}),et={name:"SlashCommandsComponent",components:{NodeViewWrapper:c.NodeViewWrapper},props:{...c.nodeViewProps},emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){var n,r,s;const e=this.$props.node.attrs.command;this.$emit("selected-command",e);const t=(s=(r=(n=this.editor)==null?void 0:n.storage)==null?void 0:r["slash-commands"])==null?void 0:s.onSelectedCommand;t&&typeof t=="function"&&t(e)}};var tt=function(){var t=this,n=t._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[t._v(" "+t._s(t.text)+" ")])},nt=[],rt=u.n(et,tt,nt);const st=rt.exports,it=(e,t)=>[...e.matchAll(t)].map(r=>{let s=r[2];return s.endsWith(" ")||(s+=" "),{index:r.index,text:s,match:r}}),ot=S.extend({name:"slash-commands",group:"inline",inline:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return c.VueNodeViewRenderer(st)},parseHTML(){return[{tag:"command-component"}]},addAttributes(){return{command:{default:""},parametersExample:{default:""},description:{default:""}}},renderText({node:e}){return`/${e.attrs.command}`},renderHTML({HTMLAttributes:e}){return["command-component",l.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){var n;const e=(n=this.options.suggestion)==null?void 0:n.items({query:""}).map(r=>r.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) $`);return[l.nodeInputRule({find:t,type:this.type,getAttributes(r){return{command:r[2]}}})]},addPasteRules(){var n;const e=(n=this.options.suggestion)==null?void 0:n.items({query:""}).map(r=>r.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) ?$`,"g");return[l.nodePasteRule({find:r=>it(r,t),type:this.type,getAttributes(r){return{command:r[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new p.PluginKey("slashCommandSuggestion")}}),at={name:"MentionSuggestion",components:{DtAvatar:se.default,DtStack:b.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:"d-recipe-contact-row--active",busy:"d-recipe-contact-row--busy",away:"d-recipe-contact-row--away",offline:"d-recipe-contact-row--busy"}[this.presence]},showDetails(){return this.item.showDetails}}};var ct=function(){var t=this,n=t._self._c;return n("dt-stack",{staticClass:"d-mention-suggestion__container",attrs:{direction:"row",gap:"400"}},[n("dt-avatar",{attrs:{"full-name":t.name,"image-src":t.avatarSrc,"image-alt":t.name,"show-presence":t.showDetails,presence:t.presence,size:"sm"}}),n("dt-stack",{staticClass:"d-mention-suggestion__details-container",attrs:{gap:"100"}},[n("span",{staticClass:"d-mention-suggestion__name"},[t._v(" "+t._s(t.name)+" ")]),t.showDetails?n("dt-stack",{staticClass:"d-label--sm-plain",attrs:{direction:"row",gap:"300"}},[t.presenceText?n("span",{staticClass:"d-mention-suggestion__presence",class:[t.presenceFontColorClass]},[t._v(" "+t._s(t.presenceText)+" ")]):t._e(),t.status&&t.presenceText?n("div",{staticClass:"d-mention-suggestion__divider"},[t._v(" • ")]):t._e(),t.status?n("div",{staticClass:"d-mention-suggestion__status"},[t._v(" "+t._s(t.status)+" ")]):t._e()]):t._e()],1)],1)},lt=[],dt=u.n(at,ct,lt);const ut=dt.exports,mt={allowSpaces:!0,render:()=>{let e,t,n=!1;return{onStart:r=>{e=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:ut,itemType:"mention",...r},editor:r.editor}),r.clientRect&&(t=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[k]}),r.items.length>0&&(t==null||t[0].show()))},onUpdate(r){e==null||e.updateProps(r),r.items.length>0?t==null||t[0].show():t==null||t[0].hide(),r.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var s;if(n)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(r)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},ht={name:"ChannelSuggestion",components:{DtStack:b.default,DtIconHash:ie,DtIconLock:oe},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};var ft=function(){var t=this,n=t._self._c;return n("dt-stack",{attrs:{direction:"row",gap:"400"}},[t.item.locked?n("dt-icon-lock",{attrs:{size:"300"}}):n("dt-icon-hash",{attrs:{size:"300"}}),n("span",[t._v(t._s(t.name))])],1)},pt=[],gt=u.n(ht,ft,pt);const _t=gt.exports,yt={allowSpaces:!0,render:()=>{let e,t,n=!1;return{onStart:r=>{e=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:_t,itemType:"channel",...r},editor:r.editor}),r.clientRect&&(t=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[k]}),r.items.length>0&&(t==null||t[0].show()))},onUpdate(r){e==null||e.updateProps(r),r.items.length>0?t==null||t[0].show():t==null||t[0].hide(),r.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var s;if(n)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(r)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},wt={name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}};var bt=function(){var t=this,n=t._self._c;return n("div",[n("div",{staticClass:"d-body--md-compact"},[n("span",[t._v("/"+t._s(t.command))]),t.parametersExample?n("span",[t._v(" "+t._s(t.parametersExample))]):t._e()]),n("div",{staticClass:"d-body--sm d-fc-tertiary"},[t._v(" "+t._s(t.description)+" ")])])},vt=[],xt=u.n(wt,bt,vt);const kt=xt.exports,Tt={allowSpaces:!0,startOfLine:!0,render:()=>{let e,t,n=!1;return{onStart:r=>{e=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:kt,itemType:"slash-command",...r},editor:r.editor}),r.clientRect&&(t=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[k]}),r.items.length>0&&(t==null||t[0].show()))},onUpdate(r){e==null||e.updateProps(r),r.items.length>0?t==null||t[0].show():t==null||t[0].hide(),r.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var s;if(n)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(r)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},Ct={name:"DtRichTextEditor",components:{EditorContent:c.EditorContent,BubbleMenu:c.BubbleMenu,DtButton:le.default,DtStack:b.default},props:{value:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},preventTyping:{type:Boolean,default:!1},pasteRichText:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e=="string"?w.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:"html",validator(e){return w.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},additionalExtensions:{type:Array,default:()=>[]},hideLinkBubbleMenu:{type:Boolean,default:!1},useDivTags:{type:Boolean,default:!1}},emits:["input","json-input","html-input","text-input","update:value","blur","focus","enter","edit-link","selected","selected-command"],data(){return{editor:null,tippyOptions:{appendTo:()=>{var e;return(e=this.$refs.editor.$el.getRootNode())==null?void 0:e.querySelector("body")},placement:"top-start"},i18n:new ce.DialtoneLocalization}},computed:{editorListeners(){return{...this.$listeners,input:()=>{},focus:()=>{},blur:()=>{}}},extensions(){const e=[j,J,G,H];e.push(this.useDivTags?Ne:$),this.allowBold&&e.push(N),this.allowBlockquote&&e.push(D),this.allowBulletList&&(e.push(V),e.push(W.extend({renderText({node:r}){return r.textContent}})),e.push(U)),this.allowItalic&&e.push(F),this.allowStrike&&e.push(z),this.allowUnderline&&e.push(X),this.placeholder&&e.push(M.configure({placeholder:this.placeholder}));const t=this,n=l.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:r})=>t.allowLineBreaks?!1:(r.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>t.allowBulletList&&s.splitListItem("listItem"),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),!0),Enter:()=>t.allowLineBreaks?!1:(t.$emit("enter"),!0)}}});if(e.push(n),this.link&&e.push(K.extend({inclusive:!1,addKeyboardShortcuts(){return{"Mod-k":()=>(t.$emit("edit-link"),!0)}}}).configure({HTMLAttributes:{class:"d-link d-wb-break-all"},openOnClick:!1,autolink:!0,protocols:w.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension(Me,this.customLink)),this.mentionSuggestion){const r={...this.mentionSuggestion,...mt};e.push(ze.configure({suggestion:r}))}if(this.channelSuggestion){const r={...this.channelSuggestion,...yt};e.push(Ze.configure({suggestion:r}))}if(this.slashCommandSuggestion){const r={...this.slashCommandSuggestion,...Tt};e.push(ot.configure({suggestion:r,onSelectedCommand:s=>{this.$emit("selected-command",s)}}))}return e.push(Ie),e.push(Y.configure({types:["paragraph"]})),this.allowCode&&e.push(q),this.allowCodeblock&&e.push(B.extend({renderText({node:r}){return`\`\`\`
2
2
  ${r.textContent}
3
- \`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&t.push(Ne),(this.allowFontFamily||this.allowFontColor)&&(t.push(Q),this.allowFontColor&&t.push(Z),this.allowFontFamily&&t.push(ee)),this.additionalExtensions.length&&t.push(...this.additionalExtensions),t},inputAttrs(){const t={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(t["aria-readonly"]=!0),t}},watch:{editable(t){this.editor.setEditable(t),this.updateEditorAttributes({"aria-readonly":!t})},inputClass(t){this.updateEditorAttributes({class:t})},inputAriaLabel(t){this.updateEditorAttributes({"aria-label":t})},extensions(){this.destroyEditor(),this.createEditor()},value(t){this.processValue(t)}},created(){this.createEditor()},beforeDestroy(){this.destroyEditor()},mounted(){E.warnIfUnmounted(this.$el,this.$options.name),this.processValue(this.value,!1)},methods:{createEditor(){this.editor=new l.Editor({autofocus:this.autoFocus,content:this.value,editable:this.editable,extensions:this.extensions,parseOptions:{preserveWhitespace:"full"},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handleKeyDown:(t,e)=>{if(!this.preventTyping)return!1;const n=["Backspace"];return!this.allowLineBreaks&&!e.shiftKey&&n.push("Enter"),!n.includes(e.key)},handlePaste:(t,e)=>{const n=e.clipboardData||window.clipboardData,r=n.getData("text/plain"),s=n.getData("text/html");return this.processPasteData(t,r,s)},transformPastedHTML(t){return t.replace(/(<\/\w+>)((<br \/>)+)/g,"$2$3$1")}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:t}){return t.isActive("link")},getSelectedLinkText(t){var a,d,m;const{view:e,state:n}=t,{from:r,to:s}=e.state.selection,o=n.doc.textBetween(r,s,""),i=this.editor.state.doc.nodeAt(r);return i&&((m=(d=(a=i.marks)==null?void 0:a.at(0))==null?void 0:d.type)==null?void 0:m.name)==="link"?i.textContent:o},editLink(){const t=this.getSelectedLinkText(this.editor),e={href:this.editor.getAttributes("link").href,text:t};this.$emit("edit-link",e)},removeLink(){var t,e,n,r;(r=(n=(e=(t=this.editor)==null?void 0:t.chain())==null?void 0:e.focus())==null?void 0:n.unsetLink())==null||r.run()},openLink(){var e,n;(n=(e=this.editor)==null?void 0:e.chain())==null||n.focus();const t=this.editor.getAttributes("link").href;window.open(t,"_blank")},setLink(t,e,n,r=y.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,s){var a,d,m;if(!t){this.removeLink();return}r.find(h=>h.test(t))||(t=`${s}${t}`),this.editor.chain().focus().extendMarkRange("link").run();const i=(m=(d=(a=this.editor)==null?void 0:a.view)==null?void 0:d.state)==null?void 0:m.selection;this.editor.chain().focus().insertContent(e).setTextSelection({from:i.from,to:i.from+e.length}).setLink({href:t,class:n.class}).run()},processValue(t,e=!0){const n=this.getOutput();if(!(e&&ce(t,n))){if(typeof t=="string"&&this.outputFormat==="text"){const r=new RegExp(`(${I.emojiPattern})`,"g");t=t==null?void 0:t.replace(r,'<emoji-component code="$1"></emoji-component>')}this.editor.commands.setContent(t,!1,{preserveWhitespace:"full"})}},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(t,e){const{tr:n}=t.state,{from:r,to:s}=t.state.selection;n.deleteRange(r,s);const o=e.split(/\r?\n/);let i=r;for(let a=0;a<o.length;a++)a>0&&(n.insert(i,t.state.schema.nodes.hardBreak.create()),i++),n.insertText(o[a],i),i+=o[a].length;t.dispatch(n)},shouldPreserveLineBreaks(t,e){return this.pasteRichText?!e&&t&&this.hasBlankLines(t):!!t},processPasteData(t,e,n){if(this.shouldPreserveLineBreaks(e,n))return this.insertPlainTextWithHardBreaks(t,e),!0;if(this.shouldHandlePreformattedHTML(n)){const r=this.extractPreformattedText(n);if(r&&r.includes(`
4
- `))return this.insertPlainTextWithHardBreaks(t,r),!0}return!1},shouldHandlePreformattedHTML(t){return this.pasteRichText&&t&&this.containsPreformattedContent(t)},containsPreformattedContent(t){const e=document.createElement("div");e.innerHTML=t;const n=e.querySelectorAll("*");for(const r of n)if(this.hasPreWhitespace(r)&&this.hasLineBreaks(r))return!0;return!1},hasPreWhitespace(t){const e=t.getAttribute("style")||"",n=t.style.whiteSpace||"",r=n==="pre"||n==="pre-wrap",s=e.includes("white-space: pre");return r||s},hasLineBreaks(t){return t.textContent&&t.textContent.includes(`
5
- `)},hasBlankLines(t){return t.includes(`
3
+ \`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&e.push(He),(this.allowFontFamily||this.allowFontColor)&&(e.push(Q),this.allowFontColor&&e.push(Z),this.allowFontFamily&&e.push(ee)),this.additionalExtensions.length&&e.push(...this.additionalExtensions),e},inputAttrs(){const e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(e["aria-readonly"]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},value(e){this.processValue(e)}},created(){this.createEditor()},beforeDestroy(){this.destroyEditor()},mounted(){E.warnIfUnmounted(this.$el,this.$options.name),this.processValue(this.value,!1)},methods:{createEditor(){this.editor=new c.Editor({autofocus:this.autoFocus,content:this.value,editable:this.editable,extensions:this.extensions,parseOptions:{preserveWhitespace:"full"},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handleKeyDown:(e,t)=>{if(!this.preventTyping)return!1;const n=["Backspace"];return!this.allowLineBreaks&&!t.shiftKey&&n.push("Enter"),!n.includes(t.key)},handlePaste:(e,t)=>{const n=t.clipboardData||window.clipboardData,r=n.getData("text/plain"),s=n.getData("text/html");return this.processPasteData(e,r,s)},transformPastedHTML(e){return e.replace(/(<\/\w+>)((<br \/>)+)/g,"$2$3$1")}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return e.isActive("link")},getSelectedLinkText(e){var a,d,m;const{view:t,state:n}=e,{from:r,to:s}=t.state.selection,i=n.doc.textBetween(r,s,""),o=this.editor.state.doc.nodeAt(r);return o&&((m=(d=(a=o.marks)==null?void 0:a.at(0))==null?void 0:d.type)==null?void 0:m.name)==="link"?o.textContent:i},editLink(){const e=this.getSelectedLinkText(this.editor),t={href:this.editor.getAttributes("link").href,text:e};this.$emit("edit-link",t)},removeLink(){var e,t,n,r;(r=(n=(t=(e=this.editor)==null?void 0:e.chain())==null?void 0:t.focus())==null?void 0:n.unsetLink())==null||r.run()},openLink(){var t,n;(n=(t=this.editor)==null?void 0:t.chain())==null||n.focus();const e=this.editor.getAttributes("link").href;window.open(e,"_blank")},setLink(e,t,n,r=w.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,s){var a,d,m;if(!e){this.removeLink();return}r.find(h=>h.test(e))||(e=`${s}${e}`),this.editor.chain().focus().extendMarkRange("link").run();const o=(m=(d=(a=this.editor)==null?void 0:a.view)==null?void 0:d.state)==null?void 0:m.selection;this.editor.chain().focus().insertContent(t).setTextSelection({from:o.from,to:o.from+t.length}).setLink({href:e,class:n.class}).run()},processValue(e,t=!0){const n=this.getOutput();if(!(t&&ae(e,n))){if(typeof e=="string"&&this.outputFormat==="text"){const r=new RegExp(`(${I.emojiPattern})`,"g");e=e==null?void 0:e.replace(r,'<emoji-component code="$1"></emoji-component>')}this.editor.commands.setContent(e,!1,{preserveWhitespace:"full"})}},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){const{tr:n}=e.state,{from:r,to:s}=e.state.selection;n.deleteRange(r,s);const i=t.split(/\r?\n/);let o=r;for(let a=0;a<i.length;a++)a>0&&(n.insert(o,e.state.schema.nodes.hardBreak.create()),o++),n.insertText(i[a],o),o+=i[a].length;e.dispatch(n)},shouldPreserveLineBreaks(e,t){return this.pasteRichText?!t&&e&&this.hasBlankLines(e):!!e},processPasteData(e,t,n){if(this.shouldPreserveLineBreaks(t,n))return this.insertPlainTextWithHardBreaks(e,t),!0;if(this.shouldHandlePreformattedHTML(n)){const r=this.extractPreformattedText(n);if(r&&r.includes(`
4
+ `))return this.insertPlainTextWithHardBreaks(e,r),!0}return!1},shouldHandlePreformattedHTML(e){return this.pasteRichText&&e&&this.containsPreformattedContent(e)},containsPreformattedContent(e){const t=document.createElement("div");t.innerHTML=e;const n=t.querySelectorAll("*");for(const r of n)if(this.hasPreWhitespace(r)&&this.hasLineBreaks(r))return!0;return!1},hasPreWhitespace(e){const t=e.getAttribute("style")||"",n=e.style.whiteSpace||"",r=n==="pre"||n==="pre-wrap",s=t.includes("white-space: pre");return r||s},hasLineBreaks(e){return e.textContent&&e.textContent.includes(`
5
+ `)},hasBlankLines(e){return e.includes(`
6
6
 
7
- `)||/\n\s*\n/.test(t)},extractPreformattedText(t){const e=document.createElement("div");return e.innerHTML=t,this.walkAndExtractText(e)},walkAndExtractText(t){let e="";if(t.nodeType===Node.TEXT_NODE)e+=t.textContent;else if(t.nodeType===Node.ELEMENT_NODE)if(this.hasPreWhitespace(t))e+=t.textContent;else for(const n of t.childNodes)e+=this.walkAndExtractText(n);return e},triggerInputChangeEvents(){const t=this.getOutput();this.$emit("input",t),this.$emit("update:value",t);const e=this.editor.getJSON();this.$emit("json-input",e);const n=this.editor.getHTML();this.$emit("html-input",n);const r=this.editor.getText({blockSeparator:`
8
- `});this.$emit("text-input",r)},addEditorListeners(){this.editor.on("create",()=>{this.triggerInputChangeEvents()}),this.editor.on("update",()=>{this.triggerInputChangeEvents()}),this.editor.on("selectionUpdate",({editor:t})=>{this.$emit("selected",this.getSelectedLinkText(t))}),this.editor.on("focus",({event:t})=>{this.$emit("focus",t)}),this.editor.on("blur",({event:t})=>{this.$emit("blur",t)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"text":default:return this.editor.getText({blockSeparator:`
9
- `})}},getExtension(t,e){var n;return typeof e=="boolean"?t:(n=t.configure)==null?void 0:n.call(t,e)},updateEditorAttributes(t){this.editor.setOptions({editorProps:{attributes:{...this.inputAttrs,class:this.inputClass,...t}}})},focusEditor(){this.editor.commands.focus()}}};var St=function(){var e=this,n=e._self._c;return n("div",[e.editor&&e.link&&!e.hideLinkBubbleMenu?n("bubble-menu",{staticStyle:{visibility:"visible"},attrs:{editor:e.editor,"should-show":e.bubbleMenuShouldShow,"tippy-options":e.tippyOptions}},[n("div",{staticClass:"d-popover__dialog"},[n("dt-stack",{staticClass:"d-rich-text-editor-bubble-menu__button-stack",attrs:{direction:"row",gap:"0"}},[n("dt-button",{attrs:{kind:"muted",importance:"clear"},on:{click:e.editLink}},[e._v(" "+e._s(e.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL"))+" ")]),n("dt-button",{attrs:{kind:"muted",importance:"clear"},on:{click:e.openLink}},[e._v(" "+e._s(e.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL"))+" ")]),n("dt-button",{attrs:{kind:"danger",importance:"clear"},on:{click:e.removeLink}},[e._v(" "+e._s(e.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL"))+" ")])],1)],1)]):e._e(),n("editor-content",e._g({ref:"editor",staticClass:"d-rich-text-editor",attrs:{editor:e.editor,"data-qa":"dt-rich-text-editor"}},e.editorListeners))],1)},Rt=[],Lt=u.n(Et,St,Rt);const $t=Lt.exports;exports.default=$t;
7
+ `)||/\n\s*\n/.test(e)},extractPreformattedText(e){const t=document.createElement("div");return t.innerHTML=e,this.walkAndExtractText(t)},walkAndExtractText(e){let t="";if(e.nodeType===Node.TEXT_NODE)t+=e.textContent;else if(e.nodeType===Node.ELEMENT_NODE)if(this.hasPreWhitespace(e))t+=e.textContent;else for(const n of e.childNodes)t+=this.walkAndExtractText(n);return t},triggerInputChangeEvents(){const e=this.getOutput();this.$emit("input",e),this.$emit("update:value",e);const t=this.editor.getJSON();this.$emit("json-input",t);const n=this.editor.getHTML();this.$emit("html-input",n);const r=this.editor.getText({blockSeparator:`
8
+ `});this.$emit("text-input",r)},addEditorListeners(){this.editor.on("create",()=>{this.triggerInputChangeEvents()}),this.editor.on("update",()=>{this.triggerInputChangeEvents()}),this.editor.on("selectionUpdate",({editor:e})=>{this.$emit("selected",this.getSelectedLinkText(e))}),this.editor.on("focus",({event:e})=>{this.$emit("focus",e)}),this.editor.on("blur",({event:e})=>{this.$emit("blur",e)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"text":default:return this.editor.getText({blockSeparator:`
9
+ `})}},getExtension(e,t){var n;return typeof t=="boolean"?e:(n=e.configure)==null?void 0:n.call(e,t)},updateEditorAttributes(e){this.editor.setOptions({editorProps:{attributes:{...this.inputAttrs,class:this.inputClass,...e}}})},focusEditor(){this.editor.commands.focus()}}};var Et=function(){var t=this,n=t._self._c;return n("div",[t.editor&&t.link&&!t.hideLinkBubbleMenu?n("bubble-menu",{staticStyle:{visibility:"visible"},attrs:{editor:t.editor,"should-show":t.bubbleMenuShouldShow,"tippy-options":t.tippyOptions}},[n("div",{staticClass:"d-popover__dialog"},[n("dt-stack",{staticClass:"d-rich-text-editor-bubble-menu__button-stack",attrs:{direction:"row",gap:"0"}},[n("dt-button",{attrs:{kind:"muted",importance:"clear"},on:{click:t.editLink}},[t._v(" "+t._s(t.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL"))+" ")]),n("dt-button",{attrs:{kind:"muted",importance:"clear"},on:{click:t.openLink}},[t._v(" "+t._s(t.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL"))+" ")]),n("dt-button",{attrs:{kind:"danger",importance:"clear"},on:{click:t.removeLink}},[t._v(" "+t._s(t.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL"))+" ")])],1)],1)]):t._e(),n("editor-content",t._g({ref:"editor",staticClass:"d-rich-text-editor",attrs:{editor:t.editor,"data-qa":"dt-rich-text-editor"}},t.editorListeners))],1)},St=[],Rt=u.n(Ct,Et,St);const Lt=Rt.exports;exports.default=Lt;
10
10
  //# sourceMappingURL=rich-text-editor.cjs.map