@onereach/ui-components 2.68.0-beta.1987.0 → 2.68.0-beta.2002.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/bundled/v2/{OrBottomSheet-04956f50.js → OrBottomSheet-7b5760dc.js} +1 -1
- package/dist/bundled/v2/{OrCardCollection-852db65c.js → OrCardCollection-95b8a8e0.js} +2 -2
- package/dist/bundled/v2/{OrCode-edc7a1f5.js → OrCode-0cd991a1.js} +1 -114
- package/dist/bundled/v2/{OrConfirm-c3736a7e.js → OrConfirm-22c7622d.js} +15 -2
- package/dist/bundled/v2/{OrIconButton-a046f34f.js → OrIconButton-2bf36347.js} +1 -1
- package/dist/bundled/v2/{OrInlineInput-fb1e1272.js → OrInlineInput-36077390.js} +1 -1
- package/dist/bundled/v2/{OrInlineTextarea-c6a26156.js → OrInlineTextarea-17b16ca8.js} +1 -1
- package/dist/bundled/v2/{OrInput-2e2c8270.js → OrInput-95fc5b53.js} +1 -1
- package/dist/bundled/v2/{OrMenu-e8c5d2e7.js → OrMenu-5ac06751.js} +1 -1
- package/dist/bundled/v2/{OrModal-de2364b3.js → OrModal-387348ca.js} +15 -2
- package/dist/bundled/v2/{OrNotification-ddef2348.js → OrNotification-1fa0b14e.js} +1 -1
- package/dist/bundled/v2/{OrOverlay-57ce6c73.js → OrOverlay-3c89d622.js} +1 -1
- package/dist/bundled/v2/{OrPopover-7a6c1cd4.js → OrPopover-2f48b854.js} +2 -2
- package/dist/bundled/v2/OrRichTextEditor-898d67d5.js +36828 -0
- package/dist/bundled/v2/{OrSearch-691ecd1a.js → OrSearch-43daeb79.js} +1 -1
- package/dist/bundled/v2/{OrSelect-b3c60dbc.js → OrSelect-dff64667.js} +3 -3
- package/dist/bundled/v2/{OrTabs-edd7cde4.js → OrTabs-2d4e0d87.js} +1 -1
- package/dist/bundled/v2/{OrTag-76a86a27.js → OrTag-bc654163.js} +1 -1
- package/dist/bundled/v2/{OrTooltip-e97b3f3c.js → OrTooltip-d1764f37.js} +1 -1
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +23 -20
- package/dist/bundled/v2/components/or-bottom-sheet-v3/index.js +3 -3
- package/dist/bundled/v2/components/or-card-collection-v3/index.js +8 -8
- package/dist/bundled/v2/components/or-code/index.js +2 -1
- package/dist/bundled/v2/components/or-confirm-v3/OrConfirm.stories3.d.ts +5 -0
- package/dist/bundled/v2/components/or-confirm-v3/OrConfirm.vue.d.ts +11 -0
- package/dist/bundled/v2/components/or-confirm-v3/index.js +8 -8
- package/dist/bundled/v2/components/or-icon-button-v3/index.js +6 -6
- package/dist/bundled/v2/components/or-inline-input-v3/index.js +7 -7
- package/dist/bundled/v2/components/or-inline-textarea-v3/index.js +7 -7
- package/dist/bundled/v2/components/or-input-v3/index.js +7 -7
- package/dist/bundled/v2/components/or-menu-v3/index.js +5 -5
- package/dist/bundled/v2/components/or-modal-v3/OrModal.stories3.d.ts +10 -0
- package/dist/bundled/v2/components/or-modal-v3/OrModal.vue.d.ts +11 -0
- package/dist/bundled/v2/components/or-modal-v3/index.js +7 -7
- package/dist/bundled/v2/components/or-notification-v3/index.js +7 -7
- package/dist/bundled/v2/components/or-overlay-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-popover-v3/index.js +4 -4
- package/dist/bundled/v2/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts +12 -0
- package/dist/bundled/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +149 -0
- package/dist/bundled/v2/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/bundled/v2/components/or-rich-text-editor-v3/index.js +24 -0
- package/dist/bundled/v2/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/bundled/v2/components/or-search-v3/index.js +8 -8
- package/dist/bundled/v2/components/or-select-v3/index.js +9 -9
- package/dist/bundled/v2/components/or-tabs-v3/index.js +6 -6
- package/dist/bundled/v2/components/or-tag-v3/index.js +7 -7
- package/dist/bundled/v2/components/or-toast-v3/index.js +7 -7
- package/dist/bundled/v2/components/or-tooltip-v3/index.js +5 -5
- package/dist/bundled/v2/hooks/index.js +1 -1
- package/dist/bundled/v2/index.es-3f39f316.js +115 -0
- package/dist/bundled/v2/index.js +24 -21
- package/dist/bundled/v2/{types-9c0f214b.js → types-4c07bc42.js} +1 -1
- package/dist/bundled/v2/{useElevation-604d48c6.js → useElevation-aac032f4.js} +5 -1
- package/dist/bundled/v2/utils/isVisible.d.ts +2 -0
- package/dist/bundled/v3/{OrBottomSheet.vue_vue_type_script_lang-9b8931d3.js → OrBottomSheet.vue_vue_type_script_lang-44d8147a.js} +1 -1
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-955758d3.js → OrCardCollection.vue_vue_type_script_lang-412c8977.js} +4 -4
- package/dist/bundled/v3/{OrCode.vue_vue_type_script_lang-ef5e7f04.js → OrCode.vue_vue_type_script_lang-6c5f94a6.js} +1 -114
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-e59a7aca.js → OrConfirm.vue_vue_type_script_lang-20ffe5df.js} +17 -4
- package/dist/bundled/v3/{OrIconButton-c521fef8.js → OrIconButton-00ab6c2d.js} +1 -1
- package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-a834417f.js → OrIconButton.vue_vue_type_script_lang-b35040f9.js} +1 -1
- package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-c2a171bb.js → OrInlineInput.vue_vue_type_script_lang-e29642fc.js} +2 -2
- package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-76f1a0ee.js → OrInlineTextarea.vue_vue_type_script_lang-551028ef.js} +2 -2
- package/dist/bundled/v3/{OrInput-42bbab4d.js → OrInput-4b4b8316.js} +1 -1
- package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-d85ed216.js → OrInput.vue_vue_type_script_lang-b4176d70.js} +2 -2
- package/dist/bundled/v3/OrMenu-08aa60de.js +29 -0
- package/dist/bundled/v3/{OrMenu.vue_vue_type_script_lang-be8c502d.js → OrMenu.vue_vue_type_script_lang-bae45062.js} +2 -2
- package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-1ad15097.js → OrModal.vue_vue_type_script_lang-f3f5a84b.js} +17 -4
- package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-3f69b727.js → OrNotification.vue_vue_type_script_lang-83bfbfc4.js} +2 -2
- package/dist/bundled/v3/{OrOverlay.vue_vue_type_script_lang-4551114e.js → OrOverlay.vue_vue_type_script_lang-cb3aad0c.js} +1 -1
- package/dist/bundled/v3/{OrPopover-18a195aa.js → OrPopover-93ef8c26.js} +1 -1
- package/dist/bundled/v3/{OrPopover.vue_vue_type_script_lang-1ed6063d.js → OrPopover.vue_vue_type_script_lang-e200f5be.js} +3 -3
- package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-2e607f79.js +36708 -0
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-d7c29ff6.js → OrSearch.vue_vue_type_script_lang-00db292e.js} +2 -2
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-12ad06b5.js → OrSelect.vue_vue_type_script_lang-d7449846.js} +5 -5
- package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-ec81a576.js → OrTabs.vue_vue_type_script_lang-2fdbd2f2.js} +10 -36
- package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-d7e117c8.js → OrTag.vue_vue_type_script_lang-6be84bb9.js} +2 -2
- package/dist/bundled/v3/{OrToastContainer-1c3ccf65.js → OrToastContainer-c09c94da.js} +1 -1
- package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-d89a9e51.js → OrTooltip.vue_vue_type_script_lang-a4168546.js} +2 -2
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +27 -23
- package/dist/bundled/v3/components/or-bottom-sheet-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-card-collection-v3/index.js +11 -11
- package/dist/bundled/v3/components/or-code/index.js +2 -1
- package/dist/bundled/v3/components/or-confirm-v3/OrConfirm.stories3.d.ts +5 -0
- package/dist/bundled/v3/components/or-confirm-v3/OrConfirm.vue.d.ts +11 -0
- package/dist/bundled/v3/components/or-confirm-v3/index.js +11 -11
- package/dist/bundled/v3/components/or-icon-button-v3/index.js +7 -7
- package/dist/bundled/v3/components/or-inline-input-v3/index.js +9 -9
- package/dist/bundled/v3/components/or-inline-textarea-v3/index.js +9 -9
- package/dist/bundled/v3/components/or-input-v3/index.js +9 -9
- package/dist/bundled/v3/components/or-menu-v3/index.js +6 -6
- package/dist/bundled/v3/components/or-modal-v3/OrModal.stories3.d.ts +10 -0
- package/dist/bundled/v3/components/or-modal-v3/OrModal.vue.d.ts +11 -0
- package/dist/bundled/v3/components/or-modal-v3/index.js +9 -9
- package/dist/bundled/v3/components/or-notification-v3/index.js +9 -9
- package/dist/bundled/v3/components/or-overlay-v3/index.js +2 -2
- package/dist/bundled/v3/components/or-popover-v3/index.js +4 -4
- package/dist/bundled/v3/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts +12 -0
- package/dist/bundled/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +149 -0
- package/dist/bundled/v3/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/bundled/v3/components/or-rich-text-editor-v3/index.js +25 -0
- package/dist/bundled/v3/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/bundled/v3/components/or-search-v3/index.js +11 -11
- package/dist/bundled/v3/components/or-select-v3/index.js +12 -12
- package/dist/bundled/v3/components/or-tabs-v3/index.js +8 -7
- package/dist/bundled/v3/components/or-tag-v3/index.js +9 -9
- package/dist/bundled/v3/components/or-toast-v3/index.js +10 -10
- package/dist/bundled/v3/components/or-tooltip-v3/index.js +6 -6
- package/dist/bundled/v3/hooks/index.js +1 -1
- package/dist/bundled/v3/index.es-3f39f316.js +115 -0
- package/dist/bundled/v3/index.js +303 -208
- package/dist/bundled/v3/{types-577637c4.js → types-bc0d88d7.js} +3 -3
- package/dist/bundled/v3/{useElevation-6aea372d.js → useElevation-c8d5d3ba.js} +5 -1
- package/dist/bundled/v3/utils/isVisible.d.ts +2 -0
- package/dist/esm/v2/{OrBottomSheet-f09adbbb.js → OrBottomSheet-5acd034f.js} +1 -1
- package/dist/esm/v2/{OrCardCollection-a3ddee38.js → OrCardCollection-799ab8bd.js} +2 -2
- package/dist/esm/v2/{OrConfirm-def2218a.js → OrConfirm-367ac968.js} +15 -2
- package/dist/esm/v2/{OrIconButton-bc8a8b2e.js → OrIconButton-a7764de4.js} +2 -2
- package/dist/esm/v2/{OrInlineInput-5c99926f.js → OrInlineInput-00fbe0a7.js} +1 -1
- package/dist/esm/v2/{OrInlineTextarea-a67f2376.js → OrInlineTextarea-b4740a94.js} +1 -1
- package/dist/esm/v2/{OrInput-b0619ac3.js → OrInput-946ef514.js} +1 -1
- package/dist/esm/v2/{OrMenu-8ca8233e.js → OrMenu-e7210edc.js} +1 -1
- package/dist/esm/v2/{OrModal-96fa7ba5.js → OrModal-5c92cdc8.js} +15 -2
- package/dist/esm/v2/{OrNotification-23f97c3d.js → OrNotification-9862ce5f.js} +1 -1
- package/dist/esm/v2/{OrOverlay-4838a9b0.js → OrOverlay-18ba2dc6.js} +1 -1
- package/dist/esm/v2/{OrPopover-ba3ddf1a.js → OrPopover-ef8c91f1.js} +2 -2
- package/dist/esm/v2/OrRichTextEditor-6bc37dc4.js +516 -0
- package/dist/esm/v2/{OrSearch-37e43e3e.js → OrSearch-18bf00f3.js} +1 -1
- package/dist/esm/v2/{OrSelect-8bdaac4f.js → OrSelect-858c2f46.js} +3 -3
- package/dist/esm/v2/{OrTabs-0d8ffa3d.js → OrTabs-c64be432.js} +2 -2
- package/dist/esm/v2/{OrTag-f02ededa.js → OrTag-23631e25.js} +1 -1
- package/dist/esm/v2/{OrTooltip-2d423c46.js → OrTooltip-3454c2e6.js} +1 -1
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +38 -19
- package/dist/esm/v2/components/or-bottom-sheet-v3/index.js +3 -3
- package/dist/esm/v2/components/or-card-collection-v3/index.js +8 -8
- package/dist/esm/v2/components/or-confirm-v3/OrConfirm.stories3.d.ts +5 -0
- package/dist/esm/v2/components/or-confirm-v3/OrConfirm.vue.d.ts +11 -0
- package/dist/esm/v2/components/or-confirm-v3/index.js +8 -8
- package/dist/esm/v2/components/or-icon-button-v3/index.js +6 -6
- package/dist/esm/v2/components/or-inline-input-v3/index.js +7 -7
- package/dist/esm/v2/components/or-inline-textarea-v3/index.js +7 -7
- package/dist/esm/v2/components/or-input-v3/index.js +7 -7
- package/dist/esm/v2/components/or-menu-v3/index.js +5 -5
- package/dist/esm/v2/components/or-modal-v3/OrModal.stories3.d.ts +10 -0
- package/dist/esm/v2/components/or-modal-v3/OrModal.vue.d.ts +11 -0
- package/dist/esm/v2/components/or-modal-v3/index.js +7 -7
- package/dist/esm/v2/components/or-notification-v3/index.js +7 -7
- package/dist/esm/v2/components/or-overlay-v3/index.js +2 -2
- package/dist/esm/v2/components/or-popover-v3/index.js +4 -4
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts +12 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +149 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +38 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v2/components/or-search-v3/index.js +8 -8
- package/dist/esm/v2/components/or-select-v3/index.js +9 -9
- package/dist/esm/v2/components/or-tabs-v3/index.js +6 -6
- package/dist/esm/v2/components/or-tag-v3/index.js +7 -7
- package/dist/esm/v2/components/or-toast-v3/index.js +7 -7
- package/dist/esm/v2/components/or-tooltip-v3/index.js +5 -5
- package/dist/esm/v2/hooks/index.js +1 -1
- package/dist/esm/v2/index.js +38 -19
- package/dist/esm/v2/{types-d3101ac7.js → types-e2beb2b6.js} +1 -1
- package/dist/esm/{v3/useElevation-0e973238.js → v2/useElevation-31bfe1f6.js} +5 -1
- package/dist/esm/v2/utils/isVisible.d.ts +2 -0
- package/dist/esm/v3/{OrBottomSheet-9de57dd0.js → OrBottomSheet-0eb33b18.js} +1 -1
- package/dist/esm/v3/{OrCardCollection-1e3b3360.js → OrCardCollection-2d34eaaf.js} +2 -2
- package/dist/esm/v3/{OrConfirm-6645a8c2.js → OrConfirm-e6735cc8.js} +15 -2
- package/dist/esm/v3/{OrIconButton-6c0732ac.js → OrIconButton-85abafab.js} +2 -2
- package/dist/esm/v3/{OrInlineInput-4cd64402.js → OrInlineInput-299e2275.js} +1 -1
- package/dist/esm/v3/{OrInlineTextarea-93f80904.js → OrInlineTextarea-40ee5ffb.js} +1 -1
- package/dist/esm/v3/{OrInput-69f8dce1.js → OrInput-4f55c0eb.js} +1 -1
- package/dist/esm/v3/{OrMenu-00f7c4a8.js → OrMenu-d9e12030.js} +1 -1
- package/dist/esm/v3/{OrModal-88c56141.js → OrModal-420174c4.js} +15 -2
- package/dist/esm/v3/{OrNotification-d3d6f51d.js → OrNotification-54394fc8.js} +1 -1
- package/dist/esm/v3/{OrOverlay-27050c19.js → OrOverlay-738a44d5.js} +1 -1
- package/dist/esm/v3/{OrPopover-67000227.js → OrPopover-94a8f21d.js} +2 -2
- package/dist/esm/v3/OrRichTextEditor-a5d38e89.js +486 -0
- package/dist/esm/v3/{OrSearch-1b68ba58.js → OrSearch-d74891a5.js} +1 -1
- package/dist/esm/v3/{OrSelect-1fa435c6.js → OrSelect-b3a233cc.js} +3 -3
- package/dist/esm/v3/{OrTabs-a0590a70.js → OrTabs-6a8fa516.js} +2 -2
- package/dist/esm/v3/{OrTag-1202497c.js → OrTag-6c3717e0.js} +1 -1
- package/dist/esm/v3/{OrTooltip-32048f0e.js → OrTooltip-1500a1cd.js} +1 -1
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +38 -19
- package/dist/esm/v3/components/or-bottom-sheet-v3/index.js +3 -3
- package/dist/esm/v3/components/or-card-collection-v3/index.js +8 -8
- package/dist/esm/v3/components/or-confirm-v3/OrConfirm.stories3.d.ts +5 -0
- package/dist/esm/v3/components/or-confirm-v3/OrConfirm.vue.d.ts +11 -0
- package/dist/esm/v3/components/or-confirm-v3/index.js +8 -8
- package/dist/esm/v3/components/or-icon-button-v3/index.js +6 -6
- package/dist/esm/v3/components/or-inline-input-v3/index.js +7 -7
- package/dist/esm/v3/components/or-inline-textarea-v3/index.js +7 -7
- package/dist/esm/v3/components/or-input-v3/index.js +7 -7
- package/dist/esm/v3/components/or-menu-v3/index.js +5 -5
- package/dist/esm/v3/components/or-modal-v3/OrModal.stories3.d.ts +10 -0
- package/dist/esm/v3/components/or-modal-v3/OrModal.vue.d.ts +11 -0
- package/dist/esm/v3/components/or-modal-v3/index.js +7 -7
- package/dist/esm/v3/components/or-notification-v3/index.js +7 -7
- package/dist/esm/v3/components/or-overlay-v3/index.js +2 -2
- package/dist/esm/v3/components/or-popover-v3/index.js +4 -4
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.d.ts +12 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +149 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +37 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v3/components/or-search-v3/index.js +8 -8
- package/dist/esm/v3/components/or-select-v3/index.js +9 -9
- package/dist/esm/v3/components/or-tabs-v3/index.js +6 -6
- package/dist/esm/v3/components/or-tag-v3/index.js +7 -7
- package/dist/esm/v3/components/or-toast-v3/index.js +7 -7
- package/dist/esm/v3/components/or-tooltip-v3/index.js +5 -5
- package/dist/esm/v3/hooks/index.js +1 -1
- package/dist/esm/v3/index.js +38 -19
- package/dist/esm/v3/{types-90a49024.js → types-98a852d8.js} +1 -1
- package/dist/esm/{v2/useElevation-0e973238.js → v3/useElevation-31bfe1f6.js} +5 -1
- package/dist/esm/v3/utils/isVisible.d.ts +2 -0
- package/package.json +20 -2
- package/src/components/index.ts +1 -0
- package/src/components/or-confirm-v3/OrConfirm.stories3.ts +60 -0
- package/src/components/or-confirm-v3/OrConfirm.vue +12 -0
- package/src/components/or-modal-v3/OrModal.docs.mdx +1 -1
- package/src/components/or-modal-v3/OrModal.stories3.ts +137 -0
- package/src/components/or-modal-v3/OrModal.vue +12 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +16 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +62 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +520 -0
- package/src/components/or-rich-text-editor-v3/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/styles.ts +65 -0
- package/src/hooks/useElevation.ts +3 -1
- package/src/utils/isVisible.ts +5 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:class="rootStyles"
|
|
6
|
+
>
|
|
7
|
+
<or-label>
|
|
8
|
+
{{ description }}
|
|
9
|
+
</or-label>
|
|
10
|
+
<div
|
|
11
|
+
ref="containerRef"
|
|
12
|
+
:class="containerStyles"
|
|
13
|
+
@click="handleEditorClick()"
|
|
14
|
+
>
|
|
15
|
+
<div :class="toolbarContainerStyles">
|
|
16
|
+
<div
|
|
17
|
+
v-for="tool in toolbar"
|
|
18
|
+
:key="tool"
|
|
19
|
+
:class="toolbarStyles"
|
|
20
|
+
>
|
|
21
|
+
<div
|
|
22
|
+
v-for="item in tool"
|
|
23
|
+
:key="item"
|
|
24
|
+
:class="toolbarButtonStyles(item)"
|
|
25
|
+
class="-my-xs"
|
|
26
|
+
>
|
|
27
|
+
<or-icon-button
|
|
28
|
+
v-if="item==='heading'"
|
|
29
|
+
ref="toolbarButtonRef"
|
|
30
|
+
:tooltip="{text: item, placement: 'top'}"
|
|
31
|
+
:icon="{icon: headingIcon, variant: 'inherit', size: 'm'}"
|
|
32
|
+
@click="menuRef.open()"
|
|
33
|
+
/>
|
|
34
|
+
<or-icon-button
|
|
35
|
+
v-else
|
|
36
|
+
:tooltip="{text: iconTooltipsEnum[item], placement: 'top'}"
|
|
37
|
+
:icon="{icon: iconsEnum[item], variant: 'inherit', size: 'm'}"
|
|
38
|
+
@click="handleToolbarClick(item)"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<div
|
|
44
|
+
ref="editorRef"
|
|
45
|
+
:class="editorInputStyles"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
<or-menu
|
|
49
|
+
v-if="toolbarButtonRef"
|
|
50
|
+
ref="menuRef"
|
|
51
|
+
:trigger="toolbarButtonRef[getIndexOfHeading].root"
|
|
52
|
+
placement="bottom-start"
|
|
53
|
+
>
|
|
54
|
+
<or-menu-item
|
|
55
|
+
v-for="heading in headingLevels"
|
|
56
|
+
:key="heading"
|
|
57
|
+
@click="handleToolbarClick('heading', heading)"
|
|
58
|
+
>
|
|
59
|
+
Heading {{ heading }}
|
|
60
|
+
</or-menu-item>
|
|
61
|
+
<or-menu-item
|
|
62
|
+
@click="handleToolbarClick('heading')"
|
|
63
|
+
>
|
|
64
|
+
None
|
|
65
|
+
</or-menu-item>
|
|
66
|
+
</or-menu>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script lang="ts">
|
|
71
|
+
import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
|
|
72
|
+
import { useClassAttribute } from '../../hooks';
|
|
73
|
+
import {
|
|
74
|
+
MarkdownSerializer as ProseMirrorMarkdownSerializer,
|
|
75
|
+
defaultMarkdownSerializer,
|
|
76
|
+
} from 'prosemirror-markdown';
|
|
77
|
+
import { DOMParser as ProseMirrorDOMParser, Node, Mark } from 'prosemirror-model';
|
|
78
|
+
import { marked } from 'marked';
|
|
79
|
+
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
80
|
+
import { OrLabelV3 as OrLabel } from '../or-label-v3';
|
|
81
|
+
import { OrMenuV3 as OrMenu } from '../or-menu-v3';
|
|
82
|
+
import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
|
|
83
|
+
import {
|
|
84
|
+
EditorContainer,
|
|
85
|
+
ToolbarContainer,
|
|
86
|
+
Toolbar,
|
|
87
|
+
ToolbarButtonActive,
|
|
88
|
+
ToolbarButton,
|
|
89
|
+
EditorInput,
|
|
90
|
+
} from './styles';
|
|
91
|
+
|
|
92
|
+
import { Editor, mergeAttributes } from '@tiptap/core';
|
|
93
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
94
|
+
import Underline from '@tiptap/extension-underline';
|
|
95
|
+
import Link from '@tiptap/extension-link';
|
|
96
|
+
import Highlight from '@tiptap/extension-highlight';
|
|
97
|
+
import Heading, { Level } from '@tiptap/extension-heading';
|
|
98
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
99
|
+
import Paragraph from '@tiptap/extension-paragraph';
|
|
100
|
+
import BulletList from '@tiptap/extension-bullet-list';
|
|
101
|
+
import ListItem from '@tiptap/extension-list-item';
|
|
102
|
+
import OrderedList from '@tiptap/extension-ordered-list';
|
|
103
|
+
import Strike from '@tiptap/extension-strike';
|
|
104
|
+
import Italic from '@tiptap/extension-italic';
|
|
105
|
+
import HardBreak from '@tiptap/extension-hard-break';
|
|
106
|
+
import Bold from '@tiptap/extension-bold';
|
|
107
|
+
|
|
108
|
+
export default defineComponent({
|
|
109
|
+
name: 'OrRichTextEditor',
|
|
110
|
+
|
|
111
|
+
components: {
|
|
112
|
+
OrIconButton,
|
|
113
|
+
OrLabel,
|
|
114
|
+
OrMenuItem,
|
|
115
|
+
OrMenu,
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
inheritAttrs: false,
|
|
119
|
+
|
|
120
|
+
props: {
|
|
121
|
+
modelValue: {
|
|
122
|
+
type: String,
|
|
123
|
+
default: '',
|
|
124
|
+
required: false,
|
|
125
|
+
},
|
|
126
|
+
toolbar: {
|
|
127
|
+
type: Array,
|
|
128
|
+
default: () => [['heading'], ['bold', 'italic', 'strike'], ['underline', 'highlight'], ['link'], ['bulletList', 'orderedList'], ['undo', 'redo']],
|
|
129
|
+
},
|
|
130
|
+
description: {
|
|
131
|
+
type: String,
|
|
132
|
+
default: 'Description',
|
|
133
|
+
},
|
|
134
|
+
placeholder: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: 'Write something...',
|
|
137
|
+
},
|
|
138
|
+
autofocus: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: false,
|
|
141
|
+
},
|
|
142
|
+
markdown: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
default: true,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
emits: ['update:modelValue'],
|
|
149
|
+
|
|
150
|
+
setup(props, { emit }) {
|
|
151
|
+
// Refs
|
|
152
|
+
let editor = null as Editor | null;
|
|
153
|
+
const editorRef = ref<HTMLDivElement>();
|
|
154
|
+
const containerRef = ref<HTMLDivElement>();
|
|
155
|
+
const toolbarButtonRef = ref<InstanceType<typeof OrIconButton>>();
|
|
156
|
+
const menuRef = ref<InstanceType<typeof OrMenu>>();
|
|
157
|
+
const isActive = ref<{[key: string]: boolean;}>({});
|
|
158
|
+
const headingLevels = [1, 2, 3, 4] as Level[];
|
|
159
|
+
const previousHeadingLevel = ref<Level>();
|
|
160
|
+
const activeHeadingLevel = ref<number>(0);
|
|
161
|
+
const markdownOutput = ref<string>('');
|
|
162
|
+
const iconsEnum = ref<{[key: string]: string;}>({
|
|
163
|
+
bold: 'format_bold',
|
|
164
|
+
italic: 'format_italic',
|
|
165
|
+
underline: 'format_underlined',
|
|
166
|
+
strike: 'format_strikethrough',
|
|
167
|
+
bulletList: 'format_list_bulleted',
|
|
168
|
+
orderedList: 'format_list_numbered',
|
|
169
|
+
link: 'link',
|
|
170
|
+
highlight: 'highlight',
|
|
171
|
+
redo: 'redo',
|
|
172
|
+
undo: 'undo',
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
const iconTooltipsEnum = ref<{[key: string]: string;}>({
|
|
176
|
+
bold: 'Bold',
|
|
177
|
+
italic: 'Italic',
|
|
178
|
+
underline: 'Underline',
|
|
179
|
+
strike: 'Strike',
|
|
180
|
+
bulletList: 'Bulleted List',
|
|
181
|
+
orderedList: 'Numbered List',
|
|
182
|
+
link: 'Link',
|
|
183
|
+
highlight: 'Highlight',
|
|
184
|
+
redo: 'Redo',
|
|
185
|
+
undo: 'Undo',
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const serializerMarks = {
|
|
189
|
+
...defaultMarkdownSerializer.marks,
|
|
190
|
+
[Bold.name]: defaultMarkdownSerializer.marks.strong,
|
|
191
|
+
[Strike.name]: {
|
|
192
|
+
open: '~~',
|
|
193
|
+
close: '~~',
|
|
194
|
+
mixable: true,
|
|
195
|
+
expelEnclosingWhitespace: true,
|
|
196
|
+
},
|
|
197
|
+
[Italic.name]: {
|
|
198
|
+
open: '_',
|
|
199
|
+
close: '_',
|
|
200
|
+
mixable: true,
|
|
201
|
+
expelEnclosingWhitespace: true,
|
|
202
|
+
},
|
|
203
|
+
[Highlight.name]: {
|
|
204
|
+
open: '==',
|
|
205
|
+
close: '==',
|
|
206
|
+
mixable: true,
|
|
207
|
+
expelEnclosingWhitespace: true,
|
|
208
|
+
},
|
|
209
|
+
[Link.name]: {
|
|
210
|
+
open(state: any, mark: Mark, parent: Node, index: number) {
|
|
211
|
+
return isPlainURL(mark, parent, index, 1) ? '<' : '[';
|
|
212
|
+
},
|
|
213
|
+
close(state: any, mark: Mark, parent: Node, index: number) {
|
|
214
|
+
const href = mark.attrs.canonicalSrc || mark.attrs.href;
|
|
215
|
+
|
|
216
|
+
return isPlainURL(mark, parent, index, -1)
|
|
217
|
+
? '>'
|
|
218
|
+
: `](${state.esc(href)}${
|
|
219
|
+
mark.attrs.title ? ` ${state.quote(mark.attrs.title)}` : ''
|
|
220
|
+
})`;
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const serializerNodes = {
|
|
227
|
+
...defaultMarkdownSerializer.nodes,
|
|
228
|
+
[Paragraph.name]: defaultMarkdownSerializer.nodes.paragraph,
|
|
229
|
+
[BulletList.name]: defaultMarkdownSerializer.nodes.bullet_list,
|
|
230
|
+
[ListItem.name]: defaultMarkdownSerializer.nodes.list_item,
|
|
231
|
+
[OrderedList.name]: defaultMarkdownSerializer.nodes.ordered_list,
|
|
232
|
+
[HardBreak.name]: defaultMarkdownSerializer.nodes.hard_break,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
onMounted(() => {
|
|
236
|
+
editor = new Editor({
|
|
237
|
+
onUpdate: ({ editor }) => {
|
|
238
|
+
setActiveFormats();
|
|
239
|
+
const html = editor.getHTML();
|
|
240
|
+
const text = editor.getText();
|
|
241
|
+
if (props.markdown) {
|
|
242
|
+
markdownOutput.value = serialize(editor.schema, editor.getJSON());
|
|
243
|
+
emit('update:modelValue', markdownOutput.value);
|
|
244
|
+
} else {
|
|
245
|
+
emit('update:modelValue', text === '' ? text : html);
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
onCreate: ({ editor }) => {
|
|
249
|
+
if (props.markdown) {
|
|
250
|
+
const deserialized = deserialize(editor.schema, props.modelValue);
|
|
251
|
+
// const deserialized = defaultMarkdownParser.parse(props.modelValue);
|
|
252
|
+
// editor.view.state.doc = deserialized as Node;
|
|
253
|
+
editor.commands.setContent(deserialized);
|
|
254
|
+
} else {
|
|
255
|
+
editor.commands.setContent(props.modelValue);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
element: editorRef.value,
|
|
259
|
+
autofocus: props.autofocus,
|
|
260
|
+
extensions: [
|
|
261
|
+
StarterKit.configure({
|
|
262
|
+
heading: false,
|
|
263
|
+
}),
|
|
264
|
+
Heading.configure({ levels: headingLevels }).extend({
|
|
265
|
+
levels: headingLevels,
|
|
266
|
+
renderHTML({ node, HTMLAttributes }) {
|
|
267
|
+
return [
|
|
268
|
+
'h' + node.attrs.level,
|
|
269
|
+
mergeAttributes(HTMLAttributes, {
|
|
270
|
+
class: `typography-headline-${node.attrs.level}`,
|
|
271
|
+
}),
|
|
272
|
+
0,
|
|
273
|
+
];
|
|
274
|
+
},
|
|
275
|
+
}),
|
|
276
|
+
Underline,
|
|
277
|
+
Link.configure({
|
|
278
|
+
openOnClick: true,
|
|
279
|
+
linkOnPaste: true,
|
|
280
|
+
autolink: false,
|
|
281
|
+
protocols: ['ftp', 'mailto', 'http', 'https'],
|
|
282
|
+
validate: href => /^https?:\/\//.test(href),
|
|
283
|
+
HTMLAttributes: {
|
|
284
|
+
class: 'text-primary cursor-pointer',
|
|
285
|
+
},
|
|
286
|
+
}),
|
|
287
|
+
Highlight,
|
|
288
|
+
Placeholder
|
|
289
|
+
.configure({
|
|
290
|
+
placeholder: props.placeholder,
|
|
291
|
+
emptyEditorClass: 'is-editor-empty text-outline',
|
|
292
|
+
}),
|
|
293
|
+
],
|
|
294
|
+
editorProps: {
|
|
295
|
+
attributes: {
|
|
296
|
+
class: 'focus:outline-none',
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
});
|
|
300
|
+
setActiveFormats();
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
onBeforeUnmount(() => {
|
|
304
|
+
editor?.destroy();
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
// Computed
|
|
308
|
+
const getIndexOfHeading = computed(() => {
|
|
309
|
+
return props.toolbar.flat().indexOf('heading');
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
const headingIcon = computed(() => {
|
|
313
|
+
if (activeHeadingLevel.value && isActive.value.heading) {
|
|
314
|
+
return `format_h${activeHeadingLevel.value}`;
|
|
315
|
+
}
|
|
316
|
+
return 'format_paragraph';
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
// Methods
|
|
320
|
+
const handleEditorClick = () => {
|
|
321
|
+
setActiveFormats();
|
|
322
|
+
editor?.commands.focus();
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const handleToolbarClick = (item: string, level?: number) => {
|
|
326
|
+
if (item === 'bulletList' || item === 'orderedList') {
|
|
327
|
+
item === 'bulletList' ? editor?.commands.toggleBulletList() : editor?.commands.toggleOrderedList();
|
|
328
|
+
}
|
|
329
|
+
else if (item === 'link') {
|
|
330
|
+
setLink();
|
|
331
|
+
}
|
|
332
|
+
else if (item === 'heading') {
|
|
333
|
+
if (!level) {
|
|
334
|
+
editor?.commands.toggleHeading({ level: previousHeadingLevel.value as Level });
|
|
335
|
+
activeHeadingLevel.value = 0;
|
|
336
|
+
} else {
|
|
337
|
+
activeHeadingLevel.value = level;
|
|
338
|
+
previousHeadingLevel.value = level as Level;
|
|
339
|
+
editor?.commands.toggleHeading({ level: level as Level });
|
|
340
|
+
}
|
|
341
|
+
editor?.commands.focus();
|
|
342
|
+
}
|
|
343
|
+
else if (item === 'undo' || item === 'redo') {
|
|
344
|
+
item === 'undo' ? editor?.commands.undo() : editor?.commands.redo();
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
editor?.chain().focus().toggleMark(item).run();
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const setLink = () => {
|
|
352
|
+
const previousUrl = editor?.getAttributes('link').href;
|
|
353
|
+
const url = window.prompt('URL', previousUrl);
|
|
354
|
+
|
|
355
|
+
// cancelled
|
|
356
|
+
if (url === null) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// empty
|
|
361
|
+
if (url === '') {
|
|
362
|
+
editor?.chain().focus().extendMarkRange('link').unsetLink().run();
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// update link
|
|
367
|
+
editor?.chain()
|
|
368
|
+
.focus()
|
|
369
|
+
.extendMarkRange('link')
|
|
370
|
+
.setLink({ href: url })
|
|
371
|
+
.run();
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
const setActiveFormats = () => {
|
|
375
|
+
const toolbarList = props.toolbar.flat() as string[];
|
|
376
|
+
toolbarList.forEach((item) => {
|
|
377
|
+
isActive.value[item] = editor?.isActive(item) || false;
|
|
378
|
+
});
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// Styles
|
|
382
|
+
const classAttribute = useClassAttribute();
|
|
383
|
+
|
|
384
|
+
const rootStyles = computed(() => {
|
|
385
|
+
return [
|
|
386
|
+
'or-rich-text-editor',
|
|
387
|
+
classAttribute.value,
|
|
388
|
+
];
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
const containerStyles = computed(() => {
|
|
392
|
+
return [
|
|
393
|
+
...EditorContainer,
|
|
394
|
+
];
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
const toolbarContainerStyles = computed(() => {
|
|
398
|
+
return [
|
|
399
|
+
...ToolbarContainer,
|
|
400
|
+
];
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
const toolbarStyles = computed(() => {
|
|
404
|
+
return [
|
|
405
|
+
...Toolbar,
|
|
406
|
+
];
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
const editorInputStyles = computed(() => {
|
|
410
|
+
return [
|
|
411
|
+
'tiptap-editor',
|
|
412
|
+
...EditorInput,
|
|
413
|
+
];
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
const toolbarButtonStyles = (item: string) => {
|
|
417
|
+
return [
|
|
418
|
+
// Layout
|
|
419
|
+
'flex',
|
|
420
|
+
// Spacing
|
|
421
|
+
'gap-md',
|
|
422
|
+
...isActive.value[item] ? ToolbarButtonActive : ToolbarButton,
|
|
423
|
+
];
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
const isPlainURL = (link: Mark, parent: Node, index: number, side: number) => {
|
|
427
|
+
if (link.attrs.title || !/^\w+:/.test(link.attrs.href)) return false;
|
|
428
|
+
const content = parent.child(index + (side < 0 ? -1 : 0));
|
|
429
|
+
if (
|
|
430
|
+
!content.isText ||
|
|
431
|
+
content.text !== link.attrs.href ||
|
|
432
|
+
content.marks[content.marks.length - 1] !== link
|
|
433
|
+
)
|
|
434
|
+
return false;
|
|
435
|
+
if (index === (side < 0 ? 1 : parent.childCount - 1)) return true;
|
|
436
|
+
const next = parent.child(index + (side < 0 ? -2 : 1));
|
|
437
|
+
return !link.isInSet(next.marks);
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
const serialize = (schema: any, content: any) => {
|
|
441
|
+
const proseMirrorDocument = schema.nodeFromJSON(content);
|
|
442
|
+
const serializer = new ProseMirrorMarkdownSerializer(
|
|
443
|
+
serializerNodes,
|
|
444
|
+
serializerMarks,
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
return serializer.serialize(proseMirrorDocument);
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
const deserialize = (schema: any, content: any) => {
|
|
451
|
+
// const html = defaultMarkdownParser.parse(content);
|
|
452
|
+
const html = marked.parse(content);
|
|
453
|
+
|
|
454
|
+
if (!html) return null;
|
|
455
|
+
|
|
456
|
+
const parser = new DOMParser();
|
|
457
|
+
const { body } = parser.parseFromString(html, 'text/html');
|
|
458
|
+
|
|
459
|
+
// append original source as a comment that nodes can access
|
|
460
|
+
body.append(document.createComment(content));
|
|
461
|
+
|
|
462
|
+
const state = ProseMirrorDOMParser.fromSchema(schema).parse(body);
|
|
463
|
+
return state.toJSON();
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
//Effects
|
|
467
|
+
watch(() => props.modelValue, (value) => {
|
|
468
|
+
if (value !== editor?.getHTML() && !props.markdown) {
|
|
469
|
+
editor?.commands.setContent(value);
|
|
470
|
+
}
|
|
471
|
+
if (props.markdown && value !== markdownOutput.value) {
|
|
472
|
+
editor?.commands.setContent(markdownOutput.value);
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
return {
|
|
477
|
+
editor,
|
|
478
|
+
editorRef,
|
|
479
|
+
containerRef,
|
|
480
|
+
toolbarButtonRef,
|
|
481
|
+
menuRef,
|
|
482
|
+
iconsEnum,
|
|
483
|
+
handleToolbarClick,
|
|
484
|
+
handleEditorClick,
|
|
485
|
+
isActive,
|
|
486
|
+
iconTooltipsEnum,
|
|
487
|
+
containerStyles,
|
|
488
|
+
toolbarContainerStyles,
|
|
489
|
+
toolbarStyles,
|
|
490
|
+
rootStyles,
|
|
491
|
+
toolbarButtonStyles,
|
|
492
|
+
editorInputStyles,
|
|
493
|
+
getIndexOfHeading,
|
|
494
|
+
headingLevels,
|
|
495
|
+
headingIcon,
|
|
496
|
+
};
|
|
497
|
+
},
|
|
498
|
+
});
|
|
499
|
+
</script>
|
|
500
|
+
|
|
501
|
+
<style lang="scss">
|
|
502
|
+
.tiptap-editor {
|
|
503
|
+
ol { //see if editor can not inherit it
|
|
504
|
+
margin: 0 24px;
|
|
505
|
+
list-style: decimal;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
ul {
|
|
509
|
+
margin: 0 24px;
|
|
510
|
+
list-style: initial;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.is-editor-empty::before {
|
|
514
|
+
content: attr(data-placeholder);
|
|
515
|
+
height: 0;
|
|
516
|
+
pointer-events: none;
|
|
517
|
+
float: left;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OrRichTextEditorV3 } from './OrRichTextEditor.vue';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const EditorContainer: string[] = [
|
|
2
|
+
// Colors
|
|
3
|
+
'border-outline',
|
|
4
|
+
'dark:border-outline-dark',
|
|
5
|
+
'focus-within:theme-border-1-primary',
|
|
6
|
+
'dark:focus-within:theme-border-1-primary-dark',
|
|
7
|
+
'focus-within:bg-primary-opacity-0-08',
|
|
8
|
+
'dark:focus-within:bg-primary-opacity-0-08-dark',
|
|
9
|
+
'focus-within:theme-outline-primary',
|
|
10
|
+
'dark:focus-within:theme-outline-primary-dark',
|
|
11
|
+
|
|
12
|
+
// Sizing
|
|
13
|
+
'border-1',
|
|
14
|
+
'rounded-md',
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export const ToolbarContainer: string[] = [
|
|
18
|
+
// Layout
|
|
19
|
+
'flex',
|
|
20
|
+
//Spacing
|
|
21
|
+
'py-sm',
|
|
22
|
+
//Sizing
|
|
23
|
+
'border-b-1',
|
|
24
|
+
//Colors
|
|
25
|
+
'border-b-outline',
|
|
26
|
+
'dark:border-b-outline-dark',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export const Toolbar: string[] = [
|
|
30
|
+
// Layout
|
|
31
|
+
'flex',
|
|
32
|
+
// Spacing
|
|
33
|
+
'px-sm',
|
|
34
|
+
'gap-md',
|
|
35
|
+
// Sizing
|
|
36
|
+
'border-r-1',
|
|
37
|
+
//Colors
|
|
38
|
+
'border-r-disabled',
|
|
39
|
+
'dark:border-r-outline-dark',
|
|
40
|
+
// Last child
|
|
41
|
+
'last-of-type:border-none',
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export const ToolbarButton: string[] = [
|
|
45
|
+
// Typography
|
|
46
|
+
'text-on-disabled',
|
|
47
|
+
'dark:text-outline-dark',
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export const ToolbarButtonActive: string[] = [
|
|
51
|
+
// Typography
|
|
52
|
+
'text-on-background',
|
|
53
|
+
'dark:text-on-background-dark',
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
export const EditorInput: string[] = [
|
|
57
|
+
// Spacing
|
|
58
|
+
'p-sm',
|
|
59
|
+
// Typography
|
|
60
|
+
'typography-body-2-regular',
|
|
61
|
+
'text-on-background',
|
|
62
|
+
'dark:text-on-background-dark',
|
|
63
|
+
// Sizing
|
|
64
|
+
'min-h-[88px]',
|
|
65
|
+
];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MaybeElementRef } from '@vueuse/core';
|
|
2
2
|
import { isRef, ref, watch } from 'vue-demi';
|
|
3
|
+
import isVisible from '../utils/isVisible';
|
|
3
4
|
|
|
4
5
|
export function useElevation(
|
|
5
6
|
element: MaybeElementRef<HTMLElement | undefined>
|
|
@@ -8,7 +9,8 @@ export function useElevation(
|
|
|
8
9
|
|
|
9
10
|
// Functions
|
|
10
11
|
function getPageElevations(): number[] {
|
|
11
|
-
return [...document.body.querySelectorAll('*')]
|
|
12
|
+
return ([...document.body.querySelectorAll('*')] as HTMLElement[])
|
|
13
|
+
.filter(isVisible)
|
|
12
14
|
.map((element) => getComputedStyle(element))
|
|
13
15
|
.map((style) => Number(style.zIndex))
|
|
14
16
|
.filter((zIndex) => !isNaN(zIndex));
|