@dialpad/dialtone-vue 3.120.0 → 3.120.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/_plugin-vue_export-helper-caHeSgYY.js +11 -0
- package/dist/chunks/_plugin-vue_export-helper-caHeSgYY.js.map +1 -0
- package/dist/chunks/_plugin-vue_export-helper-fhnQq0tA.js +10 -0
- package/dist/chunks/_plugin-vue_export-helper-fhnQq0tA.js.map +1 -0
- package/dist/chunks/{dropdown-eWOvBvwq.js → dropdown-Hn-TeTvZ.js} +151 -104
- package/dist/chunks/{dropdown-UO3UJalk.js.map → dropdown-Hn-TeTvZ.js.map} +1 -1
- package/dist/chunks/dropdown-w8Do29L5.js +442 -0
- package/dist/chunks/{dropdown-eWOvBvwq.js.map → dropdown-w8Do29L5.js.map} +1 -1
- package/dist/chunks/dropdown_constants-2pGCXy7m.js +8 -0
- package/dist/chunks/dropdown_constants-2pGCXy7m.js.map +1 -0
- package/dist/chunks/dropdown_constants-w1MXGC3Z.js +9 -0
- package/dist/chunks/dropdown_constants-w1MXGC3Z.js.map +1 -0
- package/dist/chunks/{icon_constants-OpYAAKwF.js → icon_constants-Dy4MEUJL.js} +7 -6
- package/dist/chunks/{icon_constants-2S_OSQ1t.js.map → icon_constants-Dy4MEUJL.js.map} +1 -1
- package/dist/chunks/icon_constants-QYpmdE0R.js +16 -0
- package/dist/chunks/{icon_constants-OpYAAKwF.js.map → icon_constants-QYpmdE0R.js.map} +1 -1
- package/dist/chunks/index-4qgKeErp.js +446 -0
- package/dist/chunks/{index-b4iXYvId.js.map → index-4qgKeErp.js.map} +1 -1
- package/dist/chunks/index-b_MgDylR.js +447 -0
- package/dist/chunks/{index-6tYeqbgP.js.map → index-b_MgDylR.js.map} +1 -1
- package/dist/chunks/{input-4UQWegUk.js → input-NmYDD5bn.js} +83 -60
- package/dist/chunks/{input-0Uksk4DP.js.map → input-NmYDD5bn.js.map} +1 -1
- package/dist/chunks/input-ttnte8zB.js +295 -0
- package/dist/chunks/{input-4UQWegUk.js.map → input-ttnte8zB.js.map} +1 -1
- package/dist/chunks/input_group-M-D25pOJ.js +152 -0
- package/dist/chunks/{input_group-bBKaq3Wi.js.map → input_group-M-D25pOJ.js.map} +1 -1
- package/dist/chunks/{input_group-bBKaq3Wi.js → input_group-jWnq2DJT.js} +27 -24
- package/dist/chunks/{input_group-AS760Cp7.js.map → input_group-jWnq2DJT.js.map} +1 -1
- package/dist/chunks/keyboard_list_navigation-ScXhrxya.js +284 -0
- package/dist/chunks/{keyboard_list_navigation-N74Bpdq7.js.map → keyboard_list_navigation-ScXhrxya.js.map} +1 -1
- package/dist/chunks/keyboard_list_navigation-fJnl_Iox.js +283 -0
- package/dist/chunks/{keyboard_list_navigation-F0O8nht0.js.map → keyboard_list_navigation-fJnl_Iox.js.map} +1 -1
- package/dist/chunks/link_constants-Huj7D_hm.js +22 -0
- package/dist/chunks/{link_constants-Kn6kP4i1.js.map → link_constants-Huj7D_hm.js.map} +1 -1
- package/dist/chunks/link_constants-nWVlXQBs.js +23 -0
- package/dist/chunks/{link_constants-vIUB92L4.js.map → link_constants-nWVlXQBs.js.map} +1 -1
- package/dist/chunks/list_item_constants-EiqkqZvP.js +13 -0
- package/dist/chunks/{list_item_constants-Tsz5CO1m.js.map → list_item_constants-EiqkqZvP.js.map} +1 -1
- package/dist/chunks/list_item_constants-u1xcN9Dd.js +14 -0
- package/dist/chunks/{list_item_constants-LTUc74pD.js.map → list_item_constants-u1xcN9Dd.js.map} +1 -1
- package/dist/chunks/modal-VgxXAQFP.js +105 -0
- package/dist/chunks/{modal-qEzlo0Sj.js.map → modal-VgxXAQFP.js.map} +1 -1
- package/dist/chunks/modal-XOr4kiNZ.js +106 -0
- package/dist/chunks/{modal-VuMFkZFH.js.map → modal-XOr4kiNZ.js.map} +1 -1
- package/dist/chunks/notice_action-WTucGhvr.js +222 -0
- package/dist/chunks/{notice_action-tJfD5Qw1.js.map → notice_action-WTucGhvr.js.map} +1 -1
- package/dist/chunks/notice_action-p-ePanW_.js +223 -0
- package/dist/chunks/{notice_action-jO199emq.js.map → notice_action-p-ePanW_.js.map} +1 -1
- package/dist/chunks/notice_constants-7Qt2CQEY.js +7 -0
- package/dist/chunks/{notice_constants-mC6al2Dm.js.map → notice_constants-7Qt2CQEY.js.map} +1 -1
- package/dist/chunks/notice_constants-UXo9e3bS.js +6 -0
- package/dist/chunks/{notice_constants-c--hBFQw.js.map → notice_constants-UXo9e3bS.js.map} +1 -1
- package/dist/chunks/popover_constants-JwBF9h1Z.js +143 -0
- package/dist/chunks/{popover_constants-hOEhklvr.js.map → popover_constants-JwBF9h1Z.js.map} +1 -1
- package/dist/chunks/popover_constants-Qkpb0yh2.js +144 -0
- package/dist/chunks/{popover_constants-qjlEkroB.js.map → popover_constants-Qkpb0yh2.js.map} +1 -1
- package/dist/chunks/{sr_only_close_button-7O-Ev8uM.js → sr_only_close_button-3EdsV-dH.js} +28 -24
- package/dist/chunks/{sr_only_close_button-iD7s1Pbj.js.map → sr_only_close_button-3EdsV-dH.js.map} +1 -1
- package/dist/chunks/sr_only_close_button-xGrHFjwA.js +91 -0
- package/dist/chunks/{sr_only_close_button-7O-Ev8uM.js.map → sr_only_close_button-xGrHFjwA.js.map} +1 -1
- package/dist/chunks/stack_constants-HraCekPm.js +15 -0
- package/dist/chunks/{stack_constants-m9Ickqw0.js.map → stack_constants-HraCekPm.js.map} +1 -1
- package/dist/chunks/stack_constants-SMzMWnAQ.js +14 -0
- package/dist/chunks/{stack_constants-u7tNqGtc.js.map → stack_constants-SMzMWnAQ.js.map} +1 -1
- package/dist/chunks/tab-RTDgnD9-.js +391 -0
- package/dist/chunks/{tab-at7WWglk.js.map → tab-RTDgnD9-.js.map} +1 -1
- package/dist/chunks/tab-qc3f42Yp.js +390 -0
- package/dist/chunks/{tab-GQZFMq83.js.map → tab-qc3f42Yp.js.map} +1 -1
- package/dist/common/constants.cjs +60 -0
- package/dist/{lib → common}/constants.cjs.map +1 -1
- package/dist/{lib → common}/constants.js +25 -18
- package/dist/{lib → common}/constants.js.map +1 -1
- package/dist/common/dates.cjs +72 -0
- package/dist/{lib → common}/dates.cjs.map +1 -1
- package/dist/common/dates.js +72 -0
- package/dist/{lib → common}/dates.js.map +1 -1
- package/dist/common/emoji.cjs +163 -0
- package/dist/common/emoji.cjs.map +1 -0
- package/dist/common/emoji.js +168 -0
- package/dist/common/emoji.js.map +1 -0
- package/dist/common/mixins.cjs +17 -0
- package/dist/{lib → common}/mixins.cjs.map +1 -1
- package/dist/common/mixins.js +17 -0
- package/dist/common/utils.cjs +243 -0
- package/dist/{lib → common}/utils.cjs.map +1 -1
- package/dist/common/utils.js +243 -0
- package/dist/{lib → common}/utils.js.map +1 -1
- package/dist/common/validators.cjs +23 -0
- package/dist/{lib → common}/validators.cjs.map +1 -1
- package/dist/common/validators.js +23 -0
- package/dist/{lib → common}/validators.js.map +1 -1
- package/dist/dialtone-vue.cjs +373 -1
- package/dist/dialtone-vue.cjs.map +1 -1
- package/dist/dialtone-vue.js +328 -327
- package/dist/dialtone-vue.js.map +1 -1
- package/dist/lib/attachment-carousel.cjs +345 -1
- package/dist/lib/attachment-carousel.cjs.map +1 -1
- package/dist/lib/attachment-carousel.js +126 -108
- package/dist/lib/attachment-carousel.js.map +1 -1
- package/dist/lib/avatar.cjs +447 -1
- package/dist/lib/avatar.cjs.map +1 -1
- package/dist/lib/avatar.js +135 -101
- package/dist/lib/avatar.js.map +1 -1
- package/dist/lib/badge.cjs +206 -1
- package/dist/lib/badge.cjs.map +1 -1
- package/dist/lib/badge.js +64 -48
- package/dist/lib/badge.js.map +1 -1
- package/dist/lib/banner.cjs +242 -2
- package/dist/lib/banner.cjs.map +1 -1
- package/dist/lib/banner.js +81 -71
- package/dist/lib/banner.js.map +1 -1
- package/dist/lib/breadcrumbs.cjs +150 -1
- package/dist/lib/breadcrumbs.cjs.map +1 -1
- package/dist/lib/breadcrumbs.js +60 -52
- package/dist/lib/breadcrumbs.js.map +1 -1
- package/dist/lib/button-group.cjs +41 -1
- package/dist/lib/button-group.cjs.map +1 -1
- package/dist/lib/button-group.js +15 -14
- package/dist/lib/button-group.js.map +1 -1
- package/dist/lib/button.cjs +356 -1
- package/dist/lib/button.cjs.map +1 -1
- package/dist/lib/button.js +108 -88
- package/dist/lib/button.js.map +1 -1
- package/dist/lib/callbar-button-with-popover.cjs +322 -1
- package/dist/lib/callbar-button-with-popover.cjs.map +1 -1
- package/dist/lib/callbar-button-with-popover.js +101 -83
- package/dist/lib/callbar-button-with-popover.js.map +1 -1
- package/dist/lib/callbar-button.cjs +200 -1
- package/dist/lib/callbar-button.cjs.map +1 -1
- package/dist/lib/callbar-button.js +52 -45
- package/dist/lib/callbar-button.js.map +1 -1
- package/dist/lib/callbox.cjs +217 -1
- package/dist/lib/callbox.cjs.map +1 -1
- package/dist/lib/callbox.js +80 -67
- package/dist/lib/callbox.js.map +1 -1
- package/dist/lib/card.cjs +91 -1
- package/dist/lib/card.cjs.map +1 -1
- package/dist/lib/card.js +27 -27
- package/dist/lib/card.js.map +1 -1
- package/dist/lib/checkbox-group.cjs +115 -1
- package/dist/lib/checkbox-group.cjs.map +1 -1
- package/dist/lib/checkbox-group.js +34 -23
- package/dist/lib/checkbox-group.js.map +1 -1
- package/dist/lib/checkbox.cjs +156 -1
- package/dist/lib/checkbox.cjs.map +1 -1
- package/dist/lib/checkbox.js +72 -60
- package/dist/lib/checkbox.js.map +1 -1
- package/dist/lib/chip.cjs +235 -1
- package/dist/lib/chip.cjs.map +1 -1
- package/dist/lib/chip.js +84 -67
- package/dist/lib/chip.js.map +1 -1
- package/dist/lib/codeblock.cjs +23 -2
- package/dist/lib/codeblock.cjs.map +1 -1
- package/dist/lib/codeblock.js +13 -13
- package/dist/lib/codeblock.js.map +1 -1
- package/dist/lib/collapsible.cjs +398 -1
- package/dist/lib/collapsible.cjs.map +1 -1
- package/dist/lib/collapsible.js +123 -100
- package/dist/lib/collapsible.js.map +1 -1
- package/dist/lib/combobox-multi-select.cjs +589 -1
- package/dist/lib/combobox-multi-select.cjs.map +1 -1
- package/dist/lib/combobox-multi-select.js +270 -177
- package/dist/lib/combobox-multi-select.js.map +1 -1
- package/dist/lib/combobox-with-popover.cjs +452 -1
- package/dist/lib/combobox-with-popover.cjs.map +1 -1
- package/dist/lib/combobox-with-popover.js +172 -127
- package/dist/lib/combobox-with-popover.js.map +1 -1
- package/dist/lib/combobox.cjs +18 -1
- package/dist/lib/combobox.cjs.map +1 -1
- package/dist/lib/combobox.js +9 -9
- package/dist/lib/contact-info.cjs +205 -1
- package/dist/lib/contact-info.cjs.map +1 -1
- package/dist/lib/contact-info.js +69 -60
- package/dist/lib/contact-info.js.map +1 -1
- package/dist/lib/contact-row.cjs +246 -1
- package/dist/lib/contact-row.cjs.map +1 -1
- package/dist/lib/contact-row.js +67 -63
- package/dist/lib/contact-row.js.map +1 -1
- package/dist/lib/datepicker.cjs +854 -1
- package/dist/lib/datepicker.cjs.map +1 -1
- package/dist/lib/datepicker.js +585 -441
- package/dist/lib/datepicker.js.map +1 -1
- package/dist/lib/description-list.cjs +116 -1
- package/dist/lib/description-list.cjs.map +1 -1
- package/dist/lib/description-list.js +56 -24
- package/dist/lib/description-list.js.map +1 -1
- package/dist/lib/dropdown.cjs +36 -1
- package/dist/lib/dropdown.cjs.map +1 -1
- package/dist/lib/dropdown.js +22 -21
- package/dist/lib/dropdown.js.map +1 -1
- package/dist/lib/editor.cjs +711 -1
- package/dist/lib/editor.cjs.map +1 -1
- package/dist/lib/editor.js +271 -235
- package/dist/lib/editor.js.map +1 -1
- package/dist/lib/emoji-picker.cjs +1277 -1
- package/dist/lib/emoji-picker.cjs.map +1 -1
- package/dist/lib/emoji-picker.js +859 -569
- package/dist/lib/emoji-picker.js.map +1 -1
- package/dist/lib/emoji-row.cjs +128 -1
- package/dist/lib/emoji-row.cjs.map +1 -1
- package/dist/lib/emoji-row.js +89 -75
- package/dist/lib/emoji-row.js.map +1 -1
- package/dist/lib/emoji-text-wrapper.cjs +102 -1
- package/dist/lib/emoji-text-wrapper.cjs.map +1 -1
- package/dist/lib/emoji-text-wrapper.js +42 -31
- package/dist/lib/emoji-text-wrapper.js.map +1 -1
- package/dist/lib/emoji.cjs +158 -1
- package/dist/lib/emoji.cjs.map +1 -1
- package/dist/lib/emoji.js +153 -6
- package/dist/lib/emoji.js.map +1 -1
- package/dist/lib/feed-item-row.cjs +296 -1
- package/dist/lib/feed-item-row.cjs.map +1 -1
- package/dist/lib/feed-item-row.js +119 -100
- package/dist/lib/feed-item-row.js.map +1 -1
- package/dist/lib/feed-pill.cjs +173 -1
- package/dist/lib/feed-pill.cjs.map +1 -1
- package/dist/lib/feed-pill.js +70 -57
- package/dist/lib/feed-pill.js.map +1 -1
- package/dist/lib/general-row.cjs +518 -1
- package/dist/lib/general-row.cjs.map +1 -1
- package/dist/lib/general-row.js +186 -148
- package/dist/lib/general-row.js.map +1 -1
- package/dist/lib/group-row.cjs +116 -1
- package/dist/lib/group-row.cjs.map +1 -1
- package/dist/lib/group-row.js +37 -35
- package/dist/lib/group-row.js.map +1 -1
- package/dist/lib/grouped-chip.cjs +96 -1
- package/dist/lib/grouped-chip.cjs.map +1 -1
- package/dist/lib/grouped-chip.js +51 -46
- package/dist/lib/grouped-chip.js.map +1 -1
- package/dist/lib/hovercard.cjs +223 -1
- package/dist/lib/hovercard.cjs.map +1 -1
- package/dist/lib/hovercard.js +115 -80
- package/dist/lib/hovercard.js.map +1 -1
- package/dist/lib/icon.cjs +58 -1
- package/dist/lib/icon.cjs.map +1 -1
- package/dist/lib/icon.js +20 -20
- package/dist/lib/icon.js.map +1 -1
- package/dist/lib/image-viewer.cjs +243 -1
- package/dist/lib/image-viewer.cjs.map +1 -1
- package/dist/lib/image-viewer.js +104 -80
- package/dist/lib/image-viewer.js.map +1 -1
- package/dist/lib/input-group.cjs +91 -1
- package/dist/lib/input-group.cjs.map +1 -1
- package/dist/lib/input-group.js +41 -39
- package/dist/lib/input-group.js.map +1 -1
- package/dist/lib/input.cjs +578 -1
- package/dist/lib/input.cjs.map +1 -1
- package/dist/lib/input.js +185 -137
- package/dist/lib/input.js.map +1 -1
- package/dist/lib/item-layout.cjs +91 -1
- package/dist/lib/item-layout.cjs.map +1 -1
- package/dist/lib/item-layout.js +45 -39
- package/dist/lib/item-layout.js.map +1 -1
- package/dist/lib/ivr-node.cjs +263 -1
- package/dist/lib/ivr-node.cjs.map +1 -1
- package/dist/lib/ivr-node.js +130 -112
- package/dist/lib/ivr-node.js.map +1 -1
- package/dist/lib/keyboard-shortcut.cjs +119 -1
- package/dist/lib/keyboard-shortcut.cjs.map +1 -1
- package/dist/lib/keyboard-shortcut.js +58 -48
- package/dist/lib/keyboard-shortcut.js.map +1 -1
- package/dist/lib/lazy-show.cjs +82 -1
- package/dist/lib/lazy-show.cjs.map +1 -1
- package/dist/lib/lazy-show.js +21 -19
- package/dist/lib/lazy-show.js.map +1 -1
- package/dist/lib/link.cjs +43 -1
- package/dist/lib/link.cjs.map +1 -1
- package/dist/lib/link.js +20 -19
- package/dist/lib/link.js.map +1 -1
- package/dist/lib/list-item-group.cjs +67 -1
- package/dist/lib/list-item-group.cjs.map +1 -1
- package/dist/lib/list-item-group.js +24 -22
- package/dist/lib/list-item-group.js.map +1 -1
- package/dist/lib/list-item.cjs +216 -1
- package/dist/lib/list-item.cjs.map +1 -1
- package/dist/lib/list-item.js +71 -60
- package/dist/lib/list-item.js.map +1 -1
- package/dist/lib/message-input.cjs +708 -1
- package/dist/lib/message-input.cjs.map +1 -1
- package/dist/lib/message-input.js +232 -206
- package/dist/lib/message-input.js.map +1 -1
- package/dist/lib/modal.cjs +444 -2
- package/dist/lib/modal.cjs.map +1 -1
- package/dist/lib/modal.js +153 -120
- package/dist/lib/modal.js.map +1 -1
- package/dist/lib/notice.cjs +197 -1
- package/dist/lib/notice.cjs.map +1 -1
- package/dist/lib/notice.js +66 -63
- package/dist/lib/notice.js.map +1 -1
- package/dist/lib/pagination.cjs +205 -1
- package/dist/lib/pagination.cjs.map +1 -1
- package/dist/lib/pagination.js +96 -81
- package/dist/lib/pagination.js.map +1 -1
- package/dist/lib/popover.cjs +1080 -1
- package/dist/lib/popover.cjs.map +1 -1
- package/dist/lib/popover.js +447 -267
- package/dist/lib/popover.js.map +1 -1
- package/dist/lib/presence.cjs +70 -1
- package/dist/lib/presence.cjs.map +1 -1
- package/dist/lib/presence.js +33 -27
- package/dist/lib/presence.js.map +1 -1
- package/dist/lib/radio-group.cjs +88 -1
- package/dist/lib/radio-group.cjs.map +1 -1
- package/dist/lib/radio-group.js +18 -18
- package/dist/lib/radio-group.js.map +1 -1
- package/dist/lib/radio.cjs +162 -1
- package/dist/lib/radio.cjs.map +1 -1
- package/dist/lib/radio.js +66 -57
- package/dist/lib/radio.js.map +1 -1
- package/dist/lib/rich-text-editor.cjs +1137 -1
- package/dist/lib/rich-text-editor.cjs.map +1 -1
- package/dist/lib/rich-text-editor.js +567 -386
- package/dist/lib/rich-text-editor.js.map +1 -1
- package/dist/lib/root-layout.cjs +158 -1
- package/dist/lib/root-layout.cjs.map +1 -1
- package/dist/lib/root-layout.js +33 -31
- package/dist/lib/root-layout.js.map +1 -1
- package/dist/lib/scroller.cjs +1090 -1
- package/dist/lib/scroller.cjs.map +1 -1
- package/dist/lib/scroller.js +668 -345
- package/dist/lib/scroller.js.map +1 -1
- package/dist/lib/select-menu.cjs +312 -1
- package/dist/lib/select-menu.cjs.map +1 -1
- package/dist/lib/select-menu.js +124 -79
- package/dist/lib/select-menu.js.map +1 -1
- package/dist/lib/settings-menu-button.cjs +77 -1
- package/dist/lib/settings-menu-button.cjs.map +1 -1
- package/dist/lib/settings-menu-button.js +31 -30
- package/dist/lib/settings-menu-button.js.map +1 -1
- package/dist/lib/skeleton.cjs +635 -1
- package/dist/lib/skeleton.cjs.map +1 -1
- package/dist/lib/skeleton.js +189 -152
- package/dist/lib/skeleton.js.map +1 -1
- package/dist/lib/stack.cjs +123 -1
- package/dist/lib/stack.cjs.map +1 -1
- package/dist/lib/stack.js +61 -53
- package/dist/lib/stack.js.map +1 -1
- package/dist/lib/tabs.cjs +102 -1
- package/dist/lib/tabs.cjs.map +1 -1
- package/dist/lib/tabs.js +47 -41
- package/dist/lib/tabs.js.map +1 -1
- package/dist/lib/time-pill.cjs +41 -1
- package/dist/lib/time-pill.cjs.map +1 -1
- package/dist/lib/time-pill.js +18 -14
- package/dist/lib/time-pill.js.map +1 -1
- package/dist/lib/toast.cjs +281 -1
- package/dist/lib/toast.cjs.map +1 -1
- package/dist/lib/toast.js +96 -74
- package/dist/lib/toast.js.map +1 -1
- package/dist/lib/toggle.cjs +192 -1
- package/dist/lib/toggle.cjs.map +1 -1
- package/dist/lib/toggle.js +60 -49
- package/dist/lib/toggle.js.map +1 -1
- package/dist/lib/tooltip-directive.cjs +84 -1
- package/dist/lib/tooltip-directive.cjs.map +1 -1
- package/dist/lib/tooltip-directive.js +56 -42
- package/dist/lib/tooltip-directive.js.map +1 -1
- package/dist/lib/tooltip.cjs +460 -1
- package/dist/lib/tooltip.cjs.map +1 -1
- package/dist/lib/tooltip.js +162 -103
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/lib/top-banner-info.cjs +71 -1
- package/dist/lib/top-banner-info.cjs.map +1 -1
- package/dist/lib/top-banner-info.js +27 -22
- package/dist/lib/top-banner-info.js.map +1 -1
- package/dist/lib/unread-pill.cjs +73 -1
- package/dist/lib/unread-pill.cjs.map +1 -1
- package/dist/lib/unread-pill.js +28 -25
- package/dist/lib/unread-pill.js.map +1 -1
- package/dist/lib/validation-messages.cjs +89 -1
- package/dist/lib/validation-messages.cjs.map +1 -1
- package/dist/lib/validation-messages.js +41 -36
- package/dist/lib/validation-messages.js.map +1 -1
- package/dist/style.css +1257 -1
- package/dist/types/components/rich_text_editor/extensions/emoji/EmojiComponent.vue.d.ts +2 -2
- package/dist/types/components/rich_text_editor/extensions/mentions/MentionComponent.vue.d.ts +2 -2
- package/package.json +30 -29
- package/dist/chunks/_plugin-vue_export-helper-6_y-gaV6.js +0 -2
- package/dist/chunks/_plugin-vue_export-helper-6_y-gaV6.js.map +0 -1
- package/dist/chunks/_plugin-vue_export-helper-hUChTQA_.js +0 -10
- package/dist/chunks/_plugin-vue_export-helper-hUChTQA_.js.map +0 -1
- package/dist/chunks/dropdown-UO3UJalk.js +0 -2
- package/dist/chunks/dropdown_constants-EUcDxBrX.js +0 -9
- package/dist/chunks/dropdown_constants-EUcDxBrX.js.map +0 -1
- package/dist/chunks/dropdown_constants-KHFvVI2L.js +0 -2
- package/dist/chunks/dropdown_constants-KHFvVI2L.js.map +0 -1
- package/dist/chunks/icon_constants-2S_OSQ1t.js +0 -2
- package/dist/chunks/index-6tYeqbgP.js +0 -3
- package/dist/chunks/index-IBtQ5jRJ.js +0 -2
- package/dist/chunks/index-IBtQ5jRJ.js.map +0 -1
- package/dist/chunks/index-b4iXYvId.js +0 -399
- package/dist/chunks/index-mRmwpCBG.js +0 -256
- package/dist/chunks/index-mRmwpCBG.js.map +0 -1
- package/dist/chunks/input-0Uksk4DP.js +0 -2
- package/dist/chunks/input_group-AS760Cp7.js +0 -2
- package/dist/chunks/keyboard_list_navigation-F0O8nht0.js +0 -197
- package/dist/chunks/keyboard_list_navigation-N74Bpdq7.js +0 -2
- package/dist/chunks/link_constants-Kn6kP4i1.js +0 -2
- package/dist/chunks/link_constants-vIUB92L4.js +0 -16
- package/dist/chunks/list_item_constants-LTUc74pD.js +0 -13
- package/dist/chunks/list_item_constants-Tsz5CO1m.js +0 -2
- package/dist/chunks/modal-VuMFkZFH.js +0 -82
- package/dist/chunks/modal-qEzlo0Sj.js +0 -2
- package/dist/chunks/notice_action-jO199emq.js +0 -2
- package/dist/chunks/notice_action-tJfD5Qw1.js +0 -209
- package/dist/chunks/notice_constants-c--hBFQw.js +0 -6
- package/dist/chunks/notice_constants-mC6al2Dm.js +0 -2
- package/dist/chunks/popover_constants-hOEhklvr.js +0 -2
- package/dist/chunks/popover_constants-qjlEkroB.js +0 -114
- package/dist/chunks/sr_only_close_button-iD7s1Pbj.js +0 -3
- package/dist/chunks/stack_constants-m9Ickqw0.js +0 -2
- package/dist/chunks/stack_constants-u7tNqGtc.js +0 -13
- package/dist/chunks/tab-GQZFMq83.js +0 -367
- package/dist/chunks/tab-at7WWglk.js +0 -2
- package/dist/lib/constants.cjs +0 -2
- package/dist/lib/dates.cjs +0 -2
- package/dist/lib/dates.js +0 -57
- package/dist/lib/mixins.cjs +0 -2
- package/dist/lib/mixins.js +0 -17
- package/dist/lib/utils.cjs +0 -2
- package/dist/lib/utils.js +0 -171
- package/dist/lib/validators.cjs +0 -2
- package/dist/lib/validators.js +0 -12
- /package/dist/{lib → common}/mixins.js.map +0 -0
|
@@ -1,2 +1,1138 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@tiptap/vue-3"),B=require("@tiptap/extension-blockquote"),j=require("@tiptap/extension-code-block"),L=require("@tiptap/extension-document"),O=require("@tiptap/extension-hard-break"),P=require("@tiptap/extension-paragraph"),D=require("@tiptap/extension-placeholder"),M=require("@tiptap/extension-bold"),$=require("@tiptap/extension-bullet-list"),V=require("@tiptap/extension-italic"),N=require("@tiptap/extension-link"),H=require("@tiptap/extension-list-item"),U=require("@tiptap/extension-ordered-list"),K=require("@tiptap/extension-strike"),F=require("@tiptap/extension-underline"),W=require("@tiptap/extension-text"),z=require("@tiptap/extension-text-align"),u=require("@tiptap/core"),r=require("vue"),p=require("../chunks/_plugin-vue_export-helper-6_y-gaV6.js"),f=require("../chunks/index-IBtQ5jRJ.js"),w=require("@tiptap/pm/state"),X=require("@tiptap/suggestion"),J=require("@dialpad/dialtone-emojis"),Y=require("./list-item.cjs"),C=require("./stack.cjs"),q=require("tippy.js"),R=require("./utils.cjs"),G=require("@tiptap/extension-mention"),Q=require("./link.cjs"),Z=require("./avatar.cjs");require("emoji-regex");require("./skeleton.cjs");require("../chunks/icon_constants-2S_OSQ1t.js");require("@dialpad/dialtone-icons/icons.json");require("../chunks/list_item_constants-Tsz5CO1m.js");require("./item-layout.cjs");require("./icon.cjs");require("@dialpad/dialtone-icons/vue3");require("../chunks/stack_constants-m9Ickqw0.js");require("./constants.cjs");require("../chunks/link_constants-Kn6kP4i1.js");require("./presence.cjs");const ee={name:"EmojiComponent",components:{NodeViewWrapper:d.NodeViewWrapper,DtEmoji:f.D},props:d.nodeViewProps};function te(e,t,n,o,i,s){const a=r.resolveComponent("dt-emoji"),c=r.resolveComponent("node-view-wrapper");return r.openBlock(),r.createBlock(c,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:r.withCtx(()=>[r.createVNode(a,{size:"500",code:e.node.attrs.code},null,8,["code"])]),_:1})}const ne=p._(ee,[["render",te]]),re={name:"SuggestionList",components:{DtListItem:Y.DtListItem},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:e}){return e.key==="ArrowUp"?(this.upHandler(),!0):e.key==="ArrowDown"?(this.downHandler(),!0):e.key==="Enter"||e.key==="Tab"?(e.preventDefault(),this.selectHandler(),e.stopPropagation(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},scrollActiveElementIntoView(){const e=this.$refs.suggestionList.querySelector(".dt-list-item--highlighted");e&&e.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){const t=this.items[e];switch(this.itemType){case"emoji":this.command(t);return;case"mention":this.command({name:t.name,id:t.id,avatarSrc:t.avatarSrc});break}}}},oe={class:"d-popover__dialog"},ie={ref:"suggestionList",class:"dt-suggestion-list"};function se(e,t,n,o,i,s){const a=r.resolveComponent("dt-list-item");return r.openBlock(),r.createElementBlock("div",oe,[r.withDirectives(r.createElementVNode("ul",ie,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.items,(c,l)=>(r.openBlock(),r.createBlock(a,{key:c.id,class:r.normalizeClass(["dt-suggestion-list--item",{"dt-list-item--highlighted":l===i.selectedIndex}]),"navigation-type":"arrow-keys",onClick:y=>s.selectItem(l),onKeydown:r.withModifiers(s.onKeyDown,["prevent","stop"])},{default:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(n.itemComponent),{item:c},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[r.vShow,n.items.length]])])}const S=p._(re,[["render",se]]),ae={name:"EmojiSuggestion",components:{DtEmoji:f.D,DtStack:C.DtStack},props:{item:{type:Object,required:!0}}};function ce(e,t,n,o,i,s){const a=r.resolveComponent("dt-emoji"),c=r.resolveComponent("dt-stack");return r.openBlock(),r.createBlock(c,{direction:"row",gap:"400"},{default:r.withCtx(()=>[r.createVNode(a,{size:"200",code:n.item.code},null,8,["code"]),r.createTextVNode(" "+r.toDisplayString(n.item.code),1)]),_:1})}const ue=p._(ae,[["render",ce]]),de={items:({query:e})=>e.length<2?[]:Object.values(J.emojisIndexed).filter(function(o){return!!o.shortname.substring(1,o.shortname.length-1).startsWith(e.toLowerCase())}).map(o=>({id:o.unicode_character,code:o.shortname})),command:({editor:e,range:t,props:n})=>{var s,a;const o=e.view.state.selection.$to.nodeAfter;((s=o==null?void 0:o.text)==null?void 0:s.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:"emoji",attrs:n},{type:"text",text:" "}]).run(),(a=window.getSelection())==null||a.collapseToEnd()},render:()=>{let e,t;return{onStart:n=>{e=new d.VueRenderer(S,{props:{itemComponent:r.markRaw(ue),itemType:"emoji",...n},editor:n.editor}),n.clientRect&&(t=q("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"top-start",contentElement:null,zIndex:650}))},onUpdate(n){e.updateProps(n),n.clientRect&&t[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var o;return n.event.key==="Escape"?(t[0].hide(),!0):(o=e.ref)==null?void 0:o.onKeyDown(n)},onExit(){t[0].destroy(),e.destroy()}}}},le=new w.PluginKey("emoji"),pe=/:\w+:$/,me=/:\w+:/g,he=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/,fe=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g,x=e=>{if(e&&f.o(e[0]))return{index:e.index,text:e[0],match:e}},ge=e=>[...e.matchAll(me)].filter(n=>f.o(n[0])).map(n=>({index:n.index,text:n[0],match:n})),_e=u.Node.create({addOptions(){return{HTMLAttributes:{},suggestion:{char:":",pluginKey:le}}},name:"emoji",group:"inline",inline:!0,selectable:!0,addNodeView(){return d.VueNodeViewRenderer(ne)},addAttributes(){return{code:{default:null},id:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:e}){return e.attrs.code},renderHTML({HTMLAttributes:e}){return["emoji-component",u.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[u.nodeInputRule({find:e=>{const t=e.match(pe);return x(t)},type:this.type,getAttributes(e){return{code:e[0]}}}),u.nodeInputRule({find:e=>{const t=e.match(he);return x(t)},type:this.type,getAttributes(e){const t=f.m(e[0]).unicode_output;return{code:String.fromCodePoint(parseInt(t,16)),label:"emoji"}}})]},addPasteRules(){return[u.nodePasteRule({find:ge,type:this.type,getAttributes(e){return{code:e[0]}}}),u.nodePasteRule({find:fe,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[X({editor:this.editor,...this.options.suggestion,...de})]}});function ye(e,t,n=()=>!0){const o=[];t.lastIndex=0;let i;for(;i=t.exec(e);)n(e,i)&&o.push(i);return o}function ke(e,t){return!["#","@"].includes(e.charAt(t.index))&&!["#","@"].includes(e.charAt(t.index-1))}function we(e){const t=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return e.replace(t,"")}function be(e,t){const n=e.slice(0,t+1).search(/\S+\s*$/),o=e.slice(t).search(/\s/);if(o<0){const i=e.slice(n);return{text:i,from:n,to:n+i.length}}return{text:e.slice(n,o+t),from:n,to:o+t}}function b(e,t,n,o){const i=be(e,t);if(o.lastIndex=0,!o.test(i.text))return i;const s=n==="left"?i.from-1:i.to+1;return s<=0||s>=e.length||s===t?i:b(e,s,n,o)}function xe(e,t,n,o){const i=Math.max(e.from-1,0),s=Math.min(e.to+1,t.content.size),a=u.getMarksBetween(i,s,t);for(const c of a)c.mark.type===o&&n.removeMark(c.from,c.to,o)}const E=R.getPhoneNumberRegex(1,15);function T(e,t,n,o,i,s){if(!e)return;let a=n-t-1;a=a<0?0:a;const c=o-t,l=b(e,a,"left",E),y=b(e,c,"right",E),m=e.slice(l.from,y.to);ye(m,R.linkRegex,ke).forEach(k=>{const h=we(k[0]),_=t+l.from+k.index+1,A=_+h.length;i.addMark(_,A,s.create())})}function Ee(e){let t=!1;return new w.Plugin({key:new w.PluginKey("autolink"),appendTransaction:(n,o,i)=>{const s=n.some(m=>m.docChanged)&&!o.doc.eq(i.doc);if(t&&!s)return;const{tr:a}=i,{textContent:c}=i.doc;t||T(c,0,0,c.length,a,e.type),t=!0;const l=u.combineTransactionSteps(o.doc,[...n]);return u.getChangedRanges(l).forEach(({oldRange:m,newRange:g})=>{xe(g,i.doc,a,e.type),u.findChildrenInRange(i.doc,g,h=>h.isTextblock).forEach(({node:h,pos:_})=>{T(h.textContent,_,m.from,g.to,a,e.type)})}),a}})}const Te={class:"d-link d-c-text d-d-inline-block",rel:"noopener noreferrer nofollow"},Ce=u.Mark.create({name:"Link",renderHTML({HTMLAttributes:e}){return["a",u.mergeAttributes(this.options.HTMLAttributes,e,Te),0]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[Ee({type:this.type})]}}),qe={name:"MentionComponent",components:{NodeViewWrapper:d.NodeViewWrapper,DtLink:Q.DtLink},props:d.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}}};function Re(e,t,n,o,i,s){const a=r.resolveComponent("dt-link"),c=r.resolveComponent("node-view-wrapper");return r.openBlock(),r.createBlock(c,{class:"d-d-inline-block"},{default:r.withCtx(()=>[r.createVNode(a,{kind:"mention"},{default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(s.text),1)]),_:1})]),_:1})}const Se=p._(qe,[["render",Re]]),ve=G.extend({addNodeView(){return d.VueNodeViewRenderer(Se)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["mention-component",u.mergeAttributes(this.options.HTMLAttributes,e),0]}}),v=["text","json","html"],I=["start","end","all"],Ie=["https","http","ftp","ftps","sftp","mailto"],Ae={name:"MentionSuggestion",components:{DtAvatar:Z.DtAvatar,DtStack:C.DtStack},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc}}};function Be(e,t,n,o,i,s){const a=r.resolveComponent("dt-avatar"),c=r.resolveComponent("dt-stack");return r.openBlock(),r.createBlock(c,{direction:"row",gap:"400"},{default:r.withCtx(()=>[r.createVNode(a,{"full-name":s.name,"image-src":s.avatarSrc,"image-alt":s.name,size:"xs"},null,8,["full-name","image-src","image-alt"]),r.createTextVNode(" "+r.toDisplayString(s.name),1)]),_:1})}const je=p._(Ae,[["render",Be]]),Le={allowSpaces:!0,render:()=>{let e,t;return{onStart:n=>{e=new d.VueRenderer(S,{props:{itemComponent:r.markRaw(je),itemType:"mention",...n},editor:n.editor}),n.clientRect&&(t=q("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"top-start"}))},onUpdate(n){e.updateProps(n),n.clientRect&&t[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){return n.event.key==="Escape"?(t[0].hide(),!0):e==null?void 0:e.ref.onKeyDown(n)},onExit(){t[0].destroy(),e.destroy()}}}},Oe={name:"DtRichTextEditor",components:{EditorContent:d.EditorContent},props:{modelValue:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e=="string"?I.includes(e):!0}},outputFormat:{type:String,default:"text",validator(e){return v.includes(e)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0}},emits:["input","update:modelValue","blur","focus"],data(){return{editor:null,popoverOpened:!1}},computed:{extensions(){const e=[L,P,W];if(this.link&&e.push(this.getExtension(Ce,this.link)),this.allowBlockquote&&e.push(B),this.allowBold&&e.push(M),this.allowBulletList&&(e.push($),e.push(H),e.push(U.configure({itemTypeName:"listItem"}))),this.allowItalic&&e.push(V),this.allowStrike&&e.push(K),this.allowUnderline&&e.push(F),e.push(D.configure({placeholder:this.placeholder})),this.allowLineBreaks||e.push(O.extend({addKeyboardShortcuts(){return{Enter:()=>!0,"Shift-Enter":()=>this.editor.commands.first(({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()])}}})),e.push(N.extend({inclusive:!1}).configure({autolink:!0,protocols:Ie})),this.mentionSuggestion){const t={...this.mentionSuggestion,...Le};e.push(ve.configure({suggestion:t}))}return e.push(_e),e.push(z.configure({types:["paragraph"],defaultAlignment:"left"})),e.push(j.configure({HTMLAttributes:{class:"dt-rich-text-editor--code-block"}})),e},inputAttrs(){const e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(e["aria-readonly"]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(e){let t=this.getOutput();this.outputFormat==="json"&&(e=JSON.stringify(e),t=JSON.stringify(t)),e!==t&&this.editor.commands.setContent(e,!1)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},methods:{createEditor(){this.editor=new d.Editor({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,editorProps:{attributes:{...this.inputAttrs,class:this.inputClass}}}),this.addEditorListeners()},destroyEditor(){this.editor.destroy()},addEditorListeners(){this.editor.on("update",()=>{const e=this.getOutput();this.$emit("input",e),this.$emit("update:modelValue",e)}),this.editor.on("focus",({event:e})=>{this.$emit("focus",e)}),this.editor.on("blur",({event:e})=>{this.$emit("blur",e)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"text":default:return this.editor.getText()}},getExtension(e,t){var n;return typeof t=="boolean"?e:(n=e.configure)==null?void 0:n.call(e,t)},updateEditorAttributes(e){this.editor.setOptions({editorProps:{attributes:e}})},focusEditor(){this.editor.commands.focus()}}};function Pe(e,t,n,o,i,s){const a=r.resolveComponent("editor-content");return r.openBlock(),r.createBlock(a,{editor:i.editor,"data-qa":"dt-rich-text-editor",class:"dt-rich-text-editor"},null,8,["editor"])}const De=p._(Oe,[["render",Pe]]);exports.DtRichTextEditor=De;exports.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES=I;exports.RICH_TEXT_EDITOR_OUTPUT_FORMATS=v;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue3 = require("@tiptap/vue-3");
|
|
4
|
+
const Blockquote = require("@tiptap/extension-blockquote");
|
|
5
|
+
const CodeBlock = require("@tiptap/extension-code-block");
|
|
6
|
+
const Document = require("@tiptap/extension-document");
|
|
7
|
+
const HardBreak = require("@tiptap/extension-hard-break");
|
|
8
|
+
const Paragraph = require("@tiptap/extension-paragraph");
|
|
9
|
+
const Placeholder = require("@tiptap/extension-placeholder");
|
|
10
|
+
const Bold = require("@tiptap/extension-bold");
|
|
11
|
+
const BulletList = require("@tiptap/extension-bullet-list");
|
|
12
|
+
const Italic = require("@tiptap/extension-italic");
|
|
13
|
+
const TipTapLink = require("@tiptap/extension-link");
|
|
14
|
+
const ListItem = require("@tiptap/extension-list-item");
|
|
15
|
+
const OrderedList = require("@tiptap/extension-ordered-list");
|
|
16
|
+
const Strike = require("@tiptap/extension-strike");
|
|
17
|
+
const Underline = require("@tiptap/extension-underline");
|
|
18
|
+
const Text = require("@tiptap/extension-text");
|
|
19
|
+
const TextAlign = require("@tiptap/extension-text-align");
|
|
20
|
+
const core = require("@tiptap/core");
|
|
21
|
+
const vue = require("vue");
|
|
22
|
+
const _pluginVue_exportHelper = require("../chunks/_plugin-vue_export-helper-fhnQq0tA.js");
|
|
23
|
+
const lib_emoji = require("./emoji.cjs");
|
|
24
|
+
const common_emoji = require("../common/emoji.cjs");
|
|
25
|
+
const state = require("@tiptap/pm/state");
|
|
26
|
+
const Suggestion = require("@tiptap/suggestion");
|
|
27
|
+
const dialtoneEmojis = require("@dialpad/dialtone-emojis");
|
|
28
|
+
const lib_listItem = require("./list-item.cjs");
|
|
29
|
+
const lib_stack = require("./stack.cjs");
|
|
30
|
+
const tippy = require("tippy.js");
|
|
31
|
+
const common_utils = require("../common/utils.cjs");
|
|
32
|
+
const Mention = require("@tiptap/extension-mention");
|
|
33
|
+
const lib_link = require("./link.cjs");
|
|
34
|
+
const lib_avatar = require("./avatar.cjs");
|
|
35
|
+
require("./skeleton.cjs");
|
|
36
|
+
require("../chunks/icon_constants-QYpmdE0R.js");
|
|
37
|
+
require("@dialpad/dialtone-icons/icons.json");
|
|
38
|
+
require("emoji-regex");
|
|
39
|
+
require("../chunks/list_item_constants-EiqkqZvP.js");
|
|
40
|
+
require("./item-layout.cjs");
|
|
41
|
+
require("./icon.cjs");
|
|
42
|
+
require("@dialpad/dialtone-icons/vue3");
|
|
43
|
+
require("../chunks/stack_constants-SMzMWnAQ.js");
|
|
44
|
+
require("../common/constants.cjs");
|
|
45
|
+
require("../chunks/link_constants-Huj7D_hm.js");
|
|
46
|
+
require("./presence.cjs");
|
|
47
|
+
const _sfc_main$5 = {
|
|
48
|
+
name: "EmojiComponent",
|
|
49
|
+
components: {
|
|
50
|
+
NodeViewWrapper: vue3.NodeViewWrapper,
|
|
51
|
+
DtEmoji: lib_emoji.DtEmoji
|
|
52
|
+
},
|
|
53
|
+
props: vue3.nodeViewProps
|
|
54
|
+
};
|
|
55
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
56
|
+
const _component_dt_emoji = vue.resolveComponent("dt-emoji");
|
|
57
|
+
const _component_node_view_wrapper = vue.resolveComponent("node-view-wrapper");
|
|
58
|
+
return vue.openBlock(), vue.createBlock(_component_node_view_wrapper, { class: "d-d-inline-block d-va-bottom d-lh0" }, {
|
|
59
|
+
default: vue.withCtx(() => [
|
|
60
|
+
vue.createVNode(_component_dt_emoji, {
|
|
61
|
+
size: "500",
|
|
62
|
+
code: _ctx.node.attrs.code
|
|
63
|
+
}, null, 8, ["code"])
|
|
64
|
+
]),
|
|
65
|
+
_: 1
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const EmojiComponent = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
|
|
69
|
+
const _sfc_main$4 = {
|
|
70
|
+
name: "SuggestionList",
|
|
71
|
+
components: {
|
|
72
|
+
DtListItem: lib_listItem.DtListItem
|
|
73
|
+
},
|
|
74
|
+
props: {
|
|
75
|
+
items: {
|
|
76
|
+
type: Array,
|
|
77
|
+
required: true
|
|
78
|
+
},
|
|
79
|
+
command: {
|
|
80
|
+
type: Function,
|
|
81
|
+
required: true
|
|
82
|
+
},
|
|
83
|
+
itemComponent: {
|
|
84
|
+
type: Object,
|
|
85
|
+
required: true
|
|
86
|
+
},
|
|
87
|
+
itemType: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
data() {
|
|
93
|
+
return {
|
|
94
|
+
selectedIndex: 0
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
watch: {
|
|
98
|
+
items() {
|
|
99
|
+
this.selectedIndex = 0;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
methods: {
|
|
103
|
+
onKeyDown({ event }) {
|
|
104
|
+
if (event.key === "ArrowUp") {
|
|
105
|
+
this.upHandler();
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
if (event.key === "ArrowDown") {
|
|
109
|
+
this.downHandler();
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
if (event.key === "Enter" || event.key === "Tab") {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
this.selectHandler();
|
|
115
|
+
event.stopPropagation();
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
},
|
|
120
|
+
upHandler() {
|
|
121
|
+
this.selectedIndex = (this.selectedIndex + this.items.length - 1) % this.items.length;
|
|
122
|
+
this.scrollActiveElementIntoView();
|
|
123
|
+
},
|
|
124
|
+
downHandler() {
|
|
125
|
+
this.selectedIndex = (this.selectedIndex + 1) % this.items.length;
|
|
126
|
+
this.scrollActiveElementIntoView();
|
|
127
|
+
},
|
|
128
|
+
scrollActiveElementIntoView() {
|
|
129
|
+
const activeElement = this.$refs.suggestionList.querySelector(".dt-list-item--highlighted");
|
|
130
|
+
if (activeElement) {
|
|
131
|
+
activeElement.scrollIntoView({
|
|
132
|
+
behaviour: "smooth",
|
|
133
|
+
block: "center"
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
selectHandler() {
|
|
138
|
+
this.selectItem(this.selectedIndex);
|
|
139
|
+
},
|
|
140
|
+
selectItem(index) {
|
|
141
|
+
const item = this.items[index];
|
|
142
|
+
switch (this.itemType) {
|
|
143
|
+
case "emoji":
|
|
144
|
+
this.command(item);
|
|
145
|
+
return;
|
|
146
|
+
case "mention":
|
|
147
|
+
this.command({ name: item.name, id: item.id, avatarSrc: item.avatarSrc });
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const _hoisted_1 = { class: "d-popover__dialog" };
|
|
154
|
+
const _hoisted_2 = {
|
|
155
|
+
ref: "suggestionList",
|
|
156
|
+
class: "dt-suggestion-list"
|
|
157
|
+
};
|
|
158
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
159
|
+
const _component_dt_list_item = vue.resolveComponent("dt-list-item");
|
|
160
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
161
|
+
vue.withDirectives(vue.createElementVNode("ul", _hoisted_2, [
|
|
162
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.items, (item, index) => {
|
|
163
|
+
return vue.openBlock(), vue.createBlock(_component_dt_list_item, {
|
|
164
|
+
key: item.id,
|
|
165
|
+
class: vue.normalizeClass([
|
|
166
|
+
"dt-suggestion-list--item",
|
|
167
|
+
{ "dt-list-item--highlighted": index === $data.selectedIndex }
|
|
168
|
+
]),
|
|
169
|
+
"navigation-type": "arrow-keys",
|
|
170
|
+
onClick: ($event) => $options.selectItem(index),
|
|
171
|
+
onKeydown: vue.withModifiers($options.onKeyDown, ["prevent", "stop"])
|
|
172
|
+
}, {
|
|
173
|
+
default: vue.withCtx(() => [
|
|
174
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent($props.itemComponent), { item }, null, 8, ["item"]))
|
|
175
|
+
]),
|
|
176
|
+
_: 2
|
|
177
|
+
}, 1032, ["class", "onClick", "onKeydown"]);
|
|
178
|
+
}), 128))
|
|
179
|
+
], 512), [
|
|
180
|
+
[vue.vShow, $props.items.length]
|
|
181
|
+
])
|
|
182
|
+
]);
|
|
183
|
+
}
|
|
184
|
+
const SuggestionList = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
|
|
185
|
+
const _sfc_main$3 = {
|
|
186
|
+
name: "EmojiSuggestion",
|
|
187
|
+
components: {
|
|
188
|
+
DtEmoji: lib_emoji.DtEmoji,
|
|
189
|
+
DtStack: lib_stack.DtStack
|
|
190
|
+
},
|
|
191
|
+
props: {
|
|
192
|
+
item: {
|
|
193
|
+
type: Object,
|
|
194
|
+
required: true
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
199
|
+
const _component_dt_emoji = vue.resolveComponent("dt-emoji");
|
|
200
|
+
const _component_dt_stack = vue.resolveComponent("dt-stack");
|
|
201
|
+
return vue.openBlock(), vue.createBlock(_component_dt_stack, {
|
|
202
|
+
direction: "row",
|
|
203
|
+
gap: "400"
|
|
204
|
+
}, {
|
|
205
|
+
default: vue.withCtx(() => [
|
|
206
|
+
vue.createVNode(_component_dt_emoji, {
|
|
207
|
+
size: "200",
|
|
208
|
+
code: $props.item.code
|
|
209
|
+
}, null, 8, ["code"]),
|
|
210
|
+
vue.createTextVNode(" " + vue.toDisplayString($props.item.code), 1)
|
|
211
|
+
]),
|
|
212
|
+
_: 1
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
const EmojiSuggestion = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
|
|
216
|
+
const suggestionOptions = {
|
|
217
|
+
items: ({ query }) => {
|
|
218
|
+
if (query.length < 2) {
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
const emojiList = Object.values(dialtoneEmojis.emojisIndexed);
|
|
222
|
+
const filteredEmoji = emojiList.filter(function(item) {
|
|
223
|
+
if (item.shortname.substring(1, item.shortname.length - 1).startsWith(query.toLowerCase())) {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
return false;
|
|
227
|
+
});
|
|
228
|
+
return filteredEmoji.map((item) => {
|
|
229
|
+
return { id: item.unicode_character, code: item.shortname };
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
command: ({ editor, range, props }) => {
|
|
233
|
+
var _a, _b;
|
|
234
|
+
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
235
|
+
const overrideSpace = (_a = nodeAfter == null ? void 0 : nodeAfter.text) == null ? void 0 : _a.startsWith(" ");
|
|
236
|
+
if (overrideSpace) {
|
|
237
|
+
range.to += 1;
|
|
238
|
+
}
|
|
239
|
+
editor.chain().focus().insertContentAt(range, [
|
|
240
|
+
{
|
|
241
|
+
type: "emoji",
|
|
242
|
+
attrs: props
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
type: "text",
|
|
246
|
+
text: " "
|
|
247
|
+
}
|
|
248
|
+
]).run();
|
|
249
|
+
(_b = window.getSelection()) == null ? void 0 : _b.collapseToEnd();
|
|
250
|
+
},
|
|
251
|
+
render: () => {
|
|
252
|
+
let component;
|
|
253
|
+
let popup;
|
|
254
|
+
return {
|
|
255
|
+
onStart: (props) => {
|
|
256
|
+
component = new vue3.VueRenderer(SuggestionList, {
|
|
257
|
+
props: {
|
|
258
|
+
itemComponent: vue.markRaw(EmojiSuggestion),
|
|
259
|
+
itemType: "emoji",
|
|
260
|
+
...props
|
|
261
|
+
},
|
|
262
|
+
editor: props.editor
|
|
263
|
+
});
|
|
264
|
+
if (!props.clientRect) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
popup = tippy("body", {
|
|
268
|
+
getReferenceClientRect: props.clientRect,
|
|
269
|
+
appendTo: () => document.body,
|
|
270
|
+
content: component.element,
|
|
271
|
+
showOnCreate: true,
|
|
272
|
+
interactive: true,
|
|
273
|
+
trigger: "manual",
|
|
274
|
+
placement: "top-start",
|
|
275
|
+
contentElement: null,
|
|
276
|
+
zIndex: 650
|
|
277
|
+
});
|
|
278
|
+
},
|
|
279
|
+
onUpdate(props) {
|
|
280
|
+
component.updateProps(props);
|
|
281
|
+
if (!props.clientRect) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
popup[0].setProps({
|
|
285
|
+
getReferenceClientRect: props.clientRect
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
onKeyDown(props) {
|
|
289
|
+
var _a;
|
|
290
|
+
if (props.event.key === "Escape") {
|
|
291
|
+
popup[0].hide();
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
return (_a = component.ref) == null ? void 0 : _a.onKeyDown(props);
|
|
295
|
+
},
|
|
296
|
+
onExit() {
|
|
297
|
+
popup[0].destroy();
|
|
298
|
+
component.destroy();
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
const EmojiPluginKey = new state.PluginKey("emoji");
|
|
304
|
+
const inputShortCodeRegex = /:\w+:$/;
|
|
305
|
+
const pasteShortCodeRegex = /:\w+:/g;
|
|
306
|
+
const inputUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/;
|
|
307
|
+
const pasteUnicodeRegex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g;
|
|
308
|
+
const inputRuleMatch = (match) => {
|
|
309
|
+
if (match && common_emoji.codeToEmojiData(match[0])) {
|
|
310
|
+
return {
|
|
311
|
+
index: match.index,
|
|
312
|
+
text: match[0],
|
|
313
|
+
match
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
const shortCodePasteMatch = (text) => {
|
|
318
|
+
const matches = [...text.matchAll(pasteShortCodeRegex)];
|
|
319
|
+
return matches.filter((match) => common_emoji.codeToEmojiData(match[0])).map((match) => ({
|
|
320
|
+
index: match.index,
|
|
321
|
+
text: match[0],
|
|
322
|
+
match
|
|
323
|
+
}));
|
|
324
|
+
};
|
|
325
|
+
const Emoji = core.Node.create({
|
|
326
|
+
addOptions() {
|
|
327
|
+
return {
|
|
328
|
+
HTMLAttributes: {},
|
|
329
|
+
suggestion: {
|
|
330
|
+
char: ":",
|
|
331
|
+
pluginKey: EmojiPluginKey
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
},
|
|
335
|
+
name: "emoji",
|
|
336
|
+
group: "inline",
|
|
337
|
+
inline: true,
|
|
338
|
+
selectable: true,
|
|
339
|
+
addNodeView() {
|
|
340
|
+
return vue3.VueNodeViewRenderer(EmojiComponent);
|
|
341
|
+
},
|
|
342
|
+
addAttributes() {
|
|
343
|
+
return {
|
|
344
|
+
code: {
|
|
345
|
+
default: null
|
|
346
|
+
},
|
|
347
|
+
id: {
|
|
348
|
+
default: null
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
},
|
|
352
|
+
parseHTML() {
|
|
353
|
+
return [
|
|
354
|
+
{
|
|
355
|
+
tag: "emoji-component"
|
|
356
|
+
}
|
|
357
|
+
];
|
|
358
|
+
},
|
|
359
|
+
renderText({ node }) {
|
|
360
|
+
return node.attrs.code;
|
|
361
|
+
},
|
|
362
|
+
renderHTML({ HTMLAttributes }) {
|
|
363
|
+
return ["emoji-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
|
364
|
+
},
|
|
365
|
+
addInputRules() {
|
|
366
|
+
return [
|
|
367
|
+
// shortcode input
|
|
368
|
+
core.nodeInputRule({
|
|
369
|
+
find: (text) => {
|
|
370
|
+
const match = text.match(inputShortCodeRegex);
|
|
371
|
+
return inputRuleMatch(match);
|
|
372
|
+
},
|
|
373
|
+
type: this.type,
|
|
374
|
+
getAttributes(attrs) {
|
|
375
|
+
return {
|
|
376
|
+
code: attrs[0]
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
}),
|
|
380
|
+
core.nodeInputRule({
|
|
381
|
+
find: (text) => {
|
|
382
|
+
const match = text.match(inputUnicodeRegex);
|
|
383
|
+
return inputRuleMatch(match);
|
|
384
|
+
},
|
|
385
|
+
type: this.type,
|
|
386
|
+
getAttributes(attrs) {
|
|
387
|
+
const unicode = common_emoji.shortcodeToEmojiData(attrs[0]).unicode_output;
|
|
388
|
+
const emoji = String.fromCodePoint(parseInt(unicode, 16));
|
|
389
|
+
return {
|
|
390
|
+
code: emoji,
|
|
391
|
+
label: "emoji"
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
})
|
|
395
|
+
];
|
|
396
|
+
},
|
|
397
|
+
addPasteRules() {
|
|
398
|
+
return [
|
|
399
|
+
core.nodePasteRule({
|
|
400
|
+
find: shortCodePasteMatch,
|
|
401
|
+
type: this.type,
|
|
402
|
+
getAttributes(attrs) {
|
|
403
|
+
return {
|
|
404
|
+
code: attrs[0]
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
}),
|
|
408
|
+
core.nodePasteRule({
|
|
409
|
+
find: pasteUnicodeRegex,
|
|
410
|
+
type: this.type,
|
|
411
|
+
getAttributes(attrs) {
|
|
412
|
+
return {
|
|
413
|
+
code: attrs[0]
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
})
|
|
417
|
+
];
|
|
418
|
+
},
|
|
419
|
+
addProseMirrorPlugins() {
|
|
420
|
+
return [
|
|
421
|
+
Suggestion({
|
|
422
|
+
editor: this.editor,
|
|
423
|
+
...this.options.suggestion,
|
|
424
|
+
...suggestionOptions
|
|
425
|
+
})
|
|
426
|
+
];
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
function getRegexMatches(text, regex, validator = () => true) {
|
|
430
|
+
const matches = [];
|
|
431
|
+
regex.lastIndex = 0;
|
|
432
|
+
let match;
|
|
433
|
+
while (match = regex.exec(text)) {
|
|
434
|
+
if (validator(text, match)) {
|
|
435
|
+
matches.push(match);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return matches;
|
|
439
|
+
}
|
|
440
|
+
function hasValidPrefix(text, match) {
|
|
441
|
+
return !["#", "@"].includes(text.charAt(match.index)) && !["#", "@"].includes(text.charAt(match.index - 1));
|
|
442
|
+
}
|
|
443
|
+
function trimEndPunctiation(string) {
|
|
444
|
+
const endPunctuationRegex = new RegExp(
|
|
445
|
+
"(?:" + [
|
|
446
|
+
`[!?.,:;'"]`,
|
|
447
|
+
"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"
|
|
448
|
+
].join("|"),
|
|
449
|
+
"g"
|
|
450
|
+
);
|
|
451
|
+
return string.replace(endPunctuationRegex, "");
|
|
452
|
+
}
|
|
453
|
+
function getWordAt(text, index) {
|
|
454
|
+
const left = text.slice(0, index + 1).search(/\S+\s*$/);
|
|
455
|
+
const right = text.slice(index).search(/\s/);
|
|
456
|
+
if (right < 0) {
|
|
457
|
+
const word = text.slice(left);
|
|
458
|
+
return {
|
|
459
|
+
text: word,
|
|
460
|
+
from: left,
|
|
461
|
+
to: left + word.length
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
return {
|
|
465
|
+
text: text.slice(left, right + index),
|
|
466
|
+
from: left,
|
|
467
|
+
to: right + index
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function getWordAtUntil(text, index, direction, regex) {
|
|
471
|
+
const word = getWordAt(text, index);
|
|
472
|
+
regex.lastIndex = 0;
|
|
473
|
+
if (!regex.test(word.text)) {
|
|
474
|
+
return word;
|
|
475
|
+
}
|
|
476
|
+
const newIndex = direction === "left" ? word.from - 1 : word.to + 1;
|
|
477
|
+
if (newIndex <= 0 || newIndex >= text.length || newIndex === index) {
|
|
478
|
+
return word;
|
|
479
|
+
}
|
|
480
|
+
return getWordAtUntil(text, newIndex, direction, regex);
|
|
481
|
+
}
|
|
482
|
+
function removeMarks(range, doc, tr, type) {
|
|
483
|
+
const from = Math.max(range.from - 1, 0);
|
|
484
|
+
const to = Math.min(range.to + 1, doc.content.size);
|
|
485
|
+
const marksInRange = core.getMarksBetween(from, to, doc);
|
|
486
|
+
for (const mark of marksInRange) {
|
|
487
|
+
if (mark.mark.type !== type) {
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
tr.removeMark(mark.from, mark.to, type);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
const partialPhoneNumberRegex = common_utils.getPhoneNumberRegex(1, 15);
|
|
494
|
+
function addMarks(text, pos, from, to, tr, type) {
|
|
495
|
+
if (!text) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
let rangeFrom = from - pos - 1;
|
|
499
|
+
rangeFrom = rangeFrom < 0 ? 0 : rangeFrom;
|
|
500
|
+
const rangeTo = to - pos;
|
|
501
|
+
const firstWordInRange = getWordAtUntil(
|
|
502
|
+
text,
|
|
503
|
+
rangeFrom,
|
|
504
|
+
"left",
|
|
505
|
+
partialPhoneNumberRegex
|
|
506
|
+
);
|
|
507
|
+
const lastWordInRange = getWordAtUntil(
|
|
508
|
+
text,
|
|
509
|
+
rangeTo,
|
|
510
|
+
"right",
|
|
511
|
+
partialPhoneNumberRegex
|
|
512
|
+
);
|
|
513
|
+
const wordsInRange = text.slice(firstWordInRange.from, lastWordInRange.to);
|
|
514
|
+
const matches = getRegexMatches(wordsInRange, common_utils.linkRegex, hasValidPrefix);
|
|
515
|
+
matches.forEach((match) => {
|
|
516
|
+
const word = trimEndPunctiation(match[0]);
|
|
517
|
+
const from2 = pos + firstWordInRange.from + match.index + 1;
|
|
518
|
+
const to2 = from2 + word.length;
|
|
519
|
+
tr.addMark(from2, to2, type.create());
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function autolink(options) {
|
|
523
|
+
let hasInitialized = false;
|
|
524
|
+
return new state.Plugin({
|
|
525
|
+
key: new state.PluginKey("autolink"),
|
|
526
|
+
appendTransaction: (transactions, oldState, newState) => {
|
|
527
|
+
const contentChanged = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
|
|
528
|
+
if (hasInitialized && !contentChanged) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
const { tr } = newState;
|
|
532
|
+
const { textContent } = newState.doc;
|
|
533
|
+
if (!hasInitialized) {
|
|
534
|
+
addMarks(textContent, 0, 0, textContent.length, tr, options.type);
|
|
535
|
+
}
|
|
536
|
+
hasInitialized = true;
|
|
537
|
+
const transform = core.combineTransactionSteps(
|
|
538
|
+
oldState.doc,
|
|
539
|
+
[...transactions]
|
|
540
|
+
);
|
|
541
|
+
const changes = core.getChangedRanges(transform);
|
|
542
|
+
changes.forEach(({ oldRange, newRange }) => {
|
|
543
|
+
removeMarks(newRange, newState.doc, tr, options.type);
|
|
544
|
+
const paragraphs = core.findChildrenInRange(
|
|
545
|
+
newState.doc,
|
|
546
|
+
newRange,
|
|
547
|
+
(node) => node.isTextblock
|
|
548
|
+
);
|
|
549
|
+
paragraphs.forEach(({ node, pos }) => {
|
|
550
|
+
addMarks(
|
|
551
|
+
node.textContent,
|
|
552
|
+
pos,
|
|
553
|
+
oldRange.from,
|
|
554
|
+
newRange.to,
|
|
555
|
+
tr,
|
|
556
|
+
options.type
|
|
557
|
+
);
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
return tr;
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
const defaultAttributes = {
|
|
565
|
+
class: "d-link d-c-text d-d-inline-block",
|
|
566
|
+
rel: "noopener noreferrer nofollow"
|
|
567
|
+
};
|
|
568
|
+
const Link = core.Mark.create({
|
|
569
|
+
name: "Link",
|
|
570
|
+
renderHTML({ HTMLAttributes }) {
|
|
571
|
+
return [
|
|
572
|
+
"a",
|
|
573
|
+
core.mergeAttributes(
|
|
574
|
+
this.options.HTMLAttributes,
|
|
575
|
+
HTMLAttributes,
|
|
576
|
+
defaultAttributes
|
|
577
|
+
),
|
|
578
|
+
0
|
|
579
|
+
];
|
|
580
|
+
},
|
|
581
|
+
renderText({ node }) {
|
|
582
|
+
return node.attrs.text;
|
|
583
|
+
},
|
|
584
|
+
addProseMirrorPlugins() {
|
|
585
|
+
return [
|
|
586
|
+
autolink({ type: this.type })
|
|
587
|
+
];
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
const _sfc_main$2 = {
|
|
591
|
+
name: "MentionComponent",
|
|
592
|
+
components: {
|
|
593
|
+
NodeViewWrapper: vue3.NodeViewWrapper,
|
|
594
|
+
DtLink: lib_link.DtLink
|
|
595
|
+
},
|
|
596
|
+
props: vue3.nodeViewProps,
|
|
597
|
+
computed: {
|
|
598
|
+
text() {
|
|
599
|
+
return "@" + this.$props.node.attrs.name;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
604
|
+
const _component_dt_link = vue.resolveComponent("dt-link");
|
|
605
|
+
const _component_node_view_wrapper = vue.resolveComponent("node-view-wrapper");
|
|
606
|
+
return vue.openBlock(), vue.createBlock(_component_node_view_wrapper, { class: "d-d-inline-block" }, {
|
|
607
|
+
default: vue.withCtx(() => [
|
|
608
|
+
vue.createVNode(_component_dt_link, { kind: "mention" }, {
|
|
609
|
+
default: vue.withCtx(() => [
|
|
610
|
+
vue.createTextVNode(vue.toDisplayString($options.text), 1)
|
|
611
|
+
]),
|
|
612
|
+
_: 1
|
|
613
|
+
})
|
|
614
|
+
]),
|
|
615
|
+
_: 1
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
const MentionComponent = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
619
|
+
const MentionPlugin = Mention.extend({
|
|
620
|
+
addNodeView() {
|
|
621
|
+
return vue3.VueNodeViewRenderer(MentionComponent);
|
|
622
|
+
},
|
|
623
|
+
parseHTML() {
|
|
624
|
+
return [
|
|
625
|
+
{
|
|
626
|
+
tag: "mention-component"
|
|
627
|
+
}
|
|
628
|
+
];
|
|
629
|
+
},
|
|
630
|
+
addAttributes() {
|
|
631
|
+
return {
|
|
632
|
+
name: {
|
|
633
|
+
default: ""
|
|
634
|
+
},
|
|
635
|
+
avatarSrc: {
|
|
636
|
+
default: ""
|
|
637
|
+
},
|
|
638
|
+
id: {
|
|
639
|
+
default: ""
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
},
|
|
643
|
+
renderText({ node }) {
|
|
644
|
+
return `@${node.attrs.id}`;
|
|
645
|
+
},
|
|
646
|
+
renderHTML({ HTMLAttributes }) {
|
|
647
|
+
return ["mention-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
const RICH_TEXT_EDITOR_OUTPUT_FORMATS = [
|
|
651
|
+
"text",
|
|
652
|
+
"json",
|
|
653
|
+
"html"
|
|
654
|
+
];
|
|
655
|
+
const RICH_TEXT_EDITOR_AUTOFOCUS_TYPES = [
|
|
656
|
+
"start",
|
|
657
|
+
"end",
|
|
658
|
+
"all"
|
|
659
|
+
];
|
|
660
|
+
const RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS = [
|
|
661
|
+
"https",
|
|
662
|
+
"http",
|
|
663
|
+
"ftp",
|
|
664
|
+
"ftps",
|
|
665
|
+
"sftp",
|
|
666
|
+
"mailto"
|
|
667
|
+
];
|
|
668
|
+
const _sfc_main$1 = {
|
|
669
|
+
name: "MentionSuggestion",
|
|
670
|
+
components: {
|
|
671
|
+
DtAvatar: lib_avatar.DtAvatar,
|
|
672
|
+
DtStack: lib_stack.DtStack
|
|
673
|
+
},
|
|
674
|
+
props: {
|
|
675
|
+
item: {
|
|
676
|
+
type: Object,
|
|
677
|
+
required: true
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
computed: {
|
|
681
|
+
name() {
|
|
682
|
+
return this.item.name;
|
|
683
|
+
},
|
|
684
|
+
avatarSrc() {
|
|
685
|
+
return this.item.avatarSrc;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
690
|
+
const _component_dt_avatar = vue.resolveComponent("dt-avatar");
|
|
691
|
+
const _component_dt_stack = vue.resolveComponent("dt-stack");
|
|
692
|
+
return vue.openBlock(), vue.createBlock(_component_dt_stack, {
|
|
693
|
+
direction: "row",
|
|
694
|
+
gap: "400"
|
|
695
|
+
}, {
|
|
696
|
+
default: vue.withCtx(() => [
|
|
697
|
+
vue.createVNode(_component_dt_avatar, {
|
|
698
|
+
"full-name": $options.name,
|
|
699
|
+
"image-src": $options.avatarSrc,
|
|
700
|
+
"image-alt": $options.name,
|
|
701
|
+
size: "xs"
|
|
702
|
+
}, null, 8, ["full-name", "image-src", "image-alt"]),
|
|
703
|
+
vue.createTextVNode(" " + vue.toDisplayString($options.name), 1)
|
|
704
|
+
]),
|
|
705
|
+
_: 1
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
const MentionSuggestion = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
709
|
+
const suggestion = {
|
|
710
|
+
// This function comes from the user and passed to the editor directly.
|
|
711
|
+
// This will also activate the mention plugin on the editor
|
|
712
|
+
// items: ({ query }) => { return [] },
|
|
713
|
+
allowSpaces: true,
|
|
714
|
+
render: () => {
|
|
715
|
+
let component;
|
|
716
|
+
let popup;
|
|
717
|
+
return {
|
|
718
|
+
onStart: (props) => {
|
|
719
|
+
component = new vue3.VueRenderer(SuggestionList, {
|
|
720
|
+
props: {
|
|
721
|
+
itemComponent: vue.markRaw(MentionSuggestion),
|
|
722
|
+
itemType: "mention",
|
|
723
|
+
...props
|
|
724
|
+
},
|
|
725
|
+
editor: props.editor
|
|
726
|
+
});
|
|
727
|
+
if (!props.clientRect) {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
popup = tippy("body", {
|
|
731
|
+
getReferenceClientRect: props.clientRect,
|
|
732
|
+
appendTo: () => document.body,
|
|
733
|
+
content: component.element,
|
|
734
|
+
showOnCreate: true,
|
|
735
|
+
interactive: true,
|
|
736
|
+
trigger: "manual",
|
|
737
|
+
placement: "top-start"
|
|
738
|
+
});
|
|
739
|
+
},
|
|
740
|
+
onUpdate(props) {
|
|
741
|
+
component.updateProps(props);
|
|
742
|
+
if (!props.clientRect) {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
popup[0].setProps({
|
|
746
|
+
getReferenceClientRect: props.clientRect
|
|
747
|
+
});
|
|
748
|
+
},
|
|
749
|
+
onKeyDown(props) {
|
|
750
|
+
if (props.event.key === "Escape") {
|
|
751
|
+
popup[0].hide();
|
|
752
|
+
return true;
|
|
753
|
+
}
|
|
754
|
+
return component == null ? void 0 : component.ref.onKeyDown(props);
|
|
755
|
+
},
|
|
756
|
+
onExit() {
|
|
757
|
+
popup[0].destroy();
|
|
758
|
+
component.destroy();
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
const _sfc_main = {
|
|
764
|
+
name: "DtRichTextEditor",
|
|
765
|
+
components: {
|
|
766
|
+
EditorContent: vue3.EditorContent
|
|
767
|
+
},
|
|
768
|
+
props: {
|
|
769
|
+
/**
|
|
770
|
+
* Value of the input. The object format should match TipTap's JSON
|
|
771
|
+
* document structure: https://tiptap.dev/guide/output#option-1-json
|
|
772
|
+
*/
|
|
773
|
+
modelValue: {
|
|
774
|
+
type: [Object, String],
|
|
775
|
+
default: ""
|
|
776
|
+
},
|
|
777
|
+
/**
|
|
778
|
+
* Whether the input is editable
|
|
779
|
+
*/
|
|
780
|
+
editable: {
|
|
781
|
+
type: Boolean,
|
|
782
|
+
default: true
|
|
783
|
+
},
|
|
784
|
+
/**
|
|
785
|
+
* Whether the input allows for line breaks to be introduced in the text.
|
|
786
|
+
*/
|
|
787
|
+
allowLineBreaks: {
|
|
788
|
+
type: Boolean,
|
|
789
|
+
default: false
|
|
790
|
+
},
|
|
791
|
+
/**
|
|
792
|
+
* Descriptive label for the input element
|
|
793
|
+
*/
|
|
794
|
+
inputAriaLabel: {
|
|
795
|
+
type: String,
|
|
796
|
+
required: true
|
|
797
|
+
},
|
|
798
|
+
/**
|
|
799
|
+
* Additional class name for the input element. Only accepts a String value
|
|
800
|
+
* because this is passed to the editor via options. For multiple classes,
|
|
801
|
+
* join them into one string, e.g. "d-p8 d-hmx96"
|
|
802
|
+
*/
|
|
803
|
+
inputClass: {
|
|
804
|
+
type: String,
|
|
805
|
+
default: ""
|
|
806
|
+
},
|
|
807
|
+
/**
|
|
808
|
+
* Whether the input should receive focus after the component has been
|
|
809
|
+
* mounted. Either one of `start`, `end`, `all` or a Boolean or a Number.
|
|
810
|
+
* - `start` Sets the focus to the beginning of the input
|
|
811
|
+
* - `end` Sets the focus to the end of the input
|
|
812
|
+
* - `all` Selects the whole contents of the input
|
|
813
|
+
* - `Number` Sets the focus to a specific position in the input
|
|
814
|
+
* - `true` Defaults to `start`
|
|
815
|
+
* - `false` Disables autofocus
|
|
816
|
+
* @values true, false, start, end, all, number
|
|
817
|
+
*/
|
|
818
|
+
autoFocus: {
|
|
819
|
+
type: [Boolean, String, Number],
|
|
820
|
+
default: false,
|
|
821
|
+
validator(autoFocus) {
|
|
822
|
+
if (typeof autoFocus === "string") {
|
|
823
|
+
return RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(autoFocus);
|
|
824
|
+
}
|
|
825
|
+
return true;
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
/**
|
|
829
|
+
* The output format that the editor uses when emitting the "@input" event.
|
|
830
|
+
* One of `text`, `json`, `html`. See https://tiptap.dev/guide/output for
|
|
831
|
+
* examples.
|
|
832
|
+
* @values text, json, html
|
|
833
|
+
*/
|
|
834
|
+
outputFormat: {
|
|
835
|
+
type: String,
|
|
836
|
+
default: "text",
|
|
837
|
+
validator(outputFormat) {
|
|
838
|
+
return RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
/**
|
|
842
|
+
* Placeholder text
|
|
843
|
+
*/
|
|
844
|
+
placeholder: {
|
|
845
|
+
type: String,
|
|
846
|
+
default: ""
|
|
847
|
+
},
|
|
848
|
+
/**
|
|
849
|
+
* Enables the Link extension and optionally passes configurations to it
|
|
850
|
+
*/
|
|
851
|
+
link: {
|
|
852
|
+
type: [Boolean, Object],
|
|
853
|
+
default: false
|
|
854
|
+
},
|
|
855
|
+
/**
|
|
856
|
+
* suggestion object containing the items query function.
|
|
857
|
+
* The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion
|
|
858
|
+
*
|
|
859
|
+
* The only required key is the items function which is used to query the contacts for suggestion.
|
|
860
|
+
* items({ query }) => { return [ContactObject]; }
|
|
861
|
+
* ContactObject format:
|
|
862
|
+
* { name: string, avatarSrc: string, id: string }
|
|
863
|
+
*
|
|
864
|
+
* When null, it does not add the plugin.
|
|
865
|
+
*/
|
|
866
|
+
mentionSuggestion: {
|
|
867
|
+
type: Object,
|
|
868
|
+
default: null
|
|
869
|
+
},
|
|
870
|
+
/**
|
|
871
|
+
* Whether the input allows for block quote.
|
|
872
|
+
*/
|
|
873
|
+
allowBlockquote: {
|
|
874
|
+
type: Boolean,
|
|
875
|
+
default: true
|
|
876
|
+
},
|
|
877
|
+
/**
|
|
878
|
+
* Whether the input allows for bold to be introduced in the text.
|
|
879
|
+
*/
|
|
880
|
+
allowBold: {
|
|
881
|
+
type: Boolean,
|
|
882
|
+
default: true
|
|
883
|
+
},
|
|
884
|
+
/**
|
|
885
|
+
* Whether the input allows for bullet list to be introduced in the text.
|
|
886
|
+
*/
|
|
887
|
+
allowBulletList: {
|
|
888
|
+
type: Boolean,
|
|
889
|
+
default: true
|
|
890
|
+
},
|
|
891
|
+
/**
|
|
892
|
+
* Whether the input allows for italic to be introduced in the text.
|
|
893
|
+
*/
|
|
894
|
+
allowItalic: {
|
|
895
|
+
type: Boolean,
|
|
896
|
+
default: true
|
|
897
|
+
},
|
|
898
|
+
/**
|
|
899
|
+
* Whether the input allows for strike to be introduced in the text.
|
|
900
|
+
*/
|
|
901
|
+
allowStrike: {
|
|
902
|
+
type: Boolean,
|
|
903
|
+
default: true
|
|
904
|
+
},
|
|
905
|
+
/**
|
|
906
|
+
* Whether the input allows for underline to be introduced in the text.
|
|
907
|
+
*/
|
|
908
|
+
allowUnderline: {
|
|
909
|
+
type: Boolean,
|
|
910
|
+
default: true
|
|
911
|
+
}
|
|
912
|
+
},
|
|
913
|
+
emits: [
|
|
914
|
+
/**
|
|
915
|
+
* Editor input event
|
|
916
|
+
* @event input
|
|
917
|
+
* @type {String|JSON}
|
|
918
|
+
*/
|
|
919
|
+
"input",
|
|
920
|
+
/**
|
|
921
|
+
* Event to sync the value with the parent
|
|
922
|
+
* @event input
|
|
923
|
+
* @type {String|JSON}
|
|
924
|
+
*/
|
|
925
|
+
"update:modelValue",
|
|
926
|
+
/**
|
|
927
|
+
* Editor blur event
|
|
928
|
+
* @event blur
|
|
929
|
+
* @type {FocusEvent}
|
|
930
|
+
*/
|
|
931
|
+
"blur",
|
|
932
|
+
/**
|
|
933
|
+
* Editor focus event
|
|
934
|
+
* @event focus
|
|
935
|
+
* @type {FocusEvent}
|
|
936
|
+
*/
|
|
937
|
+
"focus"
|
|
938
|
+
],
|
|
939
|
+
data() {
|
|
940
|
+
return {
|
|
941
|
+
editor: null,
|
|
942
|
+
popoverOpened: false
|
|
943
|
+
};
|
|
944
|
+
},
|
|
945
|
+
computed: {
|
|
946
|
+
// eslint-disable-next-line complexity
|
|
947
|
+
extensions() {
|
|
948
|
+
const extensions = [Document, Paragraph, Text];
|
|
949
|
+
if (this.link) {
|
|
950
|
+
extensions.push(this.getExtension(Link, this.link));
|
|
951
|
+
}
|
|
952
|
+
if (this.allowBlockquote) {
|
|
953
|
+
extensions.push(Blockquote);
|
|
954
|
+
}
|
|
955
|
+
if (this.allowBold) {
|
|
956
|
+
extensions.push(Bold);
|
|
957
|
+
}
|
|
958
|
+
if (this.allowBulletList) {
|
|
959
|
+
extensions.push(BulletList);
|
|
960
|
+
extensions.push(ListItem);
|
|
961
|
+
extensions.push(OrderedList.configure({
|
|
962
|
+
itemTypeName: "listItem"
|
|
963
|
+
}));
|
|
964
|
+
}
|
|
965
|
+
if (this.allowItalic) {
|
|
966
|
+
extensions.push(Italic);
|
|
967
|
+
}
|
|
968
|
+
if (this.allowStrike) {
|
|
969
|
+
extensions.push(Strike);
|
|
970
|
+
}
|
|
971
|
+
if (this.allowUnderline) {
|
|
972
|
+
extensions.push(Underline);
|
|
973
|
+
}
|
|
974
|
+
extensions.push(
|
|
975
|
+
Placeholder.configure({ placeholder: this.placeholder })
|
|
976
|
+
);
|
|
977
|
+
if (!this.allowLineBreaks) {
|
|
978
|
+
extensions.push(
|
|
979
|
+
HardBreak.extend({
|
|
980
|
+
addKeyboardShortcuts() {
|
|
981
|
+
return {
|
|
982
|
+
Enter: () => true,
|
|
983
|
+
"Shift-Enter": () => this.editor.commands.first(({ commands }) => [
|
|
984
|
+
() => commands.newlineInCode(),
|
|
985
|
+
() => commands.createParagraphNear(),
|
|
986
|
+
() => commands.liftEmptyBlock(),
|
|
987
|
+
() => commands.splitBlock()
|
|
988
|
+
])
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
})
|
|
992
|
+
);
|
|
993
|
+
}
|
|
994
|
+
extensions.push(TipTapLink.extend({ inclusive: false }).configure({
|
|
995
|
+
autolink: true,
|
|
996
|
+
protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
|
|
997
|
+
}));
|
|
998
|
+
if (this.mentionSuggestion) {
|
|
999
|
+
const suggestionObject = { ...this.mentionSuggestion, ...suggestion };
|
|
1000
|
+
extensions.push(MentionPlugin.configure({ suggestion: suggestionObject }));
|
|
1001
|
+
}
|
|
1002
|
+
extensions.push(Emoji);
|
|
1003
|
+
extensions.push(TextAlign.configure({
|
|
1004
|
+
types: ["paragraph"],
|
|
1005
|
+
defaultAlignment: "left"
|
|
1006
|
+
}));
|
|
1007
|
+
extensions.push(CodeBlock.configure({
|
|
1008
|
+
HTMLAttributes: {
|
|
1009
|
+
class: "dt-rich-text-editor--code-block"
|
|
1010
|
+
}
|
|
1011
|
+
}));
|
|
1012
|
+
return extensions;
|
|
1013
|
+
},
|
|
1014
|
+
inputAttrs() {
|
|
1015
|
+
const attrs = {
|
|
1016
|
+
"aria-label": this.inputAriaLabel,
|
|
1017
|
+
"aria-multiline": true,
|
|
1018
|
+
role: "textbox"
|
|
1019
|
+
};
|
|
1020
|
+
if (!this.editable) {
|
|
1021
|
+
attrs["aria-readonly"] = true;
|
|
1022
|
+
}
|
|
1023
|
+
return attrs;
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
/**
|
|
1027
|
+
* Because the Editor instance is initialized when mounted it does not get
|
|
1028
|
+
* updated props automatically, so the ones that can change after mount have
|
|
1029
|
+
* to be hooked up to the Editor's own API.
|
|
1030
|
+
*/
|
|
1031
|
+
watch: {
|
|
1032
|
+
editable(isEditable) {
|
|
1033
|
+
this.editor.setEditable(isEditable);
|
|
1034
|
+
this.updateEditorAttributes({ "aria-readonly": !isEditable });
|
|
1035
|
+
},
|
|
1036
|
+
inputClass(newClass) {
|
|
1037
|
+
this.updateEditorAttributes({ class: newClass });
|
|
1038
|
+
},
|
|
1039
|
+
inputAriaLabel(newLabel) {
|
|
1040
|
+
this.updateEditorAttributes({ "aria-label": newLabel });
|
|
1041
|
+
},
|
|
1042
|
+
extensions() {
|
|
1043
|
+
this.destroyEditor();
|
|
1044
|
+
this.createEditor();
|
|
1045
|
+
},
|
|
1046
|
+
modelValue(newValue) {
|
|
1047
|
+
let currentValue = this.getOutput();
|
|
1048
|
+
if (this.outputFormat === "json") {
|
|
1049
|
+
newValue = JSON.stringify(newValue);
|
|
1050
|
+
currentValue = JSON.stringify(currentValue);
|
|
1051
|
+
}
|
|
1052
|
+
if (newValue === currentValue) {
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
this.editor.commands.setContent(newValue, false);
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
1058
|
+
created() {
|
|
1059
|
+
this.createEditor();
|
|
1060
|
+
},
|
|
1061
|
+
beforeUnmount() {
|
|
1062
|
+
this.destroyEditor();
|
|
1063
|
+
},
|
|
1064
|
+
methods: {
|
|
1065
|
+
createEditor() {
|
|
1066
|
+
this.editor = new vue3.Editor({
|
|
1067
|
+
autofocus: this.autoFocus,
|
|
1068
|
+
content: this.modelValue,
|
|
1069
|
+
editable: this.editable,
|
|
1070
|
+
extensions: this.extensions,
|
|
1071
|
+
editorProps: {
|
|
1072
|
+
attributes: {
|
|
1073
|
+
...this.inputAttrs,
|
|
1074
|
+
class: this.inputClass
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
this.addEditorListeners();
|
|
1079
|
+
},
|
|
1080
|
+
destroyEditor() {
|
|
1081
|
+
this.editor.destroy();
|
|
1082
|
+
},
|
|
1083
|
+
/**
|
|
1084
|
+
* The Editor exposes event hooks that we have to map our emits into. See
|
|
1085
|
+
* https://tiptap.dev/api/events for all events.
|
|
1086
|
+
*/
|
|
1087
|
+
addEditorListeners() {
|
|
1088
|
+
this.editor.on("update", () => {
|
|
1089
|
+
const value = this.getOutput();
|
|
1090
|
+
this.$emit("input", value);
|
|
1091
|
+
this.$emit("update:modelValue", value);
|
|
1092
|
+
});
|
|
1093
|
+
this.editor.on("focus", ({ event }) => {
|
|
1094
|
+
this.$emit("focus", event);
|
|
1095
|
+
});
|
|
1096
|
+
this.editor.on("blur", ({ event }) => {
|
|
1097
|
+
this.$emit("blur", event);
|
|
1098
|
+
});
|
|
1099
|
+
},
|
|
1100
|
+
getOutput() {
|
|
1101
|
+
switch (this.outputFormat) {
|
|
1102
|
+
case "json":
|
|
1103
|
+
return this.editor.getJSON();
|
|
1104
|
+
case "html":
|
|
1105
|
+
return this.editor.getHTML();
|
|
1106
|
+
case "text":
|
|
1107
|
+
default:
|
|
1108
|
+
return this.editor.getText();
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
getExtension(extension, options) {
|
|
1112
|
+
var _a;
|
|
1113
|
+
if (typeof options === "boolean") {
|
|
1114
|
+
return extension;
|
|
1115
|
+
}
|
|
1116
|
+
return (_a = extension.configure) == null ? void 0 : _a.call(extension, options);
|
|
1117
|
+
},
|
|
1118
|
+
updateEditorAttributes(attributes) {
|
|
1119
|
+
this.editor.setOptions({ editorProps: { attributes } });
|
|
1120
|
+
},
|
|
1121
|
+
focusEditor() {
|
|
1122
|
+
this.editor.commands.focus();
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1127
|
+
const _component_editor_content = vue.resolveComponent("editor-content");
|
|
1128
|
+
return vue.openBlock(), vue.createBlock(_component_editor_content, {
|
|
1129
|
+
editor: $data.editor,
|
|
1130
|
+
"data-qa": "dt-rich-text-editor",
|
|
1131
|
+
class: "dt-rich-text-editor"
|
|
1132
|
+
}, null, 8, ["editor"]);
|
|
1133
|
+
}
|
|
1134
|
+
const DtRichTextEditor = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
1135
|
+
exports.DtRichTextEditor = DtRichTextEditor;
|
|
1136
|
+
exports.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES = RICH_TEXT_EDITOR_AUTOFOCUS_TYPES;
|
|
1137
|
+
exports.RICH_TEXT_EDITOR_OUTPUT_FORMATS = RICH_TEXT_EDITOR_OUTPUT_FORMATS;
|
|
2
1138
|
//# sourceMappingURL=rich-text-editor.cjs.map
|