@dialpad/dialtone 9.117.1 → 9.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/dialtone-default-theme.css +44 -3
- package/dist/css/dialtone-default-theme.min.css +1 -1
- package/dist/css/dialtone-docs.json +1 -1
- package/dist/css/dialtone.css +44 -3
- package/dist/css/dialtone.min.css +1 -1
- package/dist/tokens/doc.json +24764 -24764
- package/dist/vue2/lib/editor/editor.cjs +1 -1
- package/dist/vue2/lib/editor/editor.cjs.map +1 -1
- package/dist/vue2/lib/editor/editor.js +75 -81
- package/dist/vue2/lib/editor/editor.js.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/editor/editor.vue.d.ts +0 -1
- package/dist/vue2/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/dist/vue3/lib/editor/editor.cjs +1 -1
- package/dist/vue3/lib/editor/editor.cjs.map +1 -1
- package/dist/vue3/lib/editor/editor.js +95 -100
- package/dist/vue3/lib/editor/editor.js.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts +0 -1
- package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/package.json +6 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("./editor-constants.cjs"),o=require("@dialpad/dialtone-icons/vue2"),d=require("vue"),h=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),p=require("../rich-text-editor/rich-text-editor.cjs"),f=require("../button/button.cjs"),k=require("../popover/popover.cjs"),g=require("../stack/stack.cjs"),B=require("../input/input.cjs"),I=require("../tooltip/tooltip.cjs"),a=require("../rich-text-editor/rich-text-editor-constants.cjs"),y={name:"DtRecipeEditor",components:{DtRichTextEditor:p.default,DtButton:f.default,DtPopover:k.default,DtStack:g.default,DtInput:B.default,DtTooltip:I.default,DtIconQuickReply:o.DtIconQuickReply,DtIconBold:o.DtIconBold,DtIconItalic:o.DtIconItalic,DtIconUnderline:o.DtIconUnderline,DtIconStrikethrough:o.DtIconStrikethrough,DtIconListBullet:o.DtIconListBullet,DtIconListOrdered:o.DtIconListOrdered,DtIconAlignLeft:o.DtIconAlignLeft,DtIconAlignCenter:o.DtIconAlignCenter,DtIconAlignRight:o.DtIconAlignRight,DtIconAlignJustify:o.DtIconAlignJustify,DtIconQuote:o.DtIconQuote,DtIconCodeBlock:o.DtIconCodeBlock,DtIconLink2:o.DtIconLink2,DtIconImage:o.DtIconImage},inheritAttrs:!1,props:{value:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},inputAriaLabel:{type:String,required:!0,default:""},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e=="string"?a.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},placeholder:{type:String,default:""},maxHeight:{type:String,default:"unset"},confirmSetLinkButton:{type:Object,default:()=>({label:"Confirm",ariaLabel:"Confirm set link"})},removeLinkButton:{type:Object,default:()=>({label:"Remove",ariaLabel:"Remove link"})},cancelSetLinkButton:{type:Object,default:()=>({label:"Cancel",ariaLabel:"Cancel set link"})},setLinkPlaceholder:{type:String,default:""},showBoldButton:{type:Boolean,default:!0},showItalicsButton:{type:Boolean,default:!0},showUnderlineButton:{type:Boolean,default:!0},showStrikeButton:{type:Boolean,default:!0},showListItemsButton:{type:Boolean,default:!0},showOrderedListButton:{type:Boolean,default:!0},showAlignLeftButton:{type:Boolean,default:!0},showAlignCenterButton:{type:Boolean,default:!0},showAlignRightButton:{type:Boolean,default:!0},showAlignJustifyButton:{type:Boolean,default:!0},showQuoteButton:{type:Boolean,default:!0},showCodeBlockButton:{type:Boolean,default:!0},showQuickRepliesButton:{type:Boolean,default:!0},showInlineImageButton:{type:Boolean,default:!1},showAddLink:{type:Object,default:()=>({showAddLinkButton:!0,setLinkTitle:"Add a link",setLinkInputAriaLabel:"Input field to add link"})},useDivTags:{type:Boolean,default:!1}},emits:["focus","blur","input","quick-replies-click","inline-image-click","text-input"],data(){return{internalInputValue:this.value,hasFocus:!1,linkOptions:{class:"d-recipe-editor__link"},showLinkInput:!1,linkInput:"",currentButtonRefIndex:0,buttonRefMap:d.ref({})}},computed:{inputLength(){return this.internalInputValue.length},htmlOutputFormat(){return a.RICH_TEXT_EDITOR_OUTPUT_FORMATS[2]},showingTextFormatButtons(){return this.showBoldButton||this.showItalicsButton||this.showStrikeButton||this.showUnderlineButton},showingAlignmentButtons(){return this.showAlignLeftButton||this.showAlignCenterButton||this.showAlignRightButton||this.showAlignJustifyButton},showingListButtons(){return this.showListItemsButton||this.showOrderedListButton},orderedRefs(){const e=this.buttonGroups.reduce((function(t,i){return i.buttonGroup.forEach(n=>{t.push(this.getButtonRef(i.key,n.selector))},this),t}).bind(this),[]);return e.push(this.getButtonRef("custom","link")),e},buttonGroups(){const e=this.individualButtons.map(t=>({key:t.selector,buttonGroup:[t]}));return[{key:"new",buttonGroup:this.newButtons},{key:"format",buttonGroup:this.textFormatButtons},{key:"alignment",buttonGroup:this.alignmentButtons},{key:"list",buttonGroup:this.listButtons},...e].filter(t=>t.buttonGroup.length>0)},newButtons(){return[{showBtn:this.showQuickRepliesButton,label:"Quick reply",selector:"quickReplies",icon:o.DtIconQuickReply,dataQA:"dt-recipe-editor-quick-replies-btn",tooltipMessage:"Quick Reply",onClick:this.onQuickRepliesClick}].filter(e=>e.showBtn)},textFormatButtons(){return[{showBtn:this.showBoldButton,selector:"bold",icon:o.DtIconBold,dataQA:"dt-recipe-editor-bold-btn",tooltipMessage:"Bold",onClick:this.onBoldTextToggle},{showBtn:this.showItalicsButton,selector:"italic",icon:o.DtIconItalic,dataQA:"dt-recipe-editor-italics-btn",tooltipMessage:"Italics",onClick:this.onItalicTextToggle},{showBtn:this.showUnderlineButton,selector:"underline",icon:o.DtIconUnderline,dataQA:"dt-recipe-editor-underline-btn",tooltipMessage:"Underline",onClick:this.onUnderlineTextToggle},{showBtn:this.showStrikeButton,selector:"strike",icon:o.DtIconStrikethrough,dataQA:"dt-recipe-editor-strike-btn",tooltipMessage:"Strike",onClick:this.onStrikethroughTextToggle}].filter(e=>e.showBtn)},alignmentButtons(){return[{showBtn:this.showAlignLeftButton,selector:{textAlign:"left"},icon:o.DtIconAlignLeft,dataQA:"dt-recipe-editor-align-left-btn",tooltipMessage:"Align Left",onClick:()=>this.onTextAlign("left")},{showBtn:this.showAlignCenterButton,selector:{textAlign:"center"},icon:o.DtIconAlignCenter,dataQA:"dt-recipe-editor-align-center-btn",tooltipMessage:"Align Center",onClick:()=>this.onTextAlign("center")},{showBtn:this.showAlignRightButton,selector:{textAlign:"right"},icon:o.DtIconAlignRight,dataQA:"dt-recipe-editor-align-right-btn",tooltipMessage:"Align Right",onClick:()=>this.onTextAlign("right")},{showBtn:this.showAlignJustifyButton,selector:{textAlign:"justify"},icon:o.DtIconAlignJustify,dataQA:"dt-recipe-editor-align-justify-btn",tooltipMessage:"Align Justify",onClick:()=>this.onTextAlign("justify")}].filter(e=>e.showBtn)},listButtons(){return[{showBtn:this.showListItemsButton,selector:"bulletList",icon:o.DtIconListBullet,dataQA:"dt-recipe-editor-list-items-btn",tooltipMessage:"Bullet List",onClick:this.onBulletListToggle},{showBtn:this.showOrderedListButton,selector:"orderedList",icon:o.DtIconListOrdered,dataQA:"dt-recipe-editor-ordered-list-items-btn",tooltipMessage:"Ordered List",onClick:this.onOrderedListToggle}].filter(e=>e.showBtn)},individualButtons(){return[{showBtn:this.showQuoteButton,selector:"blockquote",icon:o.DtIconQuote,dataQA:"dt-recipe-editor-blockquote-btn",tooltipMessage:"Quote",onClick:this.onBlockquoteToggle},{showBtn:this.showCodeBlockButton,selector:"codeBlock",icon:o.DtIconCodeBlock,dataQA:"dt-recipe-editor-code-block-btn",tooltipMessage:"Code",onClick:this.onCodeBlockToggle},{showBtn:this.showInlineImageButton,selector:"image",icon:o.DtIconImage,dataQA:"dt-recipe-editor-inline-image-btn",tooltipMessage:"Image",onClick:this.onInsertInlineImageClick}].filter(e=>e.showBtn)},linkButton(){return{showBtn:this.showAddLink.showAddLinkButton,selector:"link",icon:o.DtIconLink2,dataQA:"dt-recipe-editor-add-link-btn",tooltipMessage:"Link",onClick:this.openLinkInput}}},watch:{value(e){this.internalInputValue=e}},methods:{onInputFocus(e){e==null||e.stopPropagation()},removeLink(){var e,t,i,n,r;(r=(n=(i=(t=(e=this.$refs.richTextEditor)==null?void 0:e.editor)==null?void 0:t.chain())==null?void 0:i.focus())==null?void 0:n.unsetLink())==null||r.run(),this.closeLinkInput()},setLink(e){var r,s,u;const t=(r=this.$refs.richTextEditor)==null?void 0:r.editor;if(e==null||e.preventDefault(),e==null||e.stopPropagation(),!this.linkInput){this.removeLink();return}c.EDITOR_SUPPORTED_LINK_PROTOCOLS.find(l=>l.test(this.linkInput))||(this.linkInput=`${c.EDITOR_DEFAULT_LINK_PREFIX}${this.linkInput}`);const n=(u=(s=t==null?void 0:t.view)==null?void 0:s.state)==null?void 0:u.selection;n.anchor===n.head?t.chain().focus().insertContentAt(n.anchor,`<a class="${this.linkOptions.class}" href=${this.linkInput}>${this.linkInput}</a>`).run():t.chain().focus().extendMarkRange("link").setLink({href:this.linkInput,class:this.linkOptions.class}).run(),this.closeLinkInput()},openLinkInput(){this.showLinkInput=!0},updateInput(e){var t,i,n;if(!e)return this.closeLinkInput();this.linkInput=(n=(i=(t=this.$refs.richTextEditor)==null?void 0:t.editor)==null?void 0:i.getAttributes("link"))==null?void 0:n.href},closeLinkInput(){var e;this.showLinkInput=!1,this.linkInput="",(e=this.$refs.richTextEditor.editor)==null||e.chain().focus()},onBoldTextToggle(){var e,t;(t=(e=this.$refs.richTextEditor)==null?void 0:e.editor)==null||t.chain().focus().toggleBold().run()},onItalicTextToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleItalic().run()},onUnderlineTextToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleUnderline().run()},onStrikethroughTextToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleStrike().run()},onTextAlign(e){var t,i,n,r;if((i=(t=this.$refs.richTextEditor)==null?void 0:t.editor)!=null&&i.isActive({textAlign:e}))return(n=this.$refs.richTextEditor)==null?void 0:n.editor.chain().focus().unsetTextAlign().run();(r=this.$refs.richTextEditor)==null||r.editor.chain().focus().setTextAlign(e).run()},onBulletListToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleBulletList().run()},onOrderedListToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleOrderedList().run()},onCodeBlockToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleCodeBlock().run()},onQuickRepliesClick(){this.$emit("quick-replies-click")},onInsertInlineImageClick(){this.$emit("inline-image-click")},insertInlineImage(e){var t;(t=this.$refs.richTextEditor)==null||t.editor.chain().focus().setImage({src:e}).run()},onBlockquoteToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleBlockquote().run()},insertInMessageBody(e){var t;(t=this.$refs.richTextEditor)==null||t.editor.chain().focus().insertContent(e).run()},setCursorPosition(e=null){var t;(t=this.$refs.richTextEditor)==null||t.editor.chain().focus(e).run()},onTextInput(e){this.$emit("text-input",e)},onFocus(e){this.hasFocus=!0,this.$emit("focus",e)},onBlur(e){this.hasFocus=!1,this.$emit("blur",e)},onInput(e){this.$emit("input",e)},getButtonKey(e,t){return`${e}-${JSON.stringify(t)}`},getButtonRef(e,t){return`${this.getButtonKey(e,t)}-ref`},canFocus(e){return e===this.orderedRefs[this.currentButtonRefIndex]},shiftActionBarFocusRight(){this.shiftButtonRefIndex(1)},shiftActionBarFocusLeft(){this.shiftButtonRefIndex(-1)},shiftButtonRefIndex(e){const t=this.buttonRefMap[this.orderedRefs[this.currentButtonRefIndex]],i=(this.currentButtonRefIndex+e)%this.orderedRefs.length;this.currentButtonRefIndex=i>=0?i:this.orderedRefs.length+i;const n=this.buttonRefMap[this.orderedRefs[this.currentButtonRefIndex]];t.$el.blur(),n.$el.focus()}}};var b=function(){var t=this,i=t._self._c;return i("div",{staticClass:"d-recipe-editor",attrs:{"data-qa":"dt-recipe-editor",role:"presentation"},on:{click:function(n){return t.$refs.richTextEditor.focusEditor()}}},[i("dt-stack",{staticClass:"d-recipe-editor__top-bar",attrs:{direction:"row",gap:"450"}},[t._l(t.buttonGroups,function(n){return i("dt-stack",{key:n.key,attrs:{direction:"row",gap:"300"}},[t._l(n.buttonGroup,function(r){return i("dt-tooltip",{key:t.getButtonKey(n.key,r.selector),attrs:{message:r.tooltipMessage,placement:"top"},scopedSlots:t._u([{key:"anchor",fn:function(){var s,u;return[i("dt-button",{ref:l=>{t.buttonRefMap[t.getButtonRef(n.key,r.selector)]=l},refInFor:!0,attrs:{active:(u=(s=t.$refs.richTextEditor)==null?void 0:s.editor)==null?void 0:u.isActive(r.selector),"aria-label":r.tooltipMessage,"data-qa":r.dataQA,tabindex:t.canFocus(t.getButtonRef(n.key,r.selector))?0:-1,importance:"clear",kind:"muted",size:"xs"},on:{click:function(l){return r.onClick()},keydown:[function(l){return!l.type.indexOf("key")&&t._k(l.keyCode,"right",39,l.key,["Right","ArrowRight"])||"button"in l&&l.button!==2?null:(l.stopPropagation(),t.shiftActionBarFocusRight.apply(null,arguments))},function(l){return!l.type.indexOf("key")&&t._k(l.keyCode,"left",37,l.key,["Left","ArrowLeft"])||"button"in l&&l.button!==0?null:(l.stopPropagation(),t.shiftActionBarFocusLeft.apply(null,arguments))}]},scopedSlots:t._u([{key:"icon",fn:function(){return[i(r.icon,{tag:"component",attrs:{size:"200"}})]},proxy:!0}],null,!0)},[r.label?i("span",[t._v(t._s(r.label))]):t._e()])]},proxy:!0}],null,!0)})}),i("div",{staticClass:"d-recipe-editor__button-group-divider"})],2)}),t.linkButton.showBtn?i("dt-stack",{attrs:{direction:"row",gap:"300"}},[i("dt-popover",{attrs:{open:t.showLinkInput,"show-close-button":!1,"visually-hidden-close":!0,"visually-hidden-close-label":"Close link input popover","data-qa":"dt-recipe-editor-link-input-popover",padding:"none",placement:"bottom-start"},on:{"update:open":function(n){t.showLinkInput=n},click:t.onInputFocus,opened:t.updateInput},nativeOn:{click:function(n){return n.stopPropagation(),t.onInputFocus.apply(null,arguments)}},scopedSlots:t._u([{key:"anchor",fn:function(){return[i("dt-tooltip",{key:t.linkButton.key,attrs:{message:t.linkButton.tooltipMessage,placement:"top"},scopedSlots:t._u([{key:"anchor",fn:function(){var n,r;return[i("dt-button",{ref:s=>{t.buttonRefMap[t.getButtonRef("custom","link")]=s},attrs:{active:(r=(n=t.$refs.richTextEditor)==null?void 0:n.editor)==null?void 0:r.isActive(t.linkButton.selector),"aria-label":t.linkButton.tooltipMessage,"data-qa":t.linkButton.dataQA,tabindex:t.canFocus(t.getButtonRef("custom","link"))?0:-1,importance:"clear",kind:"muted",size:"xs"},on:{click:function(s){return t.linkButton.onClick()},keydown:[function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"right",39,s.key,["Right","ArrowRight"])||"button"in s&&s.button!==2?null:(s.stopPropagation(),t.shiftActionBarFocusRight.apply(null,arguments))},function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"left",37,s.key,["Left","ArrowLeft"])||"button"in s&&s.button!==0?null:(s.stopPropagation(),t.shiftActionBarFocusLeft.apply(null,arguments))}]},scopedSlots:t._u([{key:"icon",fn:function(){return[i(t.linkButton.icon,{tag:"component",attrs:{size:"200"}})]},proxy:!0}],null,!1,3601441856)})]},proxy:!0}],null,!1,1796000448)})]},proxy:!0},{key:"content",fn:function(){return[i("div",{staticClass:"d-recipe-editor__popover-content"},[t.showAddLink.setLinkTitle.length>0?i("span",[t._v(" "+t._s(t.showAddLink.setLinkTitle)+" ")]):t._e(),i("dt-input",{attrs:{"input-aria-label":t.showAddLink.setLinkInputAriaLabel,placeholder:t.setLinkPlaceholder,"data-qa":"dt-recipe-editor-link-input","input-wrapper-class":"d-recipe-editor-link__input-wrapper"},on:{click:t.onInputFocus,focus:t.onInputFocus,keydown:function(n){return!n.type.indexOf("key")&&t._k(n.keyCode,"enter",13,n.key,"Enter")?null:t.setLink.apply(null,arguments)}},nativeOn:{click:function(n){return n.stopPropagation(),t.onInputFocus.apply(null,arguments)}},model:{value:t.linkInput,callback:function(n){t.linkInput=n},expression:"linkInput"}})],1)]},proxy:!0},{key:"footerContent",fn:function(){return[i("dt-stack",{staticClass:"d-recipe-editor__popover-footer",attrs:{direction:"row",gap:"300"}},[i("dt-button",{attrs:{"aria-label":t.removeLinkButton.ariaLabel,"data-qa":"dt-recipe-editor-remove-link-btn",importance:"clear",kind:"muted",size:"sm"},on:{click:t.removeLink}},[t._v(" "+t._s(t.removeLinkButton.label)+" ")]),i("dt-button",{attrs:{"aria-label":t.cancelSetLinkButton.ariaLabel,"data-qa":"dt-recipe-editor-set-link-cancel-btn",importance:"clear",kind:"muted",size:"sm"},on:{click:t.closeLinkInput}},[t._v(" "+t._s(t.cancelSetLinkButton.label)+" ")]),i("dt-button",{attrs:{"aria-label":t.confirmSetLinkButton.ariaLabel,"data-qa":"dt-recipe-editor-set-link-confirm-btn",size:"sm"},on:{click:t.setLink}},[t._v(" "+t._s(t.confirmSetLinkButton.label)+" ")])],1)]},proxy:!0}],null,!1,484310841)})],1):t._e()],2),i("div",{staticClass:"d-recipe-editor__content",style:{"max-height":t.maxHeight}},[i("dt-rich-text-editor",t._b({ref:"richTextEditor",attrs:{"allow-font-color":!0,"allow-font-family":!0,"allow-inline-images":!0,"allow-line-breaks":!0,"hide-link-bubble-menu":!0,"auto-focus":t.autoFocus,editable:t.editable,"input-aria-label":t.inputAriaLabel,"input-class":`d-recipe-editor__content-input ${t.inputClass}`,link:!0,"output-format":t.htmlOutputFormat,placeholder:t.placeholder,"use-div-tags":t.useDivTags,"data-qa":"dt-rich-text-editor"},on:{"text-input":t.onTextInput,blur:t.onBlur,focus:t.onFocus,input:function(n){return t.onInput(n)}},model:{value:t.internalInputValue,callback:function(n){t.internalInputValue=n},expression:"internalInputValue"}},"dt-rich-text-editor",t.$attrs,!1))],1)],1)},m=[],L=h.n(y,b,m);const w=L.exports;exports.default=w;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("./editor-constants.cjs"),o=require("@dialpad/dialtone-icons/vue2"),d=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),h=require("../rich-text-editor/rich-text-editor.cjs"),p=require("../button/button.cjs"),f=require("../popover/popover.cjs"),k=require("../stack/stack.cjs"),g=require("../input/input.cjs"),B=require("../tooltip/tooltip.cjs"),a=require("../rich-text-editor/rich-text-editor-constants.cjs"),I={name:"DtRecipeEditor",components:{DtRichTextEditor:h.default,DtButton:p.default,DtPopover:f.default,DtStack:k.default,DtInput:g.default,DtTooltip:B.default,DtIconQuickReply:o.DtIconQuickReply,DtIconBold:o.DtIconBold,DtIconItalic:o.DtIconItalic,DtIconUnderline:o.DtIconUnderline,DtIconStrikethrough:o.DtIconStrikethrough,DtIconListBullet:o.DtIconListBullet,DtIconListOrdered:o.DtIconListOrdered,DtIconAlignLeft:o.DtIconAlignLeft,DtIconAlignCenter:o.DtIconAlignCenter,DtIconAlignRight:o.DtIconAlignRight,DtIconAlignJustify:o.DtIconAlignJustify,DtIconQuote:o.DtIconQuote,DtIconCodeBlock:o.DtIconCodeBlock,DtIconLink2:o.DtIconLink2,DtIconImage:o.DtIconImage},inheritAttrs:!1,props:{value:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},inputAriaLabel:{type:String,required:!0,default:""},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e=="string"?a.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},placeholder:{type:String,default:""},maxHeight:{type:String,default:"unset"},confirmSetLinkButton:{type:Object,default:()=>({label:"Confirm",ariaLabel:"Confirm set link"})},removeLinkButton:{type:Object,default:()=>({label:"Remove",ariaLabel:"Remove link"})},cancelSetLinkButton:{type:Object,default:()=>({label:"Cancel",ariaLabel:"Cancel set link"})},setLinkPlaceholder:{type:String,default:""},showBoldButton:{type:Boolean,default:!0},showItalicsButton:{type:Boolean,default:!0},showUnderlineButton:{type:Boolean,default:!0},showStrikeButton:{type:Boolean,default:!0},showListItemsButton:{type:Boolean,default:!0},showOrderedListButton:{type:Boolean,default:!0},showAlignLeftButton:{type:Boolean,default:!0},showAlignCenterButton:{type:Boolean,default:!0},showAlignRightButton:{type:Boolean,default:!0},showAlignJustifyButton:{type:Boolean,default:!0},showQuoteButton:{type:Boolean,default:!0},showCodeBlockButton:{type:Boolean,default:!0},showQuickRepliesButton:{type:Boolean,default:!0},showInlineImageButton:{type:Boolean,default:!1},showAddLink:{type:Object,default:()=>({showAddLinkButton:!0,setLinkTitle:"Add a link",setLinkInputAriaLabel:"Input field to add link"})},useDivTags:{type:Boolean,default:!1}},emits:["focus","blur","input","quick-replies-click","inline-image-click","text-input"],data(){return{internalInputValue:this.value,hasFocus:!1,linkOptions:{class:"d-recipe-editor__link"},showLinkInput:!1,linkInput:"",currentButtonRefIndex:0}},computed:{inputLength(){return this.internalInputValue.length},htmlOutputFormat(){return a.RICH_TEXT_EDITOR_OUTPUT_FORMATS[2]},showingTextFormatButtons(){return this.showBoldButton||this.showItalicsButton||this.showStrikeButton||this.showUnderlineButton},showingAlignmentButtons(){return this.showAlignLeftButton||this.showAlignCenterButton||this.showAlignRightButton||this.showAlignJustifyButton},showingListButtons(){return this.showListItemsButton||this.showOrderedListButton},orderedRefs(){const e=this.buttonGroups.reduce((function(t,i){return i.buttonGroup.forEach(n=>{t.push(this.getButtonRef(i.key,n.selector))},this),t}).bind(this),[]);return e.push(this.getButtonRef("custom","link")),e},buttonGroups(){const e=this.individualButtons.map(t=>({key:t.selector,buttonGroup:[t]}));return[{key:"new",buttonGroup:this.newButtons},{key:"format",buttonGroup:this.textFormatButtons},{key:"alignment",buttonGroup:this.alignmentButtons},{key:"list",buttonGroup:this.listButtons},...e].filter(t=>t.buttonGroup.length>0)},newButtons(){return[{showBtn:this.showQuickRepliesButton,label:"Quick reply",selector:"quickReplies",icon:o.DtIconQuickReply,dataQA:"dt-recipe-editor-quick-replies-btn",tooltipMessage:"Quick Reply",onClick:this.onQuickRepliesClick}].filter(e=>e.showBtn)},textFormatButtons(){return[{showBtn:this.showBoldButton,selector:"bold",icon:o.DtIconBold,dataQA:"dt-recipe-editor-bold-btn",tooltipMessage:"Bold",onClick:this.onBoldTextToggle},{showBtn:this.showItalicsButton,selector:"italic",icon:o.DtIconItalic,dataQA:"dt-recipe-editor-italics-btn",tooltipMessage:"Italics",onClick:this.onItalicTextToggle},{showBtn:this.showUnderlineButton,selector:"underline",icon:o.DtIconUnderline,dataQA:"dt-recipe-editor-underline-btn",tooltipMessage:"Underline",onClick:this.onUnderlineTextToggle},{showBtn:this.showStrikeButton,selector:"strike",icon:o.DtIconStrikethrough,dataQA:"dt-recipe-editor-strike-btn",tooltipMessage:"Strike",onClick:this.onStrikethroughTextToggle}].filter(e=>e.showBtn)},alignmentButtons(){return[{showBtn:this.showAlignLeftButton,selector:{textAlign:"left"},icon:o.DtIconAlignLeft,dataQA:"dt-recipe-editor-align-left-btn",tooltipMessage:"Align Left",onClick:()=>this.onTextAlign("left")},{showBtn:this.showAlignCenterButton,selector:{textAlign:"center"},icon:o.DtIconAlignCenter,dataQA:"dt-recipe-editor-align-center-btn",tooltipMessage:"Align Center",onClick:()=>this.onTextAlign("center")},{showBtn:this.showAlignRightButton,selector:{textAlign:"right"},icon:o.DtIconAlignRight,dataQA:"dt-recipe-editor-align-right-btn",tooltipMessage:"Align Right",onClick:()=>this.onTextAlign("right")},{showBtn:this.showAlignJustifyButton,selector:{textAlign:"justify"},icon:o.DtIconAlignJustify,dataQA:"dt-recipe-editor-align-justify-btn",tooltipMessage:"Align Justify",onClick:()=>this.onTextAlign("justify")}].filter(e=>e.showBtn)},listButtons(){return[{showBtn:this.showListItemsButton,selector:"bulletList",icon:o.DtIconListBullet,dataQA:"dt-recipe-editor-list-items-btn",tooltipMessage:"Bullet List",onClick:this.onBulletListToggle},{showBtn:this.showOrderedListButton,selector:"orderedList",icon:o.DtIconListOrdered,dataQA:"dt-recipe-editor-ordered-list-items-btn",tooltipMessage:"Ordered List",onClick:this.onOrderedListToggle}].filter(e=>e.showBtn)},individualButtons(){return[{showBtn:this.showQuoteButton,selector:"blockquote",icon:o.DtIconQuote,dataQA:"dt-recipe-editor-blockquote-btn",tooltipMessage:"Quote",onClick:this.onBlockquoteToggle},{showBtn:this.showCodeBlockButton,selector:"codeBlock",icon:o.DtIconCodeBlock,dataQA:"dt-recipe-editor-code-block-btn",tooltipMessage:"Code",onClick:this.onCodeBlockToggle},{showBtn:this.showInlineImageButton,selector:"image",icon:o.DtIconImage,dataQA:"dt-recipe-editor-inline-image-btn",tooltipMessage:"Image",onClick:this.onInsertInlineImageClick}].filter(e=>e.showBtn)},linkButton(){return{showBtn:this.showAddLink.showAddLinkButton,selector:"link",icon:o.DtIconLink2,dataQA:"dt-recipe-editor-add-link-btn",tooltipMessage:"Link",onClick:this.openLinkInput}}},watch:{value(e){this.internalInputValue=e}},methods:{onInputFocus(e){e==null||e.stopPropagation()},removeLink(){var e,t,i,n,r;(r=(n=(i=(t=(e=this.$refs.richTextEditor)==null?void 0:e.editor)==null?void 0:t.chain())==null?void 0:i.focus())==null?void 0:n.unsetLink())==null||r.run(),this.closeLinkInput()},setLink(e){var r,s,u;const t=(r=this.$refs.richTextEditor)==null?void 0:r.editor;if(e==null||e.preventDefault(),e==null||e.stopPropagation(),!this.linkInput){this.removeLink();return}c.EDITOR_SUPPORTED_LINK_PROTOCOLS.find(l=>l.test(this.linkInput))||(this.linkInput=`${c.EDITOR_DEFAULT_LINK_PREFIX}${this.linkInput}`);const n=(u=(s=t==null?void 0:t.view)==null?void 0:s.state)==null?void 0:u.selection;n.anchor===n.head?t.chain().focus().insertContentAt(n.anchor,`<a class="${this.linkOptions.class}" href=${this.linkInput}>${this.linkInput}</a>`).run():t.chain().focus().extendMarkRange("link").setLink({href:this.linkInput,class:this.linkOptions.class}).run(),this.closeLinkInput()},openLinkInput(){this.showLinkInput=!0},updateInput(e){var t,i,n;if(!e)return this.closeLinkInput();this.linkInput=(n=(i=(t=this.$refs.richTextEditor)==null?void 0:t.editor)==null?void 0:i.getAttributes("link"))==null?void 0:n.href},closeLinkInput(){var e;this.showLinkInput=!1,this.linkInput="",(e=this.$refs.richTextEditor.editor)==null||e.chain().focus()},onBoldTextToggle(){var e,t;(t=(e=this.$refs.richTextEditor)==null?void 0:e.editor)==null||t.chain().focus().toggleBold().run()},onItalicTextToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleItalic().run()},onUnderlineTextToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleUnderline().run()},onStrikethroughTextToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleStrike().run()},onTextAlign(e){var t,i,n,r;if((i=(t=this.$refs.richTextEditor)==null?void 0:t.editor)!=null&&i.isActive({textAlign:e}))return(n=this.$refs.richTextEditor)==null?void 0:n.editor.chain().focus().unsetTextAlign().run();(r=this.$refs.richTextEditor)==null||r.editor.chain().focus().setTextAlign(e).run()},onBulletListToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleBulletList().run()},onOrderedListToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleOrderedList().run()},onCodeBlockToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleCodeBlock().run()},onQuickRepliesClick(){this.$emit("quick-replies-click")},onInsertInlineImageClick(){this.$emit("inline-image-click")},insertInlineImage(e){var t;(t=this.$refs.richTextEditor)==null||t.editor.chain().focus().setImage({src:e}).run()},onBlockquoteToggle(){var e;(e=this.$refs.richTextEditor)==null||e.editor.chain().focus().toggleBlockquote().run()},insertInMessageBody(e){var t;(t=this.$refs.richTextEditor)==null||t.editor.chain().focus().insertContent(e).run()},setCursorPosition(e=null){var t;(t=this.$refs.richTextEditor)==null||t.editor.chain().focus(e).run()},onTextInput(e){this.$emit("text-input",e)},onFocus(e){this.hasFocus=!0,this.$emit("focus",e)},onBlur(e){this.hasFocus=!1,this.$emit("blur",e)},onInput(e){this.$emit("input",e)},getButtonKey(e,t){return`${e}-${JSON.stringify(t)}`},getButtonRef(e,t){return`${this.getButtonKey(e,t)}-ref`},canFocus(e){return e===this.orderedRefs[this.currentButtonRefIndex]},shiftActionBarFocusRight(){this.shiftButtonRefIndex(1)},shiftActionBarFocusLeft(){this.shiftButtonRefIndex(-1)},shiftButtonRefIndex(e){const t=this.$refs[this.orderedRefs[this.currentButtonRefIndex]],i=Array.isArray(t)?t[0]:t,n=(this.currentButtonRefIndex+e)%this.orderedRefs.length;this.currentButtonRefIndex=n>=0?n:this.orderedRefs.length+n;const r=this.$refs[this.orderedRefs[this.currentButtonRefIndex]],s=Array.isArray(r)?r[0]:r;i.$el.blur(),s.$el.focus()}}};var y=function(){var t=this,i=t._self._c;return i("div",{staticClass:"d-recipe-editor",attrs:{"data-qa":"dt-recipe-editor",role:"presentation"},on:{click:function(n){return t.$refs.richTextEditor.focusEditor()}}},[i("dt-stack",{staticClass:"d-recipe-editor__top-bar",attrs:{direction:"row",gap:"450"}},[t._l(t.buttonGroups,function(n){return i("dt-stack",{key:n.key,attrs:{direction:"row",gap:"300"}},[t._l(n.buttonGroup,function(r){return i("dt-tooltip",{key:t.getButtonKey(n.key,r.selector),attrs:{message:r.tooltipMessage,placement:"top"},scopedSlots:t._u([{key:"anchor",fn:function(){var s,u;return[i("dt-button",{ref:t.getButtonRef(n.key,r.selector),refInFor:!0,attrs:{active:(u=(s=t.$refs.richTextEditor)==null?void 0:s.editor)==null?void 0:u.isActive(r.selector),"aria-label":r.tooltipMessage,"data-qa":r.dataQA,tabindex:t.canFocus(t.getButtonRef(n.key,r.selector))?0:-1,importance:"clear",kind:"muted",size:"xs"},on:{click:function(l){return r.onClick()},keydown:[function(l){return!l.type.indexOf("key")&&t._k(l.keyCode,"right",39,l.key,["Right","ArrowRight"])||"button"in l&&l.button!==2?null:(l.stopPropagation(),t.shiftActionBarFocusRight.apply(null,arguments))},function(l){return!l.type.indexOf("key")&&t._k(l.keyCode,"left",37,l.key,["Left","ArrowLeft"])||"button"in l&&l.button!==0?null:(l.stopPropagation(),t.shiftActionBarFocusLeft.apply(null,arguments))}]},scopedSlots:t._u([{key:"icon",fn:function(){return[i(r.icon,{tag:"component",attrs:{size:"200"}})]},proxy:!0}],null,!0)},[r.label?i("span",[t._v(t._s(r.label))]):t._e()])]},proxy:!0}],null,!0)})}),i("div",{staticClass:"d-recipe-editor__button-group-divider"})],2)}),t.linkButton.showBtn?i("dt-stack",{attrs:{direction:"row",gap:"300"}},[i("dt-popover",{attrs:{open:t.showLinkInput,"show-close-button":!1,"visually-hidden-close":!0,"visually-hidden-close-label":"Close link input popover","data-qa":"dt-recipe-editor-link-input-popover",padding:"none",placement:"bottom-start"},on:{"update:open":function(n){t.showLinkInput=n},click:t.onInputFocus,opened:t.updateInput},nativeOn:{click:function(n){return n.stopPropagation(),t.onInputFocus.apply(null,arguments)}},scopedSlots:t._u([{key:"anchor",fn:function(){return[i("dt-tooltip",{key:t.linkButton.key,attrs:{message:t.linkButton.tooltipMessage,placement:"top"},scopedSlots:t._u([{key:"anchor",fn:function(){var n,r;return[i("dt-button",{ref:t.getButtonRef("custom","link"),attrs:{active:(r=(n=t.$refs.richTextEditor)==null?void 0:n.editor)==null?void 0:r.isActive(t.linkButton.selector),"aria-label":t.linkButton.tooltipMessage,"data-qa":t.linkButton.dataQA,tabindex:t.canFocus(t.getButtonRef("custom","link"))?0:-1,importance:"clear",kind:"muted",size:"xs"},on:{click:function(s){return t.linkButton.onClick()},keydown:[function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"right",39,s.key,["Right","ArrowRight"])||"button"in s&&s.button!==2?null:(s.stopPropagation(),t.shiftActionBarFocusRight.apply(null,arguments))},function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"left",37,s.key,["Left","ArrowLeft"])||"button"in s&&s.button!==0?null:(s.stopPropagation(),t.shiftActionBarFocusLeft.apply(null,arguments))}]},scopedSlots:t._u([{key:"icon",fn:function(){return[i(t.linkButton.icon,{tag:"component",attrs:{size:"200"}})]},proxy:!0}],null,!1,3601441856)})]},proxy:!0}],null,!1,1067010212)})]},proxy:!0},{key:"content",fn:function(){return[i("div",{staticClass:"d-recipe-editor__popover-content"},[t.showAddLink.setLinkTitle.length>0?i("span",[t._v(" "+t._s(t.showAddLink.setLinkTitle)+" ")]):t._e(),i("dt-input",{attrs:{"input-aria-label":t.showAddLink.setLinkInputAriaLabel,placeholder:t.setLinkPlaceholder,"data-qa":"dt-recipe-editor-link-input","input-wrapper-class":"d-recipe-editor-link__input-wrapper"},on:{click:t.onInputFocus,focus:t.onInputFocus,keydown:function(n){return!n.type.indexOf("key")&&t._k(n.keyCode,"enter",13,n.key,"Enter")?null:t.setLink.apply(null,arguments)}},nativeOn:{click:function(n){return n.stopPropagation(),t.onInputFocus.apply(null,arguments)}},model:{value:t.linkInput,callback:function(n){t.linkInput=n},expression:"linkInput"}})],1)]},proxy:!0},{key:"footerContent",fn:function(){return[i("dt-stack",{staticClass:"d-recipe-editor__popover-footer",attrs:{direction:"row",gap:"300"}},[i("dt-button",{attrs:{"aria-label":t.removeLinkButton.ariaLabel,"data-qa":"dt-recipe-editor-remove-link-btn",importance:"clear",kind:"muted",size:"sm"},on:{click:t.removeLink}},[t._v(" "+t._s(t.removeLinkButton.label)+" ")]),i("dt-button",{attrs:{"aria-label":t.cancelSetLinkButton.ariaLabel,"data-qa":"dt-recipe-editor-set-link-cancel-btn",importance:"clear",kind:"muted",size:"sm"},on:{click:t.closeLinkInput}},[t._v(" "+t._s(t.cancelSetLinkButton.label)+" ")]),i("dt-button",{attrs:{"aria-label":t.confirmSetLinkButton.ariaLabel,"data-qa":"dt-recipe-editor-set-link-confirm-btn",size:"sm"},on:{click:t.setLink}},[t._v(" "+t._s(t.confirmSetLinkButton.label)+" ")])],1)]},proxy:!0}],null,!1,3688481372)})],1):t._e()],2),i("div",{staticClass:"d-recipe-editor__content",style:{"max-height":t.maxHeight}},[i("dt-rich-text-editor",t._b({ref:"richTextEditor",attrs:{"allow-font-color":!0,"allow-font-family":!0,"allow-inline-images":!0,"allow-line-breaks":!0,"hide-link-bubble-menu":!0,"auto-focus":t.autoFocus,editable:t.editable,"input-aria-label":t.inputAriaLabel,"input-class":`d-recipe-editor__content-input ${t.inputClass}`,link:!0,"output-format":t.htmlOutputFormat,placeholder:t.placeholder,"use-div-tags":t.useDivTags,"data-qa":"dt-rich-text-editor"},on:{"text-input":t.onTextInput,blur:t.onBlur,focus:t.onFocus,input:function(n){return t.onInput(n)}},model:{value:t.internalInputValue,callback:function(n){t.internalInputValue=n},expression:"internalInputValue"}},"dt-rich-text-editor",t.$attrs,!1))],1)],1)},m=[],b=d.n(I,y,m);const L=b.exports;exports.default=L;
|
|
2
2
|
//# sourceMappingURL=editor.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.cjs","sources":["../../../recipes/conversation_view/editor/editor.vue"],"sourcesContent":["<template>\n <div\n\n class=\"d-recipe-editor\"\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=\"(el) => { buttonRefMap[getButtonRef(buttonGroup.key, button.selector)] = el }\"\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 <span v-if=\"button.label\">{{ button.label }}</span>\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.sync=\"showLinkInput\"\n :show-close-button=\"false\"\n :visually-hidden-close=\"true\"\n :visually-hidden-close-label=\"'Close link input popover'\"\n data-qa=\"dt-recipe-editor-link-input-popover\"\n padding=\"none\"\n placement=\"bottom-start\"\n @click=\"onInputFocus\"\n @opened=\"updateInput\"\n @click.native.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=\"(el) => { buttonRefMap[getButtonRef('custom', 'link')] = el }\"\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 v-if=\"showAddLink.setLinkTitle.length > 0\"\n >\n {{ showAddLink.setLinkTitle }}\n </span>\n <dt-input\n v-model=\"linkInput\"\n :input-aria-label=\"showAddLink.setLinkInputAriaLabel\"\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.native.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 :aria-label=\"removeLinkButton.ariaLabel\"\n data-qa=\"dt-recipe-editor-remove-link-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"sm\"\n @click=\"removeLink\"\n >\n {{ removeLinkButton.label }}\n </dt-button>\n <dt-button\n :aria-label=\"cancelSetLinkButton.ariaLabel\"\n data-qa=\"dt-recipe-editor-set-link-cancel-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"sm\"\n @click=\"closeLinkInput\"\n >\n {{ cancelSetLinkButton.label }}\n </dt-button>\n <dt-button\n :aria-label=\"confirmSetLinkButton.ariaLabel\"\n data-qa=\"dt-recipe-editor-set-link-confirm-btn\"\n size=\"sm\"\n @click=\"setLink\"\n >\n {{ confirmSetLinkButton.label }}\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=\"$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 { 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/vue2';\nimport { ref } from 'vue';\n\nexport default {\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 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 value: {\n type: [Object, String],\n default: '',\n },\n\n /**\n * Whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Descriptive label for the input element\n */\n inputAriaLabel: {\n type: String,\n required: true,\n default: '',\n },\n\n /**\n * 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 * Confirm set link button defaults.\n */\n confirmSetLinkButton: {\n type: Object,\n default: () => ({ label: 'Confirm', ariaLabel: 'Confirm set link' }),\n },\n\n /**\n * Remove link button defaults.\n */\n removeLinkButton: {\n type: Object,\n default: () => ({ label: 'Remove', ariaLabel: 'Remove link' }),\n },\n\n /**\n * Cancel set link button defaults.\n */\n cancelSetLinkButton: {\n type: Object,\n default: () => ({ label: 'Cancel', ariaLabel: 'Cancel set link' }),\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 setLinkTitle: 'Add a link',\n setLinkInputAriaLabel: 'Input field to add link',\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 * 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 content changes (not raw html)\n */\n 'text-input',\n ],\n\n data () {\n return {\n internalInputValue: this.value, // 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 buttonRefMap: ref({}),\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: 'Quick reply',\n selector: 'quickReplies',\n icon: DtIconQuickReply,\n dataQA: 'dt-recipe-editor-quick-replies-btn',\n tooltipMessage: 'Quick Reply',\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: 'Bold',\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: 'Italics',\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: 'Underline',\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: 'Strike',\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: 'Align Left',\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: 'Align Center',\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: 'Align Right',\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: 'Align Justify',\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: 'Bullet List',\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: 'Ordered List',\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: 'Quote',\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: 'Code',\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: '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: 'Link',\n onClick: this.openLinkInput,\n };\n },\n\n },\n\n watch: {\n value (newValue) {\n this.internalInputValue = newValue;\n },\n },\n\n methods: {\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 onBlockquoteToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleBlockquote().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 onTextInput (event) {\n this.$emit('text-input', event);\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 },\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.buttonRefMap[this.orderedRefs[this.currentButtonRefIndex]];\n const index = (this.currentButtonRefIndex + shiftAmount) % this.orderedRefs.length;\n this.currentButtonRefIndex = index >= 0 ? index : this.orderedRefs.length + index;\n const currentRef = this.buttonRefMap[this.orderedRefs[this.currentButtonRefIndex]];\n previousRef.$el.blur();\n currentRef.$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","ref","RICH_TEXT_EDITOR_OUTPUT_FORMATS","refs","acc","buttonData","button","individualButtonStacks","buttonGroupData","newValue","event","_e","_d","_c","_b","_a","editor","EDITOR_SUPPORTED_LINK_PROTOCOLS","prefixRegex","EDITOR_DEFAULT_LINK_PREFIX","selection","openedInput","alignment","imageUrl","messageContent","position","key","selector","refKey","shiftAmount","previousRef","index","currentRef"],"mappings":"yiBAmOAA,EAAA,CACA,KAAA,iBAEA,WAAA,CACA,iBAAAC,EAAA,QACA,SAAAC,EAAA,QACA,UAAAC,EAAA,QACA,QAAAC,EAAA,QACA,QAAAC,EAAA,QACA,UAAAC,EAAA,QACA,iBAAAC,EAAA,iBACA,WAAAC,EAAA,WACA,aAAAC,EAAA,aACA,gBAAAC,EAAA,gBACA,oBAAAC,EAAA,oBACA,iBAAAC,EAAA,iBACA,kBAAAC,EAAA,kBACA,gBAAAC,EAAA,gBACA,kBAAAC,EAAA,kBACA,iBAAAC,EAAA,iBACA,mBAAAC,EAAA,mBACA,YAAAC,EAAA,YACA,gBAAAC,EAAA,gBACA,YAAAC,EAAA,YACA,YAAAC,EAAA,WACA,EAEA,aAAA,GAEA,MAAA,CAKA,MAAA,CACA,KAAA,CAAA,OAAA,MAAA,EACA,QAAA,EACA,EAKA,SAAA,CACA,KAAA,QACA,QAAA,EACA,EAKA,eAAA,CACA,KAAA,OACA,SAAA,GACA,QAAA,EACA,EAOA,WAAA,CACA,KAAA,OACA,QAAA,EACA,EAaA,UAAA,CACA,KAAA,CAAA,QAAA,OAAA,MAAA,EACA,QAAA,GACA,UAAAC,EAAA,CACA,OAAA,OAAAA,GAAA,SACAC,EAAA,iCAAA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YAAA,KAAA,qBAAA,CACA,EAEA,0BAAA,CACA,KAAA,oBAAA,CAAA,CACA,EAEA,yBAAA,CACA,KAAA,oBAAA,EAAA,CACA,EAEA,oBAAAC,EAAA,CACA,MAAAC,EAAA,KAAA,aAAA,KAAA,YAAA,KAAA,qBAAA,CAAA,EACAC,GAAA,KAAA,sBAAAF,GAAA,KAAA,YAAA,OACA,KAAA,sBAAAE,GAAA,EAAAA,EAAA,KAAA,YAAA,OAAAA,EACA,MAAAC,EAAA,KAAA,aAAA,KAAA,YAAA,KAAA,qBAAA,CAAA,EACAF,EAAA,IAAA,OACAE,EAAA,IAAA,OACA,CACA,CACA"}
|
|
1
|
+
{"version":3,"file":"editor.cjs","sources":["../../../recipes/conversation_view/editor/editor.vue"],"sourcesContent":["<template>\n <div\n\n class=\"d-recipe-editor\"\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 <span v-if=\"button.label\">{{ button.label }}</span>\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.sync=\"showLinkInput\"\n :show-close-button=\"false\"\n :visually-hidden-close=\"true\"\n :visually-hidden-close-label=\"'Close link input popover'\"\n data-qa=\"dt-recipe-editor-link-input-popover\"\n padding=\"none\"\n placement=\"bottom-start\"\n @click=\"onInputFocus\"\n @opened=\"updateInput\"\n @click.native.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 v-if=\"showAddLink.setLinkTitle.length > 0\"\n >\n {{ showAddLink.setLinkTitle }}\n </span>\n <dt-input\n v-model=\"linkInput\"\n :input-aria-label=\"showAddLink.setLinkInputAriaLabel\"\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.native.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 :aria-label=\"removeLinkButton.ariaLabel\"\n data-qa=\"dt-recipe-editor-remove-link-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"sm\"\n @click=\"removeLink\"\n >\n {{ removeLinkButton.label }}\n </dt-button>\n <dt-button\n :aria-label=\"cancelSetLinkButton.ariaLabel\"\n data-qa=\"dt-recipe-editor-set-link-cancel-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"sm\"\n @click=\"closeLinkInput\"\n >\n {{ cancelSetLinkButton.label }}\n </dt-button>\n <dt-button\n :aria-label=\"confirmSetLinkButton.ariaLabel\"\n data-qa=\"dt-recipe-editor-set-link-confirm-btn\"\n size=\"sm\"\n @click=\"setLink\"\n >\n {{ confirmSetLinkButton.label }}\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=\"$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 { 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/vue2';\n\nexport default {\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 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 value: {\n type: [Object, String],\n default: '',\n },\n\n /**\n * Whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Descriptive label for the input element\n */\n inputAriaLabel: {\n type: String,\n required: true,\n default: '',\n },\n\n /**\n * 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 * Confirm set link button defaults.\n */\n confirmSetLinkButton: {\n type: Object,\n default: () => ({ label: 'Confirm', ariaLabel: 'Confirm set link' }),\n },\n\n /**\n * Remove link button defaults.\n */\n removeLinkButton: {\n type: Object,\n default: () => ({ label: 'Remove', ariaLabel: 'Remove link' }),\n },\n\n /**\n * Cancel set link button defaults.\n */\n cancelSetLinkButton: {\n type: Object,\n default: () => ({ label: 'Cancel', ariaLabel: 'Cancel set link' }),\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 setLinkTitle: 'Add a link',\n setLinkInputAriaLabel: 'Input field to add link',\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 * 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 content changes (not raw html)\n */\n 'text-input',\n ],\n\n data () {\n return {\n internalInputValue: this.value, // 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 };\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: 'Quick reply',\n selector: 'quickReplies',\n icon: DtIconQuickReply,\n dataQA: 'dt-recipe-editor-quick-replies-btn',\n tooltipMessage: 'Quick Reply',\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: 'Bold',\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: 'Italics',\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: 'Underline',\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: 'Strike',\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: 'Align Left',\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: 'Align Center',\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: 'Align Right',\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: 'Align Justify',\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: 'Bullet List',\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: 'Ordered List',\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: 'Quote',\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: 'Code',\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: '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: 'Link',\n onClick: this.openLinkInput,\n };\n },\n\n },\n\n watch: {\n value (newValue) {\n this.internalInputValue = newValue;\n },\n },\n\n methods: {\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 onBlockquoteToggle () {\n this.$refs.richTextEditor?.editor.chain().focus().toggleBlockquote().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 onTextInput (event) {\n this.$emit('text-input', event);\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 },\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","RICH_TEXT_EDITOR_OUTPUT_FORMATS","refs","acc","buttonData","button","individualButtonStacks","buttonGroupData","newValue","event","_e","_d","_c","_b","_a","editor","EDITOR_SUPPORTED_LINK_PROTOCOLS","prefixRegex","EDITOR_DEFAULT_LINK_PREFIX","selection","openedInput","alignment","imageUrl","messageContent","position","key","selector","refKey","shiftAmount","previousRef","previousActionBarBtn","index","currentRef","currentActionBarBtn"],"mappings":"whBAkOAA,EAAA,CACA,KAAA,iBAEA,WAAA,CACA,iBAAAC,EAAA,QACA,SAAAC,EAAA,QACA,UAAAC,EAAA,QACA,QAAAC,EAAA,QACA,QAAAC,EAAA,QACA,UAAAC,EAAA,QACA,iBAAAC,EAAA,iBACA,WAAAC,EAAA,WACA,aAAAC,EAAA,aACA,gBAAAC,EAAA,gBACA,oBAAAC,EAAA,oBACA,iBAAAC,EAAA,iBACA,kBAAAC,EAAA,kBACA,gBAAAC,EAAA,gBACA,kBAAAC,EAAA,kBACA,iBAAAC,EAAA,iBACA,mBAAAC,EAAA,mBACA,YAAAC,EAAA,YACA,gBAAAC,EAAA,gBACA,YAAAC,EAAA,YACA,YAAAC,EAAA,WACA,EAEA,aAAA,GAEA,MAAA,CAKA,MAAA,CACA,KAAA,CAAA,OAAA,MAAA,EACA,QAAA,EACA,EAKA,SAAA,CACA,KAAA,QACA,QAAA,EACA,EAKA,eAAA,CACA,KAAA,OACA,SAAA,GACA,QAAA,EACA,EAOA,WAAA,CACA,KAAA,OACA,QAAA,EACA,EAaA,UAAA,CACA,KAAA,CAAA,QAAA,OAAA,MAAA,EACA,QAAA,GACA,UAAAC,EAAA,CACA,OAAA,OAAAA,GAAA,SACAC,EAAA,iCAAA,SAAAD,CAAA,EAEA,EACA,CACA,EAKA,YAAA,CACA,KAAA,OACA,QAAA,EACA,EAMA,UAAA,CACA,KAAA,OACA,QAAA,OACA,EAKA,qBAAA,CACA,KAAA,OACA,QAAA,KAAA,CAAA,MAAA,UAAA,UAAA,kBAAA,EACA,EAKA,iBAAA,CACA,KAAA,OACA,QAAA,KAAA,CAAA,M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,sBAAAH,GAAA,KAAA,YAAA,OACA,KAAA,sBAAAG,GAAA,EAAAA,EAAA,KAAA,YAAA,OAAAA,EACA,MAAAC,EAAA,KAAA,MAAA,KAAA,YAAA,KAAA,qBAAA,CAAA,EACAC,EAAA,MAAA,QAAAD,CAAA,EAAAA,EAAA,CAAA,EAAAA,EACAF,EAAA,IAAA,OACAG,EAAA,IAAA,OACA,CACA,CACA"}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { EDITOR_SUPPORTED_LINK_PROTOCOLS as
|
|
2
|
-
import { DtIconQuickReply as u, DtIconBold as a, DtIconItalic as c, DtIconUnderline as d, DtIconStrikethrough as h, DtIconListBullet as p, DtIconListOrdered as f, DtIconAlignLeft as k, DtIconAlignCenter as g, DtIconAlignRight as B, DtIconAlignJustify as m, DtIconQuote as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import _ from "../
|
|
6
|
-
import R from "../button/button.js";
|
|
1
|
+
import { EDITOR_SUPPORTED_LINK_PROTOCOLS as x, EDITOR_DEFAULT_LINK_PREFIX as b } from "./editor-constants.js";
|
|
2
|
+
import { DtIconQuickReply as u, DtIconBold as a, DtIconItalic as c, DtIconUnderline as d, DtIconStrikethrough as h, DtIconListBullet as p, DtIconListOrdered as f, DtIconAlignLeft as k, DtIconAlignCenter as g, DtIconAlignRight as B, DtIconAlignJustify as m, DtIconQuote as y, DtIconCodeBlock as I, DtIconLink2 as w, DtIconImage as L } from "@dialpad/dialtone-icons/vue2";
|
|
3
|
+
import { n as A } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
|
|
4
|
+
import T from "../rich-text-editor/rich-text-editor.js";
|
|
5
|
+
import _ from "../button/button.js";
|
|
7
6
|
import C from "../popover/popover.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as
|
|
12
|
-
const
|
|
7
|
+
import R from "../stack/stack.js";
|
|
8
|
+
import O from "../input/input.js";
|
|
9
|
+
import E from "../tooltip/tooltip.js";
|
|
10
|
+
import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as S, RICH_TEXT_EDITOR_OUTPUT_FORMATS as F } from "../rich-text-editor/rich-text-editor-constants.js";
|
|
11
|
+
const D = {
|
|
13
12
|
name: "DtRecipeEditor",
|
|
14
13
|
components: {
|
|
15
|
-
DtRichTextEditor:
|
|
16
|
-
DtButton:
|
|
14
|
+
DtRichTextEditor: T,
|
|
15
|
+
DtButton: _,
|
|
17
16
|
DtPopover: C,
|
|
18
|
-
DtStack:
|
|
19
|
-
DtInput:
|
|
20
|
-
DtTooltip:
|
|
17
|
+
DtStack: R,
|
|
18
|
+
DtInput: O,
|
|
19
|
+
DtTooltip: E,
|
|
21
20
|
DtIconQuickReply: u,
|
|
22
21
|
DtIconBold: a,
|
|
23
22
|
DtIconItalic: c,
|
|
@@ -29,10 +28,10 @@ const Q = {
|
|
|
29
28
|
DtIconAlignCenter: g,
|
|
30
29
|
DtIconAlignRight: B,
|
|
31
30
|
DtIconAlignJustify: m,
|
|
32
|
-
DtIconQuote:
|
|
33
|
-
DtIconCodeBlock:
|
|
31
|
+
DtIconQuote: y,
|
|
32
|
+
DtIconCodeBlock: I,
|
|
34
33
|
DtIconLink2: w,
|
|
35
|
-
DtIconImage:
|
|
34
|
+
DtIconImage: L
|
|
36
35
|
},
|
|
37
36
|
inheritAttrs: !1,
|
|
38
37
|
props: {
|
|
@@ -83,7 +82,7 @@ const Q = {
|
|
|
83
82
|
type: [Boolean, String, Number],
|
|
84
83
|
default: !1,
|
|
85
84
|
validator(e) {
|
|
86
|
-
return typeof e == "string" ?
|
|
85
|
+
return typeof e == "string" ? S.includes(e) : !0;
|
|
87
86
|
}
|
|
88
87
|
},
|
|
89
88
|
/**
|
|
@@ -291,8 +290,7 @@ const Q = {
|
|
|
291
290
|
},
|
|
292
291
|
showLinkInput: !1,
|
|
293
292
|
linkInput: "",
|
|
294
|
-
currentButtonRefIndex: 0
|
|
295
|
-
buttonRefMap: A({})
|
|
293
|
+
currentButtonRefIndex: 0
|
|
296
294
|
};
|
|
297
295
|
},
|
|
298
296
|
computed: {
|
|
@@ -300,7 +298,7 @@ const Q = {
|
|
|
300
298
|
return this.internalInputValue.length;
|
|
301
299
|
},
|
|
302
300
|
htmlOutputFormat() {
|
|
303
|
-
return
|
|
301
|
+
return F[2];
|
|
304
302
|
},
|
|
305
303
|
showingTextFormatButtons() {
|
|
306
304
|
return this.showBoldButton || this.showItalicsButton || this.showStrikeButton || this.showUnderlineButton;
|
|
@@ -312,9 +310,9 @@ const Q = {
|
|
|
312
310
|
return this.showListItemsButton || this.showOrderedListButton;
|
|
313
311
|
},
|
|
314
312
|
orderedRefs() {
|
|
315
|
-
const e = this.buttonGroups.reduce((function(t,
|
|
316
|
-
return
|
|
317
|
-
t.push(this.getButtonRef(
|
|
313
|
+
const e = this.buttonGroups.reduce((function(t, n) {
|
|
314
|
+
return n.buttonGroup.forEach((i) => {
|
|
315
|
+
t.push(this.getButtonRef(n.key, i.selector));
|
|
318
316
|
}, this), t;
|
|
319
317
|
}).bind(this), []);
|
|
320
318
|
return e.push(this.getButtonRef("custom", "link")), e;
|
|
@@ -442,7 +440,7 @@ const Q = {
|
|
|
442
440
|
{
|
|
443
441
|
showBtn: this.showQuoteButton,
|
|
444
442
|
selector: "blockquote",
|
|
445
|
-
icon:
|
|
443
|
+
icon: y,
|
|
446
444
|
dataQA: "dt-recipe-editor-blockquote-btn",
|
|
447
445
|
tooltipMessage: "Quote",
|
|
448
446
|
onClick: this.onBlockquoteToggle
|
|
@@ -450,7 +448,7 @@ const Q = {
|
|
|
450
448
|
{
|
|
451
449
|
showBtn: this.showCodeBlockButton,
|
|
452
450
|
selector: "codeBlock",
|
|
453
|
-
icon:
|
|
451
|
+
icon: I,
|
|
454
452
|
dataQA: "dt-recipe-editor-code-block-btn",
|
|
455
453
|
tooltipMessage: "Code",
|
|
456
454
|
onClick: this.onCodeBlockToggle
|
|
@@ -458,7 +456,7 @@ const Q = {
|
|
|
458
456
|
{
|
|
459
457
|
showBtn: this.showInlineImageButton,
|
|
460
458
|
selector: "image",
|
|
461
|
-
icon:
|
|
459
|
+
icon: L,
|
|
462
460
|
dataQA: "dt-recipe-editor-inline-image-btn",
|
|
463
461
|
tooltipMessage: "Image",
|
|
464
462
|
onClick: this.onInsertInlineImageClick
|
|
@@ -486,8 +484,8 @@ const Q = {
|
|
|
486
484
|
e == null || e.stopPropagation();
|
|
487
485
|
},
|
|
488
486
|
removeLink() {
|
|
489
|
-
var e, t,
|
|
490
|
-
(o = (
|
|
487
|
+
var e, t, n, i, o;
|
|
488
|
+
(o = (i = (n = (t = (e = this.$refs.richTextEditor) == null ? void 0 : e.editor) == null ? void 0 : t.chain()) == null ? void 0 : n.focus()) == null ? void 0 : i.unsetLink()) == null || o.run(), this.closeLinkInput();
|
|
491
489
|
},
|
|
492
490
|
setLink(e) {
|
|
493
491
|
var o, r, l;
|
|
@@ -496,10 +494,10 @@ const Q = {
|
|
|
496
494
|
this.removeLink();
|
|
497
495
|
return;
|
|
498
496
|
}
|
|
499
|
-
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
497
|
+
x.find((s) => s.test(this.linkInput)) || (this.linkInput = `${b}${this.linkInput}`);
|
|
498
|
+
const i = (l = (r = t == null ? void 0 : t.view) == null ? void 0 : r.state) == null ? void 0 : l.selection;
|
|
499
|
+
i.anchor === i.head ? t.chain().focus().insertContentAt(
|
|
500
|
+
i.anchor,
|
|
503
501
|
`<a class="${this.linkOptions.class}" href=${this.linkInput}>${this.linkInput}</a>`
|
|
504
502
|
).run() : t.chain().focus().extendMarkRange("link").setLink({ href: this.linkInput, class: this.linkOptions.class }).run(), this.closeLinkInput();
|
|
505
503
|
},
|
|
@@ -507,10 +505,10 @@ const Q = {
|
|
|
507
505
|
this.showLinkInput = !0;
|
|
508
506
|
},
|
|
509
507
|
updateInput(e) {
|
|
510
|
-
var t,
|
|
508
|
+
var t, n, i;
|
|
511
509
|
if (!e)
|
|
512
510
|
return this.closeLinkInput();
|
|
513
|
-
this.linkInput = (
|
|
511
|
+
this.linkInput = (i = (n = (t = this.$refs.richTextEditor) == null ? void 0 : t.editor) == null ? void 0 : n.getAttributes("link")) == null ? void 0 : i.href;
|
|
514
512
|
},
|
|
515
513
|
closeLinkInput() {
|
|
516
514
|
var e;
|
|
@@ -533,9 +531,9 @@ const Q = {
|
|
|
533
531
|
(e = this.$refs.richTextEditor) == null || e.editor.chain().focus().toggleStrike().run();
|
|
534
532
|
},
|
|
535
533
|
onTextAlign(e) {
|
|
536
|
-
var t,
|
|
537
|
-
if ((
|
|
538
|
-
return (
|
|
534
|
+
var t, n, i, o;
|
|
535
|
+
if ((n = (t = this.$refs.richTextEditor) == null ? void 0 : t.editor) != null && n.isActive({ textAlign: e }))
|
|
536
|
+
return (i = this.$refs.richTextEditor) == null ? void 0 : i.editor.chain().focus().unsetTextAlign().run();
|
|
539
537
|
(o = this.$refs.richTextEditor) == null || o.editor.chain().focus().setTextAlign(e).run();
|
|
540
538
|
},
|
|
541
539
|
onBulletListToggle() {
|
|
@@ -605,75 +603,71 @@ const Q = {
|
|
|
605
603
|
this.shiftButtonRefIndex(-1);
|
|
606
604
|
},
|
|
607
605
|
shiftButtonRefIndex(e) {
|
|
608
|
-
const t = this
|
|
606
|
+
const t = this.$refs[this.orderedRefs[this.currentButtonRefIndex]], n = Array.isArray(t) ? t[0] : t, i = (this.currentButtonRefIndex + e) % this.orderedRefs.length;
|
|
609
607
|
this.currentButtonRefIndex = i >= 0 ? i : this.orderedRefs.length + i;
|
|
610
|
-
const
|
|
611
|
-
|
|
608
|
+
const o = this.$refs[this.orderedRefs[this.currentButtonRefIndex]], r = Array.isArray(o) ? o[0] : o;
|
|
609
|
+
n.$el.blur(), r.$el.focus();
|
|
612
610
|
}
|
|
613
611
|
}
|
|
614
612
|
};
|
|
615
|
-
var
|
|
616
|
-
var t = this,
|
|
617
|
-
return
|
|
613
|
+
var Q = function() {
|
|
614
|
+
var t = this, n = t._self._c;
|
|
615
|
+
return n("div", { staticClass: "d-recipe-editor", attrs: { "data-qa": "dt-recipe-editor", role: "presentation" }, on: { click: function(i) {
|
|
618
616
|
return t.$refs.richTextEditor.focusEditor();
|
|
619
|
-
} } }, [
|
|
620
|
-
return
|
|
621
|
-
return
|
|
617
|
+
} } }, [n("dt-stack", { staticClass: "d-recipe-editor__top-bar", attrs: { direction: "row", gap: "450" } }, [t._l(t.buttonGroups, function(i) {
|
|
618
|
+
return n("dt-stack", { key: i.key, attrs: { direction: "row", gap: "300" } }, [t._l(i.buttonGroup, function(o) {
|
|
619
|
+
return n("dt-tooltip", { key: t.getButtonKey(i.key, o.selector), attrs: { message: o.tooltipMessage, placement: "top" }, scopedSlots: t._u([{ key: "anchor", fn: function() {
|
|
622
620
|
var r, l;
|
|
623
|
-
return [
|
|
624
|
-
t.buttonRefMap[t.getButtonRef(n.key, o.selector)] = s;
|
|
625
|
-
}, refInFor: !0, attrs: { active: (l = (r = t.$refs.richTextEditor) == null ? void 0 : r.editor) == null ? void 0 : l.isActive(o.selector), "aria-label": o.tooltipMessage, "data-qa": o.dataQA, tabindex: t.canFocus(t.getButtonRef(n.key, o.selector)) ? 0 : -1, importance: "clear", kind: "muted", size: "xs" }, on: { click: function(s) {
|
|
621
|
+
return [n("dt-button", { ref: t.getButtonRef(i.key, o.selector), refInFor: !0, attrs: { active: (l = (r = t.$refs.richTextEditor) == null ? void 0 : r.editor) == null ? void 0 : l.isActive(o.selector), "aria-label": o.tooltipMessage, "data-qa": o.dataQA, tabindex: t.canFocus(t.getButtonRef(i.key, o.selector)) ? 0 : -1, importance: "clear", kind: "muted", size: "xs" }, on: { click: function(s) {
|
|
626
622
|
return o.onClick();
|
|
627
623
|
}, keydown: [function(s) {
|
|
628
624
|
return !s.type.indexOf("key") && t._k(s.keyCode, "right", 39, s.key, ["Right", "ArrowRight"]) || "button" in s && s.button !== 2 ? null : (s.stopPropagation(), t.shiftActionBarFocusRight.apply(null, arguments));
|
|
629
625
|
}, function(s) {
|
|
630
626
|
return !s.type.indexOf("key") && t._k(s.keyCode, "left", 37, s.key, ["Left", "ArrowLeft"]) || "button" in s && s.button !== 0 ? null : (s.stopPropagation(), t.shiftActionBarFocusLeft.apply(null, arguments));
|
|
631
627
|
}] }, scopedSlots: t._u([{ key: "icon", fn: function() {
|
|
632
|
-
return [
|
|
633
|
-
}, proxy: !0 }], null, !0) }, [o.label ?
|
|
628
|
+
return [n(o.icon, { tag: "component", attrs: { size: "200" } })];
|
|
629
|
+
}, proxy: !0 }], null, !0) }, [o.label ? n("span", [t._v(t._s(o.label))]) : t._e()])];
|
|
634
630
|
}, proxy: !0 }], null, !0) });
|
|
635
|
-
}),
|
|
636
|
-
}), t.linkButton.showBtn ?
|
|
637
|
-
t.showLinkInput =
|
|
638
|
-
}, click: t.onInputFocus, opened: t.updateInput }, nativeOn: { click: function(
|
|
639
|
-
return
|
|
631
|
+
}), n("div", { staticClass: "d-recipe-editor__button-group-divider" })], 2);
|
|
632
|
+
}), t.linkButton.showBtn ? n("dt-stack", { attrs: { direction: "row", gap: "300" } }, [n("dt-popover", { attrs: { open: t.showLinkInput, "show-close-button": !1, "visually-hidden-close": !0, "visually-hidden-close-label": "Close link input popover", "data-qa": "dt-recipe-editor-link-input-popover", padding: "none", placement: "bottom-start" }, on: { "update:open": function(i) {
|
|
633
|
+
t.showLinkInput = i;
|
|
634
|
+
}, click: t.onInputFocus, opened: t.updateInput }, nativeOn: { click: function(i) {
|
|
635
|
+
return i.stopPropagation(), t.onInputFocus.apply(null, arguments);
|
|
640
636
|
} }, scopedSlots: t._u([{ key: "anchor", fn: function() {
|
|
641
|
-
return [
|
|
642
|
-
var
|
|
643
|
-
return [
|
|
644
|
-
t.buttonRefMap[t.getButtonRef("custom", "link")] = r;
|
|
645
|
-
}, attrs: { active: (o = (n = t.$refs.richTextEditor) == null ? void 0 : n.editor) == null ? void 0 : o.isActive(t.linkButton.selector), "aria-label": t.linkButton.tooltipMessage, "data-qa": t.linkButton.dataQA, tabindex: t.canFocus(t.getButtonRef("custom", "link")) ? 0 : -1, importance: "clear", kind: "muted", size: "xs" }, on: { click: function(r) {
|
|
637
|
+
return [n("dt-tooltip", { key: t.linkButton.key, attrs: { message: t.linkButton.tooltipMessage, placement: "top" }, scopedSlots: t._u([{ key: "anchor", fn: function() {
|
|
638
|
+
var i, o;
|
|
639
|
+
return [n("dt-button", { ref: t.getButtonRef("custom", "link"), attrs: { active: (o = (i = t.$refs.richTextEditor) == null ? void 0 : i.editor) == null ? void 0 : o.isActive(t.linkButton.selector), "aria-label": t.linkButton.tooltipMessage, "data-qa": t.linkButton.dataQA, tabindex: t.canFocus(t.getButtonRef("custom", "link")) ? 0 : -1, importance: "clear", kind: "muted", size: "xs" }, on: { click: function(r) {
|
|
646
640
|
return t.linkButton.onClick();
|
|
647
641
|
}, keydown: [function(r) {
|
|
648
642
|
return !r.type.indexOf("key") && t._k(r.keyCode, "right", 39, r.key, ["Right", "ArrowRight"]) || "button" in r && r.button !== 2 ? null : (r.stopPropagation(), t.shiftActionBarFocusRight.apply(null, arguments));
|
|
649
643
|
}, function(r) {
|
|
650
644
|
return !r.type.indexOf("key") && t._k(r.keyCode, "left", 37, r.key, ["Left", "ArrowLeft"]) || "button" in r && r.button !== 0 ? null : (r.stopPropagation(), t.shiftActionBarFocusLeft.apply(null, arguments));
|
|
651
645
|
}] }, scopedSlots: t._u([{ key: "icon", fn: function() {
|
|
652
|
-
return [
|
|
646
|
+
return [n(t.linkButton.icon, { tag: "component", attrs: { size: "200" } })];
|
|
653
647
|
}, proxy: !0 }], null, !1, 3601441856) })];
|
|
654
|
-
}, proxy: !0 }], null, !1,
|
|
648
|
+
}, proxy: !0 }], null, !1, 1067010212) })];
|
|
655
649
|
}, proxy: !0 }, { key: "content", fn: function() {
|
|
656
|
-
return [
|
|
657
|
-
return !
|
|
658
|
-
} }, nativeOn: { click: function(
|
|
659
|
-
return
|
|
660
|
-
} }, model: { value: t.linkInput, callback: function(
|
|
661
|
-
t.linkInput =
|
|
650
|
+
return [n("div", { staticClass: "d-recipe-editor__popover-content" }, [t.showAddLink.setLinkTitle.length > 0 ? n("span", [t._v(" " + t._s(t.showAddLink.setLinkTitle) + " ")]) : t._e(), n("dt-input", { attrs: { "input-aria-label": t.showAddLink.setLinkInputAriaLabel, placeholder: t.setLinkPlaceholder, "data-qa": "dt-recipe-editor-link-input", "input-wrapper-class": "d-recipe-editor-link__input-wrapper" }, on: { click: t.onInputFocus, focus: t.onInputFocus, keydown: function(i) {
|
|
651
|
+
return !i.type.indexOf("key") && t._k(i.keyCode, "enter", 13, i.key, "Enter") ? null : t.setLink.apply(null, arguments);
|
|
652
|
+
} }, nativeOn: { click: function(i) {
|
|
653
|
+
return i.stopPropagation(), t.onInputFocus.apply(null, arguments);
|
|
654
|
+
} }, model: { value: t.linkInput, callback: function(i) {
|
|
655
|
+
t.linkInput = i;
|
|
662
656
|
}, expression: "linkInput" } })], 1)];
|
|
663
657
|
}, proxy: !0 }, { key: "footerContent", fn: function() {
|
|
664
|
-
return [
|
|
665
|
-
}, proxy: !0 }], null, !1,
|
|
666
|
-
return t.onInput(
|
|
667
|
-
} }, model: { value: t.internalInputValue, callback: function(
|
|
668
|
-
t.internalInputValue =
|
|
658
|
+
return [n("dt-stack", { staticClass: "d-recipe-editor__popover-footer", attrs: { direction: "row", gap: "300" } }, [n("dt-button", { attrs: { "aria-label": t.removeLinkButton.ariaLabel, "data-qa": "dt-recipe-editor-remove-link-btn", importance: "clear", kind: "muted", size: "sm" }, on: { click: t.removeLink } }, [t._v(" " + t._s(t.removeLinkButton.label) + " ")]), n("dt-button", { attrs: { "aria-label": t.cancelSetLinkButton.ariaLabel, "data-qa": "dt-recipe-editor-set-link-cancel-btn", importance: "clear", kind: "muted", size: "sm" }, on: { click: t.closeLinkInput } }, [t._v(" " + t._s(t.cancelSetLinkButton.label) + " ")]), n("dt-button", { attrs: { "aria-label": t.confirmSetLinkButton.ariaLabel, "data-qa": "dt-recipe-editor-set-link-confirm-btn", size: "sm" }, on: { click: t.setLink } }, [t._v(" " + t._s(t.confirmSetLinkButton.label) + " ")])], 1)];
|
|
659
|
+
}, proxy: !0 }], null, !1, 3688481372) })], 1) : t._e()], 2), n("div", { staticClass: "d-recipe-editor__content", style: { "max-height": t.maxHeight } }, [n("dt-rich-text-editor", t._b({ ref: "richTextEditor", attrs: { "allow-font-color": !0, "allow-font-family": !0, "allow-inline-images": !0, "allow-line-breaks": !0, "hide-link-bubble-menu": !0, "auto-focus": t.autoFocus, editable: t.editable, "input-aria-label": t.inputAriaLabel, "input-class": `d-recipe-editor__content-input ${t.inputClass}`, link: !0, "output-format": t.htmlOutputFormat, placeholder: t.placeholder, "use-div-tags": t.useDivTags, "data-qa": "dt-rich-text-editor" }, on: { "text-input": t.onTextInput, blur: t.onBlur, focus: t.onFocus, input: function(i) {
|
|
660
|
+
return t.onInput(i);
|
|
661
|
+
} }, model: { value: t.internalInputValue, callback: function(i) {
|
|
662
|
+
t.internalInputValue = i;
|
|
669
663
|
}, expression: "internalInputValue" } }, "dt-rich-text-editor", t.$attrs, !1))], 1)], 1);
|
|
670
|
-
}, v = [],
|
|
664
|
+
}, v = [], M = /* @__PURE__ */ A(
|
|
665
|
+
D,
|
|
671
666
|
Q,
|
|
672
|
-
M,
|
|
673
667
|
v
|
|
674
668
|
);
|
|
675
|
-
const
|
|
669
|
+
const H = M.exports;
|
|
676
670
|
export {
|
|
677
|
-
|
|
671
|
+
H as default
|
|
678
672
|
};
|
|
679
673
|
//# sourceMappingURL=editor.js.map
|