@onereach/ui-components 4.2.0-beta.2549.0 → 4.2.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/components/OrCheckboxGroupV3/OrCheckboxGroup.js +145 -0
- package/dist/bundled/v2/components/OrCheckboxGroupV3/OrCheckboxGroup.vue.d.ts +91 -0
- package/dist/bundled/v2/components/OrCheckboxGroupV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrCheckboxGroupV3/index.js +31 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.js +226 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +91 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/index.d.ts +2 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/index.js +23 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/styles.d.ts +2 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/styles.js +10 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/types.d.ts +8 -0
- package/dist/bundled/v2/components/OrCheckboxV3/OrCheckbox.js +37 -39
- package/dist/bundled/v2/components/OrCheckboxV3/OrCheckbox.vue.d.ts +18 -16
- package/dist/bundled/v2/components/OrCheckboxV3/index.js +1 -0
- package/dist/bundled/v2/components/OrCode/OrCode.js +3727 -6
- package/dist/bundled/v2/components/OrCode/index.js +2 -6
- package/dist/bundled/v2/components/OrCode/lang.js +3 -3897
- package/dist/bundled/v2/components/OrCode/theme.js +1 -2
- package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +0 -1
- package/dist/bundled/v2/components/OrConfirm/index.js +0 -1
- package/dist/bundled/v2/components/OrFormGroupV3/OrFormGroup.js +127 -0
- package/dist/bundled/v2/components/OrFormGroupV3/OrFormGroup.vue.d.ts +87 -0
- package/dist/bundled/v2/components/OrFormGroupV3/index.d.ts +2 -0
- package/dist/bundled/v2/components/OrFormGroupV3/index.js +12 -0
- package/dist/bundled/v2/components/OrFormGroupV3/props.d.ts +4 -0
- package/dist/bundled/v2/components/OrFormGroupV3/props.js +7 -0
- package/dist/bundled/v2/components/OrFormGroupV3/styles.d.ts +5 -0
- package/dist/bundled/v2/components/OrFormGroupV3/styles.js +17 -0
- package/dist/bundled/v2/components/OrModal/OrModal.js +1266 -3
- package/dist/bundled/v2/components/OrModal/index.js +0 -1
- package/dist/bundled/v2/components/OrRadioGroupV3/OrRadioGroup.js +132 -0
- package/dist/bundled/v2/components/OrRadioGroupV3/OrRadioGroup.vue.d.ts +110 -0
- package/dist/bundled/v2/components/OrRadioGroupV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRadioGroupV3/index.js +19 -0
- package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +1 -1
- package/dist/bundled/v2/components/OrSelectV3/index.js +1 -1
- package/dist/bundled/v2/components/OrTooltipContent/OrTooltipContent.js +2 -2
- package/dist/bundled/v2/components/index.d.ts +0 -1
- package/dist/bundled/v2/components/index.js +2 -15
- package/dist/bundled/v2/{index-f5487f12.js → index-6976c52a.js} +115 -3
- package/dist/bundled/v2/index.d.ts +1 -0
- package/dist/bundled/v2/index.js +8 -20
- package/dist/bundled/v2/{index-70ca38c5.js → lang-02d2bb2d.js} +3965 -73
- package/dist/bundled/v2/utils/functions/flattenDeep.d.ts +2 -0
- package/dist/bundled/v2/utils/functions/flattenDeep.js +5 -0
- package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-29e8ad0e.js → OrAvatar.vue_vue_type_script_lang-6511e348.js} +1 -1
- package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-a4a16fe5.js → OrButton.vue_vue_type_script_lang-da7f7ed0.js} +1 -1
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-c1d83552.js → OrCardCollection.vue_vue_type_script_lang-7a2e1332.js} +3 -3
- package/dist/bundled/v3/{OrCarousel.vue_vue_type_script_lang-0e87c56b.js → OrCarousel.vue_vue_type_script_lang-6976844a.js} +1 -1
- package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-6ff51af9.js → OrCheckbox.vue_vue_type_script_lang-11b16d93.js} +1 -1
- package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-60cefcbd.js → OrCheckbox.vue_vue_type_script_lang-b274a5ee.js} +27 -11
- package/dist/bundled/v3/OrCheckboxTree.vue_vue_type_script_lang-f9807b75.js +115 -0
- package/dist/bundled/v3/{OrChip.vue_vue_type_script_lang-ceebbd82.js → OrChip.vue_vue_type_script_lang-5a390853.js} +1 -1
- package/dist/bundled/v3/{OrChips.vue_vue_type_script_lang-94b456c7.js → OrChips.vue_vue_type_script_lang-d4bb44eb.js} +1 -1
- package/dist/bundled/{v2/index-16aee5bc.js → v3/OrCode.vue_vue_type_script_lang-5397df6a.js} +234 -14
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-36318ca2.js → OrConfirm.vue_vue_type_script_lang-89febea7.js} +2 -2
- package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-5c1a5d4a.js → OrDateTimePicker.vue_vue_type_script_lang-8ff54abd.js} +1 -1
- package/dist/bundled/v3/OrFormGroup.vue_vue_type_script_lang-1c6844d6.js +63 -0
- package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-5d204461.js → OrIconButton.vue_vue_type_script_lang-96cb5b59.js} +2 -2
- package/dist/bundled/v3/{OrInlineTextEdit.vue_vue_type_script_lang-424e2c26.js → OrInlineTextEdit.vue_vue_type_script_lang-45987769.js} +1 -1
- package/dist/bundled/v3/{OrList.vue_vue_type_script_lang-c65271b9.js → OrList.vue_vue_type_script_lang-2c7537cc.js} +3 -3
- package/dist/bundled/v3/{OrListOfInputs.vue_vue_type_script_lang-d3dce7b8.js → OrListOfInputs.vue_vue_type_script_lang-009f62a5.js} +3 -3
- package/dist/bundled/v3/{useFocusTrap-9567b3c8.js → OrModal.vue_vue_type_script_lang-c53617ae.js} +105 -3
- package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-ef4f2661.js → OrNotification.vue_vue_type_script_lang-efb05bb2.js} +2 -2
- package/dist/bundled/v3/{OrOverflowMenu.vue_vue_type_script_lang-0c461991.js → OrOverflowMenu.vue_vue_type_script_lang-ba50133f.js} +2 -2
- package/dist/bundled/v3/{OrPassword.vue_vue_type_script_lang-3d308fef.js → OrPassword.vue_vue_type_script_lang-37f52611.js} +1 -1
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-86f4f5c7.js → OrSearch.vue_vue_type_script_lang-bcb935c3.js} +1 -1
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-f7601423.js → OrSelect.vue_vue_type_script_lang-098ea3ab.js} +1 -1
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-d2fecd97.js → OrSelect.vue_vue_type_script_lang-c82d8f58.js} +3 -3
- package/dist/bundled/v3/{OrSlider.vue_vue_type_script_lang-900036a2.js → OrSlider.vue_vue_type_script_lang-45ecddbe.js} +1 -1
- package/dist/bundled/v3/{OrStepper.vue_vue_type_script_lang-2821c496.js → OrStepper.vue_vue_type_script_lang-975a4df6.js} +1 -1
- package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-f06b54a2.js → OrTag.vue_vue_type_script_lang-621e9307.js} +1 -1
- package/dist/bundled/v3/{OrTextbox.vue_vue_type_script_lang-b8d5341b.js → OrTextbox.vue_vue_type_script_lang-812f302d.js} +1 -1
- package/dist/bundled/v3/components/OrAvatar/OrAvatar.js +3 -3
- package/dist/bundled/v3/components/OrAvatar/index.js +2 -2
- package/dist/bundled/v3/components/OrButtonV2/OrButton.js +3 -3
- package/dist/bundled/v3/components/OrButtonV2/index.js +4 -4
- package/dist/bundled/v3/components/OrCardCollection/OrCardCollection.js +6 -6
- package/dist/bundled/v3/components/OrCardCollection/index.js +5 -5
- package/dist/bundled/v3/components/OrCarousel/OrCarousel.js +3 -3
- package/dist/bundled/v3/components/OrCarousel/index.js +2 -2
- package/dist/bundled/v3/components/OrCheckbox/OrCheckbox.js +3 -3
- package/dist/bundled/v3/components/OrCheckbox/index.js +2 -2
- package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.js +121 -0
- package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.vue.d.ts +91 -0
- package/dist/bundled/v3/components/OrCheckboxGroupV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrCheckboxGroupV3/index.js +40 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.js +90 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +91 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/index.d.ts +2 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/index.js +28 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/styles.d.ts +2 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/styles.js +10 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/types.d.ts +8 -0
- package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.js +12 -9
- package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.vue.d.ts +18 -16
- package/dist/bundled/v3/components/OrCheckboxV3/index.js +2 -1
- package/dist/bundled/v3/components/OrChip/OrChip.js +3 -3
- package/dist/bundled/v3/components/OrChip/index.js +2 -2
- package/dist/bundled/v3/components/OrChips/OrChips.js +4 -4
- package/dist/bundled/v3/components/OrChips/index.js +3 -3
- package/dist/bundled/v3/components/OrCode/OrCode.js +9 -13
- package/dist/bundled/v3/components/OrCode/index.js +7 -11
- package/dist/bundled/v3/components/OrCode/lang.js +3 -3897
- package/dist/bundled/v3/components/OrCode/theme.js +1 -2
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +7 -8
- package/dist/bundled/v3/components/OrConfirm/index.js +6 -7
- package/dist/bundled/v3/components/OrDateTimePicker/OrDateTimePicker.js +5 -5
- package/dist/bundled/v3/components/OrDateTimePicker/index.js +4 -4
- package/dist/bundled/v3/components/OrFormGroupV3/OrFormGroup.js +59 -0
- package/dist/bundled/v3/components/OrFormGroupV3/OrFormGroup.vue.d.ts +87 -0
- package/dist/bundled/v3/components/OrFormGroupV3/index.d.ts +2 -0
- package/dist/bundled/v3/components/OrFormGroupV3/index.js +15 -0
- package/dist/bundled/v3/components/OrFormGroupV3/props.d.ts +4 -0
- package/dist/bundled/v3/components/OrFormGroupV3/props.js +7 -0
- package/dist/bundled/v3/components/OrFormGroupV3/styles.d.ts +5 -0
- package/dist/bundled/v3/components/OrFormGroupV3/styles.js +17 -0
- package/dist/bundled/v3/components/OrIcon/OrIcon.js +2 -2
- package/dist/bundled/v3/components/OrIcon/index.js +1 -1
- package/dist/bundled/v3/components/OrIconButtonV2/OrIconButton.js +4 -4
- package/dist/bundled/v3/components/OrIconButtonV2/index.js +3 -3
- package/dist/bundled/v3/components/OrInlineTextEdit/OrInlineTextEdit.js +5 -5
- package/dist/bundled/v3/components/OrInlineTextEdit/index.js +4 -4
- package/dist/bundled/v3/components/OrList/OrList.js +6 -6
- package/dist/bundled/v3/components/OrList/index.js +5 -5
- package/dist/bundled/v3/components/OrListOfInputs/OrListOfInputs.js +7 -7
- package/dist/bundled/v3/components/OrListOfInputs/index.js +6 -6
- package/dist/bundled/v3/components/OrModal/OrModal.js +5 -6
- package/dist/bundled/v3/components/OrModal/index.js +4 -5
- package/dist/bundled/v3/components/OrNotification/OrNotification.js +5 -5
- package/dist/bundled/v3/components/OrNotification/index.js +4 -4
- package/dist/bundled/v3/components/OrOverflowMenu/OrOverflowMenu.js +6 -6
- package/dist/bundled/v3/components/OrOverflowMenu/index.js +5 -5
- package/dist/bundled/v3/components/OrPassword/OrPassword.js +5 -5
- package/dist/bundled/v3/components/OrPassword/index.js +4 -4
- package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.js +104 -0
- package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.vue.d.ts +110 -0
- package/dist/bundled/v3/components/OrRadioGroupV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRadioGroupV3/index.js +24 -0
- package/dist/bundled/v3/components/OrSearch/OrSearch.js +5 -5
- package/dist/bundled/v3/components/OrSearch/index.js +4 -4
- package/dist/bundled/v3/components/OrSelect/OrSelect.js +5 -5
- package/dist/bundled/v3/components/OrSelect/index.js +4 -4
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +4 -4
- package/dist/bundled/v3/components/OrSelectV3/index.js +3 -3
- package/dist/bundled/v3/components/OrSlider/OrSlider.js +3 -3
- package/dist/bundled/v3/components/OrSlider/index.js +2 -2
- package/dist/bundled/v3/components/OrStepper/OrStepper.js +4 -4
- package/dist/bundled/v3/components/OrStepper/index.js +3 -3
- package/dist/bundled/v3/components/OrTag/OrTag.js +3 -3
- package/dist/bundled/v3/components/OrTag/index.js +2 -2
- package/dist/bundled/v3/components/OrTextbox/OrTextbox.js +5 -5
- package/dist/bundled/v3/components/OrTextbox/index.js +4 -4
- package/dist/bundled/v3/components/OrToast/OrToast.js +3 -3
- package/dist/bundled/v3/components/OrToast/index.js +4 -4
- package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.js +5 -5
- package/dist/bundled/v3/components/OrToastContainer/index.js +4 -4
- package/dist/bundled/v3/components/OrTooltip/OrTooltip.js +2 -2
- package/dist/bundled/v3/components/OrTooltip/index.js +1 -1
- package/dist/bundled/v3/components/OrTooltipContent/OrTooltipContent.js +1 -1
- package/dist/bundled/v3/components/index.d.ts +0 -1
- package/dist/bundled/v3/components/index.js +31 -45
- package/dist/bundled/v3/{index-f5487f12.js → index-6976c52a.js} +115 -3
- package/dist/bundled/v3/index.d.ts +1 -0
- package/dist/bundled/v3/index.js +39 -53
- package/dist/bundled/v3/{index-70ca38c5.js → lang-02d2bb2d.js} +3965 -73
- package/dist/bundled/v3/utils/functions/flattenDeep.d.ts +2 -0
- package/dist/bundled/v3/utils/functions/flattenDeep.js +5 -0
- package/dist/esm/v2/{OrAvatar-da5cba16.js → OrAvatar-7c024521.js} +1 -1
- package/dist/esm/v2/{OrButton-bdddd8d4.js → OrButton-4e532ddb.js} +1 -1
- package/dist/esm/v2/{OrButton.vue_rollup-plugin-vue_styles.0-3dbd90b4.js → OrButton.vue_rollup-plugin-vue_styles.0-48c5883e.js} +2 -2
- package/dist/esm/v2/{OrCardCollection-4e014d25.js → OrCardCollection-9bf513b7.js} +5 -5
- package/dist/esm/v2/{OrCarousel-3c809a13.js → OrCarousel-e0c2e387.js} +1 -1
- package/dist/esm/v2/{OrCheckbox-dc587ec9.js → OrCheckbox-39c94019.js} +37 -40
- package/dist/esm/v2/{OrCheckbox-bf34eb0f.js → OrCheckbox-7b98fc08.js} +1 -1
- package/dist/esm/v2/OrCheckboxTree-7b81e76c.js +220 -0
- package/dist/esm/v2/{OrChip-416e848e.js → OrChip-8a1abfc5.js} +1 -1
- package/dist/esm/v2/{OrChips-77e789e9.js → OrChips-a01d8520.js} +1 -1
- package/dist/esm/v2/{OrChips.vue_rollup-plugin-vue_styles.0-e05c5ca8.js → OrChips.vue_rollup-plugin-vue_styles.0-3cbb0871.js} +1 -1
- package/dist/esm/v2/{OrCode-dcb0132a.js → OrCode-e54e09f7.js} +4 -4
- package/dist/esm/v2/{OrConfirm-497cd260.js → OrConfirm-5d5dd9bc.js} +3 -3
- package/dist/esm/v2/{OrDateTimePicker-c88ca716.js → OrDateTimePicker-6e2853ec.js} +3 -3
- package/dist/esm/v2/OrFormGroup-29a514db.js +141 -0
- package/dist/esm/v2/{OrIcon-8a6d663a.js → OrIcon-a40e60af.js} +2 -2
- package/dist/esm/v2/{OrIconButton-97bfd51d.js → OrIconButton-23972f7d.js} +1 -1
- package/dist/esm/v2/{OrIconButton.vue_rollup-plugin-vue_styles.0-e3806cef.js → OrIconButton.vue_rollup-plugin-vue_styles.0-277ce06c.js} +3 -3
- package/dist/esm/v2/{OrInlineTextEdit-e8414fb6.js → OrInlineTextEdit-9541b625.js} +3 -3
- package/dist/esm/v2/{OrList-a46d6306.js → OrList-61c7b8ea.js} +4 -4
- package/dist/esm/v2/{OrListOfInputs-33a7bf87.js → OrListOfInputs-e1b09290.js} +5 -5
- package/dist/esm/v2/{OrModal-6d84829c.js → OrModal-b9cfb8ec.js} +3 -3
- package/dist/esm/v2/{OrNotification-7945568d.js → OrNotification-fdb88eec.js} +4 -4
- package/dist/esm/v2/{OrOverflowMenu-5ce7171b.js → OrOverflowMenu-83540c76.js} +4 -4
- package/dist/esm/v2/{OrPassword-3597153d.js → OrPassword-022e10fd.js} +3 -3
- package/dist/esm/v2/{OrSearch-49ceaac4.js → OrSearch-620d5d76.js} +3 -3
- package/dist/esm/v2/{OrSelect-40183874.js → OrSelect-1865c781.js} +1 -1
- package/dist/esm/v2/{OrSelect-eb5cc918.js → OrSelect-d887118b.js} +4 -4
- package/dist/esm/v2/{OrSlider-32a14ca4.js → OrSlider-c0a7f9cf.js} +1 -1
- package/dist/esm/v2/{OrStepper-462bc9e6.js → OrStepper-b00f7531.js} +2 -2
- package/dist/esm/v2/{OrTag-a1fff567.js → OrTag-6349049b.js} +1 -1
- package/dist/esm/v2/{OrTextbox-0a89a533.js → OrTextbox-0373bd6a.js} +3 -3
- package/dist/esm/v2/{OrToastContainer-5ce15a5b.js → OrToastContainer-1625b803.js} +3 -3
- package/dist/esm/v2/{OrTooltip-cfb56e8f.js → OrTooltip-97a42707.js} +1 -1
- package/dist/esm/v2/{OrTooltip.vue_rollup-plugin-vue_styles.0-122f7804.js → OrTooltip.vue_rollup-plugin-vue_styles.0-a256ac18.js} +1 -1
- package/dist/esm/v2/{OrTooltipContent-c9540548.js → OrTooltipContent-d85e1071.js} +2 -2
- package/dist/esm/v2/components/index.d.ts +0 -1
- package/dist/esm/v2/components/index.js +34 -58
- package/dist/esm/v2/components/or-avatar/index.js +4 -4
- package/dist/esm/v2/components/or-button-v2/index.js +8 -8
- package/dist/esm/v2/components/or-card-collection/index.js +9 -9
- package/dist/esm/v2/components/or-carousel/index.js +4 -4
- package/dist/esm/v2/components/or-checkbox/index.js +4 -4
- package/dist/esm/v2/components/or-checkbox-group-v3/OrCheckboxGroup.vue.d.ts +91 -0
- package/dist/esm/v2/components/or-checkbox-group-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-checkbox-group-v3/index.js +130 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +91 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/index.js +12 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/styles.d.ts +2 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/types.d.ts +8 -0
- package/dist/esm/v2/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -16
- package/dist/esm/v2/components/or-checkbox-v3/index.js +2 -2
- package/dist/esm/v2/components/or-chips/index.js +6 -6
- package/dist/esm/v2/components/or-chips/or-chip/index.js +4 -4
- package/dist/esm/v2/components/or-code/index.js +9 -9
- package/dist/esm/v2/components/or-confirm/index.js +10 -10
- package/dist/esm/v2/components/or-date-time-picker/index.js +8 -8
- package/dist/esm/v2/components/or-form-group-v3/OrFormGroup.vue.d.ts +87 -0
- package/dist/esm/v2/components/or-form-group-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-form-group-v3/index.js +6 -0
- package/dist/esm/v2/components/or-form-group-v3/props.d.ts +4 -0
- package/dist/esm/v2/components/or-form-group-v3/styles.d.ts +5 -0
- package/dist/esm/v2/components/or-icon/index.js +3 -3
- package/dist/esm/v2/components/or-icon-button-v2/index.js +6 -6
- package/dist/esm/v2/components/or-inline-text-edit/index.js +8 -8
- package/dist/esm/v2/components/or-list/index.js +9 -9
- package/dist/esm/v2/components/or-list-of-inputs/index.js +10 -10
- package/dist/esm/v2/components/or-modal/index.js +8 -8
- package/dist/esm/v2/components/or-notification/index.js +8 -8
- package/dist/esm/v2/components/or-overflow-menu/index.js +9 -9
- package/dist/esm/v2/components/or-password/index.js +8 -8
- package/dist/esm/v2/components/or-radio-group-v3/OrRadioGroup.vue.d.ts +110 -0
- package/dist/esm/v2/components/or-radio-group-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-radio-group-v3/index.js +124 -0
- package/dist/esm/v2/components/or-search/index.js +8 -8
- package/dist/esm/v2/components/or-select/index.js +7 -7
- package/dist/esm/v2/components/or-select-v3/index.js +2 -2
- package/dist/esm/v2/components/or-slider/index.js +4 -4
- package/dist/esm/v2/components/or-stepper/index.js +8 -8
- package/dist/esm/v2/components/or-tag/index.js +4 -4
- package/dist/esm/v2/components/or-textbox/index.js +8 -8
- package/dist/esm/v2/components/or-toast/index.js +8 -8
- package/dist/esm/v2/components/or-toast/or-toast-container/index.js +8 -8
- package/dist/esm/v2/components/or-tooltip/index.js +3 -3
- package/dist/esm/v2/components/or-tooltip/or-tooltip-content/index.js +1 -1
- package/dist/esm/v2/flattenDeep-e7a8b995.js +5 -0
- package/dist/esm/v2/index.d.ts +1 -0
- package/dist/esm/v2/index.js +35 -58
- package/dist/esm/v2/utils/functions/flattenDeep.d.ts +2 -0
- package/dist/esm/v3/{OrAvatar-b18f2208.js → OrAvatar-14a5c5f0.js} +1 -1
- package/dist/esm/v3/{OrButton-170b493f.js → OrButton-f8b10d79.js} +2 -2
- package/dist/esm/v3/{OrCardCollection-dc158967.js → OrCardCollection-ffbb9eda.js} +4 -4
- package/dist/esm/v3/{OrCarousel-8de5d65b.js → OrCarousel-03597740.js} +1 -1
- package/dist/esm/v3/{OrCheckbox-56f849f7.js → OrCheckbox-488b6915.js} +36 -19
- package/dist/esm/v3/{OrCheckbox-c2d9cf53.js → OrCheckbox-7efd5f26.js} +1 -1
- package/dist/esm/v3/OrCheckboxTree-87d0528b.js +182 -0
- package/dist/esm/v3/{OrChip-ccd4b331.js → OrChip-97a85e10.js} +1 -1
- package/dist/esm/v3/{OrChips-9a19aa03.js → OrChips-64b86761.js} +1 -1
- package/dist/esm/v3/{OrCode-b0b514ab.js → OrCode-6f2e4d99.js} +3 -3
- package/dist/esm/v3/{OrConfirm-1ffb7ed6.js → OrConfirm-ab04201f.js} +3 -3
- package/dist/esm/v3/{OrDateTimePicker-02c6de49.js → OrDateTimePicker-014f7819.js} +2 -2
- package/dist/esm/v3/OrFormGroup-9f581536.js +122 -0
- package/dist/esm/v3/{OrIcon-9b3d24cc.js → OrIcon-925c5413.js} +2 -2
- package/dist/esm/v3/{OrIconButton-9d08aa44.js → OrIconButton-5387fd59.js} +3 -3
- package/dist/esm/v3/{OrInlineTextEdit-8cfde85c.js → OrInlineTextEdit-6f97629f.js} +2 -2
- package/dist/esm/v3/{OrList-d3e330be.js → OrList-b8799cf4.js} +3 -3
- package/dist/esm/v3/{OrListOfInputs-3c8eaf97.js → OrListOfInputs-16ba8358.js} +4 -4
- package/dist/esm/v3/{OrModal-f8ae7146.js → OrModal-e6513e8c.js} +2 -2
- package/dist/esm/v3/{OrNotification-24192897.js → OrNotification-4c56f7ea.js} +3 -3
- package/dist/esm/v3/{OrOverflowMenu-a7568f8d.js → OrOverflowMenu-fe77e22c.js} +2 -2
- package/dist/esm/v3/{OrPassword-88a67993.js → OrPassword-9c8a458d.js} +2 -2
- package/dist/esm/v3/{OrSearch-fb2dd591.js → OrSearch-c4caf04e.js} +2 -2
- package/dist/esm/v3/{OrSelect-5502d82d.js → OrSelect-35b41c3f.js} +1 -1
- package/dist/esm/v3/{OrSelect-3d923250.js → OrSelect-d8a78242.js} +4 -4
- package/dist/esm/v3/{OrSlider-ae7b8a11.js → OrSlider-80e0f2e6.js} +1 -1
- package/dist/esm/v3/{OrStepper-446007c5.js → OrStepper-3a586401.js} +2 -2
- package/dist/esm/v3/{OrTag-38d1ba92.js → OrTag-e7adb078.js} +1 -1
- package/dist/esm/v3/{OrTextbox-7de2b10c.js → OrTextbox-f7388a30.js} +2 -2
- package/dist/esm/v3/{OrToastContainer-c3ecb1c8.js → OrToastContainer-94ba2803.js} +2 -2
- package/dist/esm/v3/{OrTooltip-be7209e5.js → OrTooltip-618ce7c9.js} +1 -1
- package/dist/esm/v3/{OrTooltipContent-68c34911.js → OrTooltipContent-37a5f562.js} +1 -1
- package/dist/esm/v3/components/index.d.ts +0 -1
- package/dist/esm/v3/components/index.js +30 -54
- package/dist/esm/v3/components/or-avatar/index.js +4 -4
- package/dist/esm/v3/components/or-button-v2/index.js +5 -5
- package/dist/esm/v3/components/or-card-collection/index.js +7 -7
- package/dist/esm/v3/components/or-carousel/index.js +4 -4
- package/dist/esm/v3/components/or-checkbox/index.js +4 -4
- package/dist/esm/v3/components/or-checkbox-group-v3/OrCheckboxGroup.vue.d.ts +91 -0
- package/dist/esm/v3/components/or-checkbox-group-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-checkbox-group-v3/index.js +97 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +91 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/index.js +12 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/styles.d.ts +2 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/types.d.ts +8 -0
- package/dist/esm/v3/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -16
- package/dist/esm/v3/components/or-checkbox-v3/index.js +2 -2
- package/dist/esm/v3/components/or-chips/index.js +5 -5
- package/dist/esm/v3/components/or-chips/or-chip/index.js +4 -4
- package/dist/esm/v3/components/or-code/index.js +7 -7
- package/dist/esm/v3/components/or-confirm/index.js +7 -7
- package/dist/esm/v3/components/or-date-time-picker/index.js +6 -6
- package/dist/esm/v3/components/or-form-group-v3/OrFormGroup.vue.d.ts +87 -0
- package/dist/esm/v3/components/or-form-group-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-form-group-v3/index.js +6 -0
- package/dist/esm/v3/components/or-form-group-v3/props.d.ts +4 -0
- package/dist/esm/v3/components/or-form-group-v3/styles.d.ts +5 -0
- package/dist/esm/v3/components/or-icon/index.js +3 -3
- package/dist/esm/v3/components/or-icon-button-v2/index.js +4 -4
- package/dist/esm/v3/components/or-inline-text-edit/index.js +6 -6
- package/dist/esm/v3/components/or-list/index.js +6 -6
- package/dist/esm/v3/components/or-list-of-inputs/index.js +7 -7
- package/dist/esm/v3/components/or-modal/index.js +6 -6
- package/dist/esm/v3/components/or-notification/index.js +6 -6
- package/dist/esm/v3/components/or-overflow-menu/index.js +6 -6
- package/dist/esm/v3/components/or-password/index.js +6 -6
- package/dist/esm/v3/components/or-radio-group-v3/OrRadioGroup.vue.d.ts +110 -0
- package/dist/esm/v3/components/or-radio-group-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-radio-group-v3/index.js +91 -0
- package/dist/esm/v3/components/or-search/index.js +6 -6
- package/dist/esm/v3/components/or-select/index.js +7 -7
- package/dist/esm/v3/components/or-select-v3/index.js +2 -2
- package/dist/esm/v3/components/or-slider/index.js +4 -4
- package/dist/esm/v3/components/or-stepper/index.js +6 -6
- package/dist/esm/v3/components/or-tag/index.js +4 -4
- package/dist/esm/v3/components/or-textbox/index.js +6 -6
- package/dist/esm/v3/components/or-toast/index.js +6 -6
- package/dist/esm/v3/components/or-toast/or-toast-container/index.js +6 -6
- package/dist/esm/v3/components/or-tooltip/index.js +2 -2
- package/dist/esm/v3/components/or-tooltip/or-tooltip-content/index.js +1 -1
- package/dist/esm/v3/flattenDeep-e7a8b995.js +5 -0
- package/dist/esm/v3/index.d.ts +1 -0
- package/dist/esm/v3/index.js +31 -54
- package/dist/esm/v3/utils/functions/flattenDeep.d.ts +2 -0
- package/package.json +5 -25
- package/src/components/index.ts +0 -1
- package/src/components/or-checkbox-group-v3/OrCheckboxGroup.docs.mdx +7 -0
- package/src/components/or-checkbox-group-v3/OrCheckboxGroup.stories3.ts +373 -0
- package/src/components/or-checkbox-group-v3/OrCheckboxGroup.vue +80 -0
- package/src/components/or-checkbox-group-v3/index.ts +1 -0
- package/src/components/or-checkbox-tree-v3/OrCheckboxTree.docs.mdx +7 -0
- package/src/components/or-checkbox-tree-v3/OrCheckboxTree.stories3.ts +112 -0
- package/src/components/or-checkbox-tree-v3/OrCheckboxTree.vue +192 -0
- package/src/components/or-checkbox-tree-v3/index.ts +2 -0
- package/src/components/or-checkbox-tree-v3/styles.ts +15 -0
- package/src/components/or-checkbox-tree-v3/types.ts +8 -0
- package/src/components/or-checkbox-v3/OrCheckbox.vue +33 -13
- package/src/components/or-form-group-v3/OrFormGroup.stories3.ts +114 -0
- package/src/components/or-form-group-v3/OrFormGroup.vue +116 -0
- package/src/components/or-form-group-v3/index.ts +2 -0
- package/src/components/or-form-group-v3/props.ts +4 -0
- package/src/components/or-form-group-v3/styles.ts +33 -0
- package/src/components/or-radio-group-v3/OrRadioGroup.stories3.ts +81 -0
- package/src/components/or-radio-group-v3/OrRadioGroup.vue +80 -0
- package/src/components/or-radio-group-v3/index.ts +1 -0
- package/src/components/or-radio-v3/OrRadio.stories3.ts +1 -1
- package/src/components/or-tooltip/or-tooltip-content/OrTooltipContent.vue +0 -1
- package/src/index.ts +1 -0
- package/src/utils/functions/flattenDeep.ts +5 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -1990
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -170
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +0 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +0 -68
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +0 -6
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +0 -38
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -45
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +0 -5
- package/dist/bundled/v2/index-62c3221b.js +0 -6956
- package/dist/bundled/v2/index.es-3f39f316.js +0 -115
- package/dist/bundled/v2/markdown-516daba9.js +0 -18737
- package/dist/bundled/v2/tiptap-core.esm-f85402b1.js +0 -9360
- package/dist/bundled/v2/useFocusTrap-9567b3c8.js +0 -1268
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-f6f74339.js +0 -236
- package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-af0c4288.js +0 -107
- package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-fec87993.js +0 -1765
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -228
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -170
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +0 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +0 -84
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +0 -6
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +0 -38
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -45
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +0 -5
- package/dist/bundled/v3/index-16aee5bc.js +0 -3740
- package/dist/bundled/v3/index-62c3221b.js +0 -6956
- package/dist/bundled/v3/index.es-3f39f316.js +0 -115
- package/dist/bundled/v3/markdown-516daba9.js +0 -18737
- package/dist/bundled/v3/tiptap-core.esm-f85402b1.js +0 -9360
- package/dist/esm/v2/OrRichTextEditor-b3da3217.js +0 -724
- package/dist/esm/v2/codemirrorView-be2c7423.js +0 -353
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -170
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +0 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +0 -59
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -6
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
- package/dist/esm/v3/OrRichTextEditor-39eb04a8.js +0 -687
- package/dist/esm/v3/codemirrorView-be2c7423.js +0 -353
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -170
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +0 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +0 -57
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -6
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +0 -7
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +0 -102
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +0 -624
- package/src/components/or-rich-text-editor-v3/index.ts +0 -1
- package/src/components/or-rich-text-editor-v3/styles.ts +0 -64
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +0 -40
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +0 -254
- package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +0 -1
- package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +0 -213
- package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +0 -22
- package/src/components/or-rich-text-editor-v3/utils/markdown.ts +0 -117
- /package/dist/bundled/v2/components/{OrRichTextEditorV3/utils/codemirror → OrCheckboxTreeV3}/types.js +0 -0
- /package/dist/bundled/v3/{OrIcon.vue_vue_type_script_lang-e3152dc5.js → OrIcon.vue_vue_type_script_lang-e5349e49.js} +0 -0
- /package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-0811fd48.js → OrToastContainer.vue_vue_type_script_lang-70cc38be.js} +0 -0
- /package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-b8594f7e.js → OrTooltip.vue_vue_type_script_lang-76a6b7f4.js} +0 -0
- /package/dist/bundled/v3/components/{OrRichTextEditorV3/utils/codemirror → OrCheckboxTreeV3}/types.js +0 -0
|
@@ -1,1990 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
|
|
2
|
-
import { u as useFocusTrap } from '../../useFocusTrap-9567b3c8.js';
|
|
3
|
-
import { onClickOutside } from '@vueuse/core';
|
|
4
|
-
import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, c as Link, e as Highlight } from '../../markdown-516daba9.js';
|
|
5
|
-
import { EditorContainer, ToolbarContainer, Toolbar, ToolbarButtonFocused, ToolbarButton, EditorInput } from './styles.js';
|
|
6
|
-
import { M as Mark, m as mergeAttributes, a as markInputRule, b as markPasteRule, N as Node, E as Extension, k as keydownHandler, D as DecorationSet, c as Decoration, d as callOrReturn, g as getExtensionField, t as textblockTypeInputRule, n as nodeInputRule, e as Editor } from '../../tiptap-core.esm-f85402b1.js';
|
|
7
|
-
import { P as Plugin, d as dropPoint, S as Selection, N as NodeSelection, F as Fragment, a as Slice, T as TextSelection, b as PluginKey, M as Mapping } from '../../index-62c3221b.js';
|
|
8
|
-
import codemirrorNode from './utils/codemirror/codemirrorNode.js';
|
|
9
|
-
import __vue_component__$1 from '../OrIconButtonV3/OrIconButton.js';
|
|
10
|
-
import __vue_component__$2 from '../OrLabelV3/OrLabel.js';
|
|
11
|
-
import __vue_component__$3 from '../OrMenuItemV3/OrMenuItem.js';
|
|
12
|
-
import __vue_component__$4 from '../OrMenuV3/OrMenu.js';
|
|
13
|
-
import __vue_component__$5 from '../OrModalV3/OrModal.js';
|
|
14
|
-
import __vue_component__$6 from '../OrInputV3/OrInput.js';
|
|
15
|
-
import __vue_component__$7 from '../OrButtonV3/OrButton.js';
|
|
16
|
-
import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
|
|
17
|
-
import { n as normalizeComponent } from '../../normalize-component-6e8e3d80.js';
|
|
18
|
-
import 'node:punycode';
|
|
19
|
-
import '../../index.es-3f39f316.js';
|
|
20
|
-
import './utils/codemirror/codemirrorView.js';
|
|
21
|
-
import '../../index-f5487f12.js';
|
|
22
|
-
import './utils/codemirror/theme.js';
|
|
23
|
-
import '../../index-16aee5bc.js';
|
|
24
|
-
import '../../index-70ca38c5.js';
|
|
25
|
-
import '../OrIconButtonV3/props.js';
|
|
26
|
-
import '../OrIconV3/props.js';
|
|
27
|
-
import '../OrIconButtonV3/styles.js';
|
|
28
|
-
import '../OrIconV3/OrIcon.js';
|
|
29
|
-
import '../OrIconV3/styles.js';
|
|
30
|
-
import '../OrTooltipV3/OrTooltip.js';
|
|
31
|
-
import '../OrTooltipV3/styles.js';
|
|
32
|
-
import '../OrPopoverV3/OrPopover.js';
|
|
33
|
-
import '../../floating-ui.dom.esm-83eba816.js';
|
|
34
|
-
import '../OrPopoverV3/props.js';
|
|
35
|
-
import '../OrPopoverV3/styles.js';
|
|
36
|
-
import '../OrBottomSheetV3/OrBottomSheet.js';
|
|
37
|
-
import '../OrBottomSheetV3/styles.js';
|
|
38
|
-
import '../OrOverlayV3/OrOverlay.js';
|
|
39
|
-
import '../OrOverlayV3/styles.js';
|
|
40
|
-
import '../OrTeleportV3/OrTeleport.js';
|
|
41
|
-
import 'portal-vue';
|
|
42
|
-
import '../../hooks/useElevation.js';
|
|
43
|
-
import '../../utils/isVisible.js';
|
|
44
|
-
import '../../hooks/useResponsive/useResponsive.js';
|
|
45
|
-
import '../OrLabelV3/props.js';
|
|
46
|
-
import '../OrLabelV3/styles.js';
|
|
47
|
-
import '../OrMenuItemV3/styles.js';
|
|
48
|
-
import '../OrMenuV3/styles.js';
|
|
49
|
-
import '../OrModalV3/props.js';
|
|
50
|
-
import '../OrModalV3/styles.js';
|
|
51
|
-
import '../OrInputV3/props.js';
|
|
52
|
-
import '../OrInputBoxV3/props.js';
|
|
53
|
-
import '../OrInputV3/styles.js';
|
|
54
|
-
import '../OrErrorV3/OrError.js';
|
|
55
|
-
import '../OrErrorV3/styles.js';
|
|
56
|
-
import '../OrHintV3/OrHint.js';
|
|
57
|
-
import '../OrHintV3/styles.js';
|
|
58
|
-
import '../OrInputBoxV3/OrInputBox.js';
|
|
59
|
-
import '../OrInputBoxV3/styles.js';
|
|
60
|
-
import '../OrLoaderV3/OrLoader.js';
|
|
61
|
-
import '../OrLoaderV3/props.js';
|
|
62
|
-
import '../OrLoaderV3/styles.js';
|
|
63
|
-
import '../../hooks/useIdAttribute.js';
|
|
64
|
-
import '../../hooks/useControlAttributes.js';
|
|
65
|
-
import '../../hooks/useValidationAttributes.js';
|
|
66
|
-
import '../OrButtonV3/props.js';
|
|
67
|
-
import '../OrButtonV3/styles.js';
|
|
68
|
-
|
|
69
|
-
const inputRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/;
|
|
70
|
-
const pasteRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/g;
|
|
71
|
-
const Code = Mark.create({
|
|
72
|
-
name: 'code',
|
|
73
|
-
addOptions() {
|
|
74
|
-
return {
|
|
75
|
-
HTMLAttributes: {}
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
excludes: '_',
|
|
79
|
-
code: true,
|
|
80
|
-
exitable: true,
|
|
81
|
-
parseHTML() {
|
|
82
|
-
return [{
|
|
83
|
-
tag: 'code'
|
|
84
|
-
}];
|
|
85
|
-
},
|
|
86
|
-
renderHTML({
|
|
87
|
-
HTMLAttributes
|
|
88
|
-
}) {
|
|
89
|
-
return ['code', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
90
|
-
},
|
|
91
|
-
addCommands() {
|
|
92
|
-
return {
|
|
93
|
-
setCode: () => ({
|
|
94
|
-
commands
|
|
95
|
-
}) => {
|
|
96
|
-
return commands.setMark(this.name);
|
|
97
|
-
},
|
|
98
|
-
toggleCode: () => ({
|
|
99
|
-
commands
|
|
100
|
-
}) => {
|
|
101
|
-
return commands.toggleMark(this.name);
|
|
102
|
-
},
|
|
103
|
-
unsetCode: () => ({
|
|
104
|
-
commands
|
|
105
|
-
}) => {
|
|
106
|
-
return commands.unsetMark(this.name);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
addKeyboardShortcuts() {
|
|
111
|
-
return {
|
|
112
|
-
'Mod-e': () => this.editor.commands.toggleCode()
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
addInputRules() {
|
|
116
|
-
return [markInputRule({
|
|
117
|
-
find: inputRegex,
|
|
118
|
-
type: this.type
|
|
119
|
-
})];
|
|
120
|
-
},
|
|
121
|
-
addPasteRules() {
|
|
122
|
-
return [markPasteRule({
|
|
123
|
-
find: pasteRegex,
|
|
124
|
-
type: this.type
|
|
125
|
-
})];
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const Document = Node.create({
|
|
130
|
-
name: 'doc',
|
|
131
|
-
topNode: true,
|
|
132
|
-
content: 'block+'
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
Create a plugin that, when added to a ProseMirror instance,
|
|
137
|
-
causes a decoration to show up at the drop position when something
|
|
138
|
-
is dragged over the editor.
|
|
139
|
-
|
|
140
|
-
Nodes may add a `disableDropCursor` property to their spec to
|
|
141
|
-
control the showing of a drop cursor inside them. This may be a
|
|
142
|
-
boolean or a function, which will be called with a view and a
|
|
143
|
-
position, and should return a boolean.
|
|
144
|
-
*/
|
|
145
|
-
function dropCursor(options = {}) {
|
|
146
|
-
return new Plugin({
|
|
147
|
-
view(editorView) {
|
|
148
|
-
return new DropCursorView(editorView, options);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
class DropCursorView {
|
|
153
|
-
constructor(editorView, options) {
|
|
154
|
-
var _a;
|
|
155
|
-
this.editorView = editorView;
|
|
156
|
-
this.cursorPos = null;
|
|
157
|
-
this.element = null;
|
|
158
|
-
this.timeout = -1;
|
|
159
|
-
this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;
|
|
160
|
-
this.color = options.color === false ? undefined : options.color || "black";
|
|
161
|
-
this.class = options.class;
|
|
162
|
-
this.handlers = ["dragover", "dragend", "drop", "dragleave"].map(name => {
|
|
163
|
-
let handler = e => {
|
|
164
|
-
this[name](e);
|
|
165
|
-
};
|
|
166
|
-
editorView.dom.addEventListener(name, handler);
|
|
167
|
-
return {
|
|
168
|
-
name,
|
|
169
|
-
handler
|
|
170
|
-
};
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
destroy() {
|
|
174
|
-
this.handlers.forEach(({
|
|
175
|
-
name,
|
|
176
|
-
handler
|
|
177
|
-
}) => this.editorView.dom.removeEventListener(name, handler));
|
|
178
|
-
}
|
|
179
|
-
update(editorView, prevState) {
|
|
180
|
-
if (this.cursorPos != null && prevState.doc != editorView.state.doc) {
|
|
181
|
-
if (this.cursorPos > editorView.state.doc.content.size) this.setCursor(null);else this.updateOverlay();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
setCursor(pos) {
|
|
185
|
-
if (pos == this.cursorPos) return;
|
|
186
|
-
this.cursorPos = pos;
|
|
187
|
-
if (pos == null) {
|
|
188
|
-
this.element.parentNode.removeChild(this.element);
|
|
189
|
-
this.element = null;
|
|
190
|
-
} else {
|
|
191
|
-
this.updateOverlay();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
updateOverlay() {
|
|
195
|
-
let $pos = this.editorView.state.doc.resolve(this.cursorPos);
|
|
196
|
-
let isBlock = !$pos.parent.inlineContent,
|
|
197
|
-
rect;
|
|
198
|
-
if (isBlock) {
|
|
199
|
-
let before = $pos.nodeBefore,
|
|
200
|
-
after = $pos.nodeAfter;
|
|
201
|
-
if (before || after) {
|
|
202
|
-
let node = this.editorView.nodeDOM(this.cursorPos - (before ? before.nodeSize : 0));
|
|
203
|
-
if (node) {
|
|
204
|
-
let nodeRect = node.getBoundingClientRect();
|
|
205
|
-
let top = before ? nodeRect.bottom : nodeRect.top;
|
|
206
|
-
if (before && after) top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2;
|
|
207
|
-
rect = {
|
|
208
|
-
left: nodeRect.left,
|
|
209
|
-
right: nodeRect.right,
|
|
210
|
-
top: top - this.width / 2,
|
|
211
|
-
bottom: top + this.width / 2
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (!rect) {
|
|
217
|
-
let coords = this.editorView.coordsAtPos(this.cursorPos);
|
|
218
|
-
rect = {
|
|
219
|
-
left: coords.left - this.width / 2,
|
|
220
|
-
right: coords.left + this.width / 2,
|
|
221
|
-
top: coords.top,
|
|
222
|
-
bottom: coords.bottom
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
let parent = this.editorView.dom.offsetParent;
|
|
226
|
-
if (!this.element) {
|
|
227
|
-
this.element = parent.appendChild(document.createElement("div"));
|
|
228
|
-
if (this.class) this.element.className = this.class;
|
|
229
|
-
this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;";
|
|
230
|
-
if (this.color) {
|
|
231
|
-
this.element.style.backgroundColor = this.color;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
this.element.classList.toggle("prosemirror-dropcursor-block", isBlock);
|
|
235
|
-
this.element.classList.toggle("prosemirror-dropcursor-inline", !isBlock);
|
|
236
|
-
let parentLeft, parentTop;
|
|
237
|
-
if (!parent || parent == document.body && getComputedStyle(parent).position == "static") {
|
|
238
|
-
parentLeft = -pageXOffset;
|
|
239
|
-
parentTop = -pageYOffset;
|
|
240
|
-
} else {
|
|
241
|
-
let rect = parent.getBoundingClientRect();
|
|
242
|
-
parentLeft = rect.left - parent.scrollLeft;
|
|
243
|
-
parentTop = rect.top - parent.scrollTop;
|
|
244
|
-
}
|
|
245
|
-
this.element.style.left = rect.left - parentLeft + "px";
|
|
246
|
-
this.element.style.top = rect.top - parentTop + "px";
|
|
247
|
-
this.element.style.width = rect.right - rect.left + "px";
|
|
248
|
-
this.element.style.height = rect.bottom - rect.top + "px";
|
|
249
|
-
}
|
|
250
|
-
scheduleRemoval(timeout) {
|
|
251
|
-
clearTimeout(this.timeout);
|
|
252
|
-
this.timeout = setTimeout(() => this.setCursor(null), timeout);
|
|
253
|
-
}
|
|
254
|
-
dragover(event) {
|
|
255
|
-
if (!this.editorView.editable) return;
|
|
256
|
-
let pos = this.editorView.posAtCoords({
|
|
257
|
-
left: event.clientX,
|
|
258
|
-
top: event.clientY
|
|
259
|
-
});
|
|
260
|
-
let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);
|
|
261
|
-
let disableDropCursor = node && node.type.spec.disableDropCursor;
|
|
262
|
-
let disabled = typeof disableDropCursor == "function" ? disableDropCursor(this.editorView, pos, event) : disableDropCursor;
|
|
263
|
-
if (pos && !disabled) {
|
|
264
|
-
let target = pos.pos;
|
|
265
|
-
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
266
|
-
let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);
|
|
267
|
-
if (point != null) target = point;
|
|
268
|
-
}
|
|
269
|
-
this.setCursor(target);
|
|
270
|
-
this.scheduleRemoval(5000);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
dragend() {
|
|
274
|
-
this.scheduleRemoval(20);
|
|
275
|
-
}
|
|
276
|
-
drop() {
|
|
277
|
-
this.scheduleRemoval(20);
|
|
278
|
-
}
|
|
279
|
-
dragleave(event) {
|
|
280
|
-
if (event.target == this.editorView.dom || !this.editorView.dom.contains(event.relatedTarget)) this.setCursor(null);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const Dropcursor = Extension.create({
|
|
285
|
-
name: 'dropCursor',
|
|
286
|
-
addOptions() {
|
|
287
|
-
return {
|
|
288
|
-
color: 'currentColor',
|
|
289
|
-
width: 1,
|
|
290
|
-
class: undefined
|
|
291
|
-
};
|
|
292
|
-
},
|
|
293
|
-
addProseMirrorPlugins() {
|
|
294
|
-
return [dropCursor(this.options)];
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
Gap cursor selections are represented using this class. Its
|
|
300
|
-
`$anchor` and `$head` properties both point at the cursor position.
|
|
301
|
-
*/
|
|
302
|
-
class GapCursor extends Selection {
|
|
303
|
-
/**
|
|
304
|
-
Create a gap cursor.
|
|
305
|
-
*/
|
|
306
|
-
constructor($pos) {
|
|
307
|
-
super($pos, $pos);
|
|
308
|
-
}
|
|
309
|
-
map(doc, mapping) {
|
|
310
|
-
let $pos = doc.resolve(mapping.map(this.head));
|
|
311
|
-
return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
|
|
312
|
-
}
|
|
313
|
-
content() {
|
|
314
|
-
return Slice.empty;
|
|
315
|
-
}
|
|
316
|
-
eq(other) {
|
|
317
|
-
return other instanceof GapCursor && other.head == this.head;
|
|
318
|
-
}
|
|
319
|
-
toJSON() {
|
|
320
|
-
return {
|
|
321
|
-
type: "gapcursor",
|
|
322
|
-
pos: this.head
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
@internal
|
|
327
|
-
*/
|
|
328
|
-
static fromJSON(doc, json) {
|
|
329
|
-
if (typeof json.pos != "number") throw new RangeError("Invalid input for GapCursor.fromJSON");
|
|
330
|
-
return new GapCursor(doc.resolve(json.pos));
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
@internal
|
|
334
|
-
*/
|
|
335
|
-
getBookmark() {
|
|
336
|
-
return new GapBookmark(this.anchor);
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
@internal
|
|
340
|
-
*/
|
|
341
|
-
static valid($pos) {
|
|
342
|
-
let parent = $pos.parent;
|
|
343
|
-
if (parent.isTextblock || !closedBefore($pos) || !closedAfter($pos)) return false;
|
|
344
|
-
let override = parent.type.spec.allowGapCursor;
|
|
345
|
-
if (override != null) return override;
|
|
346
|
-
let deflt = parent.contentMatchAt($pos.index()).defaultType;
|
|
347
|
-
return deflt && deflt.isTextblock;
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
@internal
|
|
351
|
-
*/
|
|
352
|
-
static findGapCursorFrom($pos, dir, mustMove = false) {
|
|
353
|
-
search: for (;;) {
|
|
354
|
-
if (!mustMove && GapCursor.valid($pos)) return $pos;
|
|
355
|
-
let pos = $pos.pos,
|
|
356
|
-
next = null;
|
|
357
|
-
// Scan up from this position
|
|
358
|
-
for (let d = $pos.depth;; d--) {
|
|
359
|
-
let parent = $pos.node(d);
|
|
360
|
-
if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {
|
|
361
|
-
next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);
|
|
362
|
-
break;
|
|
363
|
-
} else if (d == 0) {
|
|
364
|
-
return null;
|
|
365
|
-
}
|
|
366
|
-
pos += dir;
|
|
367
|
-
let $cur = $pos.doc.resolve(pos);
|
|
368
|
-
if (GapCursor.valid($cur)) return $cur;
|
|
369
|
-
}
|
|
370
|
-
// And then down into the next node
|
|
371
|
-
for (;;) {
|
|
372
|
-
let inside = dir > 0 ? next.firstChild : next.lastChild;
|
|
373
|
-
if (!inside) {
|
|
374
|
-
if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {
|
|
375
|
-
$pos = $pos.doc.resolve(pos + next.nodeSize * dir);
|
|
376
|
-
mustMove = false;
|
|
377
|
-
continue search;
|
|
378
|
-
}
|
|
379
|
-
break;
|
|
380
|
-
}
|
|
381
|
-
next = inside;
|
|
382
|
-
pos += dir;
|
|
383
|
-
let $cur = $pos.doc.resolve(pos);
|
|
384
|
-
if (GapCursor.valid($cur)) return $cur;
|
|
385
|
-
}
|
|
386
|
-
return null;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
GapCursor.prototype.visible = false;
|
|
391
|
-
GapCursor.findFrom = GapCursor.findGapCursorFrom;
|
|
392
|
-
Selection.jsonID("gapcursor", GapCursor);
|
|
393
|
-
class GapBookmark {
|
|
394
|
-
constructor(pos) {
|
|
395
|
-
this.pos = pos;
|
|
396
|
-
}
|
|
397
|
-
map(mapping) {
|
|
398
|
-
return new GapBookmark(mapping.map(this.pos));
|
|
399
|
-
}
|
|
400
|
-
resolve(doc) {
|
|
401
|
-
let $pos = doc.resolve(this.pos);
|
|
402
|
-
return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
function closedBefore($pos) {
|
|
406
|
-
for (let d = $pos.depth; d >= 0; d--) {
|
|
407
|
-
let index = $pos.index(d),
|
|
408
|
-
parent = $pos.node(d);
|
|
409
|
-
// At the start of this parent, look at next one
|
|
410
|
-
if (index == 0) {
|
|
411
|
-
if (parent.type.spec.isolating) return true;
|
|
412
|
-
continue;
|
|
413
|
-
}
|
|
414
|
-
// See if the node before (or its first ancestor) is closed
|
|
415
|
-
for (let before = parent.child(index - 1);; before = before.lastChild) {
|
|
416
|
-
if (before.childCount == 0 && !before.inlineContent || before.isAtom || before.type.spec.isolating) return true;
|
|
417
|
-
if (before.inlineContent) return false;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
// Hit start of document
|
|
421
|
-
return true;
|
|
422
|
-
}
|
|
423
|
-
function closedAfter($pos) {
|
|
424
|
-
for (let d = $pos.depth; d >= 0; d--) {
|
|
425
|
-
let index = $pos.indexAfter(d),
|
|
426
|
-
parent = $pos.node(d);
|
|
427
|
-
if (index == parent.childCount) {
|
|
428
|
-
if (parent.type.spec.isolating) return true;
|
|
429
|
-
continue;
|
|
430
|
-
}
|
|
431
|
-
for (let after = parent.child(index);; after = after.firstChild) {
|
|
432
|
-
if (after.childCount == 0 && !after.inlineContent || after.isAtom || after.type.spec.isolating) return true;
|
|
433
|
-
if (after.inlineContent) return false;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
return true;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
Create a gap cursor plugin. When enabled, this will capture clicks
|
|
441
|
-
near and arrow-key-motion past places that don't have a normally
|
|
442
|
-
selectable position nearby, and create a gap cursor selection for
|
|
443
|
-
them. The cursor is drawn as an element with class
|
|
444
|
-
`ProseMirror-gapcursor`. You can either include
|
|
445
|
-
`style/gapcursor.css` from the package's directory or add your own
|
|
446
|
-
styles to make it visible.
|
|
447
|
-
*/
|
|
448
|
-
function gapCursor() {
|
|
449
|
-
return new Plugin({
|
|
450
|
-
props: {
|
|
451
|
-
decorations: drawGapCursor,
|
|
452
|
-
createSelectionBetween(_view, $anchor, $head) {
|
|
453
|
-
return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;
|
|
454
|
-
},
|
|
455
|
-
handleClick,
|
|
456
|
-
handleKeyDown,
|
|
457
|
-
handleDOMEvents: {
|
|
458
|
-
beforeinput: beforeinput
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
const handleKeyDown = keydownHandler({
|
|
464
|
-
"ArrowLeft": arrow("horiz", -1),
|
|
465
|
-
"ArrowRight": arrow("horiz", 1),
|
|
466
|
-
"ArrowUp": arrow("vert", -1),
|
|
467
|
-
"ArrowDown": arrow("vert", 1)
|
|
468
|
-
});
|
|
469
|
-
function arrow(axis, dir) {
|
|
470
|
-
const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
|
|
471
|
-
return function (state, dispatch, view) {
|
|
472
|
-
let sel = state.selection;
|
|
473
|
-
let $start = dir > 0 ? sel.$to : sel.$from,
|
|
474
|
-
mustMove = sel.empty;
|
|
475
|
-
if (sel instanceof TextSelection) {
|
|
476
|
-
if (!view.endOfTextblock(dirStr) || $start.depth == 0) return false;
|
|
477
|
-
mustMove = false;
|
|
478
|
-
$start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());
|
|
479
|
-
}
|
|
480
|
-
let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);
|
|
481
|
-
if (!$found) return false;
|
|
482
|
-
if (dispatch) dispatch(state.tr.setSelection(new GapCursor($found)));
|
|
483
|
-
return true;
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
function handleClick(view, pos, event) {
|
|
487
|
-
if (!view || !view.editable) return false;
|
|
488
|
-
let $pos = view.state.doc.resolve(pos);
|
|
489
|
-
if (!GapCursor.valid($pos)) return false;
|
|
490
|
-
let clickPos = view.posAtCoords({
|
|
491
|
-
left: event.clientX,
|
|
492
|
-
top: event.clientY
|
|
493
|
-
});
|
|
494
|
-
if (clickPos && clickPos.inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside))) return false;
|
|
495
|
-
view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));
|
|
496
|
-
return true;
|
|
497
|
-
}
|
|
498
|
-
// This is a hack that, when a composition starts while a gap cursor
|
|
499
|
-
// is active, quickly creates an inline context for the composition to
|
|
500
|
-
// happen in, to avoid it being aborted by the DOM selection being
|
|
501
|
-
// moved into a valid position.
|
|
502
|
-
function beforeinput(view, event) {
|
|
503
|
-
if (event.inputType != "insertCompositionText" || !(view.state.selection instanceof GapCursor)) return false;
|
|
504
|
-
let {
|
|
505
|
-
$from
|
|
506
|
-
} = view.state.selection;
|
|
507
|
-
let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);
|
|
508
|
-
if (!insert) return false;
|
|
509
|
-
let frag = Fragment.empty;
|
|
510
|
-
for (let i = insert.length - 1; i >= 0; i--) frag = Fragment.from(insert[i].createAndFill(null, frag));
|
|
511
|
-
let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));
|
|
512
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));
|
|
513
|
-
view.dispatch(tr);
|
|
514
|
-
return false;
|
|
515
|
-
}
|
|
516
|
-
function drawGapCursor(state) {
|
|
517
|
-
if (!(state.selection instanceof GapCursor)) return null;
|
|
518
|
-
let node = document.createElement("div");
|
|
519
|
-
node.className = "ProseMirror-gapcursor";
|
|
520
|
-
return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, {
|
|
521
|
-
key: "gapcursor"
|
|
522
|
-
})]);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
const Gapcursor = Extension.create({
|
|
526
|
-
name: 'gapCursor',
|
|
527
|
-
addProseMirrorPlugins() {
|
|
528
|
-
return [gapCursor()];
|
|
529
|
-
},
|
|
530
|
-
extendNodeSchema(extension) {
|
|
531
|
-
var _a;
|
|
532
|
-
const context = {
|
|
533
|
-
name: extension.name,
|
|
534
|
-
options: extension.options,
|
|
535
|
-
storage: extension.storage
|
|
536
|
-
};
|
|
537
|
-
return {
|
|
538
|
-
allowGapCursor: (_a = callOrReturn(getExtensionField(extension, 'allowGapCursor', context))) !== null && _a !== void 0 ? _a : null
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
|
|
543
|
-
const Heading = Node.create({
|
|
544
|
-
name: 'heading',
|
|
545
|
-
addOptions() {
|
|
546
|
-
return {
|
|
547
|
-
levels: [1, 2, 3, 4, 5, 6],
|
|
548
|
-
HTMLAttributes: {}
|
|
549
|
-
};
|
|
550
|
-
},
|
|
551
|
-
content: 'inline*',
|
|
552
|
-
group: 'block',
|
|
553
|
-
defining: true,
|
|
554
|
-
addAttributes() {
|
|
555
|
-
return {
|
|
556
|
-
level: {
|
|
557
|
-
default: 1,
|
|
558
|
-
rendered: false
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
},
|
|
562
|
-
parseHTML() {
|
|
563
|
-
return this.options.levels.map(level => ({
|
|
564
|
-
tag: `h${level}`,
|
|
565
|
-
attrs: {
|
|
566
|
-
level
|
|
567
|
-
}
|
|
568
|
-
}));
|
|
569
|
-
},
|
|
570
|
-
renderHTML({
|
|
571
|
-
node,
|
|
572
|
-
HTMLAttributes
|
|
573
|
-
}) {
|
|
574
|
-
const hasLevel = this.options.levels.includes(node.attrs.level);
|
|
575
|
-
const level = hasLevel ? node.attrs.level : this.options.levels[0];
|
|
576
|
-
return [`h${level}`, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
577
|
-
},
|
|
578
|
-
addCommands() {
|
|
579
|
-
return {
|
|
580
|
-
setHeading: attributes => ({
|
|
581
|
-
commands
|
|
582
|
-
}) => {
|
|
583
|
-
if (!this.options.levels.includes(attributes.level)) {
|
|
584
|
-
return false;
|
|
585
|
-
}
|
|
586
|
-
return commands.setNode(this.name, attributes);
|
|
587
|
-
},
|
|
588
|
-
toggleHeading: attributes => ({
|
|
589
|
-
commands
|
|
590
|
-
}) => {
|
|
591
|
-
if (!this.options.levels.includes(attributes.level)) {
|
|
592
|
-
return false;
|
|
593
|
-
}
|
|
594
|
-
return commands.toggleNode(this.name, 'paragraph', attributes);
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
},
|
|
598
|
-
addKeyboardShortcuts() {
|
|
599
|
-
return this.options.levels.reduce((items, level) => ({
|
|
600
|
-
...items,
|
|
601
|
-
...{
|
|
602
|
-
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({
|
|
603
|
-
level
|
|
604
|
-
})
|
|
605
|
-
}
|
|
606
|
-
}), {});
|
|
607
|
-
},
|
|
608
|
-
addInputRules() {
|
|
609
|
-
return this.options.levels.map(level => {
|
|
610
|
-
return textblockTypeInputRule({
|
|
611
|
-
find: new RegExp(`^(#{1,${level}})\\s$`),
|
|
612
|
-
type: this.type,
|
|
613
|
-
getAttributes: {
|
|
614
|
-
level
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
|
|
621
|
-
var GOOD_LEAF_SIZE = 200;
|
|
622
|
-
|
|
623
|
-
// :: class<T> A rope sequence is a persistent sequence data structure
|
|
624
|
-
// that supports appending, prepending, and slicing without doing a
|
|
625
|
-
// full copy. It is represented as a mostly-balanced tree.
|
|
626
|
-
var RopeSequence = function RopeSequence() {};
|
|
627
|
-
RopeSequence.prototype.append = function append(other) {
|
|
628
|
-
if (!other.length) {
|
|
629
|
-
return this;
|
|
630
|
-
}
|
|
631
|
-
other = RopeSequence.from(other);
|
|
632
|
-
return !this.length && other || other.length < GOOD_LEAF_SIZE && this.leafAppend(other) || this.length < GOOD_LEAF_SIZE && other.leafPrepend(this) || this.appendInner(other);
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
// :: (union<[T], RopeSequence<T>>) → RopeSequence<T>
|
|
636
|
-
// Prepend an array or other rope to this one, returning a new rope.
|
|
637
|
-
RopeSequence.prototype.prepend = function prepend(other) {
|
|
638
|
-
if (!other.length) {
|
|
639
|
-
return this;
|
|
640
|
-
}
|
|
641
|
-
return RopeSequence.from(other).append(this);
|
|
642
|
-
};
|
|
643
|
-
RopeSequence.prototype.appendInner = function appendInner(other) {
|
|
644
|
-
return new Append(this, other);
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
// :: (?number, ?number) → RopeSequence<T>
|
|
648
|
-
// Create a rope repesenting a sub-sequence of this rope.
|
|
649
|
-
RopeSequence.prototype.slice = function slice(from, to) {
|
|
650
|
-
if (from === void 0) from = 0;
|
|
651
|
-
if (to === void 0) to = this.length;
|
|
652
|
-
if (from >= to) {
|
|
653
|
-
return RopeSequence.empty;
|
|
654
|
-
}
|
|
655
|
-
return this.sliceInner(Math.max(0, from), Math.min(this.length, to));
|
|
656
|
-
};
|
|
657
|
-
|
|
658
|
-
// :: (number) → T
|
|
659
|
-
// Retrieve the element at the given position from this rope.
|
|
660
|
-
RopeSequence.prototype.get = function get(i) {
|
|
661
|
-
if (i < 0 || i >= this.length) {
|
|
662
|
-
return undefined;
|
|
663
|
-
}
|
|
664
|
-
return this.getInner(i);
|
|
665
|
-
};
|
|
666
|
-
|
|
667
|
-
// :: ((element: T, index: number) → ?bool, ?number, ?number)
|
|
668
|
-
// Call the given function for each element between the given
|
|
669
|
-
// indices. This tends to be more efficient than looping over the
|
|
670
|
-
// indices and calling `get`, because it doesn't have to descend the
|
|
671
|
-
// tree for every element.
|
|
672
|
-
RopeSequence.prototype.forEach = function forEach(f, from, to) {
|
|
673
|
-
if (from === void 0) from = 0;
|
|
674
|
-
if (to === void 0) to = this.length;
|
|
675
|
-
if (from <= to) {
|
|
676
|
-
this.forEachInner(f, from, to, 0);
|
|
677
|
-
} else {
|
|
678
|
-
this.forEachInvertedInner(f, from, to, 0);
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
|
|
682
|
-
// :: ((element: T, index: number) → U, ?number, ?number) → [U]
|
|
683
|
-
// Map the given functions over the elements of the rope, producing
|
|
684
|
-
// a flat array.
|
|
685
|
-
RopeSequence.prototype.map = function map(f, from, to) {
|
|
686
|
-
if (from === void 0) from = 0;
|
|
687
|
-
if (to === void 0) to = this.length;
|
|
688
|
-
var result = [];
|
|
689
|
-
this.forEach(function (elt, i) {
|
|
690
|
-
return result.push(f(elt, i));
|
|
691
|
-
}, from, to);
|
|
692
|
-
return result;
|
|
693
|
-
};
|
|
694
|
-
|
|
695
|
-
// :: (?union<[T], RopeSequence<T>>) → RopeSequence<T>
|
|
696
|
-
// Create a rope representing the given array, or return the rope
|
|
697
|
-
// itself if a rope was given.
|
|
698
|
-
RopeSequence.from = function from(values) {
|
|
699
|
-
if (values instanceof RopeSequence) {
|
|
700
|
-
return values;
|
|
701
|
-
}
|
|
702
|
-
return values && values.length ? new Leaf(values) : RopeSequence.empty;
|
|
703
|
-
};
|
|
704
|
-
var Leaf = /*@__PURE__*/function (RopeSequence) {
|
|
705
|
-
function Leaf(values) {
|
|
706
|
-
RopeSequence.call(this);
|
|
707
|
-
this.values = values;
|
|
708
|
-
}
|
|
709
|
-
if (RopeSequence) Leaf.__proto__ = RopeSequence;
|
|
710
|
-
Leaf.prototype = Object.create(RopeSequence && RopeSequence.prototype);
|
|
711
|
-
Leaf.prototype.constructor = Leaf;
|
|
712
|
-
var prototypeAccessors = {
|
|
713
|
-
length: {
|
|
714
|
-
configurable: true
|
|
715
|
-
},
|
|
716
|
-
depth: {
|
|
717
|
-
configurable: true
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
Leaf.prototype.flatten = function flatten() {
|
|
721
|
-
return this.values;
|
|
722
|
-
};
|
|
723
|
-
Leaf.prototype.sliceInner = function sliceInner(from, to) {
|
|
724
|
-
if (from == 0 && to == this.length) {
|
|
725
|
-
return this;
|
|
726
|
-
}
|
|
727
|
-
return new Leaf(this.values.slice(from, to));
|
|
728
|
-
};
|
|
729
|
-
Leaf.prototype.getInner = function getInner(i) {
|
|
730
|
-
return this.values[i];
|
|
731
|
-
};
|
|
732
|
-
Leaf.prototype.forEachInner = function forEachInner(f, from, to, start) {
|
|
733
|
-
for (var i = from; i < to; i++) {
|
|
734
|
-
if (f(this.values[i], start + i) === false) {
|
|
735
|
-
return false;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
Leaf.prototype.forEachInvertedInner = function forEachInvertedInner(f, from, to, start) {
|
|
740
|
-
for (var i = from - 1; i >= to; i--) {
|
|
741
|
-
if (f(this.values[i], start + i) === false) {
|
|
742
|
-
return false;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
};
|
|
746
|
-
Leaf.prototype.leafAppend = function leafAppend(other) {
|
|
747
|
-
if (this.length + other.length <= GOOD_LEAF_SIZE) {
|
|
748
|
-
return new Leaf(this.values.concat(other.flatten()));
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
Leaf.prototype.leafPrepend = function leafPrepend(other) {
|
|
752
|
-
if (this.length + other.length <= GOOD_LEAF_SIZE) {
|
|
753
|
-
return new Leaf(other.flatten().concat(this.values));
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
prototypeAccessors.length.get = function () {
|
|
757
|
-
return this.values.length;
|
|
758
|
-
};
|
|
759
|
-
prototypeAccessors.depth.get = function () {
|
|
760
|
-
return 0;
|
|
761
|
-
};
|
|
762
|
-
Object.defineProperties(Leaf.prototype, prototypeAccessors);
|
|
763
|
-
return Leaf;
|
|
764
|
-
}(RopeSequence);
|
|
765
|
-
|
|
766
|
-
// :: RopeSequence
|
|
767
|
-
// The empty rope sequence.
|
|
768
|
-
RopeSequence.empty = new Leaf([]);
|
|
769
|
-
var Append = /*@__PURE__*/function (RopeSequence) {
|
|
770
|
-
function Append(left, right) {
|
|
771
|
-
RopeSequence.call(this);
|
|
772
|
-
this.left = left;
|
|
773
|
-
this.right = right;
|
|
774
|
-
this.length = left.length + right.length;
|
|
775
|
-
this.depth = Math.max(left.depth, right.depth) + 1;
|
|
776
|
-
}
|
|
777
|
-
if (RopeSequence) Append.__proto__ = RopeSequence;
|
|
778
|
-
Append.prototype = Object.create(RopeSequence && RopeSequence.prototype);
|
|
779
|
-
Append.prototype.constructor = Append;
|
|
780
|
-
Append.prototype.flatten = function flatten() {
|
|
781
|
-
return this.left.flatten().concat(this.right.flatten());
|
|
782
|
-
};
|
|
783
|
-
Append.prototype.getInner = function getInner(i) {
|
|
784
|
-
return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length);
|
|
785
|
-
};
|
|
786
|
-
Append.prototype.forEachInner = function forEachInner(f, from, to, start) {
|
|
787
|
-
var leftLen = this.left.length;
|
|
788
|
-
if (from < leftLen && this.left.forEachInner(f, from, Math.min(to, leftLen), start) === false) {
|
|
789
|
-
return false;
|
|
790
|
-
}
|
|
791
|
-
if (to > leftLen && this.right.forEachInner(f, Math.max(from - leftLen, 0), Math.min(this.length, to) - leftLen, start + leftLen) === false) {
|
|
792
|
-
return false;
|
|
793
|
-
}
|
|
794
|
-
};
|
|
795
|
-
Append.prototype.forEachInvertedInner = function forEachInvertedInner(f, from, to, start) {
|
|
796
|
-
var leftLen = this.left.length;
|
|
797
|
-
if (from > leftLen && this.right.forEachInvertedInner(f, from - leftLen, Math.max(to, leftLen) - leftLen, start + leftLen) === false) {
|
|
798
|
-
return false;
|
|
799
|
-
}
|
|
800
|
-
if (to < leftLen && this.left.forEachInvertedInner(f, Math.min(from, leftLen), to, start) === false) {
|
|
801
|
-
return false;
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
Append.prototype.sliceInner = function sliceInner(from, to) {
|
|
805
|
-
if (from == 0 && to == this.length) {
|
|
806
|
-
return this;
|
|
807
|
-
}
|
|
808
|
-
var leftLen = this.left.length;
|
|
809
|
-
if (to <= leftLen) {
|
|
810
|
-
return this.left.slice(from, to);
|
|
811
|
-
}
|
|
812
|
-
if (from >= leftLen) {
|
|
813
|
-
return this.right.slice(from - leftLen, to - leftLen);
|
|
814
|
-
}
|
|
815
|
-
return this.left.slice(from, leftLen).append(this.right.slice(0, to - leftLen));
|
|
816
|
-
};
|
|
817
|
-
Append.prototype.leafAppend = function leafAppend(other) {
|
|
818
|
-
var inner = this.right.leafAppend(other);
|
|
819
|
-
if (inner) {
|
|
820
|
-
return new Append(this.left, inner);
|
|
821
|
-
}
|
|
822
|
-
};
|
|
823
|
-
Append.prototype.leafPrepend = function leafPrepend(other) {
|
|
824
|
-
var inner = this.left.leafPrepend(other);
|
|
825
|
-
if (inner) {
|
|
826
|
-
return new Append(inner, this.right);
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
Append.prototype.appendInner = function appendInner(other) {
|
|
830
|
-
if (this.left.depth >= Math.max(this.right.depth, other.depth) + 1) {
|
|
831
|
-
return new Append(this.left, new Append(this.right, other));
|
|
832
|
-
}
|
|
833
|
-
return new Append(this, other);
|
|
834
|
-
};
|
|
835
|
-
return Append;
|
|
836
|
-
}(RopeSequence);
|
|
837
|
-
var ropeSequence = RopeSequence;
|
|
838
|
-
|
|
839
|
-
// ProseMirror's history isn't simply a way to roll back to a previous
|
|
840
|
-
// state, because ProseMirror supports applying changes without adding
|
|
841
|
-
// them to the history (for example during collaboration).
|
|
842
|
-
//
|
|
843
|
-
// To this end, each 'Branch' (one for the undo history and one for
|
|
844
|
-
// the redo history) keeps an array of 'Items', which can optionally
|
|
845
|
-
// hold a step (an actual undoable change), and always hold a position
|
|
846
|
-
// map (which is needed to move changes below them to apply to the
|
|
847
|
-
// current document).
|
|
848
|
-
//
|
|
849
|
-
// An item that has both a step and a selection bookmark is the start
|
|
850
|
-
// of an 'event' — a group of changes that will be undone or redone at
|
|
851
|
-
// once. (It stores only the bookmark, since that way we don't have to
|
|
852
|
-
// provide a document until the selection is actually applied, which
|
|
853
|
-
// is useful when compressing.)
|
|
854
|
-
// Used to schedule history compression
|
|
855
|
-
const max_empty_items = 500;
|
|
856
|
-
class Branch {
|
|
857
|
-
constructor(items, eventCount) {
|
|
858
|
-
this.items = items;
|
|
859
|
-
this.eventCount = eventCount;
|
|
860
|
-
}
|
|
861
|
-
// Pop the latest event off the branch's history and apply it
|
|
862
|
-
// to a document transform.
|
|
863
|
-
popEvent(state, preserveItems) {
|
|
864
|
-
if (this.eventCount == 0) return null;
|
|
865
|
-
let end = this.items.length;
|
|
866
|
-
for (;; end--) {
|
|
867
|
-
let next = this.items.get(end - 1);
|
|
868
|
-
if (next.selection) {
|
|
869
|
-
--end;
|
|
870
|
-
break;
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
let remap, mapFrom;
|
|
874
|
-
if (preserveItems) {
|
|
875
|
-
remap = this.remapping(end, this.items.length);
|
|
876
|
-
mapFrom = remap.maps.length;
|
|
877
|
-
}
|
|
878
|
-
let transform = state.tr;
|
|
879
|
-
let selection, remaining;
|
|
880
|
-
let addAfter = [],
|
|
881
|
-
addBefore = [];
|
|
882
|
-
this.items.forEach((item, i) => {
|
|
883
|
-
if (!item.step) {
|
|
884
|
-
if (!remap) {
|
|
885
|
-
remap = this.remapping(end, i + 1);
|
|
886
|
-
mapFrom = remap.maps.length;
|
|
887
|
-
}
|
|
888
|
-
mapFrom--;
|
|
889
|
-
addBefore.push(item);
|
|
890
|
-
return;
|
|
891
|
-
}
|
|
892
|
-
if (remap) {
|
|
893
|
-
addBefore.push(new Item(item.map));
|
|
894
|
-
let step = item.step.map(remap.slice(mapFrom)),
|
|
895
|
-
map;
|
|
896
|
-
if (step && transform.maybeStep(step).doc) {
|
|
897
|
-
map = transform.mapping.maps[transform.mapping.maps.length - 1];
|
|
898
|
-
addAfter.push(new Item(map, undefined, undefined, addAfter.length + addBefore.length));
|
|
899
|
-
}
|
|
900
|
-
mapFrom--;
|
|
901
|
-
if (map) remap.appendMap(map, mapFrom);
|
|
902
|
-
} else {
|
|
903
|
-
transform.maybeStep(item.step);
|
|
904
|
-
}
|
|
905
|
-
if (item.selection) {
|
|
906
|
-
selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;
|
|
907
|
-
remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);
|
|
908
|
-
return false;
|
|
909
|
-
}
|
|
910
|
-
}, this.items.length, 0);
|
|
911
|
-
return {
|
|
912
|
-
remaining: remaining,
|
|
913
|
-
transform,
|
|
914
|
-
selection: selection
|
|
915
|
-
};
|
|
916
|
-
}
|
|
917
|
-
// Create a new branch with the given transform added.
|
|
918
|
-
addTransform(transform, selection, histOptions, preserveItems) {
|
|
919
|
-
let newItems = [],
|
|
920
|
-
eventCount = this.eventCount;
|
|
921
|
-
let oldItems = this.items,
|
|
922
|
-
lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;
|
|
923
|
-
for (let i = 0; i < transform.steps.length; i++) {
|
|
924
|
-
let step = transform.steps[i].invert(transform.docs[i]);
|
|
925
|
-
let item = new Item(transform.mapping.maps[i], step, selection),
|
|
926
|
-
merged;
|
|
927
|
-
if (merged = lastItem && lastItem.merge(item)) {
|
|
928
|
-
item = merged;
|
|
929
|
-
if (i) newItems.pop();else oldItems = oldItems.slice(0, oldItems.length - 1);
|
|
930
|
-
}
|
|
931
|
-
newItems.push(item);
|
|
932
|
-
if (selection) {
|
|
933
|
-
eventCount++;
|
|
934
|
-
selection = undefined;
|
|
935
|
-
}
|
|
936
|
-
if (!preserveItems) lastItem = item;
|
|
937
|
-
}
|
|
938
|
-
let overflow = eventCount - histOptions.depth;
|
|
939
|
-
if (overflow > DEPTH_OVERFLOW) {
|
|
940
|
-
oldItems = cutOffEvents(oldItems, overflow);
|
|
941
|
-
eventCount -= overflow;
|
|
942
|
-
}
|
|
943
|
-
return new Branch(oldItems.append(newItems), eventCount);
|
|
944
|
-
}
|
|
945
|
-
remapping(from, to) {
|
|
946
|
-
let maps = new Mapping();
|
|
947
|
-
this.items.forEach((item, i) => {
|
|
948
|
-
let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from ? maps.maps.length - item.mirrorOffset : undefined;
|
|
949
|
-
maps.appendMap(item.map, mirrorPos);
|
|
950
|
-
}, from, to);
|
|
951
|
-
return maps;
|
|
952
|
-
}
|
|
953
|
-
addMaps(array) {
|
|
954
|
-
if (this.eventCount == 0) return this;
|
|
955
|
-
return new Branch(this.items.append(array.map(map => new Item(map))), this.eventCount);
|
|
956
|
-
}
|
|
957
|
-
// When the collab module receives remote changes, the history has
|
|
958
|
-
// to know about those, so that it can adjust the steps that were
|
|
959
|
-
// rebased on top of the remote changes, and include the position
|
|
960
|
-
// maps for the remote changes in its array of items.
|
|
961
|
-
rebased(rebasedTransform, rebasedCount) {
|
|
962
|
-
if (!this.eventCount) return this;
|
|
963
|
-
let rebasedItems = [],
|
|
964
|
-
start = Math.max(0, this.items.length - rebasedCount);
|
|
965
|
-
let mapping = rebasedTransform.mapping;
|
|
966
|
-
let newUntil = rebasedTransform.steps.length;
|
|
967
|
-
let eventCount = this.eventCount;
|
|
968
|
-
this.items.forEach(item => {
|
|
969
|
-
if (item.selection) eventCount--;
|
|
970
|
-
}, start);
|
|
971
|
-
let iRebased = rebasedCount;
|
|
972
|
-
this.items.forEach(item => {
|
|
973
|
-
let pos = mapping.getMirror(--iRebased);
|
|
974
|
-
if (pos == null) return;
|
|
975
|
-
newUntil = Math.min(newUntil, pos);
|
|
976
|
-
let map = mapping.maps[pos];
|
|
977
|
-
if (item.step) {
|
|
978
|
-
let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);
|
|
979
|
-
let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));
|
|
980
|
-
if (selection) eventCount++;
|
|
981
|
-
rebasedItems.push(new Item(map, step, selection));
|
|
982
|
-
} else {
|
|
983
|
-
rebasedItems.push(new Item(map));
|
|
984
|
-
}
|
|
985
|
-
}, start);
|
|
986
|
-
let newMaps = [];
|
|
987
|
-
for (let i = rebasedCount; i < newUntil; i++) newMaps.push(new Item(mapping.maps[i]));
|
|
988
|
-
let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);
|
|
989
|
-
let branch = new Branch(items, eventCount);
|
|
990
|
-
if (branch.emptyItemCount() > max_empty_items) branch = branch.compress(this.items.length - rebasedItems.length);
|
|
991
|
-
return branch;
|
|
992
|
-
}
|
|
993
|
-
emptyItemCount() {
|
|
994
|
-
let count = 0;
|
|
995
|
-
this.items.forEach(item => {
|
|
996
|
-
if (!item.step) count++;
|
|
997
|
-
});
|
|
998
|
-
return count;
|
|
999
|
-
}
|
|
1000
|
-
// Compressing a branch means rewriting it to push the air (map-only
|
|
1001
|
-
// items) out. During collaboration, these naturally accumulate
|
|
1002
|
-
// because each remote change adds one. The `upto` argument is used
|
|
1003
|
-
// to ensure that only the items below a given level are compressed,
|
|
1004
|
-
// because `rebased` relies on a clean, untouched set of items in
|
|
1005
|
-
// order to associate old items with rebased steps.
|
|
1006
|
-
compress(upto = this.items.length) {
|
|
1007
|
-
let remap = this.remapping(0, upto),
|
|
1008
|
-
mapFrom = remap.maps.length;
|
|
1009
|
-
let items = [],
|
|
1010
|
-
events = 0;
|
|
1011
|
-
this.items.forEach((item, i) => {
|
|
1012
|
-
if (i >= upto) {
|
|
1013
|
-
items.push(item);
|
|
1014
|
-
if (item.selection) events++;
|
|
1015
|
-
} else if (item.step) {
|
|
1016
|
-
let step = item.step.map(remap.slice(mapFrom)),
|
|
1017
|
-
map = step && step.getMap();
|
|
1018
|
-
mapFrom--;
|
|
1019
|
-
if (map) remap.appendMap(map, mapFrom);
|
|
1020
|
-
if (step) {
|
|
1021
|
-
let selection = item.selection && item.selection.map(remap.slice(mapFrom));
|
|
1022
|
-
if (selection) events++;
|
|
1023
|
-
let newItem = new Item(map.invert(), step, selection),
|
|
1024
|
-
merged,
|
|
1025
|
-
last = items.length - 1;
|
|
1026
|
-
if (merged = items.length && items[last].merge(newItem)) items[last] = merged;else items.push(newItem);
|
|
1027
|
-
}
|
|
1028
|
-
} else if (item.map) {
|
|
1029
|
-
mapFrom--;
|
|
1030
|
-
}
|
|
1031
|
-
}, this.items.length, 0);
|
|
1032
|
-
return new Branch(ropeSequence.from(items.reverse()), events);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
Branch.empty = new Branch(ropeSequence.empty, 0);
|
|
1036
|
-
function cutOffEvents(items, n) {
|
|
1037
|
-
let cutPoint;
|
|
1038
|
-
items.forEach((item, i) => {
|
|
1039
|
-
if (item.selection && n-- == 0) {
|
|
1040
|
-
cutPoint = i;
|
|
1041
|
-
return false;
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
1044
|
-
return items.slice(cutPoint);
|
|
1045
|
-
}
|
|
1046
|
-
class Item {
|
|
1047
|
-
constructor(
|
|
1048
|
-
// The (forward) step map for this item.
|
|
1049
|
-
map,
|
|
1050
|
-
// The inverted step
|
|
1051
|
-
step,
|
|
1052
|
-
// If this is non-null, this item is the start of a group, and
|
|
1053
|
-
// this selection is the starting selection for the group (the one
|
|
1054
|
-
// that was active before the first step was applied)
|
|
1055
|
-
selection,
|
|
1056
|
-
// If this item is the inverse of a previous mapping on the stack,
|
|
1057
|
-
// this points at the inverse's offset
|
|
1058
|
-
mirrorOffset) {
|
|
1059
|
-
this.map = map;
|
|
1060
|
-
this.step = step;
|
|
1061
|
-
this.selection = selection;
|
|
1062
|
-
this.mirrorOffset = mirrorOffset;
|
|
1063
|
-
}
|
|
1064
|
-
merge(other) {
|
|
1065
|
-
if (this.step && other.step && !other.selection) {
|
|
1066
|
-
let step = other.step.merge(this.step);
|
|
1067
|
-
if (step) return new Item(step.getMap().invert(), step, this.selection);
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
// The value of the state field that tracks undo/redo history for that
|
|
1072
|
-
// state. Will be stored in the plugin state when the history plugin
|
|
1073
|
-
// is active.
|
|
1074
|
-
class HistoryState {
|
|
1075
|
-
constructor(done, undone, prevRanges, prevTime) {
|
|
1076
|
-
this.done = done;
|
|
1077
|
-
this.undone = undone;
|
|
1078
|
-
this.prevRanges = prevRanges;
|
|
1079
|
-
this.prevTime = prevTime;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
const DEPTH_OVERFLOW = 20;
|
|
1083
|
-
// Record a transformation in undo history.
|
|
1084
|
-
function applyTransaction(history, state, tr, options) {
|
|
1085
|
-
let historyTr = tr.getMeta(historyKey),
|
|
1086
|
-
rebased;
|
|
1087
|
-
if (historyTr) return historyTr.historyState;
|
|
1088
|
-
if (tr.getMeta(closeHistoryKey)) history = new HistoryState(history.done, history.undone, null, 0);
|
|
1089
|
-
let appended = tr.getMeta("appendedTransaction");
|
|
1090
|
-
if (tr.steps.length == 0) {
|
|
1091
|
-
return history;
|
|
1092
|
-
} else if (appended && appended.getMeta(historyKey)) {
|
|
1093
|
-
if (appended.getMeta(historyKey).redo) return new HistoryState(history.done.addTransform(tr, undefined, options, mustPreserveItems(state)), history.undone, rangesFor(tr.mapping.maps[tr.steps.length - 1]), history.prevTime);else return new HistoryState(history.done, history.undone.addTransform(tr, undefined, options, mustPreserveItems(state)), null, history.prevTime);
|
|
1094
|
-
} else if (tr.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
|
|
1095
|
-
// Group transforms that occur in quick succession into one event.
|
|
1096
|
-
let newGroup = history.prevTime == 0 || !appended && (history.prevTime < (tr.time || 0) - options.newGroupDelay || !isAdjacentTo(tr, history.prevRanges));
|
|
1097
|
-
let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps[tr.steps.length - 1]);
|
|
1098
|
-
return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : undefined, options, mustPreserveItems(state)), Branch.empty, prevRanges, tr.time);
|
|
1099
|
-
} else if (rebased = tr.getMeta("rebased")) {
|
|
1100
|
-
// Used by the collab module to tell the history that some of its
|
|
1101
|
-
// content has been rebased.
|
|
1102
|
-
return new HistoryState(history.done.rebased(tr, rebased), history.undone.rebased(tr, rebased), mapRanges(history.prevRanges, tr.mapping), history.prevTime);
|
|
1103
|
-
} else {
|
|
1104
|
-
return new HistoryState(history.done.addMaps(tr.mapping.maps), history.undone.addMaps(tr.mapping.maps), mapRanges(history.prevRanges, tr.mapping), history.prevTime);
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
function isAdjacentTo(transform, prevRanges) {
|
|
1108
|
-
if (!prevRanges) return false;
|
|
1109
|
-
if (!transform.docChanged) return true;
|
|
1110
|
-
let adjacent = false;
|
|
1111
|
-
transform.mapping.maps[0].forEach((start, end) => {
|
|
1112
|
-
for (let i = 0; i < prevRanges.length; i += 2) if (start <= prevRanges[i + 1] && end >= prevRanges[i]) adjacent = true;
|
|
1113
|
-
});
|
|
1114
|
-
return adjacent;
|
|
1115
|
-
}
|
|
1116
|
-
function rangesFor(map) {
|
|
1117
|
-
let result = [];
|
|
1118
|
-
map.forEach((_from, _to, from, to) => result.push(from, to));
|
|
1119
|
-
return result;
|
|
1120
|
-
}
|
|
1121
|
-
function mapRanges(ranges, mapping) {
|
|
1122
|
-
if (!ranges) return null;
|
|
1123
|
-
let result = [];
|
|
1124
|
-
for (let i = 0; i < ranges.length; i += 2) {
|
|
1125
|
-
let from = mapping.map(ranges[i], 1),
|
|
1126
|
-
to = mapping.map(ranges[i + 1], -1);
|
|
1127
|
-
if (from <= to) result.push(from, to);
|
|
1128
|
-
}
|
|
1129
|
-
return result;
|
|
1130
|
-
}
|
|
1131
|
-
// Apply the latest event from one branch to the document and shift the event
|
|
1132
|
-
// onto the other branch.
|
|
1133
|
-
function histTransaction(history, state, dispatch, redo) {
|
|
1134
|
-
let preserveItems = mustPreserveItems(state);
|
|
1135
|
-
let histOptions = historyKey.get(state).spec.config;
|
|
1136
|
-
let pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);
|
|
1137
|
-
if (!pop) return;
|
|
1138
|
-
let selection = pop.selection.resolve(pop.transform.doc);
|
|
1139
|
-
let added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(), histOptions, preserveItems);
|
|
1140
|
-
let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0);
|
|
1141
|
-
dispatch(pop.transform.setSelection(selection).setMeta(historyKey, {
|
|
1142
|
-
redo,
|
|
1143
|
-
historyState: newHist
|
|
1144
|
-
}).scrollIntoView());
|
|
1145
|
-
}
|
|
1146
|
-
let cachedPreserveItems = false,
|
|
1147
|
-
cachedPreserveItemsPlugins = null;
|
|
1148
|
-
// Check whether any plugin in the given state has a
|
|
1149
|
-
// `historyPreserveItems` property in its spec, in which case we must
|
|
1150
|
-
// preserve steps exactly as they came in, so that they can be
|
|
1151
|
-
// rebased.
|
|
1152
|
-
function mustPreserveItems(state) {
|
|
1153
|
-
let plugins = state.plugins;
|
|
1154
|
-
if (cachedPreserveItemsPlugins != plugins) {
|
|
1155
|
-
cachedPreserveItems = false;
|
|
1156
|
-
cachedPreserveItemsPlugins = plugins;
|
|
1157
|
-
for (let i = 0; i < plugins.length; i++) if (plugins[i].spec.historyPreserveItems) {
|
|
1158
|
-
cachedPreserveItems = true;
|
|
1159
|
-
break;
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
return cachedPreserveItems;
|
|
1163
|
-
}
|
|
1164
|
-
const historyKey = new PluginKey("history");
|
|
1165
|
-
const closeHistoryKey = new PluginKey("closeHistory");
|
|
1166
|
-
/**
|
|
1167
|
-
Returns a plugin that enables the undo history for an editor. The
|
|
1168
|
-
plugin will track undo and redo stacks, which can be used with the
|
|
1169
|
-
[`undo`](https://prosemirror.net/docs/ref/#history.undo) and [`redo`](https://prosemirror.net/docs/ref/#history.redo) commands.
|
|
1170
|
-
|
|
1171
|
-
You can set an `"addToHistory"` [metadata
|
|
1172
|
-
property](https://prosemirror.net/docs/ref/#state.Transaction.setMeta) of `false` on a transaction
|
|
1173
|
-
to prevent it from being rolled back by undo.
|
|
1174
|
-
*/
|
|
1175
|
-
function history(config = {}) {
|
|
1176
|
-
config = {
|
|
1177
|
-
depth: config.depth || 100,
|
|
1178
|
-
newGroupDelay: config.newGroupDelay || 500
|
|
1179
|
-
};
|
|
1180
|
-
return new Plugin({
|
|
1181
|
-
key: historyKey,
|
|
1182
|
-
state: {
|
|
1183
|
-
init() {
|
|
1184
|
-
return new HistoryState(Branch.empty, Branch.empty, null, 0);
|
|
1185
|
-
},
|
|
1186
|
-
apply(tr, hist, state) {
|
|
1187
|
-
return applyTransaction(hist, state, tr, config);
|
|
1188
|
-
}
|
|
1189
|
-
},
|
|
1190
|
-
config,
|
|
1191
|
-
props: {
|
|
1192
|
-
handleDOMEvents: {
|
|
1193
|
-
beforeinput(view, e) {
|
|
1194
|
-
let inputType = e.inputType;
|
|
1195
|
-
let command = inputType == "historyUndo" ? undo : inputType == "historyRedo" ? redo : null;
|
|
1196
|
-
if (!command) return false;
|
|
1197
|
-
e.preventDefault();
|
|
1198
|
-
return command(view.state, view.dispatch);
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
});
|
|
1203
|
-
}
|
|
1204
|
-
/**
|
|
1205
|
-
A command function that undoes the last change, if any.
|
|
1206
|
-
*/
|
|
1207
|
-
const undo = (state, dispatch) => {
|
|
1208
|
-
let hist = historyKey.getState(state);
|
|
1209
|
-
if (!hist || hist.done.eventCount == 0) return false;
|
|
1210
|
-
if (dispatch) histTransaction(hist, state, dispatch, false);
|
|
1211
|
-
return true;
|
|
1212
|
-
};
|
|
1213
|
-
/**
|
|
1214
|
-
A command function that redoes the last undone change, if any.
|
|
1215
|
-
*/
|
|
1216
|
-
const redo = (state, dispatch) => {
|
|
1217
|
-
let hist = historyKey.getState(state);
|
|
1218
|
-
if (!hist || hist.undone.eventCount == 0) return false;
|
|
1219
|
-
if (dispatch) histTransaction(hist, state, dispatch, true);
|
|
1220
|
-
return true;
|
|
1221
|
-
};
|
|
1222
|
-
|
|
1223
|
-
const History = Extension.create({
|
|
1224
|
-
name: 'history',
|
|
1225
|
-
addOptions() {
|
|
1226
|
-
return {
|
|
1227
|
-
depth: 100,
|
|
1228
|
-
newGroupDelay: 500
|
|
1229
|
-
};
|
|
1230
|
-
},
|
|
1231
|
-
addCommands() {
|
|
1232
|
-
return {
|
|
1233
|
-
undo: () => ({
|
|
1234
|
-
state,
|
|
1235
|
-
dispatch
|
|
1236
|
-
}) => {
|
|
1237
|
-
return undo(state, dispatch);
|
|
1238
|
-
},
|
|
1239
|
-
redo: () => ({
|
|
1240
|
-
state,
|
|
1241
|
-
dispatch
|
|
1242
|
-
}) => {
|
|
1243
|
-
return redo(state, dispatch);
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
1246
|
-
},
|
|
1247
|
-
addProseMirrorPlugins() {
|
|
1248
|
-
return [history(this.options)];
|
|
1249
|
-
},
|
|
1250
|
-
addKeyboardShortcuts() {
|
|
1251
|
-
return {
|
|
1252
|
-
'Mod-z': () => this.editor.commands.undo(),
|
|
1253
|
-
'Mod-y': () => this.editor.commands.redo(),
|
|
1254
|
-
'Shift-Mod-z': () => this.editor.commands.redo(),
|
|
1255
|
-
// Russian keyboard layouts
|
|
1256
|
-
'Mod-я': () => this.editor.commands.undo(),
|
|
1257
|
-
'Shift-Mod-я': () => this.editor.commands.redo()
|
|
1258
|
-
};
|
|
1259
|
-
}
|
|
1260
|
-
});
|
|
1261
|
-
|
|
1262
|
-
const HorizontalRule = Node.create({
|
|
1263
|
-
name: 'horizontalRule',
|
|
1264
|
-
addOptions() {
|
|
1265
|
-
return {
|
|
1266
|
-
HTMLAttributes: {}
|
|
1267
|
-
};
|
|
1268
|
-
},
|
|
1269
|
-
group: 'block',
|
|
1270
|
-
parseHTML() {
|
|
1271
|
-
return [{
|
|
1272
|
-
tag: 'hr'
|
|
1273
|
-
}];
|
|
1274
|
-
},
|
|
1275
|
-
renderHTML({
|
|
1276
|
-
HTMLAttributes
|
|
1277
|
-
}) {
|
|
1278
|
-
return ['hr', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
|
1279
|
-
},
|
|
1280
|
-
addCommands() {
|
|
1281
|
-
return {
|
|
1282
|
-
setHorizontalRule: () => ({
|
|
1283
|
-
chain
|
|
1284
|
-
}) => {
|
|
1285
|
-
return chain().insertContent({
|
|
1286
|
-
type: this.name
|
|
1287
|
-
})
|
|
1288
|
-
// set cursor after horizontal rule
|
|
1289
|
-
.command(({
|
|
1290
|
-
tr,
|
|
1291
|
-
dispatch
|
|
1292
|
-
}) => {
|
|
1293
|
-
var _a;
|
|
1294
|
-
if (dispatch) {
|
|
1295
|
-
const {
|
|
1296
|
-
$to
|
|
1297
|
-
} = tr.selection;
|
|
1298
|
-
const posAfter = $to.end();
|
|
1299
|
-
if ($to.nodeAfter) {
|
|
1300
|
-
tr.setSelection(TextSelection.create(tr.doc, $to.pos));
|
|
1301
|
-
} else {
|
|
1302
|
-
// add node after horizontal rule if it’s the end of the document
|
|
1303
|
-
const node = (_a = $to.parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create();
|
|
1304
|
-
if (node) {
|
|
1305
|
-
tr.insert(posAfter, node);
|
|
1306
|
-
tr.setSelection(TextSelection.create(tr.doc, posAfter));
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
tr.scrollIntoView();
|
|
1310
|
-
}
|
|
1311
|
-
return true;
|
|
1312
|
-
}).run();
|
|
1313
|
-
}
|
|
1314
|
-
};
|
|
1315
|
-
},
|
|
1316
|
-
addInputRules() {
|
|
1317
|
-
return [nodeInputRule({
|
|
1318
|
-
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
1319
|
-
type: this.type
|
|
1320
|
-
})];
|
|
1321
|
-
}
|
|
1322
|
-
});
|
|
1323
|
-
|
|
1324
|
-
const Text = Node.create({
|
|
1325
|
-
name: 'text',
|
|
1326
|
-
group: 'inline'
|
|
1327
|
-
});
|
|
1328
|
-
|
|
1329
|
-
const StarterKit = Extension.create({
|
|
1330
|
-
name: 'starterKit',
|
|
1331
|
-
addExtensions() {
|
|
1332
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
1333
|
-
const extensions = [];
|
|
1334
|
-
if (this.options.blockquote !== false) {
|
|
1335
|
-
extensions.push(Blockquote.configure((_a = this.options) === null || _a === void 0 ? void 0 : _a.blockquote));
|
|
1336
|
-
}
|
|
1337
|
-
if (this.options.bold !== false) {
|
|
1338
|
-
extensions.push(Bold.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.bold));
|
|
1339
|
-
}
|
|
1340
|
-
if (this.options.bulletList !== false) {
|
|
1341
|
-
extensions.push(BulletList.configure((_c = this.options) === null || _c === void 0 ? void 0 : _c.bulletList));
|
|
1342
|
-
}
|
|
1343
|
-
if (this.options.code !== false) {
|
|
1344
|
-
extensions.push(Code.configure((_d = this.options) === null || _d === void 0 ? void 0 : _d.code));
|
|
1345
|
-
}
|
|
1346
|
-
if (this.options.codeBlock !== false) {
|
|
1347
|
-
extensions.push(CodeBlock.configure((_e = this.options) === null || _e === void 0 ? void 0 : _e.codeBlock));
|
|
1348
|
-
}
|
|
1349
|
-
if (this.options.document !== false) {
|
|
1350
|
-
extensions.push(Document.configure((_f = this.options) === null || _f === void 0 ? void 0 : _f.document));
|
|
1351
|
-
}
|
|
1352
|
-
if (this.options.dropcursor !== false) {
|
|
1353
|
-
extensions.push(Dropcursor.configure((_g = this.options) === null || _g === void 0 ? void 0 : _g.dropcursor));
|
|
1354
|
-
}
|
|
1355
|
-
if (this.options.gapcursor !== false) {
|
|
1356
|
-
extensions.push(Gapcursor.configure((_h = this.options) === null || _h === void 0 ? void 0 : _h.gapcursor));
|
|
1357
|
-
}
|
|
1358
|
-
if (this.options.hardBreak !== false) {
|
|
1359
|
-
extensions.push(HardBreak.configure((_j = this.options) === null || _j === void 0 ? void 0 : _j.hardBreak));
|
|
1360
|
-
}
|
|
1361
|
-
if (this.options.heading !== false) {
|
|
1362
|
-
extensions.push(Heading.configure((_k = this.options) === null || _k === void 0 ? void 0 : _k.heading));
|
|
1363
|
-
}
|
|
1364
|
-
if (this.options.history !== false) {
|
|
1365
|
-
extensions.push(History.configure((_l = this.options) === null || _l === void 0 ? void 0 : _l.history));
|
|
1366
|
-
}
|
|
1367
|
-
if (this.options.horizontalRule !== false) {
|
|
1368
|
-
extensions.push(HorizontalRule.configure((_m = this.options) === null || _m === void 0 ? void 0 : _m.horizontalRule));
|
|
1369
|
-
}
|
|
1370
|
-
if (this.options.italic !== false) {
|
|
1371
|
-
extensions.push(Italic.configure((_o = this.options) === null || _o === void 0 ? void 0 : _o.italic));
|
|
1372
|
-
}
|
|
1373
|
-
if (this.options.listItem !== false) {
|
|
1374
|
-
extensions.push(ListItem.configure((_p = this.options) === null || _p === void 0 ? void 0 : _p.listItem));
|
|
1375
|
-
}
|
|
1376
|
-
if (this.options.orderedList !== false) {
|
|
1377
|
-
extensions.push(OrderedList.configure((_q = this.options) === null || _q === void 0 ? void 0 : _q.orderedList));
|
|
1378
|
-
}
|
|
1379
|
-
if (this.options.paragraph !== false) {
|
|
1380
|
-
extensions.push(Paragraph.configure((_r = this.options) === null || _r === void 0 ? void 0 : _r.paragraph));
|
|
1381
|
-
}
|
|
1382
|
-
if (this.options.strike !== false) {
|
|
1383
|
-
extensions.push(Strike.configure((_s = this.options) === null || _s === void 0 ? void 0 : _s.strike));
|
|
1384
|
-
}
|
|
1385
|
-
if (this.options.text !== false) {
|
|
1386
|
-
extensions.push(Text.configure((_t = this.options) === null || _t === void 0 ? void 0 : _t.text));
|
|
1387
|
-
}
|
|
1388
|
-
return extensions;
|
|
1389
|
-
}
|
|
1390
|
-
});
|
|
1391
|
-
|
|
1392
|
-
const Placeholder = Extension.create({
|
|
1393
|
-
name: 'placeholder',
|
|
1394
|
-
addOptions() {
|
|
1395
|
-
return {
|
|
1396
|
-
emptyEditorClass: 'is-editor-empty',
|
|
1397
|
-
emptyNodeClass: 'is-empty',
|
|
1398
|
-
placeholder: 'Write something …',
|
|
1399
|
-
showOnlyWhenEditable: true,
|
|
1400
|
-
showOnlyCurrent: true,
|
|
1401
|
-
includeChildren: false
|
|
1402
|
-
};
|
|
1403
|
-
},
|
|
1404
|
-
addProseMirrorPlugins() {
|
|
1405
|
-
return [new Plugin({
|
|
1406
|
-
props: {
|
|
1407
|
-
decorations: ({
|
|
1408
|
-
doc,
|
|
1409
|
-
selection
|
|
1410
|
-
}) => {
|
|
1411
|
-
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
1412
|
-
const {
|
|
1413
|
-
anchor
|
|
1414
|
-
} = selection;
|
|
1415
|
-
const decorations = [];
|
|
1416
|
-
if (!active) {
|
|
1417
|
-
return null;
|
|
1418
|
-
}
|
|
1419
|
-
// only calculate isEmpty once due to its performance impacts (see issue #3360)
|
|
1420
|
-
const emptyDocInstance = doc.type.createAndFill();
|
|
1421
|
-
const isEditorEmpty = (emptyDocInstance === null || emptyDocInstance === void 0 ? void 0 : emptyDocInstance.sameMarkup(doc)) && emptyDocInstance.content.findDiffStart(doc.content) === null;
|
|
1422
|
-
doc.descendants((node, pos) => {
|
|
1423
|
-
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
1424
|
-
const isEmpty = !node.isLeaf && !node.childCount;
|
|
1425
|
-
if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {
|
|
1426
|
-
const classes = [this.options.emptyNodeClass];
|
|
1427
|
-
if (isEditorEmpty) {
|
|
1428
|
-
classes.push(this.options.emptyEditorClass);
|
|
1429
|
-
}
|
|
1430
|
-
const decoration = Decoration.node(pos, pos + node.nodeSize, {
|
|
1431
|
-
class: classes.join(' '),
|
|
1432
|
-
'data-placeholder': typeof this.options.placeholder === 'function' ? this.options.placeholder({
|
|
1433
|
-
editor: this.editor,
|
|
1434
|
-
node,
|
|
1435
|
-
pos,
|
|
1436
|
-
hasAnchor
|
|
1437
|
-
}) : this.options.placeholder
|
|
1438
|
-
});
|
|
1439
|
-
decorations.push(decoration);
|
|
1440
|
-
}
|
|
1441
|
-
return this.options.includeChildren;
|
|
1442
|
-
});
|
|
1443
|
-
return DecorationSet.create(doc, decorations);
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
})];
|
|
1447
|
-
}
|
|
1448
|
-
});
|
|
1449
|
-
|
|
1450
|
-
var script = defineComponent({
|
|
1451
|
-
name: 'OrRichTextEditor',
|
|
1452
|
-
components: {
|
|
1453
|
-
OrIconButton: __vue_component__$1,
|
|
1454
|
-
OrLabel: __vue_component__$2,
|
|
1455
|
-
OrMenuItem: __vue_component__$3,
|
|
1456
|
-
OrMenu: __vue_component__$4,
|
|
1457
|
-
OrModal: __vue_component__$5,
|
|
1458
|
-
OrInput: __vue_component__$6,
|
|
1459
|
-
OrButton: __vue_component__$7
|
|
1460
|
-
},
|
|
1461
|
-
inheritAttrs: false,
|
|
1462
|
-
model: {
|
|
1463
|
-
prop: 'modelValue',
|
|
1464
|
-
event: 'update:modelValue'
|
|
1465
|
-
},
|
|
1466
|
-
props: {
|
|
1467
|
-
modelValue: {
|
|
1468
|
-
type: String,
|
|
1469
|
-
default: undefined
|
|
1470
|
-
},
|
|
1471
|
-
toolbar: {
|
|
1472
|
-
type: Array,
|
|
1473
|
-
default: () => []
|
|
1474
|
-
},
|
|
1475
|
-
description: {
|
|
1476
|
-
type: String,
|
|
1477
|
-
default: ''
|
|
1478
|
-
},
|
|
1479
|
-
placeholder: {
|
|
1480
|
-
type: String,
|
|
1481
|
-
default: ''
|
|
1482
|
-
},
|
|
1483
|
-
autofocus: {
|
|
1484
|
-
type: Boolean,
|
|
1485
|
-
default: false
|
|
1486
|
-
},
|
|
1487
|
-
markdownFormat: {
|
|
1488
|
-
type: Boolean,
|
|
1489
|
-
default: false
|
|
1490
|
-
},
|
|
1491
|
-
fullHeight: {
|
|
1492
|
-
type: Boolean,
|
|
1493
|
-
default: false
|
|
1494
|
-
}
|
|
1495
|
-
},
|
|
1496
|
-
emits: ['update:modelValue', 'input', 'file-upload'],
|
|
1497
|
-
expose: ['root'],
|
|
1498
|
-
setup(props, context) {
|
|
1499
|
-
// Refs
|
|
1500
|
-
const root = ref();
|
|
1501
|
-
let editor = null;
|
|
1502
|
-
const editorRef = ref();
|
|
1503
|
-
const containerRef = ref();
|
|
1504
|
-
const toolbarButtonRef = ref();
|
|
1505
|
-
const menuRef = ref();
|
|
1506
|
-
const isActive = ref({});
|
|
1507
|
-
const isFocused = ref(props.autofocus);
|
|
1508
|
-
const headingLevels = [1, 2, 3, 4];
|
|
1509
|
-
const activeHeadingLevel = ref(0);
|
|
1510
|
-
const markdownOutput = ref('');
|
|
1511
|
-
const isOpenLinkModal = ref(false);
|
|
1512
|
-
const text = ref('');
|
|
1513
|
-
const link = ref('');
|
|
1514
|
-
let trap = useFocusTrap(editorRef, {
|
|
1515
|
-
immediate: true,
|
|
1516
|
-
fallbackFocus: '.container',
|
|
1517
|
-
allowOutsideClick: true
|
|
1518
|
-
});
|
|
1519
|
-
const iconsEnum = ref({
|
|
1520
|
-
bold: 'format_bold',
|
|
1521
|
-
italic: 'format_italic',
|
|
1522
|
-
underline: 'format_underlined',
|
|
1523
|
-
strike: 'format_strikethrough',
|
|
1524
|
-
bulletList: 'format_list_bulleted',
|
|
1525
|
-
orderedList: 'format_list_numbered',
|
|
1526
|
-
link: 'link',
|
|
1527
|
-
highlight: 'highlight',
|
|
1528
|
-
redo: 'redo',
|
|
1529
|
-
undo: 'undo',
|
|
1530
|
-
codeBlock: 'code_blocks',
|
|
1531
|
-
blockquote: 'format_quote',
|
|
1532
|
-
file: 'attach_file'
|
|
1533
|
-
});
|
|
1534
|
-
const iconTooltipsEnum = ref({
|
|
1535
|
-
bold: 'Bold',
|
|
1536
|
-
italic: 'Italic',
|
|
1537
|
-
underline: 'Underline',
|
|
1538
|
-
strike: 'Strike',
|
|
1539
|
-
bulletList: 'Bulleted List',
|
|
1540
|
-
orderedList: 'Numbered List',
|
|
1541
|
-
link: 'Link',
|
|
1542
|
-
highlight: 'Highlight',
|
|
1543
|
-
redo: 'Redo',
|
|
1544
|
-
undo: 'Undo',
|
|
1545
|
-
codeBlock: 'Code Block',
|
|
1546
|
-
blockquote: 'Quote',
|
|
1547
|
-
file: 'File'
|
|
1548
|
-
});
|
|
1549
|
-
onMounted(() => {
|
|
1550
|
-
editor = new Editor({
|
|
1551
|
-
onUpdate: ({
|
|
1552
|
-
editor
|
|
1553
|
-
}) => {
|
|
1554
|
-
isFocused.value = true;
|
|
1555
|
-
setActiveFormats();
|
|
1556
|
-
const html = editor.getHTML();
|
|
1557
|
-
const text = editor.getText();
|
|
1558
|
-
if (props.markdownFormat) {
|
|
1559
|
-
markdownOutput.value = serialize(editor.schema, editor.getJSON());
|
|
1560
|
-
proxyModelValue.value = markdownOutput.value;
|
|
1561
|
-
} else {
|
|
1562
|
-
proxyModelValue.value = text === '' ? text : html;
|
|
1563
|
-
}
|
|
1564
|
-
},
|
|
1565
|
-
onCreate: ({
|
|
1566
|
-
editor
|
|
1567
|
-
}) => {
|
|
1568
|
-
if (props.markdownFormat) {
|
|
1569
|
-
const deserialized = deserialize(editor.schema, proxyModelValue.value);
|
|
1570
|
-
editor.commands.setContent(deserialized);
|
|
1571
|
-
} else {
|
|
1572
|
-
editor.commands.setContent(proxyModelValue.value);
|
|
1573
|
-
}
|
|
1574
|
-
},
|
|
1575
|
-
element: editorRef.value,
|
|
1576
|
-
autofocus: props.autofocus,
|
|
1577
|
-
extensions: [codemirrorNode, StarterKit.configure({
|
|
1578
|
-
heading: false,
|
|
1579
|
-
codeBlock: false
|
|
1580
|
-
}), Heading.configure({
|
|
1581
|
-
levels: headingLevels
|
|
1582
|
-
}).extend({
|
|
1583
|
-
levels: headingLevels,
|
|
1584
|
-
renderHTML({
|
|
1585
|
-
node,
|
|
1586
|
-
HTMLAttributes
|
|
1587
|
-
}) {
|
|
1588
|
-
return ['h' + node.attrs.level, mergeAttributes(HTMLAttributes, {
|
|
1589
|
-
class: `typography-headline-${node.attrs.level}`
|
|
1590
|
-
}), 0];
|
|
1591
|
-
}
|
|
1592
|
-
}), Underline, Link.configure({
|
|
1593
|
-
openOnClick: true,
|
|
1594
|
-
linkOnPaste: true,
|
|
1595
|
-
autolink: false,
|
|
1596
|
-
protocols: ['ftp', 'mailto', 'http', 'https'],
|
|
1597
|
-
validate: href => /^https?:\/\//.test(href),
|
|
1598
|
-
HTMLAttributes: {
|
|
1599
|
-
class: 'text-primary cursor-pointer'
|
|
1600
|
-
}
|
|
1601
|
-
}), Highlight, Placeholder.configure({
|
|
1602
|
-
placeholder: props.placeholder,
|
|
1603
|
-
emptyEditorClass: 'is-editor-empty text-outline'
|
|
1604
|
-
})],
|
|
1605
|
-
editorProps: {
|
|
1606
|
-
attributes: {
|
|
1607
|
-
class: 'focus:outline-none'
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
});
|
|
1611
|
-
setActiveFormats();
|
|
1612
|
-
trap.activate();
|
|
1613
|
-
});
|
|
1614
|
-
onBeforeUnmount(() => {
|
|
1615
|
-
editor === null || editor === void 0 ? void 0 : editor.destroy();
|
|
1616
|
-
});
|
|
1617
|
-
onClickOutside(root, () => {
|
|
1618
|
-
isFocused.value = false;
|
|
1619
|
-
trap.deactivate();
|
|
1620
|
-
});
|
|
1621
|
-
// Computed
|
|
1622
|
-
const proxyModelValue = computed({
|
|
1623
|
-
get: () => {
|
|
1624
|
-
return props.modelValue;
|
|
1625
|
-
},
|
|
1626
|
-
set: value => {
|
|
1627
|
-
context.emit('input', value);
|
|
1628
|
-
context.emit('update:modelValue', value);
|
|
1629
|
-
}
|
|
1630
|
-
});
|
|
1631
|
-
const getIndexOfHeading = computed(() => {
|
|
1632
|
-
return props.toolbar.flat().indexOf('heading');
|
|
1633
|
-
});
|
|
1634
|
-
const headingIcon = computed(() => {
|
|
1635
|
-
if (activeHeadingLevel.value && isActive.value.heading) {
|
|
1636
|
-
return `format_h${activeHeadingLevel.value}`;
|
|
1637
|
-
}
|
|
1638
|
-
return 'format_paragraph';
|
|
1639
|
-
});
|
|
1640
|
-
//Methods
|
|
1641
|
-
const handleEditorClick = () => {
|
|
1642
|
-
var _a;
|
|
1643
|
-
setActiveFormats();
|
|
1644
|
-
isFocused.value = true;
|
|
1645
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.focus();
|
|
1646
|
-
activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
|
|
1647
|
-
};
|
|
1648
|
-
const handleToolbarClick = (item, level) => {
|
|
1649
|
-
var _a, _b;
|
|
1650
|
-
switch (item) {
|
|
1651
|
-
case 'bulletList':
|
|
1652
|
-
case 'orderedList':
|
|
1653
|
-
item === 'bulletList' ? editor === null || editor === void 0 ? void 0 : editor.commands.toggleBulletList() : editor === null || editor === void 0 ? void 0 : editor.commands.toggleOrderedList();
|
|
1654
|
-
break;
|
|
1655
|
-
case 'link':
|
|
1656
|
-
if (editor) {
|
|
1657
|
-
const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
|
|
1658
|
-
const {
|
|
1659
|
-
from,
|
|
1660
|
-
to,
|
|
1661
|
-
empty
|
|
1662
|
-
} = editor.state.selection;
|
|
1663
|
-
const isLink = (_a = editor.view.state.doc.nodeAt(cursorPosition)) === null || _a === void 0 ? void 0 : _a.marks.filter(mark => mark.type.name === 'link');
|
|
1664
|
-
const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? ((_b = editor.view.state.doc.nodeAt(cursorPosition)) === null || _b === void 0 ? void 0 : _b.text) || '' : '';
|
|
1665
|
-
text.value = empty ? existedText : editor.state.doc.textBetween(from, to, ' ');
|
|
1666
|
-
link.value = editor.getAttributes('link').href || '';
|
|
1667
|
-
}
|
|
1668
|
-
isOpenLinkModal.value = !isOpenLinkModal.value;
|
|
1669
|
-
break;
|
|
1670
|
-
case 'blockquote':
|
|
1671
|
-
editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleBlockquote().run();
|
|
1672
|
-
break;
|
|
1673
|
-
case 'codeBlock':
|
|
1674
|
-
if (!isActive.value['codeBlock']) {
|
|
1675
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.setNode(item, {
|
|
1676
|
-
language: 'javascript'
|
|
1677
|
-
});
|
|
1678
|
-
} else {
|
|
1679
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.setNode('paragraph');
|
|
1680
|
-
}
|
|
1681
|
-
break;
|
|
1682
|
-
case 'heading':
|
|
1683
|
-
if (!level) {
|
|
1684
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
|
|
1685
|
-
level: 0
|
|
1686
|
-
});
|
|
1687
|
-
activeHeadingLevel.value = 0;
|
|
1688
|
-
} else {
|
|
1689
|
-
activeHeadingLevel.value = level;
|
|
1690
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
|
|
1691
|
-
level: level
|
|
1692
|
-
});
|
|
1693
|
-
}
|
|
1694
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.focus();
|
|
1695
|
-
break;
|
|
1696
|
-
case 'undo':
|
|
1697
|
-
case 'redo':
|
|
1698
|
-
item === 'undo' ? editor === null || editor === void 0 ? void 0 : editor.commands.undo() : editor === null || editor === void 0 ? void 0 : editor.commands.redo();
|
|
1699
|
-
break;
|
|
1700
|
-
case 'file':
|
|
1701
|
-
context.emit('file-upload');
|
|
1702
|
-
break;
|
|
1703
|
-
default:
|
|
1704
|
-
editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleMark(item).run();
|
|
1705
|
-
break;
|
|
1706
|
-
}
|
|
1707
|
-
};
|
|
1708
|
-
const attachLink = async () => {
|
|
1709
|
-
var _a, _b;
|
|
1710
|
-
// empty
|
|
1711
|
-
if (link.value === '') {
|
|
1712
|
-
editor === null || editor === void 0 ? void 0 : editor.chain().focus().extendMarkRange('link').unsetLink().run();
|
|
1713
|
-
}
|
|
1714
|
-
const isEmptySelection = editor === null || editor === void 0 ? void 0 : editor.state.selection.empty;
|
|
1715
|
-
const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
|
|
1716
|
-
const isLink = (_a = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _a === void 0 ? void 0 : _a.marks.filter(mark => mark.type.name === 'link');
|
|
1717
|
-
const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? (_b = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _b === void 0 ? void 0 : _b.text : '';
|
|
1718
|
-
if (link.value && isEmptySelection && !existedText) {
|
|
1719
|
-
editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
|
|
1720
|
-
href: link.value,
|
|
1721
|
-
target: '__blank'
|
|
1722
|
-
}).command(({
|
|
1723
|
-
tr
|
|
1724
|
-
}) => {
|
|
1725
|
-
const preparedValue = text.value[text.value.length - 1] === ' ' ? text.value : `${text.value} `;
|
|
1726
|
-
tr.insertText(preparedValue);
|
|
1727
|
-
return true;
|
|
1728
|
-
}).run();
|
|
1729
|
-
}
|
|
1730
|
-
if (link.value && existedText === text.value && isEmptySelection) {
|
|
1731
|
-
editor === null || editor === void 0 ? void 0 : editor.chain().extendMarkRange('link').updateAttributes('link', {
|
|
1732
|
-
href: link.value
|
|
1733
|
-
}).run();
|
|
1734
|
-
}
|
|
1735
|
-
if (link.value && !isEmptySelection) {
|
|
1736
|
-
editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
|
|
1737
|
-
href: link.value,
|
|
1738
|
-
target: '__blank'
|
|
1739
|
-
}).run();
|
|
1740
|
-
}
|
|
1741
|
-
text.value = '';
|
|
1742
|
-
link.value = '';
|
|
1743
|
-
isOpenLinkModal.value = false;
|
|
1744
|
-
};
|
|
1745
|
-
const discardLink = () => {
|
|
1746
|
-
isOpenLinkModal.value = false;
|
|
1747
|
-
};
|
|
1748
|
-
const setActiveFormats = () => {
|
|
1749
|
-
const toolbarList = props.toolbar.flat();
|
|
1750
|
-
toolbarList.forEach(item => {
|
|
1751
|
-
isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
|
|
1752
|
-
});
|
|
1753
|
-
};
|
|
1754
|
-
// Styles
|
|
1755
|
-
const rootStyles = computed(() => {
|
|
1756
|
-
return ['or-rich-text-editor', ...(props.fullHeight ? ['h-full'] : [])];
|
|
1757
|
-
});
|
|
1758
|
-
const containerStyles = computed(() => {
|
|
1759
|
-
return [...EditorContainer, ...(props.fullHeight ? ['h-full'] : [])];
|
|
1760
|
-
});
|
|
1761
|
-
const toolbarContainerStyles = computed(() => {
|
|
1762
|
-
return [...ToolbarContainer];
|
|
1763
|
-
});
|
|
1764
|
-
const toolbarStyles = computed(() => {
|
|
1765
|
-
return [...Toolbar, ...(isFocused.value ? ToolbarButtonFocused : ToolbarButton)];
|
|
1766
|
-
});
|
|
1767
|
-
const editorInputStyles = computed(() => {
|
|
1768
|
-
return ['tiptap-editor', ...(props.fullHeight ? ['h-full overflow-y-auto'] : []), ...EditorInput];
|
|
1769
|
-
});
|
|
1770
|
-
//Effects
|
|
1771
|
-
watch(proxyModelValue, value => {
|
|
1772
|
-
if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && !props.markdownFormat) {
|
|
1773
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
|
|
1774
|
-
}
|
|
1775
|
-
if (props.markdownFormat && value !== markdownOutput.value) {
|
|
1776
|
-
const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
|
|
1777
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
|
|
1778
|
-
}
|
|
1779
|
-
});
|
|
1780
|
-
return {
|
|
1781
|
-
editor,
|
|
1782
|
-
editorRef,
|
|
1783
|
-
containerRef,
|
|
1784
|
-
toolbarButtonRef,
|
|
1785
|
-
menuRef,
|
|
1786
|
-
iconsEnum,
|
|
1787
|
-
handleToolbarClick,
|
|
1788
|
-
handleEditorClick,
|
|
1789
|
-
isActive,
|
|
1790
|
-
iconTooltipsEnum,
|
|
1791
|
-
containerStyles,
|
|
1792
|
-
toolbarContainerStyles,
|
|
1793
|
-
toolbarStyles,
|
|
1794
|
-
rootStyles,
|
|
1795
|
-
root,
|
|
1796
|
-
editorInputStyles,
|
|
1797
|
-
getIndexOfHeading,
|
|
1798
|
-
headingLevels,
|
|
1799
|
-
headingIcon,
|
|
1800
|
-
attachLink,
|
|
1801
|
-
discardLink,
|
|
1802
|
-
isOpenLinkModal,
|
|
1803
|
-
text,
|
|
1804
|
-
link,
|
|
1805
|
-
isFocused
|
|
1806
|
-
};
|
|
1807
|
-
}
|
|
1808
|
-
});
|
|
1809
|
-
|
|
1810
|
-
var css_248z = ".tiptap-editor ol{margin:0 24px;list-style:decimal}.tiptap-editor ul{margin:0 24px;list-style:disc outside none;list-style:initial}.tiptap-editor pre{background-color:rgba(186,209,236,.3);padding:4px 8px;margin:4px 0;width:100%;border-radius:4px}.tiptap-editor blockquote{margin:8px 24px;padding:0 24px;border-left:4px solid #bad1ec}.tiptap-editor .is-editor-empty::before{content:attr(data-placeholder);height:0;pointer-events:none;float:left}.tiptap-editor .cm-editor{border:none;border-radius:4px}.tiptap-editor .cm-editor .cm-scroller{border-radius:4px}.tiptap-editor .cm-editor.cm-focused{outline:0}.tiptap-editor .cm-editor .cm-gutters{background-color:rgba(0,95,177,.08);border:none}.tiptap-editor .cm-editor .cm-gutters .cm-gutterElement{padding:0 10px}.tiptap-editor .cm-editor .cm-gutters .cm-gutterElement.cm-activeLineGutter{background-color:rgba(0,95,177,.07)}";
|
|
1811
|
-
styleInject(css_248z);
|
|
1812
|
-
|
|
1813
|
-
/* script */
|
|
1814
|
-
const __vue_script__ = script;
|
|
1815
|
-
/* template */
|
|
1816
|
-
var __vue_render__ = function () {
|
|
1817
|
-
var _vm = this;
|
|
1818
|
-
var _h = _vm.$createElement;
|
|
1819
|
-
var _c = _vm._self._c || _h;
|
|
1820
|
-
return _c('div', {
|
|
1821
|
-
ref: "root",
|
|
1822
|
-
class: _vm.rootStyles
|
|
1823
|
-
}, [_c('or-label', [_vm._v("\n " + _vm._s(_vm.description) + "\n ")]), _vm._v(" "), _c('div', {
|
|
1824
|
-
ref: "containerRef",
|
|
1825
|
-
class: _vm.containerStyles,
|
|
1826
|
-
on: {
|
|
1827
|
-
"click": function ($event) {
|
|
1828
|
-
return _vm.handleEditorClick();
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
}, [_c('div', {
|
|
1832
|
-
class: _vm.toolbarContainerStyles
|
|
1833
|
-
}, _vm._l(_vm.toolbar, function (tool, index) {
|
|
1834
|
-
return _c('div', {
|
|
1835
|
-
key: index,
|
|
1836
|
-
class: _vm.toolbarStyles
|
|
1837
|
-
}, _vm._l(tool, function (item) {
|
|
1838
|
-
return _c('div', {
|
|
1839
|
-
key: item,
|
|
1840
|
-
staticClass: "flex gap-md"
|
|
1841
|
-
}, [item === 'heading' ? _c('or-icon-button', {
|
|
1842
|
-
ref: "toolbarButtonRef",
|
|
1843
|
-
refInFor: true,
|
|
1844
|
-
attrs: {
|
|
1845
|
-
"selected": _vm.isActive[item],
|
|
1846
|
-
"disabled": !_vm.isFocused,
|
|
1847
|
-
"tooltip": {
|
|
1848
|
-
text: item,
|
|
1849
|
-
placement: 'top'
|
|
1850
|
-
},
|
|
1851
|
-
"icon": {
|
|
1852
|
-
icon: _vm.headingIcon,
|
|
1853
|
-
variant: 'inherit',
|
|
1854
|
-
size: 'm'
|
|
1855
|
-
}
|
|
1856
|
-
},
|
|
1857
|
-
on: {
|
|
1858
|
-
"click": function ($event) {
|
|
1859
|
-
return _vm.menuRef.open();
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
}) : _c('or-icon-button', {
|
|
1863
|
-
attrs: {
|
|
1864
|
-
"tooltip": {
|
|
1865
|
-
text: _vm.iconTooltipsEnum[item],
|
|
1866
|
-
placement: 'top'
|
|
1867
|
-
},
|
|
1868
|
-
"selected": _vm.isActive[item],
|
|
1869
|
-
"disabled": !_vm.isFocused,
|
|
1870
|
-
"icon": {
|
|
1871
|
-
icon: _vm.iconsEnum[item],
|
|
1872
|
-
variant: 'inherit',
|
|
1873
|
-
size: 'm'
|
|
1874
|
-
}
|
|
1875
|
-
},
|
|
1876
|
-
on: {
|
|
1877
|
-
"click": function ($event) {
|
|
1878
|
-
return _vm.handleToolbarClick(item);
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
})], 1);
|
|
1882
|
-
}), 0);
|
|
1883
|
-
}), 0), _vm._v(" "), _c('div', {
|
|
1884
|
-
class: ['p-sm', {
|
|
1885
|
-
'h-[calc(100%-32px)]': _vm.fullHeight
|
|
1886
|
-
}]
|
|
1887
|
-
}, [_c('div', {
|
|
1888
|
-
ref: "editorRef",
|
|
1889
|
-
class: _vm.editorInputStyles
|
|
1890
|
-
}), _vm._v(" "), _vm._t("files")], 2)]), _vm._v(" "), _vm.toolbarButtonRef ? _c('or-menu', {
|
|
1891
|
-
ref: "menuRef",
|
|
1892
|
-
attrs: {
|
|
1893
|
-
"trigger": _vm.toolbarButtonRef[_vm.getIndexOfHeading].root,
|
|
1894
|
-
"placement": "bottom-start"
|
|
1895
|
-
}
|
|
1896
|
-
}, [_vm._l(_vm.headingLevels, function (heading) {
|
|
1897
|
-
return _c('or-menu-item', {
|
|
1898
|
-
key: heading,
|
|
1899
|
-
on: {
|
|
1900
|
-
"click": function ($event) {
|
|
1901
|
-
return _vm.handleToolbarClick('heading', heading);
|
|
1902
|
-
}
|
|
1903
|
-
}
|
|
1904
|
-
}, [_vm._v("\n Heading " + _vm._s(heading) + "\n ")]);
|
|
1905
|
-
}), _vm._v(" "), _c('or-menu-item', {
|
|
1906
|
-
on: {
|
|
1907
|
-
"click": function ($event) {
|
|
1908
|
-
return _vm.handleToolbarClick('heading');
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
}, [_vm._v("\n None\n ")])], 2) : _vm._e(), _vm._v(" "), _c('or-modal', {
|
|
1912
|
-
attrs: {
|
|
1913
|
-
"is-open": _vm.isOpenLinkModal,
|
|
1914
|
-
"size": "s"
|
|
1915
|
-
},
|
|
1916
|
-
scopedSlots: _vm._u([{
|
|
1917
|
-
key: "header",
|
|
1918
|
-
fn: function () {
|
|
1919
|
-
return [_c('p', {
|
|
1920
|
-
staticClass: "text-headline-2"
|
|
1921
|
-
}, [_vm._v("\n Add Link\n ")])];
|
|
1922
|
-
},
|
|
1923
|
-
proxy: true
|
|
1924
|
-
}, {
|
|
1925
|
-
key: "footer",
|
|
1926
|
-
fn: function () {
|
|
1927
|
-
return [_c('div', {
|
|
1928
|
-
staticClass: "flex ml-auto gap-md"
|
|
1929
|
-
}, [_c('or-button', {
|
|
1930
|
-
attrs: {
|
|
1931
|
-
"variant": "outlined"
|
|
1932
|
-
},
|
|
1933
|
-
on: {
|
|
1934
|
-
"click": _vm.discardLink
|
|
1935
|
-
}
|
|
1936
|
-
}, [_c('p', [_vm._v("Cancel")])]), _vm._v(" "), _c('or-button', {
|
|
1937
|
-
on: {
|
|
1938
|
-
"click": _vm.attachLink
|
|
1939
|
-
}
|
|
1940
|
-
}, [_c('p', [_vm._v("Save")])])], 1)];
|
|
1941
|
-
},
|
|
1942
|
-
proxy: true
|
|
1943
|
-
}])
|
|
1944
|
-
}, [_vm._v(" "), _c('div', [_c('or-label', [_vm._v("\n Text\n ")]), _vm._v(" "), _c('or-input', {
|
|
1945
|
-
staticClass: "pb-md",
|
|
1946
|
-
attrs: {
|
|
1947
|
-
"placeholder": "Placeholder"
|
|
1948
|
-
},
|
|
1949
|
-
model: {
|
|
1950
|
-
value: _vm.text,
|
|
1951
|
-
callback: function ($$v) {
|
|
1952
|
-
_vm.text = $$v;
|
|
1953
|
-
},
|
|
1954
|
-
expression: "text"
|
|
1955
|
-
}
|
|
1956
|
-
}), _vm._v(" "), _c('or-label', [_vm._v("\n Link\n ")]), _vm._v(" "), _c('or-input', {
|
|
1957
|
-
attrs: {
|
|
1958
|
-
"placeholder": "Placeholder"
|
|
1959
|
-
},
|
|
1960
|
-
model: {
|
|
1961
|
-
value: _vm.link,
|
|
1962
|
-
callback: function ($$v) {
|
|
1963
|
-
_vm.link = $$v;
|
|
1964
|
-
},
|
|
1965
|
-
expression: "link"
|
|
1966
|
-
}
|
|
1967
|
-
})], 1)])], 1);
|
|
1968
|
-
};
|
|
1969
|
-
var __vue_staticRenderFns__ = [];
|
|
1970
|
-
|
|
1971
|
-
/* style */
|
|
1972
|
-
const __vue_inject_styles__ = undefined;
|
|
1973
|
-
/* scoped */
|
|
1974
|
-
const __vue_scope_id__ = undefined;
|
|
1975
|
-
/* module identifier */
|
|
1976
|
-
const __vue_module_identifier__ = undefined;
|
|
1977
|
-
/* functional template */
|
|
1978
|
-
const __vue_is_functional_template__ = false;
|
|
1979
|
-
/* style inject */
|
|
1980
|
-
|
|
1981
|
-
/* style inject SSR */
|
|
1982
|
-
|
|
1983
|
-
/* style inject shadow dom */
|
|
1984
|
-
|
|
1985
|
-
const __vue_component__ = /*#__PURE__*/normalizeComponent({
|
|
1986
|
-
render: __vue_render__,
|
|
1987
|
-
staticRenderFns: __vue_staticRenderFns__
|
|
1988
|
-
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
|
|
1989
|
-
|
|
1990
|
-
export { __vue_component__ as default };
|