@dialpad/dialtone-vue 3.199.1 → 3.201.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 (47) hide show
  1. package/dist/common/utils/index.js +3 -3
  2. package/dist/component-documentation.json +1 -1
  3. package/dist/dialtone-vue.cjs +1 -1
  4. package/dist/dialtone-vue.js +440 -410
  5. package/dist/lib/avatar/avatar.js +5 -5
  6. package/dist/lib/editor/editor.cjs +1 -1
  7. package/dist/lib/editor/editor.cjs.map +1 -1
  8. package/dist/lib/editor/editor.js +51 -43
  9. package/dist/lib/editor/editor.js.map +1 -1
  10. package/dist/lib/rich-text-editor/rich-text-editor.cjs +4 -4
  11. package/dist/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  12. package/dist/lib/rich-text-editor/rich-text-editor.js +161 -149
  13. package/dist/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  14. package/dist/types/components/checkbox_group/checkbox_group.vue.d.ts +1 -1
  15. package/dist/types/components/combobox/combobox_empty-list.vue.d.ts +1 -1
  16. package/dist/types/components/combobox/combobox_loading-list.vue.d.ts +1 -1
  17. package/dist/types/components/emoji_picker/emoji_picker.vue.d.ts +6 -6
  18. package/dist/types/components/emoji_picker/modules/emoji_search.vue.d.ts +6 -6
  19. package/dist/types/components/notice/notice.vue.d.ts +4 -4
  20. package/dist/types/components/notice/notice_action.vue.d.ts +2 -2
  21. package/dist/types/components/pagination/pagination.vue.d.ts +1 -1
  22. package/dist/types/components/radio_group/radio_group.vue.d.ts +1 -1
  23. package/dist/types/components/rich_text_editor/extensions/mentions/MentionSuggestion.vue.d.ts +1 -1
  24. package/dist/types/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.d.ts +1 -1
  25. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +9 -0
  26. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  27. package/dist/types/components/split_button/split_button-alpha.vue.d.ts +1 -1
  28. package/dist/types/components/tab/tab.vue.d.ts +1 -1
  29. package/dist/types/components/toast/toast.vue.d.ts +14 -14
  30. package/dist/types/index.d.ts +2 -2
  31. package/dist/types/recipes/cards/ivr_node/ivr_node.vue.d.ts +6 -6
  32. package/dist/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts +4 -4
  33. package/dist/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts +3 -3
  34. package/dist/types/recipes/conversation_view/editor/editor.vue.d.ts +18 -0
  35. package/dist/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
  36. package/dist/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts +2 -2
  37. package/dist/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts +2 -2
  38. package/dist/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts +2 -2
  39. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +9 -0
  40. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  41. package/dist/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts +2 -2
  42. package/dist/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts +10 -10
  43. package/dist/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +2 -2
  44. package/dist/types/recipes/header/settings_menu_button/settings_menu_button.vue.d.ts +1 -1
  45. package/dist/types/recipes/item_layout/contact_info/contact_info.vue.d.ts +2 -2
  46. package/dist/types/recipes/leftbar/callbox/callbox.vue.d.ts +1 -1
  47. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"editor.js","sources":["../../../recipes/conversation_view/editor/editor.vue"],"sourcesContent":["<template>\n <div\n class=\"d-recipe-editor\"\n v-bind=\"addClassStyleAttrs($attrs)\"\n data-qa=\"dt-recipe-editor\"\n role=\"presentation\"\n @click=\"$refs.richTextEditor.focusEditor()\"\n >\n <!-- Section for the top UI -->\n <dt-stack\n class=\"d-recipe-editor__top-bar\"\n direction=\"row\"\n gap=\"450\"\n >\n <dt-stack\n v-for=\"buttonGroup in buttonGroups\"\n :key=\"buttonGroup.key\"\n direction=\"row\"\n gap=\"300\"\n >\n <dt-tooltip\n v-for=\"button in buttonGroup.buttonGroup\"\n :key=\"getButtonKey(buttonGroup.key, button.selector)\"\n :message=\"button.tooltipMessage\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n :ref=\"getButtonRef(buttonGroup.key, button.selector)\"\n :active=\"$refs.richTextEditor?.editor?.isActive(button.selector)\"\n :aria-label=\"button.tooltipMessage\"\n :data-qa=\"button.dataQA\"\n :tabindex=\"canFocus(getButtonRef(buttonGroup.key, button.selector)) ? 0 : -1\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n @click=\"button.onClick()\"\n @keydown.right.stop=\"shiftActionBarFocusRight\"\n @keydown.left.stop=\"shiftActionBarFocusLeft\"\n >\n <template #icon>\n <component\n :is=\"button.icon\"\n size=\"200\"\n />\n </template>\n {{ button?.label }}\n </dt-button>\n </template>\n </dt-tooltip>\n <div class=\"d-recipe-editor__button-group-divider\" />\n </dt-stack>\n <dt-stack\n v-if=\"linkButton.showBtn\"\n direction=\"row\"\n gap=\"300\"\n >\n <dt-popover\n :open=\"showLinkInput\"\n :show-close-button=\"false\"\n data-qa=\"dt-recipe-editor-link-input-popover\"\n padding=\"none\"\n placement=\"bottom-start\"\n @click=\"onInputFocus\"\n @opened=\"updateInput\"\n @click.stop=\"onInputFocus\"\n >\n <template #anchor>\n <dt-tooltip\n :key=\"linkButton.key\"\n :message=\"linkButton.tooltipMessage\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n :ref=\"getButtonRef('custom', 'link')\"\n :active=\"$refs.richTextEditor?.editor?.isActive(linkButton.selector)\"\n :aria-label=\"linkButton.tooltipMessage\"\n :data-qa=\"linkButton.dataQA\"\n :tabindex=\"canFocus(getButtonRef('custom', 'link')) ? 0 : -1\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n @click=\"linkButton.onClick()\"\n @keydown.right.stop=\"shiftActionBarFocusRight\"\n @keydown.left.stop=\"shiftActionBarFocusLeft\"\n >\n <template #icon>\n <component\n :is=\"linkButton.icon\"\n size=\"200\"\n />\n </template>\n </dt-button>\n </template>\n </dt-tooltip>\n </template>\n\n <template #content>\n <div class=\"d-recipe-editor__popover-content\">\n <span>\n {{ showAddLinkButtonLabels.title }}\n </span>\n <dt-input\n v-model=\"linkInput\"\n :input-aria-label=\"showAddLinkButtonLabels['aria-label']\"\n :placeholder=\"setLinkPlaceholder\"\n data-qa=\"dt-recipe-editor-link-input\"\n input-wrapper-class=\"d-recipe-editor-link__input-wrapper\"\n @click=\"onInputFocus\"\n @focus=\"onInputFocus\"\n @click.stop=\"onInputFocus\"\n @keydown.enter=\"setLink\"\n />\n </div>\n </template>\n <template #footerContent>\n <dt-stack\n direction=\"row\"\n gap=\"300\"\n class=\"d-recipe-editor__popover-footer\"\n >\n <dt-button\n data-qa=\"dt-recipe-editor-remove-link-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"sm\"\n v-bind=\"removeLinkButtonLabels\"\n @click=\"removeLink\"\n >\n {{ removeLinkButtonLabels.title }}\n </dt-button>\n <dt-button\n data-qa=\"dt-recipe-editor-set-link-cancel-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"sm\"\n v-bind=\"cancelSetLinkButtonLabels\"\n @click=\"closeLinkInput\"\n >\n {{ cancelSetLinkButtonLabels.title }}\n </dt-button>\n <dt-button\n data-qa=\"dt-recipe-editor-set-link-confirm-btn\"\n size=\"sm\"\n v-bind=\"confirmSetLinkButtonLabels\"\n @click=\"setLink\"\n >\n {{ confirmSetLinkButtonLabels.title }}\n </dt-button>\n </dt-stack>\n </template>\n </dt-popover>\n </dt-stack>\n </dt-stack>\n\n <!-- Some wrapper to restrict the height and show the scrollbar -->\n <div\n :style=\"{ 'max-height': maxHeight }\"\n class=\"d-recipe-editor__content\"\n >\n <dt-rich-text-editor\n ref=\"richTextEditor\"\n v-model=\"internalInputValue\"\n :allow-font-color=\"true\"\n :allow-font-family=\"true\"\n :allow-inline-images=\"true\"\n :allow-line-breaks=\"true\"\n :hide-link-bubble-menu=\"true\"\n :auto-focus=\"autoFocus\"\n :editable=\"editable\"\n :input-aria-label=\"inputAriaLabel\"\n :input-class=\"`d-recipe-editor__content-input ${inputClass}`\"\n :link=\"true\"\n :output-format=\"htmlOutputFormat\"\n :placeholder=\"placeholder\"\n :use-div-tags=\"useDivTags\"\n data-qa=\"dt-rich-text-editor\"\n v-bind=\"removeClassStyleAttrs($attrs)\"\n @text-input=\"onTextInput\"\n @blur=\"onBlur\"\n @focus=\"onFocus\"\n @input=\"onInput($event)\"\n />\n </div>\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 {\n EDITOR_SUPPORTED_LINK_PROTOCOLS,\n EDITOR_DEFAULT_LINK_PREFIX,\n} from './editor_constants.js';\nimport { removeClassStyleAttrs, addClassStyleAttrs } from '@/common/utils';\nimport { DtButton } from '@/components/button';\nimport { DtPopover } from '@/components/popover';\nimport { DtStack } from '@/components/stack';\nimport { DtInput } from '@/components/input';\nimport { DtTooltip } from '@/components/tooltip';\nimport {\n DtIconAlignCenter,\n DtIconAlignJustify,\n DtIconAlignLeft,\n DtIconAlignRight,\n DtIconBold,\n DtIconCodeBlock,\n DtIconImage,\n DtIconItalic,\n DtIconQuickReply,\n DtIconLink2,\n DtIconListBullet,\n DtIconListOrdered,\n DtIconQuote,\n DtIconStrikethrough,\n DtIconUnderline,\n} from '@dialpad/dialtone-icons/vue3';\nimport { DialtoneLocalization } from '@/localization';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtRecipeEditor',\n\n components: {\n DtRichTextEditor,\n DtButton,\n DtPopover,\n DtStack,\n DtInput,\n DtTooltip,\n DtIconQuickReply,\n DtIconBold,\n DtIconItalic,\n DtIconUnderline,\n DtIconStrikethrough,\n DtIconListBullet,\n DtIconListOrdered,\n DtIconAlignLeft,\n DtIconAlignCenter,\n DtIconAlignRight,\n DtIconAlignJustify,\n DtIconQuote,\n DtIconCodeBlock,\n DtIconLink2,\n DtIconImage,\n },\n\n mixins: [],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Value of the input. The object format should match TipTap's JSON\n * document structure: https://tiptap.dev/guide/output#option-1-json\n */\n modelValue: {\n type: [Object, String],\n default: '',\n },\n\n /**\n * Whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Descriptive label for the input element\n */\n inputAriaLabel: {\n type: String,\n required: true,\n default: '',\n },\n\n /**\n * Additional class name for the input element. Only accepts a String value\n * because this is passed to the editor via options. For multiple classes,\n * join them into one string, e.g. \"d-p8 d-hmx96\"\n */\n inputClass: {\n type: String,\n default: '',\n },\n\n /**\n * Whether the input should receive focus after the component has been\n * mounted. Either one of `start`, `end`, `all` or a Boolean or a Number.\n * - `start` Sets the focus to the beginning of the input\n * - `end` Sets the focus to the end of the input\n * - `all` Selects the whole contents of the input\n * - `Number` Sets the focus to a specific position in the input\n * - `true` Defaults to `start`\n * - `false` Disables autofocus\n * @values true, false, start, end, all, number\n */\n autoFocus: {\n type: [Boolean, String, Number],\n default: false,\n validator (autoFocus) {\n if (typeof autoFocus === 'string') {\n return RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(autoFocus);\n }\n return true;\n },\n },\n\n /**\n * Placeholder text\n */\n placeholder: {\n type: String,\n default: '',\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 /**\n * Placeholder text for the set link input field\n */\n setLinkPlaceholder: {\n type: String,\n default: '',\n },\n\n /**\n * Show button to render text as bold\n */\n showBoldButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to render text in italics\n */\n showItalicsButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to underline text\n */\n showUnderlineButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to strike text\n */\n showStrikeButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to render list items\n */\n showListItemsButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to render ordered list items\n */\n showOrderedListButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to align text to the left\n */\n showAlignLeftButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to align text to the center\n */\n showAlignCenterButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to align text to the right\n */\n showAlignRightButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to justify text\n */\n showAlignJustifyButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to add quote format to text\n */\n showQuoteButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to add code block\n */\n showCodeBlockButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to handle quick replies\n */\n showQuickRepliesButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to add an inline image\n */\n showInlineImageButton: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Show add link default config.\n */\n showAddLink: {\n type: Object,\n default: () => ({\n showAddLinkButton: true,\n }),\n },\n\n /**\n * Use div tags instead of paragraph tags to show text\n */\n useDivTags: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native focus event\n * @event input\n * @type {String|JSON}\n */\n 'focus',\n\n /**\n * Native blur event\n * @event input\n * @type {String|JSON}\n */\n 'blur',\n\n /**\n * Native input event\n * @event input\n * @type {String|JSON}\n */\n 'input',\n\n /**\n * Event fired to sync the modelValue prop with the parent component\n * @event input\n * @type {String|JSON}\n */\n 'update:modelValue',\n\n /**\n * Quick replies button\n * pressed event\n * @event quick-replies-click\n */\n 'quick-replies-click',\n\n /**\n * Emit when inline image button is clicked\n * @event inline-image-click\n */\n 'inline-image-click',\n\n /**\n * Emit when text input is changed\n * @event text-input\n * @type {String}\n */\n 'text-input',\n ],\n\n data () {\n return {\n internalInputValue: this.modelValue, // internal input content\n hasFocus: false,\n\n linkOptions: {\n class: 'd-recipe-editor__link',\n },\n\n showLinkInput: false,\n linkInput: '',\n currentButtonRefIndex: 0,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n inputLength () {\n return this.internalInputValue.length;\n },\n\n htmlOutputFormat () {\n return RICH_TEXT_EDITOR_OUTPUT_FORMATS[2];\n },\n\n showingTextFormatButtons () {\n return this.showBoldButton || this.showItalicsButton || this.showStrikeButton || this.showUnderlineButton;\n },\n\n showingAlignmentButtons () {\n return this.showAlignLeftButton || this.showAlignCenterButton ||\n this.showAlignRightButton || this.showAlignJustifyButton;\n },\n\n showingListButtons () {\n return this.showListItemsButton || this.showOrderedListButton;\n },\n\n orderedRefs () {\n const refs = this.buttonGroups.reduce(function (acc, buttonData) {\n buttonData.buttonGroup.forEach(button => {\n acc.push(this.getButtonRef(buttonData.key, button.selector));\n }, this);\n return acc;\n }.bind(this), []);\n refs.push(this.getButtonRef('custom', 'link'));\n return refs;\n },\n\n buttonGroups () {\n const individualButtonStacks = this.individualButtons.map(buttonData => ({\n key: buttonData.selector,\n buttonGroup: [buttonData],\n }));\n return [\n { key: 'new', buttonGroup: this.newButtons },\n { key: 'format', buttonGroup: this.textFormatButtons },\n { key: 'alignment', buttonGroup: this.alignmentButtons },\n { key: 'list', buttonGroup: this.listButtons },\n ...individualButtonStacks,\n ].filter(buttonGroupData => buttonGroupData.buttonGroup.length > 0);\n },\n\n newButtons () {\n return [\n {\n showBtn: this.showQuickRepliesButton,\n label: this.i18n.$t('DIALTONE_EDITOR_QUICK_REPLY_BUTTON_LABEL'),\n selector: 'quickReplies',\n icon: DtIconQuickReply,\n dataQA: 'dt-recipe-editor-quick-replies-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_QUICK_REPLY_BUTTON_LABEL'),\n onClick: this.onQuickRepliesClick,\n },\n ].filter(button => button.showBtn);\n },\n\n textFormatButtons () {\n return [\n {\n showBtn: this.showBoldButton,\n selector: 'bold',\n icon: DtIconBold,\n dataQA: 'dt-recipe-editor-bold-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_BOLD_BUTTON_LABEL'),\n onClick: this.onBoldTextToggle,\n },\n {\n showBtn: this.showItalicsButton,\n selector: 'italic',\n icon: DtIconItalic,\n dataQA: 'dt-recipe-editor-italics-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ITALICS_BUTTON_LABEL'),\n onClick: this.onItalicTextToggle,\n },\n {\n showBtn: this.showUnderlineButton,\n selector: 'underline',\n icon: DtIconUnderline,\n dataQA: 'dt-recipe-editor-underline-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_UNDERLINE_BUTTON_LABEL'),\n onClick: this.onUnderlineTextToggle,\n },\n {\n showBtn: this.showStrikeButton,\n selector: 'strike',\n icon: DtIconStrikethrough,\n dataQA: 'dt-recipe-editor-strike-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_STRIKE_BUTTON_LABEL'),\n onClick: this.onStrikethroughTextToggle,\n },\n ].filter(button => button.showBtn);\n },\n\n alignmentButtons () {\n return [\n {\n showBtn: this.showAlignLeftButton,\n selector: { textAlign: 'left' },\n icon: DtIconAlignLeft,\n dataQA: 'dt-recipe-editor-align-left-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ALIGN_LEFT_BUTTON_LABEL'),\n onClick: () => this.onTextAlign('left'),\n },\n {\n showBtn: this.showAlignCenterButton,\n selector: { textAlign: 'center' },\n icon: DtIconAlignCenter,\n dataQA: 'dt-recipe-editor-align-center-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ALIGN_CENTER_BUTTON_LABEL'),\n onClick: () => this.onTextAlign('center'),\n },\n {\n showBtn: this.showAlignRightButton,\n selector: { textAlign: 'right' },\n icon: DtIconAlignRight,\n dataQA: 'dt-recipe-editor-align-right-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ALIGN_RIGHT_BUTTON_LABEL'),\n onClick: () => this.onTextAlign('right'),\n },\n {\n showBtn: this.showAlignJustifyButton,\n selector: { textAlign: 'justify' },\n icon: DtIconAlignJustify,\n dataQA: 'dt-recipe-editor-align-justify-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ALIGN_JUSTIFY_BUTTON_LABEL'),\n onClick: () => this.onTextAlign('justify'),\n },\n ].filter(button => button.showBtn);\n },\n\n listButtons () {\n return [\n {\n showBtn: this.showListItemsButton,\n selector: 'bulletList',\n icon: DtIconListBullet,\n dataQA: 'dt-recipe-editor-list-items-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_BULLET_LIST_BUTTON_LABEL'),\n onClick: this.onBulletListToggle,\n },\n {\n showBtn: this.showOrderedListButton,\n selector: 'orderedList',\n icon: DtIconListOrdered,\n dataQA: 'dt-recipe-editor-ordered-list-items-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ORDERED_LIST_BUTTON_LABEL'),\n onClick: this.onOrderedListToggle,\n },\n ].filter(button => button.showBtn);\n },\n\n individualButtons () {\n return [\n {\n showBtn: this.showQuoteButton,\n selector: 'blockquote',\n icon: DtIconQuote,\n dataQA: 'dt-recipe-editor-blockquote-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_QUOTE_BUTTON_LABEL'),\n onClick: this.onBlockquoteToggle,\n },\n {\n showBtn: this.showCodeBlockButton,\n selector: 'codeBlock',\n icon: DtIconCodeBlock,\n dataQA: 'dt-recipe-editor-code-block-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_CODE_BUTTON_LABEL'),\n onClick: this.onCodeBlockToggle,\n },\n {\n showBtn: this.showInlineImageButton,\n selector: 'image',\n icon: DtIconImage,\n dataQA: 'dt-recipe-editor-inline-image-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_IMAGE_BUTTON_LABEL'),\n // Handle getting image\n onClick: this.onInsertInlineImageClick,\n },\n ].filter(button => button.showBtn);\n },\n\n linkButton () {\n return {\n showBtn: this.showAddLink.showAddLinkButton,\n selector: 'link',\n icon: DtIconLink2,\n dataQA: 'dt-recipe-editor-add-link-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_LINK_BUTTON_LABEL'),\n onClick: this.openLinkInput,\n };\n },\n\n confirmSetLinkButtonLabels () {\n return this.i18n.$ta('DIALTONE_EDITOR_CONFIRM_SET_LINK_BUTTON');\n },\n\n cancelSetLinkButtonLabels () {\n return this.i18n.$ta('DIALTONE_EDITOR_CANCEL_SET_LINK_BUTTON');\n },\n\n removeLinkButtonLabels () {\n return this.i18n.$ta('DIALTONE_EDITOR_REMOVE_LINK_BUTTON');\n },\n\n showAddLinkButtonLabels () {\n return this.i18n.$ta('DIALTONE_EDITOR_ADD_LINK_BUTTON');\n },\n },\n\n watch: {\n modelValue (newValue) {\n this.internalInputValue = newValue;\n },\n },\n\n methods: {\n removeClassStyleAttrs,\n addClassStyleAttrs,\n\n onInputFocus (event) {\n event?.stopPropagation();\n },\n\n removeLink () {\n this.$refs.richTextEditor?.editor?.chain()?.focus()?.unsetLink()?.run();\n this.closeLinkInput();\n },\n\n setLink (event) {\n const editor = this.$refs.richTextEditor?.editor;\n event?.preventDefault();\n event?.stopPropagation();\n\n if (!this.linkInput) {\n // If link text is set to empty string,\n // remove any existing links.\n this.removeLink();\n return;\n }\n\n // Check if input matches any of the supported link formats\n const prefix = EDITOR_SUPPORTED_LINK_PROTOCOLS.find(prefixRegex => prefixRegex.test(this.linkInput));\n\n if (!prefix) {\n // If no matching pattern is found, prepend default prefix\n this.linkInput = `${EDITOR_DEFAULT_LINK_PREFIX}${this.linkInput}`;\n }\n\n const selection = editor?.view?.state?.selection;\n\n if (selection.anchor === selection.head) {\n // If no text has been selected, manually insert the link text.\n // Do not rely on link options set through DtRichTextEditor\n // component, because they clash with these and cause issues.\n editor\n .chain()\n .focus()\n .insertContentAt(\n selection.anchor,\n `<a class=\"${this.linkOptions.class}\" href=${this.linkInput}>${this.linkInput}</a>`,\n )\n .run();\n } else {\n // Set or edit the link\n editor\n .chain()\n .focus()\n .extendMarkRange('link')\n .setLink({ href: this.linkInput, class: this.linkOptions.class })\n .run();\n }\n\n this.closeLinkInput();\n },\n\n openLinkInput () {\n this.showLinkInput = true;\n },\n\n updateInput (openedInput) {\n if (!openedInput) {\n return this.closeLinkInput();\n }\n this.linkInput = this.$refs.richTextEditor?.editor?.getAttributes('link')?.href;\n },\n\n closeLinkInput () {\n this.showLinkInput = false;\n this.linkInput = '';\n this.$refs.richTextEditor.editor?.chain().focus();\n },\n\n onBoldTextToggle () {\n this.$refs.richTextEditor?.editor?.chain().focus().toggleBold().run();\n },\n\n onItalicTextToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleItalic().run();\n },\n\n onUnderlineTextToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleUnderline().run();\n },\n\n onStrikethroughTextToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleStrike().run();\n },\n\n onTextAlign (alignment) {\n if (this.$refs.richTextEditor?.editor?.isActive({ textAlign: alignment })) {\n // If this alignment type is already set here, unset it\n return this.$refs.richTextEditor?.editor.chain().focus().unsetTextAlign().run();\n }\n this.$refs.richTextEditor?.editor.chain().focus().setTextAlign(alignment).run();\n },\n\n onBulletListToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleBulletList().run();\n },\n\n onOrderedListToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleOrderedList().run();\n },\n\n onCodeBlockToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleCodeBlock().run();\n },\n\n onQuickRepliesClick () {\n this.$emit('quick-replies-click');\n },\n\n onInsertInlineImageClick () {\n this.$emit('inline-image-click');\n },\n\n insertInlineImage (imageUrl) {\n this.$refs.richTextEditor?.editor.chain().focus().setImage({ src: imageUrl }).run();\n },\n\n insertInMessageBody (messageContent) {\n this.$refs.richTextEditor?.editor.chain().focus().insertContent(messageContent).run();\n },\n\n setCursorPosition (position = null) {\n this.$refs.richTextEditor?.editor.chain().focus(position).run();\n },\n\n onBlockquoteToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleBlockquote().run();\n },\n\n onTextInput (input) {\n this.$emit('text-input', input);\n },\n\n onFocus (event) {\n this.hasFocus = true;\n this.$emit('focus', event);\n },\n\n onBlur (event) {\n this.hasFocus = false;\n this.$emit('blur', event);\n },\n\n onInput (event) {\n this.$emit('input', event);\n this.$emit('update:modelValue', event);\n },\n\n getButtonKey (key, selector) {\n return `${key}-${JSON.stringify(selector)}`;\n },\n\n // Unique Button Ref Key to identify ref\n getButtonRef (key, selector) {\n return `${this.getButtonKey(key, selector)}-ref`;\n },\n\n /**\n * Determines if an element in the action bar button list is focusable with tab key\n * @param {string} refKey - unique identifier for the ref element in DOM\n */\n canFocus (refKey) {\n return refKey === this.orderedRefs[this.currentButtonRefIndex];\n },\n\n shiftActionBarFocusRight () {\n this.shiftButtonRefIndex(1);\n },\n\n shiftActionBarFocusLeft () {\n this.shiftButtonRefIndex(-1);\n },\n\n shiftButtonRefIndex (shiftAmount) {\n const previousRef = this.$refs[this.orderedRefs[this.currentButtonRefIndex]];\n const previousActionBarBtn = Array.isArray(previousRef) ? previousRef[0] : previousRef;\n const index = (this.currentButtonRefIndex + shiftAmount) % this.orderedRefs.length;\n this.currentButtonRefIndex = index >= 0 ? index : this.orderedRefs.length + index;\n const currentRef = this.$refs[this.orderedRefs[this.currentButtonRefIndex]];\n const currentActionBarBtn = Array.isArray(currentRef) ? currentRef[0] : currentRef;\n previousActionBarBtn.$el.blur();\n currentActionBarBtn.$el.focus();\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtRichTextEditor","DtButton","DtPopover","DtStack","DtInput","DtTooltip","DtIconQuickReply","DtIconBold","DtIconItalic","DtIconUnderline","DtIconStrikethrough","DtIconListBullet","DtIconListOrdered","DtIconAlignLeft","DtIconAlignCenter","DtIconAlignRight","DtIconAlignJustify","DtIconQuote","DtIconCodeBlock","DtIconLink2","DtIconImage","autoFocus","RICH_TEXT_EDITOR_AUTOFOCUS_TYPES","DialtoneLocalization","RICH_TEXT_EDITOR_OUTPUT_FORMATS","refs","acc","buttonData","button","individualButtonStacks","buttonGroupData","newValue","removeClassStyleAttrs","addClassStyleAttrs","event","_e","_d","_c","_b","_a","editor","EDITOR_SUPPORTED_LINK_PROTOCOLS","prefixRegex","EDITOR_DEFAULT_LINK_PREFIX","selection","openedInput","alignment","imageUrl","messageContent","position","input","key","selector","refKey","shiftAmount","previousRef","previousActionBarBtn","index","currentRef","currentActionBarBtn","_hoisted_1","_createElementBlock","_mergeProps","$options","_ctx","_cache","$event","_createVNode","_component_dt_stack","_Fragment","_renderList","buttonGroup","_createBlock","_openBlock","_component_dt_tooltip","_component_dt_button","_resolveDynamicComponent","_toDisplayString","_createElementVNode","_component_dt_popover","$data","_component_dt_input","$props","_createTextVNode","_component_dt_rich_text_editor"],"mappings":";;;;;;;;;;;;;AAgOA,MAAKA,KAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,kBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA;EAGF,QAAQ,CAAA;AAAA,EAER,cAAc;AAAA,EAEd,OAA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AenB,EAAA;AAAA,QACf,aAAamB,EAAA;AAAA,QACb,gBAAcA,EAAA;AAAA,QACf,WAAQ;AAAA,MACA,GAAAnB,EAAA,sBAAsBC,EAAA,MAAM,GAAA;AAAA,QACnC,aAAYD,EAAA;AAAA,QACZ,QAAMA,EAAA;AAAA,QACN,SAAOA,EAAA;AAAA,QACP,SAAKE,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEH,EAAA,QAAQG,CAAM;AAAA;;;;;"}
1
+ {"version":3,"file":"editor.js","sources":["../../../recipes/conversation_view/editor/editor.vue"],"sourcesContent":["<template>\n <div\n class=\"d-recipe-editor\"\n v-bind=\"addClassStyleAttrs($attrs)\"\n data-qa=\"dt-recipe-editor\"\n role=\"presentation\"\n @click=\"$refs.richTextEditor.focusEditor()\"\n >\n <!-- Section for the top UI -->\n <dt-stack\n class=\"d-recipe-editor__top-bar\"\n direction=\"row\"\n gap=\"450\"\n >\n <dt-stack\n v-for=\"buttonGroup in buttonGroups\"\n :key=\"buttonGroup.key\"\n direction=\"row\"\n gap=\"300\"\n >\n <dt-tooltip\n v-for=\"button in buttonGroup.buttonGroup\"\n :key=\"getButtonKey(buttonGroup.key, button.selector)\"\n :message=\"button.tooltipMessage\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n :ref=\"getButtonRef(buttonGroup.key, button.selector)\"\n :active=\"$refs.richTextEditor?.editor?.isActive(button.selector)\"\n :aria-label=\"button.tooltipMessage\"\n :data-qa=\"button.dataQA\"\n :tabindex=\"canFocus(getButtonRef(buttonGroup.key, button.selector)) ? 0 : -1\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n @click=\"button.onClick()\"\n @keydown.right.stop=\"shiftActionBarFocusRight\"\n @keydown.left.stop=\"shiftActionBarFocusLeft\"\n >\n <template #icon>\n <component\n :is=\"button.icon\"\n size=\"200\"\n />\n </template>\n {{ button?.label }}\n </dt-button>\n </template>\n </dt-tooltip>\n <div class=\"d-recipe-editor__button-group-divider\" />\n </dt-stack>\n <dt-stack\n v-if=\"linkButton.showBtn\"\n direction=\"row\"\n gap=\"300\"\n >\n <dt-popover\n :open=\"showLinkInput\"\n :show-close-button=\"false\"\n data-qa=\"dt-recipe-editor-link-input-popover\"\n padding=\"none\"\n placement=\"bottom-start\"\n @click=\"onInputFocus\"\n @opened=\"updateInput\"\n @click.stop=\"onInputFocus\"\n >\n <template #anchor>\n <dt-tooltip\n :key=\"linkButton.key\"\n :message=\"linkButton.tooltipMessage\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n :ref=\"getButtonRef('custom', 'link')\"\n :active=\"$refs.richTextEditor?.editor?.isActive(linkButton.selector)\"\n :aria-label=\"linkButton.tooltipMessage\"\n :data-qa=\"linkButton.dataQA\"\n :tabindex=\"canFocus(getButtonRef('custom', 'link')) ? 0 : -1\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n @click=\"linkButton.onClick()\"\n @keydown.right.stop=\"shiftActionBarFocusRight\"\n @keydown.left.stop=\"shiftActionBarFocusLeft\"\n >\n <template #icon>\n <component\n :is=\"linkButton.icon\"\n size=\"200\"\n />\n </template>\n </dt-button>\n </template>\n </dt-tooltip>\n </template>\n\n <template #content>\n <div class=\"d-recipe-editor__popover-content\">\n <span>\n {{ showAddLinkButtonLabels.title }}\n </span>\n <dt-input\n v-model=\"linkInput\"\n :input-aria-label=\"showAddLinkButtonLabels['aria-label']\"\n :placeholder=\"setLinkPlaceholder\"\n data-qa=\"dt-recipe-editor-link-input\"\n input-wrapper-class=\"d-recipe-editor-link__input-wrapper\"\n @click=\"onInputFocus\"\n @focus=\"onInputFocus\"\n @click.stop=\"onInputFocus\"\n @keydown.enter=\"setLink\"\n />\n </div>\n </template>\n <template #footerContent>\n <dt-stack\n direction=\"row\"\n gap=\"300\"\n class=\"d-recipe-editor__popover-footer\"\n >\n <dt-button\n data-qa=\"dt-recipe-editor-remove-link-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"sm\"\n v-bind=\"removeLinkButtonLabels\"\n @click=\"removeLink\"\n >\n {{ removeLinkButtonLabels.title }}\n </dt-button>\n <dt-button\n data-qa=\"dt-recipe-editor-set-link-cancel-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"sm\"\n v-bind=\"cancelSetLinkButtonLabels\"\n @click=\"closeLinkInput\"\n >\n {{ cancelSetLinkButtonLabels.title }}\n </dt-button>\n <dt-button\n data-qa=\"dt-recipe-editor-set-link-confirm-btn\"\n size=\"sm\"\n v-bind=\"confirmSetLinkButtonLabels\"\n @click=\"setLink\"\n >\n {{ confirmSetLinkButtonLabels.title }}\n </dt-button>\n </dt-stack>\n </template>\n </dt-popover>\n </dt-stack>\n </dt-stack>\n\n <!-- Some wrapper to restrict the height and show the scrollbar -->\n <div\n :style=\"{ 'max-height': maxHeight }\"\n class=\"d-recipe-editor__content\"\n >\n <dt-rich-text-editor\n ref=\"richTextEditor\"\n v-model=\"internalInputValue\"\n :allow-font-color=\"true\"\n :allow-font-family=\"true\"\n :allow-inline-images=\"true\"\n :allow-line-breaks=\"true\"\n :hide-link-bubble-menu=\"true\"\n :auto-focus=\"autoFocus\"\n :editable=\"editable\"\n :input-aria-label=\"inputAriaLabel\"\n :input-class=\"`d-recipe-editor__content-input ${inputClass}`\"\n :link=\"true\"\n :output-format=\"htmlOutputFormat\"\n :placeholder=\"placeholder\"\n :use-div-tags=\"useDivTags\"\n :allow-tables=\"allowTables\"\n data-qa=\"dt-rich-text-editor\"\n v-bind=\"removeClassStyleAttrs($attrs)\"\n @text-input=\"onTextInput\"\n @blur=\"onBlur\"\n @focus=\"onFocus\"\n @input=\"onInput($event)\"\n />\n </div>\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 {\n EDITOR_SUPPORTED_LINK_PROTOCOLS,\n EDITOR_DEFAULT_LINK_PREFIX,\n} from './editor_constants.js';\nimport { removeClassStyleAttrs, addClassStyleAttrs } from '@/common/utils';\nimport { DtButton } from '@/components/button';\nimport { DtPopover } from '@/components/popover';\nimport { DtStack } from '@/components/stack';\nimport { DtInput } from '@/components/input';\nimport { DtTooltip } from '@/components/tooltip';\nimport {\n DtIconAlignCenter,\n DtIconAlignJustify,\n DtIconAlignLeft,\n DtIconAlignRight,\n DtIconBold,\n DtIconCodeBlock,\n DtIconImage,\n DtIconItalic,\n DtIconQuickReply,\n DtIconLink2,\n DtIconListBullet,\n DtIconListOrdered,\n DtIconQuote,\n DtIconStrikethrough,\n DtIconUnderline,\n} from '@dialpad/dialtone-icons/vue3';\nimport { DialtoneLocalization } from '@/localization';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtRecipeEditor',\n\n components: {\n DtRichTextEditor,\n DtButton,\n DtPopover,\n DtStack,\n DtInput,\n DtTooltip,\n DtIconQuickReply,\n DtIconBold,\n DtIconItalic,\n DtIconUnderline,\n DtIconStrikethrough,\n DtIconListBullet,\n DtIconListOrdered,\n DtIconAlignLeft,\n DtIconAlignCenter,\n DtIconAlignRight,\n DtIconAlignJustify,\n DtIconQuote,\n DtIconCodeBlock,\n DtIconLink2,\n DtIconImage,\n },\n\n mixins: [],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Value of the input. The object format should match TipTap's JSON\n * document structure: https://tiptap.dev/guide/output#option-1-json\n */\n modelValue: {\n type: [Object, String],\n default: '',\n },\n\n /**\n * Whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Descriptive label for the input element\n */\n inputAriaLabel: {\n type: String,\n required: true,\n default: '',\n },\n\n /**\n * Additional class name for the input element. Only accepts a String value\n * because this is passed to the editor via options. For multiple classes,\n * join them into one string, e.g. \"d-p8 d-hmx96\"\n */\n inputClass: {\n type: String,\n default: '',\n },\n\n /**\n * Whether the input should receive focus after the component has been\n * mounted. Either one of `start`, `end`, `all` or a Boolean or a Number.\n * - `start` Sets the focus to the beginning of the input\n * - `end` Sets the focus to the end of the input\n * - `all` Selects the whole contents of the input\n * - `Number` Sets the focus to a specific position in the input\n * - `true` Defaults to `start`\n * - `false` Disables autofocus\n * @values true, false, start, end, all, number\n */\n autoFocus: {\n type: [Boolean, String, Number],\n default: false,\n validator (autoFocus) {\n if (typeof autoFocus === 'string') {\n return RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(autoFocus);\n }\n return true;\n },\n },\n\n /**\n * Placeholder text\n */\n placeholder: {\n type: String,\n default: '',\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 /**\n * Placeholder text for the set link input field\n */\n setLinkPlaceholder: {\n type: String,\n default: '',\n },\n\n /**\n * Show button to render text as bold\n */\n showBoldButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to render text in italics\n */\n showItalicsButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to underline text\n */\n showUnderlineButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to strike text\n */\n showStrikeButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to render list items\n */\n showListItemsButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to render ordered list items\n */\n showOrderedListButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to align text to the left\n */\n showAlignLeftButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to align text to the center\n */\n showAlignCenterButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to align text to the right\n */\n showAlignRightButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to justify text\n */\n showAlignJustifyButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to add quote format to text\n */\n showQuoteButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to add code block\n */\n showCodeBlockButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to handle quick replies\n */\n showQuickRepliesButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Show button to add an inline image\n */\n showInlineImageButton: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Show add link default config.\n */\n showAddLink: {\n type: Object,\n default: () => ({\n showAddLinkButton: true,\n }),\n },\n\n /**\n * Use div tags instead of paragraph tags to show text\n */\n useDivTags: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Allow Tables to be used in to the editor\n */\n allowTables: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native focus event\n * @event input\n * @type {String|JSON}\n */\n 'focus',\n\n /**\n * Native blur event\n * @event input\n * @type {String|JSON}\n */\n 'blur',\n\n /**\n * Native input event\n * @event input\n * @type {String|JSON}\n */\n 'input',\n\n /**\n * Event fired to sync the modelValue prop with the parent component\n * @event input\n * @type {String|JSON}\n */\n 'update:modelValue',\n\n /**\n * Quick replies button\n * pressed event\n * @event quick-replies-click\n */\n 'quick-replies-click',\n\n /**\n * Emit when inline image button is clicked\n * @event inline-image-click\n */\n 'inline-image-click',\n\n /**\n * Emit when text input is changed\n * @event text-input\n * @type {String}\n */\n 'text-input',\n ],\n\n data () {\n return {\n internalInputValue: this.modelValue, // internal input content\n hasFocus: false,\n\n linkOptions: {\n class: 'd-recipe-editor__link',\n },\n\n showLinkInput: false,\n linkInput: '',\n currentButtonRefIndex: 0,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n inputLength () {\n return this.internalInputValue.length;\n },\n\n htmlOutputFormat () {\n return RICH_TEXT_EDITOR_OUTPUT_FORMATS[2];\n },\n\n showingTextFormatButtons () {\n return this.showBoldButton || this.showItalicsButton || this.showStrikeButton || this.showUnderlineButton;\n },\n\n showingAlignmentButtons () {\n return this.showAlignLeftButton || this.showAlignCenterButton ||\n this.showAlignRightButton || this.showAlignJustifyButton;\n },\n\n showingListButtons () {\n return this.showListItemsButton || this.showOrderedListButton;\n },\n\n orderedRefs () {\n const refs = this.buttonGroups.reduce(function (acc, buttonData) {\n buttonData.buttonGroup.forEach(button => {\n acc.push(this.getButtonRef(buttonData.key, button.selector));\n }, this);\n return acc;\n }.bind(this), []);\n refs.push(this.getButtonRef('custom', 'link'));\n return refs;\n },\n\n buttonGroups () {\n const individualButtonStacks = this.individualButtons.map(buttonData => ({\n key: buttonData.selector,\n buttonGroup: [buttonData],\n }));\n return [\n { key: 'new', buttonGroup: this.newButtons },\n { key: 'format', buttonGroup: this.textFormatButtons },\n { key: 'alignment', buttonGroup: this.alignmentButtons },\n { key: 'list', buttonGroup: this.listButtons },\n ...individualButtonStacks,\n ].filter(buttonGroupData => buttonGroupData.buttonGroup.length > 0);\n },\n\n newButtons () {\n return [\n {\n showBtn: this.showQuickRepliesButton,\n label: this.i18n.$t('DIALTONE_EDITOR_QUICK_REPLY_BUTTON_LABEL'),\n selector: 'quickReplies',\n icon: DtIconQuickReply,\n dataQA: 'dt-recipe-editor-quick-replies-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_QUICK_REPLY_BUTTON_LABEL'),\n onClick: this.onQuickRepliesClick,\n },\n ].filter(button => button.showBtn);\n },\n\n textFormatButtons () {\n return [\n {\n showBtn: this.showBoldButton,\n selector: 'bold',\n icon: DtIconBold,\n dataQA: 'dt-recipe-editor-bold-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_BOLD_BUTTON_LABEL'),\n onClick: this.onBoldTextToggle,\n },\n {\n showBtn: this.showItalicsButton,\n selector: 'italic',\n icon: DtIconItalic,\n dataQA: 'dt-recipe-editor-italics-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ITALICS_BUTTON_LABEL'),\n onClick: this.onItalicTextToggle,\n },\n {\n showBtn: this.showUnderlineButton,\n selector: 'underline',\n icon: DtIconUnderline,\n dataQA: 'dt-recipe-editor-underline-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_UNDERLINE_BUTTON_LABEL'),\n onClick: this.onUnderlineTextToggle,\n },\n {\n showBtn: this.showStrikeButton,\n selector: 'strike',\n icon: DtIconStrikethrough,\n dataQA: 'dt-recipe-editor-strike-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_STRIKE_BUTTON_LABEL'),\n onClick: this.onStrikethroughTextToggle,\n },\n ].filter(button => button.showBtn);\n },\n\n alignmentButtons () {\n return [\n {\n showBtn: this.showAlignLeftButton,\n selector: { textAlign: 'left' },\n icon: DtIconAlignLeft,\n dataQA: 'dt-recipe-editor-align-left-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ALIGN_LEFT_BUTTON_LABEL'),\n onClick: () => this.onTextAlign('left'),\n },\n {\n showBtn: this.showAlignCenterButton,\n selector: { textAlign: 'center' },\n icon: DtIconAlignCenter,\n dataQA: 'dt-recipe-editor-align-center-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ALIGN_CENTER_BUTTON_LABEL'),\n onClick: () => this.onTextAlign('center'),\n },\n {\n showBtn: this.showAlignRightButton,\n selector: { textAlign: 'right' },\n icon: DtIconAlignRight,\n dataQA: 'dt-recipe-editor-align-right-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ALIGN_RIGHT_BUTTON_LABEL'),\n onClick: () => this.onTextAlign('right'),\n },\n {\n showBtn: this.showAlignJustifyButton,\n selector: { textAlign: 'justify' },\n icon: DtIconAlignJustify,\n dataQA: 'dt-recipe-editor-align-justify-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ALIGN_JUSTIFY_BUTTON_LABEL'),\n onClick: () => this.onTextAlign('justify'),\n },\n ].filter(button => button.showBtn);\n },\n\n listButtons () {\n return [\n {\n showBtn: this.showListItemsButton,\n selector: 'bulletList',\n icon: DtIconListBullet,\n dataQA: 'dt-recipe-editor-list-items-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_BULLET_LIST_BUTTON_LABEL'),\n onClick: this.onBulletListToggle,\n },\n {\n showBtn: this.showOrderedListButton,\n selector: 'orderedList',\n icon: DtIconListOrdered,\n dataQA: 'dt-recipe-editor-ordered-list-items-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_ORDERED_LIST_BUTTON_LABEL'),\n onClick: this.onOrderedListToggle,\n },\n ].filter(button => button.showBtn);\n },\n\n individualButtons () {\n return [\n {\n showBtn: this.showQuoteButton,\n selector: 'blockquote',\n icon: DtIconQuote,\n dataQA: 'dt-recipe-editor-blockquote-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_QUOTE_BUTTON_LABEL'),\n onClick: this.onBlockquoteToggle,\n },\n {\n showBtn: this.showCodeBlockButton,\n selector: 'codeBlock',\n icon: DtIconCodeBlock,\n dataQA: 'dt-recipe-editor-code-block-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_CODE_BUTTON_LABEL'),\n onClick: this.onCodeBlockToggle,\n },\n {\n showBtn: this.showInlineImageButton,\n selector: 'image',\n icon: DtIconImage,\n dataQA: 'dt-recipe-editor-inline-image-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_IMAGE_BUTTON_LABEL'),\n // Handle getting image\n onClick: this.onInsertInlineImageClick,\n },\n ].filter(button => button.showBtn);\n },\n\n linkButton () {\n return {\n showBtn: this.showAddLink.showAddLinkButton,\n selector: 'link',\n icon: DtIconLink2,\n dataQA: 'dt-recipe-editor-add-link-btn',\n tooltipMessage: this.i18n.$t('DIALTONE_EDITOR_LINK_BUTTON_LABEL'),\n onClick: this.openLinkInput,\n };\n },\n\n confirmSetLinkButtonLabels () {\n return this.i18n.$ta('DIALTONE_EDITOR_CONFIRM_SET_LINK_BUTTON');\n },\n\n cancelSetLinkButtonLabels () {\n return this.i18n.$ta('DIALTONE_EDITOR_CANCEL_SET_LINK_BUTTON');\n },\n\n removeLinkButtonLabels () {\n return this.i18n.$ta('DIALTONE_EDITOR_REMOVE_LINK_BUTTON');\n },\n\n showAddLinkButtonLabels () {\n return this.i18n.$ta('DIALTONE_EDITOR_ADD_LINK_BUTTON');\n },\n },\n\n watch: {\n modelValue (newValue) {\n this.internalInputValue = newValue;\n },\n },\n\n methods: {\n removeClassStyleAttrs,\n addClassStyleAttrs,\n\n onInputFocus (event) {\n event?.stopPropagation();\n },\n\n removeLink () {\n this.$refs.richTextEditor?.editor?.chain()?.focus()?.unsetLink()?.run();\n this.closeLinkInput();\n },\n\n setLink (event) {\n const editor = this.$refs.richTextEditor?.editor;\n event?.preventDefault();\n event?.stopPropagation();\n\n if (!this.linkInput) {\n // If link text is set to empty string,\n // remove any existing links.\n this.removeLink();\n return;\n }\n\n // Check if input matches any of the supported link formats\n const prefix = EDITOR_SUPPORTED_LINK_PROTOCOLS.find(prefixRegex => prefixRegex.test(this.linkInput));\n\n if (!prefix) {\n // If no matching pattern is found, prepend default prefix\n this.linkInput = `${EDITOR_DEFAULT_LINK_PREFIX}${this.linkInput}`;\n }\n\n const selection = editor?.view?.state?.selection;\n\n if (selection.anchor === selection.head) {\n // If no text has been selected, manually insert the link text.\n // Do not rely on link options set through DtRichTextEditor\n // component, because they clash with these and cause issues.\n editor\n .chain()\n .focus()\n .insertContentAt(\n selection.anchor,\n `<a class=\"${this.linkOptions.class}\" href=${this.linkInput}>${this.linkInput}</a>`,\n )\n .run();\n } else {\n // Set or edit the link\n editor\n .chain()\n .focus()\n .extendMarkRange('link')\n .setLink({ href: this.linkInput, class: this.linkOptions.class })\n .run();\n }\n\n this.closeLinkInput();\n },\n\n openLinkInput () {\n this.showLinkInput = true;\n },\n\n updateInput (openedInput) {\n if (!openedInput) {\n return this.closeLinkInput();\n }\n this.linkInput = this.$refs.richTextEditor?.editor?.getAttributes('link')?.href;\n },\n\n closeLinkInput () {\n this.showLinkInput = false;\n this.linkInput = '';\n this.$refs.richTextEditor.editor?.chain().focus();\n },\n\n onBoldTextToggle () {\n this.$refs.richTextEditor?.editor?.chain().focus().toggleBold().run();\n },\n\n onItalicTextToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleItalic().run();\n },\n\n onUnderlineTextToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleUnderline().run();\n },\n\n onStrikethroughTextToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleStrike().run();\n },\n\n onTextAlign (alignment) {\n if (this.$refs.richTextEditor?.editor?.isActive({ textAlign: alignment })) {\n // If this alignment type is already set here, unset it\n return this.$refs.richTextEditor?.editor.chain().focus().unsetTextAlign().run();\n }\n this.$refs.richTextEditor?.editor.chain().focus().setTextAlign(alignment).run();\n },\n\n onBulletListToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleBulletList().run();\n },\n\n onOrderedListToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleOrderedList().run();\n },\n\n onCodeBlockToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleCodeBlock().run();\n },\n\n onQuickRepliesClick () {\n this.$emit('quick-replies-click');\n },\n\n onInsertInlineImageClick () {\n this.$emit('inline-image-click');\n },\n\n insertInlineImage (imageUrl) {\n this.$refs.richTextEditor?.editor.chain().focus().setImage({ src: imageUrl }).run();\n },\n\n insertInMessageBody (messageContent) {\n this.$refs.richTextEditor?.editor.chain().focus().insertContent(messageContent).run();\n },\n\n setCursorPosition (position = null) {\n this.$refs.richTextEditor?.editor.chain().focus(position).run();\n },\n\n onBlockquoteToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleBlockquote().run();\n },\n\n onTextInput (input) {\n this.$emit('text-input', input);\n },\n\n onFocus (event) {\n this.hasFocus = true;\n this.$emit('focus', event);\n },\n\n onBlur (event) {\n this.hasFocus = false;\n this.$emit('blur', event);\n },\n\n onInput (event) {\n this.$emit('input', event);\n this.$emit('update:modelValue', event);\n },\n\n getButtonKey (key, selector) {\n return `${key}-${JSON.stringify(selector)}`;\n },\n\n // Unique Button Ref Key to identify ref\n getButtonRef (key, selector) {\n return `${this.getButtonKey(key, selector)}-ref`;\n },\n\n /**\n * Determines if an element in the action bar button list is focusable with tab key\n * @param {string} refKey - unique identifier for the ref element in DOM\n */\n canFocus (refKey) {\n return refKey === this.orderedRefs[this.currentButtonRefIndex];\n },\n\n shiftActionBarFocusRight () {\n this.shiftButtonRefIndex(1);\n },\n\n shiftActionBarFocusLeft () {\n this.shiftButtonRefIndex(-1);\n },\n\n shiftButtonRefIndex (shiftAmount) {\n const previousRef = this.$refs[this.orderedRefs[this.currentButtonRefIndex]];\n const previousActionBarBtn = Array.isArray(previousRef) ? previousRef[0] : previousRef;\n const index = (this.currentButtonRefIndex + shiftAmount) % this.orderedRefs.length;\n this.currentButtonRefIndex = index >= 0 ? index : this.orderedRefs.length + index;\n const currentRef = this.$refs[this.orderedRefs[this.currentButtonRefIndex]];\n const currentActionBarBtn = Array.isArray(currentRef) ? currentRef[0] : currentRef;\n previousActionBarBtn.$el.blur();\n currentActionBarBtn.$el.focus();\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtRichTextEditor","DtButton","DtPopover","DtStack","DtInput","DtTooltip","DtIconQuickReply","DtIconBold","DtIconItalic","DtIconUnderline","DtIconStrikethrough","DtIconListBullet","DtIconListOrdered","DtIconAlignLeft","DtIconAlignCenter","DtIconAlignRight","DtIconAlignJustify","DtIconQuote","DtIconCodeBlock","DtIconLink2","DtIconImage","autoFocus","RICH_TEXT_EDITOR_AUTOFOCUS_TYPES","DialtoneLocalization","RICH_TEXT_EDITOR_OUTPUT_FORMATS","refs","acc","buttonData","button","individualButtonStacks","buttonGroupData","newValue","removeClassStyleAttrs","addClassStyleAttrs","event","_e","_d","_c","_b","_a","editor","EDITOR_SUPPORTED_LINK_PROTOCOLS","prefixRegex","EDITOR_DEFAULT_LINK_PREFIX","selection","openedInput","alignment","imageUrl","messageContent","position","input","key","selector","refKey","shiftAmount","previousRef","previousActionBarBtn","index","currentRef","currentActionBarBtn","_hoisted_1","_createElementBlock","_mergeProps","$options","_ctx","_cache","$event","_createVNode","_component_dt_stack","_Fragment","_renderList","buttonGroup","_createBlock","_openBlock","_component_dt_tooltip","_component_dt_button","_resolveDynamicComponent","_toDisplayString","_createElementVNode","_component_dt_popover","$data","_component_dt_input","$props","_createTextVNode","_component_dt_rich_text_editor"],"mappings":";;;;;;;;;;;;;AAiOA,MAAKA,KAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,kBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA;EAGF,QAAQ,CAAA;AAAA,EAER,cAAc;AAAA,EAEd,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,YAAY;AAAA,MACV,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA;;;;IAMX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA;;;;;;IAQX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;;;;;;;IAcX,WAAW;AAAA,MACT,MAAM,CAAC,SAAS,QAAQ,MAAM;AAAA,MAC9B,SAAS;AAAA,MACT,UAAWC,GAAW;AACpB,eAAI,OAAOA,KAAc,WAChBC,GAAiC,SAASD,CAAS,IAErD;AAAA,MACT;AAAA;;;;IAMF,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA;;;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A,CAAA;AAAA;;;oBAEpCI,EAOYQ,GAPZb,EAOY;AAAA,sBANV,WAAQ;AAAA,sBACR,MAAK;AAAA,uBACGC,EAAA,4BAA0B,EACjC,SAAOA,EAAA,QAAO,CAAA,GAAA;AAAA,iCAEf,MAAsC;AAAA,wBAAnCoB,EAAAN,EAAAd,EAAA,2BAA2B,KAAK,GAAA,CAAA;AAAA;;;;;;;;;;;;;;;IAS/Ce,EA4BM,OAAA;AAAA,MA3BH,yBAAuBI,EAAA,UAAS,CAAA;AAAA,MACjC,OAAM;AAAA;MAENf,EAuBEiB,GAvBFtB,EAuBE;AAAA,QAtBA,KAAI;AAAA,oBACKkB,EAAA;AAAA,sDAAAA,EAAA,qBAAkBd;AAAA,QAC1B,oBAAkB;AAAA,QAClB,qBAAmB;AAAA,QACnB,uBAAqB;AAAA,QACrB,qBAAmB;AAAA,QACnB,yBAAuB;AAAA,QACvB,cAAYgB,EAAA;AAAA,QACZ,UAAUA,EAAA;AAAA,QACV,oBAAkBA,EAAA;AAAA,QAClB,iDAA+CA,EAAA,UAAU;AAAA,QACzD,MAAM;AAAA,QACN,iBAAenB,EAAA;AAAA,QACf,aAAamB,EAAA;AAAA,QACb,gBAAcA,EAAA;AAAA,QACd,gBAAcA,EAAA;AAAA,QACf,WAAQ;AAAA,MACA,GAAAnB,EAAA,sBAAsBC,EAAA,MAAM,GAAA;AAAA,QACnC,aAAYD,EAAA;AAAA,QACZ,QAAMA,EAAA;AAAA,QACN,SAAOA,EAAA;AAAA,QACP,SAAKE,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEH,EAAA,QAAQG,CAAM;AAAA;;;;;"}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("../../node_modules/@tiptap/vue-3.cjs"),u=require("@tiptap/core"),O=require("@tiptap/extension-blockquote"),P=require("@tiptap/extension-code-block"),V=require("@tiptap/extension-code"),A=require("@tiptap/extension-document"),j=require("@tiptap/extension-hard-break"),$=require("@tiptap/extension-paragraph"),q=require("@tiptap/extension-placeholder"),H=require("@tiptap/extension-bold"),K=require("@tiptap/extension-bullet-list"),W=require("@tiptap/extension-italic"),F=require("@tiptap/extension-link"),U=require("@tiptap/extension-list-item"),z=require("@tiptap/extension-ordered-list"),X=require("@tiptap/extension-strike"),J=require("@tiptap/extension-underline"),Y=require("@tiptap/extension-text"),G=require("@tiptap/extension-text-align"),Q=require("@tiptap/extension-history"),Z=require("@tiptap/extension-text-style"),ee=require("@tiptap/extension-color"),te=require("@tiptap/extension-font-family"),g=require("@tiptap/pm/state"),ne=require("@tiptap/suggestion"),R=require("regex-combined-emojis"),o=require("vue"),h=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),D=require("../emoji/emoji.cjs"),f=require("../../common/emoji/index.cjs"),oe=require("../list-item/list-item.cjs"),w=require("../stack/stack.cjs"),b=require("tippy.js"),_=require("../../common/utils/index.cjs"),re=require("@tiptap/extension-image"),B=require("@tiptap/extension-mention"),I=require("../link/link.cjs"),se=require("@dialpad/dialtone-icons/vue3"),x=require("./rich-text-editor-constants.cjs"),ie=require("../avatar/avatar.cjs"),ae=require("@dialpad/dialtone-icons/vue3/hash"),ce=require("@dialpad/dialtone-icons/vue3/lock"),le=require("deep-equal"),de=require("../../localization/index.cjs"),ue=require("../button/button.cjs"),me={compatConfig:{MODE:3},name:"EmojiComponent",components:{NodeViewWrapper:d.NodeViewWrapper,DtEmoji:D.default},props:d.nodeViewProps};function he(e,t,r,n,s,i){const a=o.resolveComponent("dt-emoji"),c=o.resolveComponent("node-view-wrapper");return o.openBlock(),o.createBlock(c,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:o.withCtx(()=>[o.createVNode(a,{size:"500",code:e.node.attrs.code},null,8,["code"])]),_:1})}const pe=h._(me,[["render",he]]),fe={compatConfig:{MODE:3},name:"SuggestionList",components:{DtListItem:oe.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,contactKey:t.contactKey});break;case"channel":this.command({name:t.name,id:t.id,locked:t.locked,channelKey:t.channelKey});break;case"slash-command":this.command({command:t.command});break}}}},ge={class:"d-popover__dialog d-suggestion-list__container"},ke={ref:"suggestionList",class:"d-suggestion-list"};function _e(e,t,r,n,s,i){const a=o.resolveComponent("dt-list-item");return o.openBlock(),o.createElementBlock("div",ge,[o.withDirectives(o.createElementVNode("ul",ke,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.items,(c,l)=>(o.openBlock(),o.createBlock(a,{key:c.id,class:o.normalizeClass(["d-suggestion-list__item",{"d-list-item--highlighted":l===s.selectedIndex}]),"navigation-type":"arrow-keys",onClick:m=>i.selectItem(l),onKeydown:o.withModifiers(i.onKeyDown,["prevent"])},{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.itemComponent),{item:c},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[o.vShow,r.items.length]])])}const T=h._(fe,[["render",_e]]),we={compatConfig:{MODE:3},name:"EmojiSuggestion",components:{DtEmoji:D.default,DtStack:w.default},props:{item:{type:Object,required:!0}}};function ye(e,t,r,n,s,i){const a=o.resolveComponent("dt-emoji"),c=o.resolveComponent("dt-stack");return o.openBlock(),o.createBlock(c,{direction:"row",gap:"400"},{default:o.withCtx(()=>[o.createVNode(a,{size:"200",code:r.item.code},null,8,["code"]),o.createTextVNode(" "+o.toDisplayString(r.item.code),1)]),_:1})}const Ce=h._(we,[["render",ye]]),E={name:"hideOnEsc",defaultValue:!0,fn({hide:e}){function t(r){r.keyCode===27&&e()}return{onShow(){document.addEventListener("keydown",t)},onHide(){document.removeEventListener("keydown",t)}}}},xe=20,be=(e,t,r)=>{var c,l;const n=(c=e.shortname)==null?void 0:c.replaceAll(":",""),s=(l=t.shortname)==null?void 0:l.replaceAll(":",""),i=n.startsWith(r),a=s.startsWith(r);return i&&!a?-1:!i&&a?1:n.localeCompare(s)},Te={items:({query:e})=>{if(e.length<2)return[];const t=Object.values(f.getEmojiData());return e=e.toLowerCase(),t.filter(n=>{var s;return[n.name,(s=n.shortname)==null?void 0:s.replaceAll(":",""),...n.keywords||[]].some(i=>i&&i.startsWith(e))}).splice(0,xe).sort((n,s)=>be(n,s,e)).map(n=>({code:n.shortname}))},command:({editor:e,range:t,props:r})=>{var i,a;const n=e.view.state.selection.$to.nodeAfter;((i=n==null?void 0:n.text)==null?void 0:i.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:"emoji",attrs:r}]).run(),(a=window.getSelection())==null||a.collapseToEnd()},render:()=>{let e,t,r=!1;return{onStart:n=>{e=new d.VueRenderer(T,{props:{itemComponent:o.markRaw(Ce),itemType:"emoji",...n},editor:n.editor}),n.clientRect&&(t=b("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{r=!0},onHidden:()=>{r=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[E]}),n.items.length>0&&(t==null||t[0].show()))},onUpdate(n){e==null||e.updateProps(n),n.items.length>0?t==null||t[0].show():t==null||t[0].hide(),t==null||t[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var s;if(r)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(n)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},Ee=/(:\w+:)$/,Se=new RegExp(R.emojiPattern+"$"),ve=e=>{if(e&&f.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},Be=e=>[...e.matchAll(f.emojiShortCodeRegex)].filter(r=>f.codeToEmojiData(r[0])).map(r=>({index:r.index,text:r[0],match:r})),Ne=u.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return d.VueNodeViewRenderer(pe)},addAttributes(){return{code:{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",u.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[new u.InputRule({find:e=>{const t=e.match(Ee)||e.match(Se);if(t)return ve(t)},handler:({state:e,range:t,match:r})=>{const{tr:n}=e,s=t.from,i=t.to;n.replaceWith(s,i,this.type.create({code:r[0]}))}})]},addPasteRules(){return[u.nodePasteRule({find:Be,type:this.type,getAttributes(e){return{code:e[0]}}}),u.nodePasteRule({find:f.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[ne({char:":",pluginKey:new g.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...Te})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let r=!1;const{selection:n}=t,{empty:s,anchor:i}=n;return s?(t.doc.nodesBetween(i-1,i,(a,c)=>{if(a.type.name===this.name)return r=!0,e.insertText("",c,c+a.nodeSize),!1}),r):!1})}}});function Le(e,t,r=()=>!0){const n=[];t.lastIndex=0;let s;for(;s=t.exec(e);)r(e,s)&&n.push(s);return n}function $e(e,t){return!["#","@"].includes(e.charAt(t.index))&&!["#","@"].includes(e.charAt(t.index-1))}function Re(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 r=e.slice(0,t+1).search(/\S+\s*$/),n=e.slice(t).search(/\s/);if(n<0){const s=e.slice(r);return{text:s,from:r,to:r+s.length}}return{text:e.slice(r,n+t),from:r,to:n+t}}function v(e,t,r,n){const s=De(e,t);if(n.lastIndex=0,!n.test(s.text))return s;const i=r==="left"?s.from-1:s.to+1;return i<=0||i>=e.length||i===t?s:v(e,i,r,n)}function Ie(e,t,r,n){const s=Math.max(e.from-1,0),i=Math.min(e.to+1,t.content.size),a=u.getMarksBetween(s,i,t);for(const c of a)c.mark.type===n&&r.removeMark(c.from,c.to,n)}const N=_.getPhoneNumberRegex(1,15);function L(e,t,r,n,s,i){if(!e)return;let a=r-t-1;a=a<0?0:a;const c=n-t,l=v(e,a,"left",N),m=v(e,c,"right",N),p=e.slice(l.from,m.to);Le(p,_.linkRegex,$e).forEach(S=>{const k=Re(S[0]),C=t+l.from+S.index+1,M=C+k.length;s.addMark(C,M,i.create())})}function Me(e){let t=!1;return new g.Plugin({key:new g.PluginKey("autolink"),appendTransaction:(r,n,s)=>{const i=r.some(p=>p.docChanged)&&!n.doc.eq(s.doc);if(t&&!i)return;const{tr:a}=s,{textContent:c}=s.doc;t||L(c,0,0,c.length,a,e.type),t=!0;const l=u.combineTransactionSteps(n.doc,[...r]);return u.getChangedRanges(l).forEach(({oldRange:p,newRange:y})=>{Ie(y,s.doc,a,e.type),u.findChildrenInRange(s.doc,y,k=>k.isTextblock).forEach(({node:k,pos:C})=>{L(k.textContent,C,p.from,y.to,a,e.type)})}),a}})}const Oe={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},Pe=u.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:e}){return["a",u.mergeAttributes(this.options.HTMLAttributes,e,Oe)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[Me({type:this.type})]}}),Ve=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}),Ae=$.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",u.mergeAttributes(this.options.HTMLAttributes,e),0]}}),je={compatConfig:{MODE:3},name:"MentionComponent",components:{NodeViewWrapper:d.NodeViewWrapper,DtLink:I.default},props:d.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}},methods:{handleClick(){const e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,avatarSrc:this.$props.node.attrs.avatarSrc,contactKey:this.$props.node.attrs.contactKey};this.$props.editor.emit("mention-click",e)}}};function qe(e,t,r,n,s,i){const a=o.resolveComponent("dt-link"),c=o.resolveComponent("node-view-wrapper");return o.openBlock(),o.createBlock(c,{class:"d-d-inline-block"},{default:o.withCtx(()=>[o.createVNode(a,{kind:"mention",onClick:o.withModifiers(i.handleClick,["prevent"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.text),1)]),_:1},8,["onClick"])]),_:1})}const He=h._(je,[["render",qe]]),Ke=B.extend({addNodeView(){return d.VueNodeViewRenderer(He)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""},contactKey:{default:""}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["mention-component",u.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"@",pluginKey:new g.PluginKey("mentionSuggestion")}}),We={compatConfig:{MODE:3},name:"ChannelComponent",components:{NodeViewWrapper:d.NodeViewWrapper,DtLink:I.default,DtIconLock:se.DtIconLock,DtStack:w.default},props:d.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:"#"+this.$props.node.attrs.name}},methods:{handleClick(){const e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,locked:this.$props.node.attrs.locked,channelKey:this.$props.node.attrs.channelKey};this.$props.editor.emit("channel-click",e)}}};function Fe(e,t,r,n,s,i){const a=o.resolveComponent("dt-icon-lock"),c=o.resolveComponent("dt-stack"),l=o.resolveComponent("dt-link"),m=o.resolveComponent("node-view-wrapper");return o.openBlock(),o.createBlock(m,{class:"d-d-inline-block"},{default:o.withCtx(()=>[o.createVNode(l,{kind:"mention",onClick:o.withModifiers(i.handleClick,["prevent"])},{default:o.withCtx(()=>[o.createVNode(c,{direction:"row",gap:"0"},{default:o.withCtx(()=>[e.$props.node.attrs.locked?(o.openBlock(),o.createBlock(a,{key:0,size:"200"})):o.createCommentVNode("",!0),o.createElementVNode("span",null,o.toDisplayString(i.text),1)]),_:1})]),_:1},8,["onClick"])]),_:1})}const Ue=h._(We,[["render",Fe]]),ze=B.extend({name:"channel",addNodeView(){return d.VueNodeViewRenderer(Ue)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1},channelKey:{default:""}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["channel-component",u.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"#",pluginKey:new g.PluginKey("channelSuggestion")}}),Xe={compatConfig:{MODE:3},name:"SlashCommandsComponent",components:{NodeViewWrapper:d.NodeViewWrapper},props:{...d.nodeViewProps},emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){var r,n,s;const e=this.$props.node.attrs.command;this.$emit("selected-command",e);const t=(s=(n=(r=this.editor)==null?void 0:r.storage)==null?void 0:n["slash-commands"])==null?void 0:s.onSelectedCommand;t&&typeof t=="function"&&t(e)}};function Je(e,t,r,n,s,i){const a=o.resolveComponent("node-view-wrapper");return o.openBlock(),o.createBlock(a,{class:"d-d-inline-block"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.text),1)]),_:1})}const Ye=h._(Xe,[["render",Je]]),Ge=(e,t)=>[...e.matchAll(t)].map(n=>{let s=n[2];return s.endsWith(" ")||(s+=" "),{index:n.index,text:s,match:n}}),Qe=B.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 d.VueNodeViewRenderer(Ye)},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",u.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){var r;const e=(r=this.options.suggestion)==null?void 0:r.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) $`);return[u.nodeInputRule({find:t,type:this.type,getAttributes(n){return{command:n[2]}}})]},addPasteRules(){var r;const e=(r=this.options.suggestion)==null?void 0:r.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) ?$`,"g");return[u.nodePasteRule({find:n=>Ge(n,t),type:this.type,getAttributes(n){return{command:n[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new g.PluginKey("slashCommandSuggestion")}}),Ze={compatConfig:{MODE:3},name:"MentionSuggestion",components:{DtAvatar:ie.default,DtStack:w.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}}},et={class:"d-mention-suggestion__name"},tt={key:1,class:"d-mention-suggestion__divider"},nt={key:2,class:"d-mention-suggestion__status"};function ot(e,t,r,n,s,i){const a=o.resolveComponent("dt-avatar"),c=o.resolveComponent("dt-stack");return o.openBlock(),o.createBlock(c,{direction:"row",class:"d-mention-suggestion__container",gap:"400"},{default:o.withCtx(()=>[o.createVNode(a,{"full-name":i.name,"image-src":i.avatarSrc,"image-alt":i.name,"show-presence":i.showDetails,presence:i.presence,size:"sm"},null,8,["full-name","image-src","image-alt","show-presence","presence"]),o.createVNode(c,{class:"d-mention-suggestion__details-container",gap:"100"},{default:o.withCtx(()=>[o.createElementVNode("span",et,o.toDisplayString(i.name),1),i.showDetails?(o.openBlock(),o.createBlock(c,{key:0,direction:"row",gap:"300",class:"d-label--sm-plain"},{default:o.withCtx(()=>[i.presenceText?(o.openBlock(),o.createElementBlock("span",{key:0,class:o.normalizeClass(["d-mention-suggestion__presence",[i.presenceFontColorClass]])},o.toDisplayString(i.presenceText),3)):o.createCommentVNode("",!0),i.status&&i.presenceText?(o.openBlock(),o.createElementBlock("div",tt," • ")):o.createCommentVNode("",!0),i.status?(o.openBlock(),o.createElementBlock("div",nt,o.toDisplayString(i.status),1)):o.createCommentVNode("",!0)]),_:1})):o.createCommentVNode("",!0)]),_:1})]),_:1})}const rt=h._(Ze,[["render",ot]]),st={allowSpaces:!0,render:()=>{let e,t,r=!1;return{onStart:n=>{e=new d.VueRenderer(T,{props:{itemComponent:o.markRaw(rt),itemType:"mention",...n},editor:n.editor}),n.clientRect&&(t=b("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{r=!0},onHidden:()=>{r=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[E]}),n.items.length>0&&(t==null||t[0].show()))},onUpdate(n){e==null||e.updateProps(n),n.items.length>0?t==null||t[0].show():t==null||t[0].hide(),n.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:n.clientRect}))},onKeyDown(n){var s;if(r)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(n)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},it={compatConfig:{MODE:3},name:"ChannelSuggestion",components:{DtStack:w.default,DtIconHash:ae,DtIconLock:ce},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function at(e,t,r,n,s,i){const a=o.resolveComponent("dt-icon-hash"),c=o.resolveComponent("dt-icon-lock"),l=o.resolveComponent("dt-stack");return o.openBlock(),o.createBlock(l,{direction:"row",gap:"400"},{default:o.withCtx(()=>[r.item.locked?(o.openBlock(),o.createBlock(c,{key:1,size:"300"})):(o.openBlock(),o.createBlock(a,{key:0,size:"300"})),o.createElementVNode("span",null,o.toDisplayString(i.name),1)]),_:1})}const ct=h._(it,[["render",at]]),lt={allowSpaces:!0,render:()=>{let e,t,r=!1;return{onStart:n=>{e=new d.VueRenderer(T,{props:{itemComponent:o.markRaw(ct),itemType:"channel",...n},editor:n.editor}),n.clientRect&&(t=b("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{r=!0},onHidden:()=>{r=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[E]}),n.items.length>0&&(t==null||t[0].show()))},onUpdate(n){e==null||e.updateProps(n),n.items.length>0?t==null||t[0].show():t==null||t[0].hide(),n.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:n.clientRect}))},onKeyDown(n){var s;if(r)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(n)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},dt={compatConfig:{MODE:3},name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},ut={class:"d-body--md-compact"},mt={key:0},ht={class:"d-body--sm d-fc-tertiary"};function pt(e,t,r,n,s,i){return o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("div",ut,[o.createElementVNode("span",null,"/"+o.toDisplayString(i.command),1),i.parametersExample?(o.openBlock(),o.createElementBlock("span",mt,o.toDisplayString(i.parametersExample),1)):o.createCommentVNode("",!0)]),o.createElementVNode("div",ht,o.toDisplayString(i.description),1)])}const ft=h._(dt,[["render",pt]]),gt={allowSpaces:!0,startOfLine:!0,render:()=>{let e,t,r=!1;return{onStart:n=>{e=new d.VueRenderer(T,{parent:void 0,props:{itemComponent:o.markRaw(ft),itemType:"slash-command",...n},editor:n.editor}),n.clientRect&&(t=b("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{r=!0},onHidden:()=>{r=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[E]}),n.items.length>0&&(t==null||t[0].show()))},onUpdate(n){e==null||e.updateProps(n),n.items.length>0?t==null||t[0].show():t==null||t[0].hide(),n.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:n.clientRect}))},onKeyDown(n){var s;if(r)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(n)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},kt={compatConfig:{MODE:3},name:"DtRichTextEditor",components:{EditorContent:d.EditorContent,BubbleMenu:d.BubbleMenu,DtButton:ue.default,DtStack:w.default},props:{modelValue:{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"?x.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:"html",validator(e){return x.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","markdown-input","update:modelValue","blur","focus","enter","edit-link","selected","selected-command","mention-click","channel-click"],data(){return{editor:null,tippyOptions:{appendTo:()=>{var e;return(e=_.returnFirstEl(this.$refs.editor.$el).getRootNode())==null?void 0:e.querySelector("body")},placement:"top-start"},i18n:new de.DialtoneLocalization,jsonToMarkdownConverter:{convertToMarkdown(e){return this.processNode(e)},processNodeContent(e){return e.content?e.content.map(t=>this.processNode(t)).join(""):""},processNode(e){if(!e)return"";const r={doc:n=>this.processDocNode(n),paragraph:n=>this.processParagraphNode(n),text:n=>this.processTextNode(n),hardBreak:()=>this.processHardBreakNode(),blockquote:n=>this.processBlockquoteNode(n),bulletList:n=>this.processBulletListNode(n),orderedList:n=>this.processOrderedListNode(n),listItem:n=>this.processListItemNode(n),codeBlock:n=>this.processCodeBlockNode(n),mention:n=>this.processMentionNode(n),channel:n=>this.processChannelNode(n),"slash-commands":n=>this.processSlashCommandsNode(n),emoji:n=>this.processEmojiNode(n)}[e.type];return r?r(e):this.processUnknownNode(e)},processDocNode(e){return this.processNodeContent(e)},processParagraphNode(e){const t=this.processNodeContent(e);return t?t+`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("../../node_modules/@tiptap/vue-3.cjs"),u=require("@tiptap/core"),O=require("@tiptap/extension-blockquote"),P=require("@tiptap/extension-code-block"),q=require("@tiptap/extension-code"),V=require("@tiptap/extension-document"),A=require("@tiptap/extension-gapcursor"),j=require("@tiptap/extension-hard-break"),R=require("@tiptap/extension-paragraph"),H=require("@tiptap/extension-placeholder"),K=require("@tiptap/extension-bold"),W=require("@tiptap/extension-bullet-list"),F=require("@tiptap/extension-italic"),U=require("@tiptap/extension-link"),z=require("@tiptap/extension-list-item"),X=require("@tiptap/extension-ordered-list"),J=require("@tiptap/extension-strike"),G=require("@tiptap/extension-underline"),Y=require("@tiptap/extension-text"),Q=require("@tiptap/extension-text-align"),Z=require("@tiptap/extension-history"),ee=require("@tiptap/extension-table"),te=require("@tiptap/extension-table-cell"),ne=require("@tiptap/extension-table-header"),oe=require("@tiptap/extension-table-row"),re=require("@tiptap/extension-text-style"),se=require("@tiptap/extension-color"),ie=require("@tiptap/extension-font-family"),g=require("@tiptap/pm/state"),ae=require("@tiptap/suggestion"),$=require("regex-combined-emojis"),o=require("vue"),h=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),D=require("../emoji/emoji.cjs"),f=require("../../common/emoji/index.cjs"),ce=require("../list-item/list-item.cjs"),w=require("../stack/stack.cjs"),x=require("tippy.js"),_=require("../../common/utils/index.cjs"),le=require("@tiptap/extension-image"),v=require("@tiptap/extension-mention"),I=require("../link/link.cjs"),de=require("@dialpad/dialtone-icons/vue3"),b=require("./rich-text-editor-constants.cjs"),ue=require("../avatar/avatar.cjs"),me=require("@dialpad/dialtone-icons/vue3/hash"),he=require("@dialpad/dialtone-icons/vue3/lock"),pe=require("deep-equal"),fe=require("../../localization/index.cjs"),ge=require("../button/button.cjs"),ke={compatConfig:{MODE:3},name:"EmojiComponent",components:{NodeViewWrapper:d.NodeViewWrapper,DtEmoji:D.default},props:d.nodeViewProps};function _e(e,t,r,n,s,i){const a=o.resolveComponent("dt-emoji"),c=o.resolveComponent("node-view-wrapper");return o.openBlock(),o.createBlock(c,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:o.withCtx(()=>[o.createVNode(a,{size:"500",code:e.node.attrs.code},null,8,["code"])]),_:1})}const we=h._(ke,[["render",_e]]),ye={compatConfig:{MODE:3},name:"SuggestionList",components:{DtListItem:ce.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,contactKey:t.contactKey});break;case"channel":this.command({name:t.name,id:t.id,locked:t.locked,channelKey:t.channelKey});break;case"slash-command":this.command({command:t.command});break}}}},Ce={class:"d-popover__dialog d-suggestion-list__container"},be={ref:"suggestionList",class:"d-suggestion-list"};function xe(e,t,r,n,s,i){const a=o.resolveComponent("dt-list-item");return o.openBlock(),o.createElementBlock("div",Ce,[o.withDirectives(o.createElementVNode("ul",be,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.items,(c,l)=>(o.openBlock(),o.createBlock(a,{key:c.id,class:o.normalizeClass(["d-suggestion-list__item",{"d-list-item--highlighted":l===s.selectedIndex}]),"navigation-type":"arrow-keys",onClick:m=>i.selectItem(l),onKeydown:o.withModifiers(i.onKeyDown,["prevent"])},{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.itemComponent),{item:c},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[o.vShow,r.items.length]])])}const T=h._(ye,[["render",xe]]),Te={compatConfig:{MODE:3},name:"EmojiSuggestion",components:{DtEmoji:D.default,DtStack:w.default},props:{item:{type:Object,required:!0}}};function Ee(e,t,r,n,s,i){const a=o.resolveComponent("dt-emoji"),c=o.resolveComponent("dt-stack");return o.openBlock(),o.createBlock(c,{direction:"row",gap:"400"},{default:o.withCtx(()=>[o.createVNode(a,{size:"200",code:r.item.code},null,8,["code"]),o.createTextVNode(" "+o.toDisplayString(r.item.code),1)]),_:1})}const Se=h._(Te,[["render",Ee]]),E={name:"hideOnEsc",defaultValue:!0,fn({hide:e}){function t(r){r.keyCode===27&&e()}return{onShow(){document.addEventListener("keydown",t)},onHide(){document.removeEventListener("keydown",t)}}}},Be=20,ve=(e,t,r)=>{var c,l;const n=(c=e.shortname)==null?void 0:c.replaceAll(":",""),s=(l=t.shortname)==null?void 0:l.replaceAll(":",""),i=n.startsWith(r),a=s.startsWith(r);return i&&!a?-1:!i&&a?1:n.localeCompare(s)},Ne={items:({query:e})=>{if(e.length<2)return[];const t=Object.values(f.getEmojiData());return e=e.toLowerCase(),t.filter(n=>{var s;return[n.name,(s=n.shortname)==null?void 0:s.replaceAll(":",""),...n.keywords||[]].some(i=>i&&i.startsWith(e))}).splice(0,Be).sort((n,s)=>ve(n,s,e)).map(n=>({code:n.shortname}))},command:({editor:e,range:t,props:r})=>{var i,a;const n=e.view.state.selection.$to.nodeAfter;((i=n==null?void 0:n.text)==null?void 0:i.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:"emoji",attrs:r}]).run(),(a=window.getSelection())==null||a.collapseToEnd()},render:()=>{let e,t,r=!1;return{onStart:n=>{e=new d.VueRenderer(T,{props:{itemComponent:o.markRaw(Se),itemType:"emoji",...n},editor:n.editor}),n.clientRect&&(t=x("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{r=!0},onHidden:()=>{r=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[E]}),n.items.length>0&&(t==null||t[0].show()))},onUpdate(n){e==null||e.updateProps(n),n.items.length>0?t==null||t[0].show():t==null||t[0].hide(),t==null||t[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var s;if(r)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(n)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},Le=/(:\w+:)$/,Re=new RegExp($.emojiPattern+"$"),$e=e=>{if(e&&f.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},De=e=>[...e.matchAll(f.emojiShortCodeRegex)].filter(r=>f.codeToEmojiData(r[0])).map(r=>({index:r.index,text:r[0],match:r})),Ie=u.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return d.VueNodeViewRenderer(we)},addAttributes(){return{code:{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",u.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[new u.InputRule({find:e=>{const t=e.match(Le)||e.match(Re);if(t)return $e(t)},handler:({state:e,range:t,match:r})=>{const{tr:n}=e,s=t.from,i=t.to;n.replaceWith(s,i,this.type.create({code:r[0]}))}})]},addPasteRules(){return[u.nodePasteRule({find:De,type:this.type,getAttributes(e){return{code:e[0]}}}),u.nodePasteRule({find:f.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[ae({char:":",pluginKey:new g.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...Ne})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let r=!1;const{selection:n}=t,{empty:s,anchor:i}=n;return s?(t.doc.nodesBetween(i-1,i,(a,c)=>{if(a.type.name===this.name)return r=!0,e.insertText("",c,c+a.nodeSize),!1}),r):!1})}}});function Me(e,t,r=()=>!0){const n=[];t.lastIndex=0;let s;for(;s=t.exec(e);)r(e,s)&&n.push(s);return n}function Oe(e,t){return!["#","@"].includes(e.charAt(t.index))&&!["#","@"].includes(e.charAt(t.index-1))}function Pe(e){const t=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return e.replace(t,"")}function qe(e,t){const r=e.slice(0,t+1).search(/\S+\s*$/),n=e.slice(t).search(/\s/);if(n<0){const s=e.slice(r);return{text:s,from:r,to:r+s.length}}return{text:e.slice(r,n+t),from:r,to:n+t}}function B(e,t,r,n){const s=qe(e,t);if(n.lastIndex=0,!n.test(s.text))return s;const i=r==="left"?s.from-1:s.to+1;return i<=0||i>=e.length||i===t?s:B(e,i,r,n)}function Ve(e,t,r,n){const s=Math.max(e.from-1,0),i=Math.min(e.to+1,t.content.size),a=u.getMarksBetween(s,i,t);for(const c of a)c.mark.type===n&&r.removeMark(c.from,c.to,n)}const N=_.getPhoneNumberRegex(1,15);function L(e,t,r,n,s,i){if(!e)return;let a=r-t-1;a=a<0?0:a;const c=n-t,l=B(e,a,"left",N),m=B(e,c,"right",N),p=e.slice(l.from,m.to);Me(p,_.linkRegex,Oe).forEach(S=>{const k=Pe(S[0]),C=t+l.from+S.index+1,M=C+k.length;s.addMark(C,M,i.create())})}function Ae(e){let t=!1;return new g.Plugin({key:new g.PluginKey("autolink"),appendTransaction:(r,n,s)=>{const i=r.some(p=>p.docChanged)&&!n.doc.eq(s.doc);if(t&&!i)return;const{tr:a}=s,{textContent:c}=s.doc;t||L(c,0,0,c.length,a,e.type),t=!0;const l=u.combineTransactionSteps(n.doc,[...r]);return u.getChangedRanges(l).forEach(({oldRange:p,newRange:y})=>{Ve(y,s.doc,a,e.type),u.findChildrenInRange(s.doc,y,k=>k.isTextblock).forEach(({node:k,pos:C})=>{L(k.textContent,C,p.from,y.to,a,e.type)})}),a}})}const je={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},He=u.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:e}){return["a",u.mergeAttributes(this.options.HTMLAttributes,e,je)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[Ae({type:this.type})]}}),Ke=le.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}),We=R.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",u.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Fe={compatConfig:{MODE:3},name:"MentionComponent",components:{NodeViewWrapper:d.NodeViewWrapper,DtLink:I.default},props:d.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}},methods:{handleClick(){const e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,avatarSrc:this.$props.node.attrs.avatarSrc,contactKey:this.$props.node.attrs.contactKey};this.$props.editor.emit("mention-click",e)}}};function Ue(e,t,r,n,s,i){const a=o.resolveComponent("dt-link"),c=o.resolveComponent("node-view-wrapper");return o.openBlock(),o.createBlock(c,{class:"d-d-inline-block"},{default:o.withCtx(()=>[o.createVNode(a,{kind:"mention",onClick:o.withModifiers(i.handleClick,["prevent"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.text),1)]),_:1},8,["onClick"])]),_:1})}const ze=h._(Fe,[["render",Ue]]),Xe=v.extend({addNodeView(){return d.VueNodeViewRenderer(ze)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""},contactKey:{default:""}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["mention-component",u.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"@",pluginKey:new g.PluginKey("mentionSuggestion")}}),Je={compatConfig:{MODE:3},name:"ChannelComponent",components:{NodeViewWrapper:d.NodeViewWrapper,DtLink:I.default,DtIconLock:de.DtIconLock,DtStack:w.default},props:d.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:"#"+this.$props.node.attrs.name}},methods:{handleClick(){const e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,locked:this.$props.node.attrs.locked,channelKey:this.$props.node.attrs.channelKey};this.$props.editor.emit("channel-click",e)}}};function Ge(e,t,r,n,s,i){const a=o.resolveComponent("dt-icon-lock"),c=o.resolveComponent("dt-stack"),l=o.resolveComponent("dt-link"),m=o.resolveComponent("node-view-wrapper");return o.openBlock(),o.createBlock(m,{class:"d-d-inline-block"},{default:o.withCtx(()=>[o.createVNode(l,{kind:"mention",onClick:o.withModifiers(i.handleClick,["prevent"])},{default:o.withCtx(()=>[o.createVNode(c,{direction:"row",gap:"0"},{default:o.withCtx(()=>[e.$props.node.attrs.locked?(o.openBlock(),o.createBlock(a,{key:0,size:"200"})):o.createCommentVNode("",!0),o.createElementVNode("span",null,o.toDisplayString(i.text),1)]),_:1})]),_:1},8,["onClick"])]),_:1})}const Ye=h._(Je,[["render",Ge]]),Qe=v.extend({name:"channel",addNodeView(){return d.VueNodeViewRenderer(Ye)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1},channelKey:{default:""}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["channel-component",u.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"#",pluginKey:new g.PluginKey("channelSuggestion")}}),Ze={compatConfig:{MODE:3},name:"SlashCommandsComponent",components:{NodeViewWrapper:d.NodeViewWrapper},props:{...d.nodeViewProps},emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){var r,n,s;const e=this.$props.node.attrs.command;this.$emit("selected-command",e);const t=(s=(n=(r=this.editor)==null?void 0:r.storage)==null?void 0:n["slash-commands"])==null?void 0:s.onSelectedCommand;t&&typeof t=="function"&&t(e)}};function et(e,t,r,n,s,i){const a=o.resolveComponent("node-view-wrapper");return o.openBlock(),o.createBlock(a,{class:"d-d-inline-block"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.text),1)]),_:1})}const tt=h._(Ze,[["render",et]]),nt=(e,t)=>[...e.matchAll(t)].map(n=>{let s=n[2];return s.endsWith(" ")||(s+=" "),{index:n.index,text:s,match:n}}),ot=v.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 d.VueNodeViewRenderer(tt)},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",u.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){var r;const e=(r=this.options.suggestion)==null?void 0:r.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) $`);return[u.nodeInputRule({find:t,type:this.type,getAttributes(n){return{command:n[2]}}})]},addPasteRules(){var r;const e=(r=this.options.suggestion)==null?void 0:r.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) ?$`,"g");return[u.nodePasteRule({find:n=>nt(n,t),type:this.type,getAttributes(n){return{command:n[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new g.PluginKey("slashCommandSuggestion")}}),rt={compatConfig:{MODE:3},name:"MentionSuggestion",components:{DtAvatar:ue.default,DtStack:w.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}}},st={class:"d-mention-suggestion__name"},it={key:1,class:"d-mention-suggestion__divider"},at={key:2,class:"d-mention-suggestion__status"};function ct(e,t,r,n,s,i){const a=o.resolveComponent("dt-avatar"),c=o.resolveComponent("dt-stack");return o.openBlock(),o.createBlock(c,{direction:"row",class:"d-mention-suggestion__container",gap:"400"},{default:o.withCtx(()=>[o.createVNode(a,{"full-name":i.name,"image-src":i.avatarSrc,"image-alt":i.name,"show-presence":i.showDetails,presence:i.presence,size:"sm"},null,8,["full-name","image-src","image-alt","show-presence","presence"]),o.createVNode(c,{class:"d-mention-suggestion__details-container",gap:"100"},{default:o.withCtx(()=>[o.createElementVNode("span",st,o.toDisplayString(i.name),1),i.showDetails?(o.openBlock(),o.createBlock(c,{key:0,direction:"row",gap:"300",class:"d-label--sm-plain"},{default:o.withCtx(()=>[i.presenceText?(o.openBlock(),o.createElementBlock("span",{key:0,class:o.normalizeClass(["d-mention-suggestion__presence",[i.presenceFontColorClass]])},o.toDisplayString(i.presenceText),3)):o.createCommentVNode("",!0),i.status&&i.presenceText?(o.openBlock(),o.createElementBlock("div",it," • ")):o.createCommentVNode("",!0),i.status?(o.openBlock(),o.createElementBlock("div",at,o.toDisplayString(i.status),1)):o.createCommentVNode("",!0)]),_:1})):o.createCommentVNode("",!0)]),_:1})]),_:1})}const lt=h._(rt,[["render",ct]]),dt={allowSpaces:!0,render:()=>{let e,t,r=!1;return{onStart:n=>{e=new d.VueRenderer(T,{props:{itemComponent:o.markRaw(lt),itemType:"mention",...n},editor:n.editor}),n.clientRect&&(t=x("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{r=!0},onHidden:()=>{r=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[E]}),n.items.length>0&&(t==null||t[0].show()))},onUpdate(n){e==null||e.updateProps(n),n.items.length>0?t==null||t[0].show():t==null||t[0].hide(),n.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:n.clientRect}))},onKeyDown(n){var s;if(r)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(n)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},ut={compatConfig:{MODE:3},name:"ChannelSuggestion",components:{DtStack:w.default,DtIconHash:me,DtIconLock:he},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function mt(e,t,r,n,s,i){const a=o.resolveComponent("dt-icon-hash"),c=o.resolveComponent("dt-icon-lock"),l=o.resolveComponent("dt-stack");return o.openBlock(),o.createBlock(l,{direction:"row",gap:"400"},{default:o.withCtx(()=>[r.item.locked?(o.openBlock(),o.createBlock(c,{key:1,size:"300"})):(o.openBlock(),o.createBlock(a,{key:0,size:"300"})),o.createElementVNode("span",null,o.toDisplayString(i.name),1)]),_:1})}const ht=h._(ut,[["render",mt]]),pt={allowSpaces:!0,render:()=>{let e,t,r=!1;return{onStart:n=>{e=new d.VueRenderer(T,{props:{itemComponent:o.markRaw(ht),itemType:"channel",...n},editor:n.editor}),n.clientRect&&(t=x("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{r=!0},onHidden:()=>{r=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[E]}),n.items.length>0&&(t==null||t[0].show()))},onUpdate(n){e==null||e.updateProps(n),n.items.length>0?t==null||t[0].show():t==null||t[0].hide(),n.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:n.clientRect}))},onKeyDown(n){var s;if(r)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(n)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},ft={compatConfig:{MODE:3},name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},gt={class:"d-body--md-compact"},kt={key:0},_t={class:"d-body--sm d-fc-tertiary"};function wt(e,t,r,n,s,i){return o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("div",gt,[o.createElementVNode("span",null,"/"+o.toDisplayString(i.command),1),i.parametersExample?(o.openBlock(),o.createElementBlock("span",kt,o.toDisplayString(i.parametersExample),1)):o.createCommentVNode("",!0)]),o.createElementVNode("div",_t,o.toDisplayString(i.description),1)])}const yt=h._(ft,[["render",wt]]),Ct={allowSpaces:!0,startOfLine:!0,render:()=>{let e,t,r=!1;return{onStart:n=>{e=new d.VueRenderer(T,{parent:void 0,props:{itemComponent:o.markRaw(yt),itemType:"slash-command",...n},editor:n.editor}),n.clientRect&&(t=x("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{r=!0},onHidden:()=>{r=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[E]}),n.items.length>0&&(t==null||t[0].show()))},onUpdate(n){e==null||e.updateProps(n),n.items.length>0?t==null||t[0].show():t==null||t[0].hide(),n.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:n.clientRect}))},onKeyDown(n){var s;if(r)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(n)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},bt={compatConfig:{MODE:3},name:"DtRichTextEditor",components:{EditorContent:d.EditorContent,BubbleMenu:d.BubbleMenu,DtButton:ge.default,DtStack:w.default},props:{modelValue:{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"?b.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:"html",validator(e){return b.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},allowTables:{type:Boolean,default:!1}},emits:["input","json-input","html-input","text-input","markdown-input","update:modelValue","blur","focus","enter","edit-link","selected","selected-command","mention-click","channel-click"],data(){return{editor:null,tippyOptions:{appendTo:()=>{var e;return(e=_.returnFirstEl(this.$refs.editor.$el).getRootNode())==null?void 0:e.querySelector("body")},placement:"top-start"},i18n:new fe.DialtoneLocalization,jsonToMarkdownConverter:{convertToMarkdown(e){return this.processNode(e)},processNodeContent(e){return e.content?e.content.map(t=>this.processNode(t)).join(""):""},processNode(e){if(!e)return"";const r={doc:n=>this.processDocNode(n),paragraph:n=>this.processParagraphNode(n),text:n=>this.processTextNode(n),hardBreak:()=>this.processHardBreakNode(),blockquote:n=>this.processBlockquoteNode(n),bulletList:n=>this.processBulletListNode(n),orderedList:n=>this.processOrderedListNode(n),listItem:n=>this.processListItemNode(n),codeBlock:n=>this.processCodeBlockNode(n),mention:n=>this.processMentionNode(n),channel:n=>this.processChannelNode(n),"slash-commands":n=>this.processSlashCommandsNode(n),emoji:n=>this.processEmojiNode(n)}[e.type];return r?r(e):this.processUnknownNode(e)},processDocNode(e){return this.processNodeContent(e)},processParagraphNode(e){const t=this.processNodeContent(e);return t?t+`
2
2
  `:`
3
3
  `},processTextNode(e){let t=e.text||"";return e.marks&&(t=this.applyMarks(t,e.marks)),t},processHardBreakNode(){return`
4
4
  `},processBlockquoteNode(e){return this.processNodeContent(e).split(`
@@ -7,9 +7,9 @@
7
7
  `},processBulletListNode(e){return this.processNodeContent(e)},processOrderedListNode(e){return e.content?e.content.map((t,r)=>this.processNode(t).replace(/^- /,`${r+1}. `)).join(""):""},processListItemNode(e){const t=this.processNodeContent(e);return t?`- ${t.replace(/\n$/,"")}
8
8
  `:""},processCodeBlockNode(e){return`\`\`\`
9
9
  ${this.processNodeContent(e)}
10
- \`\`\``},processMentionNode(e){var s,i,a;const t=((s=e.attrs)==null?void 0:s.name)||"",r=((i=e.attrs)==null?void 0:i.id)||"",n=((a=e.attrs)==null?void 0:a.contactKey)||"";return`<!-- @mention: {"id": "${r}", "contactKey": "${n}", "name": "${t}"} -->`},processChannelNode(e){var i,a,c,l;const t=((i=e.attrs)==null?void 0:i.name)||"",r=((a=e.attrs)==null?void 0:a.id)||"",n=((c=e.attrs)==null?void 0:c.locked.toString())||"",s=((l=e.attrs)==null?void 0:l.channelKey)||"";return`<!-- @channel: {"id": "${r}", "channelKey": "${s}", "name": "${t}", "locked": "${n}"} -->`},processSlashCommandsNode(e){var n,s;const t=((n=e.attrs)==null?void 0:n.command)||"",r=((s=e.attrs)==null?void 0:s.parameters)||"";return`/${t}${r?` ${r}`:""}`},processEmojiNode(e){var t;return((t=e.attrs)==null?void 0:t.code)||""},processUnknownNode(e){return this.processNodeContent(e)},applyMarks(e,t){let r=e;return[...t].sort((s,i)=>{const a={link:0,bold:1,italic:2,strike:3,code:4};return(a[s.type]||5)-(a[i.type]||5)}).forEach(s=>{var i;switch(s.type){case"bold":r=`**${r}**`;break;case"italic":r=`*${r}*`;break;case"strike":r=`~~${r}~~`;break;case"code":r=`\`${r}\``;break;case"link":{const a=((i=s.attrs)==null?void 0:i.href)||"";r=`[${r}](${a})`;break}}}),r}}}},computed:{attrs(){return{...this.$attrs,onInput:()=>{},onFocus:()=>{},onBlur:()=>{}}},extensions(){const e=[A,Y,Q,j];e.push(this.useDivTags?Ae:$),this.allowBold&&e.push(H),this.allowBlockquote&&e.push(O),this.allowBulletList&&(e.push(K),e.push(U.extend({renderText({node:n}){return n.textContent}})),e.push(z)),this.allowItalic&&e.push(W),this.allowStrike&&e.push(X),this.allowUnderline&&e.push(J),this.placeholder&&e.push(q.configure({placeholder:this.placeholder}));const t=this,r=u.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:n})=>t.allowLineBreaks?!1:(n.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(r),this.link&&e.push(F.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:x.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension(Pe,this.customLink)),this.mentionSuggestion){const n={...this.mentionSuggestion,...st};e.push(Ke.configure({suggestion:n}))}if(this.channelSuggestion){const n={...this.channelSuggestion,...lt};e.push(ze.configure({suggestion:n}))}if(this.slashCommandSuggestion){const n={...this.slashCommandSuggestion,...gt};e.push(Qe.configure({suggestion:n,onSelectedCommand:s=>{this.$emit("selected-command",s)}}))}return e.push(Ne),e.push(G.configure({types:["paragraph"]})),this.allowCode&&e.push(V),this.allowCodeblock&&e.push(P.extend({renderText({node:n}){return`\`\`\`
10
+ \`\`\``},processMentionNode(e){var s,i,a;const t=((s=e.attrs)==null?void 0:s.name)||"",r=((i=e.attrs)==null?void 0:i.id)||"",n=((a=e.attrs)==null?void 0:a.contactKey)||"";return`<!-- @mention: {"id": "${r}", "contactKey": "${n}", "name": "${t}"} -->`},processChannelNode(e){var i,a,c,l;const t=((i=e.attrs)==null?void 0:i.name)||"",r=((a=e.attrs)==null?void 0:a.id)||"",n=((c=e.attrs)==null?void 0:c.locked.toString())||"",s=((l=e.attrs)==null?void 0:l.channelKey)||"";return`<!-- @channel: {"id": "${r}", "channelKey": "${s}", "name": "${t}", "locked": "${n}"} -->`},processSlashCommandsNode(e){var n,s;const t=((n=e.attrs)==null?void 0:n.command)||"",r=((s=e.attrs)==null?void 0:s.parameters)||"";return`/${t}${r?` ${r}`:""}`},processEmojiNode(e){var t;return((t=e.attrs)==null?void 0:t.code)||""},processUnknownNode(e){return this.processNodeContent(e)},applyMarks(e,t){let r=e;return[...t].sort((s,i)=>{const a={link:0,bold:1,italic:2,strike:3,code:4};return(a[s.type]||5)-(a[i.type]||5)}).forEach(s=>{var i;switch(s.type){case"bold":r=`**${r}**`;break;case"italic":r=`*${r}*`;break;case"strike":r=`~~${r}~~`;break;case"code":r=`\`${r}\``;break;case"link":{const a=((i=s.attrs)==null?void 0:i.href)||"";r=`[${r}](${a})`;break}}}),r}}}},computed:{attrs(){return{...this.$attrs,onInput:()=>{},onFocus:()=>{},onBlur:()=>{}}},extensions(){const e=[V,Y,Z,j];e.push(this.useDivTags?We:R),this.allowBold&&e.push(K),this.allowBlockquote&&e.push(O),this.allowBulletList&&(e.push(W),e.push(z.extend({renderText({node:n}){return n.textContent}})),e.push(X)),this.allowItalic&&e.push(F),this.allowStrike&&e.push(J),this.allowUnderline&&e.push(G),this.placeholder&&e.push(H.configure({placeholder:this.placeholder}));const t=this,r=u.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:n})=>t.allowLineBreaks?!1:(n.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(r),this.link&&e.push(U.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:b.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension(He,this.customLink)),this.mentionSuggestion){const n={...this.mentionSuggestion,...dt};e.push(Xe.configure({suggestion:n}))}if(this.channelSuggestion){const n={...this.channelSuggestion,...pt};e.push(Qe.configure({suggestion:n}))}if(this.slashCommandSuggestion){const n={...this.slashCommandSuggestion,...Ct};e.push(ot.configure({suggestion:n,onSelectedCommand:s=>{this.$emit("selected-command",s)}}))}return e.push(Ie),e.push(Q.configure({types:["paragraph"]})),this.allowCode&&e.push(q),this.allowCodeblock&&e.push(P.extend({renderText({node:n}){return`\`\`\`
11
11
  ${n.textContent}
12
- \`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&e.push(Ve),(this.allowFontFamily||this.allowFontColor)&&(e.push(Z),this.allowFontColor&&e.push(ee),this.allowFontFamily&&e.push(te)),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()},modelValue(e){this.processValue(e)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){_.warnIfUnmounted(_.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new d.Editor({autofocus:this.autoFocus,content:this.modelValue,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 r=["Backspace"];return!this.allowLineBreaks&&!t.shiftKey&&r.push("Enter"),!r.includes(t.key)},handlePaste:(e,t)=>{const r=t.clipboardData||window.clipboardData,n=r.getData("text/plain"),s=r.getData("text/html");return this.processPasteData(e,n,s)},transformPastedHTML(e){return e.replace(/(<\/\w+>)((<br \/>)+)/g,"$2$3$1")}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return e.isActive("link")},getSelectedLinkText(e){var c,l,m;const{view:t,state:r}=e,{from:n,to:s}=t.state.selection,i=r.doc.textBetween(n,s,""),a=this.editor.state.doc.nodeAt(n);return a&&((m=(l=(c=a.marks)==null?void 0:c.at(0))==null?void 0:l.type)==null?void 0:m.name)==="link"?a.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,r,n;(n=(r=(t=(e=this.editor)==null?void 0:e.chain())==null?void 0:t.focus())==null?void 0:r.unsetLink())==null||n.run()},openLink(){var t,r;(r=(t=this.editor)==null?void 0:t.chain())==null||r.focus();const e=this.editor.getAttributes("link").href;window.open(e,"_blank")},setLink(e,t,r,n=x.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,s){var c,l,m;if(!e){this.removeLink();return}n.find(p=>p.test(e))||(e=`${s}${e}`),this.editor.chain().focus().extendMarkRange("link").run();const a=(m=(l=(c=this.editor)==null?void 0:c.view)==null?void 0:l.state)==null?void 0:m.selection;this.editor.chain().focus().insertContent(t).setTextSelection({from:a.from,to:a.from+t.length}).setLink({href:e,class:r.class}).run()},processValue(e,t=!0){const r=this.getOutput();if(!(t&&le(e,r))){if(typeof e=="string"&&this.outputFormat==="text"){const n=new RegExp(`(${R.emojiPattern})`,"g");e=e==null?void 0:e.replace(n,'<emoji-component code="$1"></emoji-component>')}this.editor.commands.setContent(e,!1,{preserveWhitespace:"full"})}},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){const s=(this.pasteRichText?t:t.replace(/\r\n/g,`
12
+ \`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&e.push(Ke),(this.allowFontFamily||this.allowFontColor)&&(e.push(re),this.allowFontColor&&e.push(se),this.allowFontFamily&&e.push(ie)),this.additionalExtensions.length&&e.push(...this.additionalExtensions),this.allowTables&&e.push(ee.configure({resizable:!0}),oe,ne,te,A),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()},modelValue(e){this.processValue(e)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){_.warnIfUnmounted(_.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new d.Editor({autofocus:this.autoFocus,content:this.modelValue,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 r=["Backspace"];return!this.allowLineBreaks&&!t.shiftKey&&r.push("Enter"),!r.includes(t.key)},handlePaste:(e,t)=>{const r=t.clipboardData||window.clipboardData,n=r.getData("text/plain"),s=r.getData("text/html");return this.processPasteData(e,n,s)},transformPastedHTML(e){return e.replace(/(<\/\w+>)((<br \/>)+)/g,"$2$3$1")}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return e.isActive("link")},getSelectedLinkText(e){var c,l,m;const{view:t,state:r}=e,{from:n,to:s}=t.state.selection,i=r.doc.textBetween(n,s,""),a=this.editor.state.doc.nodeAt(n);return a&&((m=(l=(c=a.marks)==null?void 0:c.at(0))==null?void 0:l.type)==null?void 0:m.name)==="link"?a.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,r,n;(n=(r=(t=(e=this.editor)==null?void 0:e.chain())==null?void 0:t.focus())==null?void 0:r.unsetLink())==null||n.run()},openLink(){var t,r;(r=(t=this.editor)==null?void 0:t.chain())==null||r.focus();const e=this.editor.getAttributes("link").href;window.open(e,"_blank")},setLink(e,t,r,n=b.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,s){var c,l,m;if(!e){this.removeLink();return}n.find(p=>p.test(e))||(e=`${s}${e}`),this.editor.chain().focus().extendMarkRange("link").run();const a=(m=(l=(c=this.editor)==null?void 0:c.view)==null?void 0:l.state)==null?void 0:m.selection;this.editor.chain().focus().insertContent(t).setTextSelection({from:a.from,to:a.from+t.length}).setLink({href:e,class:r.class}).run()},processValue(e,t=!0){const r=this.getOutput();if(!(t&&pe(e,r))){if(typeof e=="string"&&this.outputFormat==="text"){const n=new RegExp(`(${$.emojiPattern})`,"g");e=e==null?void 0:e.replace(n,'<emoji-component code="$1"></emoji-component>')}this.editor.commands.setContent(e,!1,{preserveWhitespace:"full"})}},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){const s=(this.pasteRichText?t:t.replace(/\r\n/g,`
13
13
  `).replace(/\n\n/g,`
14
14
  `)).replace(/[\r\n]+$/,"").split(/\r?\n/),i=[];for(let a=0;a<s.length;a++)a>0&&i.push({type:"hardBreak"}),s[a]&&i.push({type:"text",text:s[a]});this.editor.chain().focus().insertContent(i).run()},shouldPreserveLineBreaks(e,t){return this.pasteRichText?!t&&e&&this.hasBlankLines(e):!!e},processPasteData(e,t,r){if(this.shouldPreserveLineBreaks(t,r))return this.insertPlainTextWithHardBreaks(e,t),!0;if(this.shouldHandlePreformattedHTML(r)){const n=this.extractPreformattedText(r);if(n&&n.includes(`
15
15
  `))return this.insertPlainTextWithHardBreaks(e,n),!0}return!1},shouldHandlePreformattedHTML(e){return this.pasteRichText&&e&&this.containsPreformattedContent(e)},containsPreformattedContent(e){const t=document.createElement("div");t.innerHTML=e;const r=t.querySelectorAll("*");for(const n of r)if(this.hasPreWhitespace(n)&&this.hasLineBreaks(n))return!0;return!1},hasPreWhitespace(e){const t=e.getAttribute("style")||"",r=e.style.whiteSpace||"",n=r==="pre"||r==="pre-wrap",s=t.includes("white-space: pre");return n||s},hasLineBreaks(e){return e.textContent&&e.textContent.includes(`
@@ -17,5 +17,5 @@ ${n.textContent}
17
17
 
18
18
  `)||/\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 r of e.childNodes)t+=this.walkAndExtractText(r);return t},triggerInputChangeEvents(){const e=this.getOutput();this.$emit("input",e),this.$emit("update:modelValue",e);const t=this.editor.getJSON();this.$emit("json-input",t);const r=this.editor.getHTML();this.$emit("html-input",r);const n=this.editor.getText({blockSeparator:`
19
19
  `});this.$emit("text-input",n);const s=this.jsonToMarkdownConverter.convertToMarkdown(t);this.$emit("markdown-input",s)},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)}),this.editor.on("mention-click",e=>{this.$emit("mention-click",e)}),this.editor.on("channel-click",e=>{this.$emit("channel-click",e)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"markdown":return this.jsonToMarkdownConverter.convertToMarkdown(this.editor.getJSON());case"text":default:return this.editor.getText({blockSeparator:`
20
- `})}},getExtension(e,t){var r;return typeof t=="boolean"?e:(r=e.configure)==null?void 0:r.call(e,t)},updateEditorAttributes(e){this.editor.setOptions({editorProps:{attributes:{...this.inputAttrs,class:this.inputClass,...e}}})},focusEditor(){this.editor.commands.focus()}}},_t={class:"d-popover__dialog"};function wt(e,t,r,n,s,i){const a=o.resolveComponent("dt-button"),c=o.resolveComponent("dt-stack"),l=o.resolveComponent("bubble-menu"),m=o.resolveComponent("editor-content");return o.openBlock(),o.createElementBlock("div",null,[s.editor&&r.link&&!r.hideLinkBubbleMenu?(o.openBlock(),o.createBlock(l,{key:0,editor:s.editor,"should-show":i.bubbleMenuShouldShow,"tippy-options":s.tippyOptions,style:{visibility:"visible"}},{default:o.withCtx(()=>[o.createElementVNode("div",_t,[o.createVNode(c,{direction:"row",class:"d-rich-text-editor-bubble-menu__button-stack",gap:"0"},{default:o.withCtx(()=>[o.createVNode(a,{kind:"muted",importance:"clear",onClick:i.editLink},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(s.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL")),1)]),_:1},8,["onClick"]),o.createVNode(a,{kind:"muted",importance:"clear",onClick:i.openLink},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(s.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL")),1)]),_:1},8,["onClick"]),o.createVNode(a,{kind:"danger",importance:"clear",onClick:i.removeLink},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(s.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL")),1)]),_:1},8,["onClick"])]),_:1})])]),_:1},8,["editor","should-show","tippy-options"])):o.createCommentVNode("",!0),o.createVNode(m,o.mergeProps({ref:"editor",editor:s.editor,class:"d-rich-text-editor","data-qa":"dt-rich-text-editor"},i.attrs),null,16,["editor"])])}const yt=h._(kt,[["render",wt]]);exports.default=yt;
20
+ `})}},getExtension(e,t){var r;return typeof t=="boolean"?e:(r=e.configure)==null?void 0:r.call(e,t)},updateEditorAttributes(e){this.editor.setOptions({editorProps:{attributes:{...this.inputAttrs,class:this.inputClass,...e}}})},focusEditor(){this.editor.commands.focus()}}},xt={class:"d-popover__dialog"};function Tt(e,t,r,n,s,i){const a=o.resolveComponent("dt-button"),c=o.resolveComponent("dt-stack"),l=o.resolveComponent("bubble-menu"),m=o.resolveComponent("editor-content");return o.openBlock(),o.createElementBlock("div",null,[s.editor&&r.link&&!r.hideLinkBubbleMenu?(o.openBlock(),o.createBlock(l,{key:0,editor:s.editor,"should-show":i.bubbleMenuShouldShow,"tippy-options":s.tippyOptions,style:{visibility:"visible"}},{default:o.withCtx(()=>[o.createElementVNode("div",xt,[o.createVNode(c,{direction:"row",class:"d-rich-text-editor-bubble-menu__button-stack",gap:"0"},{default:o.withCtx(()=>[o.createVNode(a,{kind:"muted",importance:"clear",onClick:i.editLink},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(s.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL")),1)]),_:1},8,["onClick"]),o.createVNode(a,{kind:"muted",importance:"clear",onClick:i.openLink},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(s.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL")),1)]),_:1},8,["onClick"]),o.createVNode(a,{kind:"danger",importance:"clear",onClick:i.removeLink},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(s.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL")),1)]),_:1},8,["onClick"])]),_:1})])]),_:1},8,["editor","should-show","tippy-options"])):o.createCommentVNode("",!0),o.createVNode(m,o.mergeProps({ref:"editor",editor:s.editor,class:"d-rich-text-editor","data-qa":"dt-rich-text-editor"},i.attrs),null,16,["editor"])])}const Et=h._(bt,[["render",Tt]]);exports.default=Et;
21
21
  //# sourceMappingURL=rich-text-editor.cjs.map