@opengis/form 0.0.119 → 0.0.121
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/README.md +61 -61
- package/dist/api/suggest/suggestions_list.json +7 -7
- package/dist/index-BuPGF652.js +8573 -0
- package/dist/index.css +1 -1
- package/dist/index.js +37 -9312
- package/dist/index.umd.cjs +48 -3
- package/dist/src/components/behavior.vue.d.ts.map +1 -0
- package/dist/{components/layouts → src/components/container-views}/index.d.ts.map +1 -1
- package/dist/src/components/container-views/vs-container-accordion.vue.d.ts.map +1 -0
- package/dist/src/components/container-views/vs-container-default.vue.d.ts.map +1 -0
- package/dist/src/components/container-views/vs-container-switcher.vue.d.ts.map +1 -0
- package/dist/src/components/form/vs-compact-form-navigation.vue.d.ts.map +1 -0
- package/dist/src/components/form/vs-compact-form.vue.d.ts.map +1 -0
- package/dist/src/components/icons/icon-no-data.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/address/vs-input-address.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/array/vs-input-array.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/array-select/vs-input-array-select.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-color.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-email.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-mask.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-number.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-password.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-range.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-static.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-switcher.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-tel.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-text.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/base/vs-input-textarea.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/Datepicker.vue.d.ts +16 -4
- package/dist/src/components/inputs/date/datepicker/Datepicker.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/DayPicker.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/DayPicker.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/MonthPicker.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/MonthPicker.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/PickerPopup.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/PickerPopup.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/Timepicker.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/Timepicker.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/date/datepicker/YearPicker.vue.d.ts +4 -1
- package/dist/src/components/inputs/date/datepicker/YearPicker.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/datepicker/types.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-date-text.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-input-date.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-input-date1.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-input-date2.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/date/vs-input-time.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file/vs-input-file-list-item.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file/vs-input-file.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file/vs-input-file2.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file-list/vs-input-file-list.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file-list/vs-widget-file-info.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/file-list/vs-widget-file-item.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/index.d.ts +8 -1
- package/dist/{components → src/components}/inputs/index.d.ts.map +1 -1
- package/dist/src/components/inputs/list/vs-input-dataform.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/list/vs-input-datalist.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/icons/icon-line.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/icons/icon-poligon-rectangle.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/icons/icon-poligon.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/map-layers.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/map-search.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/map/map.d.ts.map +1 -0
- package/dist/src/components/inputs/map/util.d.ts.map +1 -0
- package/dist/src/components/inputs/map/vs-input-map.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/checkbox/index.d.ts.map +1 -0
- package/dist/src/components/inputs/options/checkbox/vs-checkbox-buttons.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/options/checkbox/vs-checkbox-default.vue.d.ts +2 -2
- package/dist/src/components/inputs/options/checkbox/vs-checkbox-default.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/checkbox/vs-input-checkbox-item.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/checkbox/vs-input-checkbox.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/radio/index.d.ts.map +1 -0
- package/dist/src/components/inputs/options/radio/vs-input-radio-buttons.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/radio/vs-input-radio-default.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/options/radio/vs-input-radio.vue.d.ts.map +1 -0
- package/dist/{components/inputs/base → src/components/inputs/richtext}/vs-input-richtext.vue.d.ts +2 -0
- package/dist/src/components/inputs/richtext/vs-input-richtext.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/table/vs-input-datatable.vue.d.ts +2 -2
- package/dist/src/components/inputs/table/vs-input-datatable.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/tag/vs-input-tag.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-codegen.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-container.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-key-value.vue.d.ts.map +1 -0
- package/dist/{components → src/components}/inputs/vs-input-monaco.vue.d.ts +5 -1
- package/dist/src/components/inputs/vs-input-monaco.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-select.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-slug.vue.d.ts.map +1 -0
- package/dist/src/components/inputs/vs-input-text-array.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/index.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-compact-form-layout.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-layout-default.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-layout-horizontal.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-layout-inline.vue.d.ts.map +1 -0
- package/dist/src/components/layouts/vs-layout-settings.vue.d.ts.map +1 -0
- package/dist/src/components/modal/modal-edit.vue.d.ts.map +1 -0
- package/dist/src/components/ui/vs-calendar.vue.d.ts.map +1 -0
- package/dist/src/components/ui/vs-info-tooltip.vue.d.ts.map +1 -0
- package/dist/src/composables/i18n.d.ts.map +1 -0
- package/dist/src/composables/useForm.d.ts.map +1 -0
- package/dist/src/composables/useLocale.d.ts.map +1 -0
- package/dist/src/composables/useStyle.d.ts.map +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +2 -1
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/plugin/form-plugin.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/index.d.ts +31 -0
- package/dist/src/richtext/components/controls/index.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-align.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-align.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-background-color.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-background-color.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-blockquote.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-blockquote.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-boldtext.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-boldtext.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-bullet-list.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-bullet-list.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-clear-formatting.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-clear-formatting.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-codeblock.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-codeblock.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-color.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-color.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-font-family.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-font-family.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-font-size.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-font-size.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-fullscreen.vue.d.ts +9 -0
- package/dist/src/richtext/components/controls/vs-editor-fullscreen.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-heading.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-heading.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-help.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-help.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-highlight.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-highlight.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-history.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-history.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-horizontal-rule.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-horizontal-rule.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-image.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-image.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-italic.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-italic.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-link.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-link.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-ordered-list.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-ordered-list.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-strike.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-strike.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-subscript.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-subscript.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-superscript.vue.d.ts +11 -0
- package/dist/src/richtext/components/controls/vs-editor-superscript.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-tab.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-tab.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-table.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-table.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-type-tag.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-type-tag.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/controls/vs-editor-underline.vue.d.ts +8 -0
- package/dist/src/richtext/components/controls/vs-editor-underline.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/shared-components/vs-dialog.vue.d.ts +68 -0
- package/dist/src/richtext/components/shared-components/vs-dialog.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/shared-components/vs-form-color-picker.vue.d.ts +179 -0
- package/dist/src/richtext/components/shared-components/vs-form-color-picker.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/shared-components/vs-popover.vue.d.ts +33 -0
- package/dist/src/richtext/components/shared-components/vs-popover.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/shared-components/vs-text.vue.d.ts +135 -0
- package/dist/src/richtext/components/shared-components/vs-text.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/vs-markdown-richtext.vue.d.ts +17 -0
- package/dist/src/richtext/components/vs-markdown-richtext.vue.d.ts.map +1 -0
- package/dist/src/richtext/components/vs-richtext.vue.d.ts +15 -0
- package/dist/src/richtext/components/vs-richtext.vue.d.ts.map +1 -0
- package/dist/src/richtext/composables/contentFormat.d.ts +5 -0
- package/dist/src/richtext/composables/contentFormat.d.ts.map +1 -0
- package/dist/src/richtext/locales.d.ts +132 -0
- package/dist/src/richtext/locales.d.ts.map +1 -0
- package/dist/src/schema.d.ts.map +1 -0
- package/dist/{types → src/types}/form.d.ts +1 -1
- package/dist/src/types/form.d.ts.map +1 -0
- package/dist/{types → src/types}/rules.d.ts.map +1 -1
- package/dist/src/utils/convertForm.d.ts.map +1 -0
- package/dist/src/utils/dateHelper.d.ts.map +1 -0
- package/dist/src/utils/dynamicPosition.d.ts.map +1 -0
- package/dist/src/utils/file.api.d.ts.map +1 -0
- package/dist/src/utils/file.preview.d.ts +3 -0
- package/dist/src/utils/file.preview.d.ts.map +1 -0
- package/dist/src/utils/formConditions.d.ts.map +1 -0
- package/dist/src/utils/formRules.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/randomId.d.ts.map +1 -0
- package/dist/vs-richtext-DQBsTWOL.js +3005 -0
- package/locales/en.json +34 -0
- package/locales/uk.json +34 -0
- package/package.json +79 -75
- package/dist/components/behavior.vue.d.ts.map +0 -1
- package/dist/components/container-views/index.d.ts.map +0 -1
- package/dist/components/container-views/vs-container-accordion.vue.d.ts.map +0 -1
- package/dist/components/container-views/vs-container-default.vue.d.ts.map +0 -1
- package/dist/components/container-views/vs-container-switcher.vue.d.ts.map +0 -1
- package/dist/components/form/vs-compact-form-navigation.vue.d.ts.map +0 -1
- package/dist/components/form/vs-compact-form.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-arrow-top-bottom.vue.d.ts +0 -3
- package/dist/components/icons/icon-arrow-top-bottom.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-check.vue.d.ts +0 -3
- package/dist/components/icons/icon-check.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-chevron-down.vue.d.ts +0 -3
- package/dist/components/icons/icon-chevron-down.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-chevron-top-bottom.vue.d.ts +0 -3
- package/dist/components/icons/icon-chevron-top-bottom.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-close.vue.d.ts +0 -3
- package/dist/components/icons/icon-close.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-copy.vue.d.ts +0 -3
- package/dist/components/icons/icon-copy.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-csv.vue.d.ts +0 -3
- package/dist/components/icons/icon-csv.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-delete.vue.d.ts +0 -3
- package/dist/components/icons/icon-delete.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-download.vue.d.ts +0 -3
- package/dist/components/icons/icon-download.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-export.vue.d.ts +0 -3
- package/dist/components/icons/icon-export.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-file.vue.d.ts +0 -3
- package/dist/components/icons/icon-file.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-geojson.vue.d.ts +0 -3
- package/dist/components/icons/icon-geojson.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-grip-vertical.vue.d.ts +0 -3
- package/dist/components/icons/icon-grip-vertical.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-import.vue.d.ts +0 -3
- package/dist/components/icons/icon-import.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-info.vue.d.ts +0 -3
- package/dist/components/icons/icon-info.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-magnifying-glass.vue.d.ts +0 -3
- package/dist/components/icons/icon-magnifying-glass.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-no-data.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-pdf.vue.d.ts +0 -3
- package/dist/components/icons/icon-pdf.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-pen.vue.d.ts +0 -3
- package/dist/components/icons/icon-pen.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-plus.vue.d.ts +0 -3
- package/dist/components/icons/icon-plus.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-upload.vue.d.ts +0 -3
- package/dist/components/icons/icon-upload.vue.d.ts.map +0 -1
- package/dist/components/icons/icon-zip.vue.d.ts +0 -3
- package/dist/components/icons/icon-zip.vue.d.ts.map +0 -1
- package/dist/components/icons/index.d.ts +0 -6
- package/dist/components/icons/index.d.ts.map +0 -1
- package/dist/components/inputs/address/vs-input-address.vue.d.ts.map +0 -1
- package/dist/components/inputs/array/vs-input-array.vue.d.ts.map +0 -1
- package/dist/components/inputs/array-select/vs-input-array-select.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-color.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-email.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-mask.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-number.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-password.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-range.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-richtext.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-static.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-switcher.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-tel.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-text.vue.d.ts.map +0 -1
- package/dist/components/inputs/base/vs-input-textarea.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/Datepicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/DayPicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/MonthPicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/PickerPopup.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/Timepicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/YearPicker.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/datepicker/types.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-date-text.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-input-date.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-input-date1.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-input-date2.vue.d.ts.map +0 -1
- package/dist/components/inputs/date/vs-input-time.vue.d.ts.map +0 -1
- package/dist/components/inputs/file/vs-input-file-list-item.vue.d.ts.map +0 -1
- package/dist/components/inputs/file/vs-input-file.vue.d.ts.map +0 -1
- package/dist/components/inputs/file/vs-input-file2.vue.d.ts.map +0 -1
- package/dist/components/inputs/file-list/vs-input-file-list.vue.d.ts.map +0 -1
- package/dist/components/inputs/file-list/vs-widget-file-info.vue.d.ts.map +0 -1
- package/dist/components/inputs/file-list/vs-widget-file-item.vue.d.ts.map +0 -1
- package/dist/components/inputs/list/vs-input-dataform.vue.d.ts.map +0 -1
- package/dist/components/inputs/list/vs-input-datalist.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-compass.vue.d.ts +0 -3
- package/dist/components/inputs/map/icons/icon-compass.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-full-screen.vue.d.ts +0 -3
- package/dist/components/inputs/map/icons/icon-full-screen.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-line.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-map-pin.vue.d.ts +0 -3
- package/dist/components/inputs/map/icons/icon-map-pin.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-poligon-rectangle.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/icons/icon-poligon.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/map-layers.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/map-search.vue.d.ts.map +0 -1
- package/dist/components/inputs/map/map.d.ts.map +0 -1
- package/dist/components/inputs/map/util.d.ts.map +0 -1
- package/dist/components/inputs/map/vs-input-map.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/index.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/vs-checkbox-buttons.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/vs-checkbox-default.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/vs-input-checkbox-item.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/checkbox/vs-input-checkbox.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/radio/index.d.ts.map +0 -1
- package/dist/components/inputs/options/radio/vs-input-radio-buttons.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/radio/vs-input-radio-default.vue.d.ts.map +0 -1
- package/dist/components/inputs/options/radio/vs-input-radio.vue.d.ts.map +0 -1
- package/dist/components/inputs/table/vs-input-datatable.vue.d.ts.map +0 -1
- package/dist/components/inputs/tag/vs-input-tag.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-codegen.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-container.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-key-value.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-monaco.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-select.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-slug.vue.d.ts.map +0 -1
- package/dist/components/inputs/vs-input-text-array.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-compact-form-layout.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-layout-default.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-layout-horizontal.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-layout-inline.vue.d.ts.map +0 -1
- package/dist/components/layouts/vs-layout-settings.vue.d.ts.map +0 -1
- package/dist/components/modal/modal-edit.vue.d.ts.map +0 -1
- package/dist/components/ui/vs-calendar.vue.d.ts.map +0 -1
- package/dist/components/ui/vs-info-tooltip.vue.d.ts.map +0 -1
- package/dist/composables/i18n.d.ts.map +0 -1
- package/dist/composables/useForm.d.ts.map +0 -1
- package/dist/composables/useLocale.d.ts.map +0 -1
- package/dist/composables/useStyle.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/plugin/form-plugin.d.ts.map +0 -1
- package/dist/schema.d.ts.map +0 -1
- package/dist/types/form.d.ts.map +0 -1
- package/dist/utils/convertForm.d.ts.map +0 -1
- package/dist/utils/dateHelper.d.ts.map +0 -1
- package/dist/utils/dynamicPosition.d.ts.map +0 -1
- package/dist/utils/file.api.d.ts.map +0 -1
- package/dist/utils/file.preview.d.ts +0 -3
- package/dist/utils/file.preview.d.ts.map +0 -1
- package/dist/utils/formConditions.d.ts.map +0 -1
- package/dist/utils/formRules.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/randomId.d.ts.map +0 -1
- /package/dist/{components → src/components}/behavior.vue.d.ts +0 -0
- /package/dist/{components → src/components}/container-views/index.d.ts +0 -0
- /package/dist/{components → src/components}/container-views/vs-container-accordion.vue.d.ts +0 -0
- /package/dist/{components → src/components}/container-views/vs-container-default.vue.d.ts +0 -0
- /package/dist/{components → src/components}/container-views/vs-container-switcher.vue.d.ts +0 -0
- /package/dist/{components → src/components}/form/vs-compact-form-navigation.vue.d.ts +0 -0
- /package/dist/{components → src/components}/form/vs-compact-form.vue.d.ts +0 -0
- /package/dist/{components → src/components}/icons/icon-no-data.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/address/vs-input-address.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/array/vs-input-array.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/array-select/vs-input-array-select.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-color.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-email.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-mask.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-number.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-password.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-range.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-static.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-switcher.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-tel.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-text.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/base/vs-input-textarea.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/datepicker/types.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-date-text.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-input-date.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-input-date1.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-input-date2.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/date/vs-input-time.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file/vs-input-file-list-item.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file/vs-input-file.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file/vs-input-file2.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file-list/vs-input-file-list.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file-list/vs-widget-file-info.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/file-list/vs-widget-file-item.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/list/vs-input-dataform.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/list/vs-input-datalist.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/icons/icon-line.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/icons/icon-poligon-rectangle.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/icons/icon-poligon.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/map-layers.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/map-search.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/map.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/util.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/map/vs-input-map.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/checkbox/index.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/checkbox/vs-checkbox-buttons.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/checkbox/vs-input-checkbox-item.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/checkbox/vs-input-checkbox.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/radio/index.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/radio/vs-input-radio-buttons.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/radio/vs-input-radio-default.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/options/radio/vs-input-radio.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/tag/vs-input-tag.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-codegen.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-container.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-key-value.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-select.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-slug.vue.d.ts +0 -0
- /package/dist/{components → src/components}/inputs/vs-input-text-array.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/index.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-compact-form-layout.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-layout-default.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-layout-horizontal.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-layout-inline.vue.d.ts +0 -0
- /package/dist/{components → src/components}/layouts/vs-layout-settings.vue.d.ts +0 -0
- /package/dist/{components → src/components}/modal/modal-edit.vue.d.ts +0 -0
- /package/dist/{components → src/components}/ui/vs-calendar.vue.d.ts +0 -0
- /package/dist/{components → src/components}/ui/vs-info-tooltip.vue.d.ts +0 -0
- /package/dist/{composables → src/composables}/i18n.d.ts +0 -0
- /package/dist/{composables → src/composables}/useForm.d.ts +0 -0
- /package/dist/{composables → src/composables}/useLocale.d.ts +0 -0
- /package/dist/{composables → src/composables}/useStyle.d.ts +0 -0
- /package/dist/{plugin → src/plugin}/form-plugin.d.ts +0 -0
- /package/dist/{schema.d.ts → src/schema.d.ts} +0 -0
- /package/dist/{types → src/types}/rules.d.ts +0 -0
- /package/dist/{utils → src/utils}/convertForm.d.ts +0 -0
- /package/dist/{utils → src/utils}/dateHelper.d.ts +0 -0
- /package/dist/{utils → src/utils}/dynamicPosition.d.ts +0 -0
- /package/dist/{utils → src/utils}/file.api.d.ts +0 -0
- /package/dist/{utils → src/utils}/formConditions.d.ts +0 -0
- /package/dist/{utils → src/utils}/formRules.d.ts +0 -0
- /package/dist/{utils → src/utils}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/randomId.d.ts +0 -0
|
@@ -0,0 +1,3005 @@
|
|
|
1
|
+
import { shallowRef as Je, ref as $, computed as P, watch as ue, markRaw as et, nextTick as be, getCurrentInstance as tt, resolveComponent as G, openBlock as g, createElementBlock as w, normalizeClass as T, createVNode as C, createElementVNode as d, unref as k, createBlock as K, Teleport as Oe, Transition as Re, withCtx as V, toDisplayString as W, renderSlot as he, createCommentVNode as R, defineComponent as rt, withDirectives as ie, mergeProps as ot, vModelDynamic as lt, Fragment as re, vModelCheckbox as at, onMounted as fe, onBeforeUnmount as Ue, normalizeStyle as ae, vShow as ye, renderList as le, onUnmounted as ke, resolveDynamicComponent as Fe, vModelText as st, withModifiers as nt, createStaticVNode as it, useModel as ct, isRef as dt, mergeModels as Pe } from "vue";
|
|
2
|
+
import { r as Me, _ as X, a as ut, b as ft } from "./index-BuPGF652.js";
|
|
3
|
+
import { Quote as pt, List as gt, ListOrdered as ht, CodeXml as vt, Bold as mt, Italic as bt, Underline as yt, Strikethrough as xt, X as Te, Mail as wt, Search as kt, Link2 as _t, ExternalLink as $t, Trash2 as Ct, Table2 as At, AlignJustify as Ft, AlignRight as St, AlignCenter as Tt, AlignLeft as Lt, Type as Bt, Check as ve, Eraser as It, PaintBucket as Et, Highlighter as jt, ChevronDown as Le, ALargeSmall as Pt, Superscript as Mt, Subscript as Ht, RemoveFormatting as zt, Image as Nt, Undo2 as Vt, Redo2 as Dt, CircleHelp as Ot, Minus as Rt, Maximize as Ut, ListIndentIncrease as qt } from "lucide-vue-next";
|
|
4
|
+
import { notify as we } from "@opengis/core";
|
|
5
|
+
const Kt = async (t) => {
|
|
6
|
+
try {
|
|
7
|
+
const e = new FormData();
|
|
8
|
+
return e.append("unique", "true"), e.append("file", t), (await (await fetch("/file/upload/uploads?id=&form=&table=", {
|
|
9
|
+
method: "POST",
|
|
10
|
+
body: e
|
|
11
|
+
})).json())?.result;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.error(e);
|
|
14
|
+
}
|
|
15
|
+
}, Wt = async (t, e, l) => {
|
|
16
|
+
const s = e.clipboardData?.items;
|
|
17
|
+
if (s) {
|
|
18
|
+
const a = e.clipboardData?.getData("text/html"), o = e.clipboardData?.getData("text/plain");
|
|
19
|
+
if (a) {
|
|
20
|
+
const { state: n, dispatch: c } = t, { tr: r } = n, i = l.fromSchema(t.state.schema), y = new DOMParser().parseFromString(a, "text/html").body, p = i.parse(y), h = r.replaceSelectionWith(p);
|
|
21
|
+
return c(h), e.preventDefault(), !0;
|
|
22
|
+
}
|
|
23
|
+
if (o) {
|
|
24
|
+
const { state: n, dispatch: c } = t, { tr: r } = n, i = r.insertText(o, n.selection.from, n.selection.to);
|
|
25
|
+
return c(i), e.preventDefault(), !0;
|
|
26
|
+
}
|
|
27
|
+
for (let n = 0; n < s.length; n++) {
|
|
28
|
+
const c = s[n];
|
|
29
|
+
if (c.type.startsWith("image/")) {
|
|
30
|
+
const r = c.getAsFile();
|
|
31
|
+
if (r) {
|
|
32
|
+
const i = await Kt(r), { schema: y } = t.state, p = y.nodes.image.create({
|
|
33
|
+
src: i?.file_path
|
|
34
|
+
}), h = t.state.tr.replaceSelectionWith(p);
|
|
35
|
+
return t.dispatch(h), e.preventDefault(), !0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return !1;
|
|
41
|
+
}, Xt = "https://esm.sh", te = "3.7.2", qe = "3.7.2", Gt = `?deps=@tiptap/core@${te},@tiptap/pm@${qe}`, Z = (t) => `${Xt}/${t}${Gt}`, J = {
|
|
42
|
+
core: Z(`@tiptap/core@${te}`),
|
|
43
|
+
starterKit: Z(`@tiptap/starter-kit@${te}`),
|
|
44
|
+
textStyle: Z(`@tiptap/extension-text-style@${te}`),
|
|
45
|
+
table: Z(`@tiptap/extension-table@${te}`),
|
|
46
|
+
highlight: Z(`@tiptap/extension-highlight@${te}`),
|
|
47
|
+
subscript: Z(`@tiptap/extension-subscript@${te}`),
|
|
48
|
+
superscript: Z(`@tiptap/extension-superscript@${te}`),
|
|
49
|
+
link: Z(`@tiptap/extension-link@${te}`),
|
|
50
|
+
image: Z(`@tiptap/extension-image@${te}`),
|
|
51
|
+
textAlign: Z(`@tiptap/extension-text-align@${te}`),
|
|
52
|
+
heading: Z(`@tiptap/extension-heading@${te}`),
|
|
53
|
+
paragraph: Z(`@tiptap/extension-paragraph@${te}`),
|
|
54
|
+
pmModel: Z(`@tiptap/pm@${qe}/model`)
|
|
55
|
+
}, pe = "__vs_form_tiptap_loader__", ee = (t) => import(
|
|
56
|
+
/* @vite-ignore */
|
|
57
|
+
t
|
|
58
|
+
), U = (t, e) => t?.[e] || t?.default?.[e] || t?.default?.default?.[e] || t?.default || t, He = {
|
|
59
|
+
1: "font-weight:700; font-size:30px;",
|
|
60
|
+
2: "font-weight:700; font-size:26px;",
|
|
61
|
+
3: "font-weight:700; font-size:22px;",
|
|
62
|
+
4: "font-weight:700; font-size:18px;",
|
|
63
|
+
5: "font-weight:500; font-size:16px;",
|
|
64
|
+
6: "font-weight:400; font-size:14px;"
|
|
65
|
+
}, Yt = (t) => t.extend({
|
|
66
|
+
addOptions() {
|
|
67
|
+
return {
|
|
68
|
+
...this.parent?.(),
|
|
69
|
+
levels: [1, 2, 3, 4, 5, 6]
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}).extend({
|
|
73
|
+
addAttributes() {
|
|
74
|
+
return {
|
|
75
|
+
...this.parent?.(),
|
|
76
|
+
level: {
|
|
77
|
+
default: 1,
|
|
78
|
+
renderHTML: (e) => {
|
|
79
|
+
const l = e.level || 1;
|
|
80
|
+
return {
|
|
81
|
+
class: `heading-level-${l}`,
|
|
82
|
+
style: He[l] || He[1]
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}), Qt = (t) => t.configure({
|
|
89
|
+
HTMLAttributes: {
|
|
90
|
+
style: "min-height: 1rem;"
|
|
91
|
+
}
|
|
92
|
+
}), Zt = (t, e, l, s, a) => {
|
|
93
|
+
const o = e.extend({
|
|
94
|
+
renderHTML({ HTMLAttributes: n }) {
|
|
95
|
+
return [
|
|
96
|
+
"div",
|
|
97
|
+
{ style: "overflow-x: auto;" },
|
|
98
|
+
["table", n, 0]
|
|
99
|
+
];
|
|
100
|
+
},
|
|
101
|
+
parseHTML() {
|
|
102
|
+
return [
|
|
103
|
+
{
|
|
104
|
+
tag: "div.table-wrapper table",
|
|
105
|
+
priority: 100
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
tag: "table"
|
|
109
|
+
}
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return t.extend({
|
|
114
|
+
addExtensions() {
|
|
115
|
+
return [
|
|
116
|
+
o.configure({
|
|
117
|
+
HTMLAttributes: {
|
|
118
|
+
class: "editor-content"
|
|
119
|
+
},
|
|
120
|
+
resizable: !0
|
|
121
|
+
}),
|
|
122
|
+
l,
|
|
123
|
+
s,
|
|
124
|
+
a
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}, Jt = (t) => t.extend({
|
|
129
|
+
addAttributes() {
|
|
130
|
+
return {
|
|
131
|
+
...this.parent?.(),
|
|
132
|
+
fontFamily: {
|
|
133
|
+
default: null,
|
|
134
|
+
parseHTML: (e) => e.style.fontFamily?.replace(/['"]/g, ""),
|
|
135
|
+
renderHTML: (e) => e.fontFamily ? {
|
|
136
|
+
style: `font-family: ${e.fontFamily}`
|
|
137
|
+
} : {}
|
|
138
|
+
},
|
|
139
|
+
fontSize: {
|
|
140
|
+
default: null,
|
|
141
|
+
parseHTML: (e) => e.style.fontSize?.replace(/['"]/g, ""),
|
|
142
|
+
renderHTML: (e) => e.fontSize ? {
|
|
143
|
+
style: `font-size: ${e.fontSize}`
|
|
144
|
+
} : {}
|
|
145
|
+
},
|
|
146
|
+
color: {
|
|
147
|
+
default: null,
|
|
148
|
+
parseHTML: (e) => e.style.color?.replace(/['"]/g, ""),
|
|
149
|
+
renderHTML: (e) => e.color ? {
|
|
150
|
+
style: `color: ${e.color}`
|
|
151
|
+
} : {}
|
|
152
|
+
},
|
|
153
|
+
backgroundColor: {
|
|
154
|
+
default: null,
|
|
155
|
+
parseHTML: (e) => e.style.backgroundColor?.replace(/['"]/g, ""),
|
|
156
|
+
renderHTML: (e) => !e.backgroundColor || e.backgroundColor === "transparent" ? {} : {
|
|
157
|
+
style: `background-color: ${e.backgroundColor}`
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
addCommands() {
|
|
163
|
+
return {
|
|
164
|
+
setFontFamily: (e) => ({ chain: l }) => l().setMark("textStyle", { fontFamily: e }).run(),
|
|
165
|
+
unsetFontFamily: () => ({ chain: e }) => e().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run(),
|
|
166
|
+
setFontSize: (e) => ({ chain: l }) => l().setMark("textStyle", { fontSize: e }).run(),
|
|
167
|
+
unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run(),
|
|
168
|
+
setColor: (e) => ({ chain: l }) => l().setMark("textStyle", { color: e }).run(),
|
|
169
|
+
unsetColor: () => ({ chain: e }) => e().setMark("textStyle", { color: null }).removeEmptyTextStyle().run(),
|
|
170
|
+
setBackgroundColor: (e) => ({ chain: l }) => l().setMark("textStyle", { backgroundColor: e }).run(),
|
|
171
|
+
unsetBackgroundColor: () => ({ chain: e }) => e().setMark("textStyle", { backgroundColor: null }).removeEmptyTextStyle().run()
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}), er = (t) => t.create({
|
|
175
|
+
name: "iframe",
|
|
176
|
+
group: "block",
|
|
177
|
+
inline: !1,
|
|
178
|
+
atom: !0,
|
|
179
|
+
selectable: !0,
|
|
180
|
+
addAttributes() {
|
|
181
|
+
return {
|
|
182
|
+
src: { default: null },
|
|
183
|
+
width: { default: "100%" },
|
|
184
|
+
height: { default: "280" },
|
|
185
|
+
frameborder: { default: "0" },
|
|
186
|
+
allow: { default: null },
|
|
187
|
+
allowfullscreen: { default: null },
|
|
188
|
+
referrerpolicy: { default: null },
|
|
189
|
+
loading: { default: null },
|
|
190
|
+
class: { default: null },
|
|
191
|
+
title: { default: null },
|
|
192
|
+
style: { default: null }
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
parseHTML() {
|
|
196
|
+
return [{ tag: "iframe" }];
|
|
197
|
+
},
|
|
198
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
199
|
+
return ["iframe", e];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
async function tr() {
|
|
203
|
+
if (typeof window > "u") return null;
|
|
204
|
+
const t = window;
|
|
205
|
+
return t[pe] || (t[pe] = Promise.all([
|
|
206
|
+
ee(J.core),
|
|
207
|
+
ee(J.starterKit),
|
|
208
|
+
ee(J.textStyle),
|
|
209
|
+
ee(J.table),
|
|
210
|
+
ee(J.highlight),
|
|
211
|
+
ee(J.subscript),
|
|
212
|
+
ee(J.superscript),
|
|
213
|
+
ee(J.link),
|
|
214
|
+
ee(J.image),
|
|
215
|
+
ee(J.textAlign),
|
|
216
|
+
ee(J.heading),
|
|
217
|
+
ee(J.paragraph),
|
|
218
|
+
ee(J.pmModel)
|
|
219
|
+
]).then(([
|
|
220
|
+
e,
|
|
221
|
+
l,
|
|
222
|
+
s,
|
|
223
|
+
a,
|
|
224
|
+
o,
|
|
225
|
+
n,
|
|
226
|
+
c,
|
|
227
|
+
r,
|
|
228
|
+
i,
|
|
229
|
+
y,
|
|
230
|
+
p,
|
|
231
|
+
h,
|
|
232
|
+
b
|
|
233
|
+
]) => {
|
|
234
|
+
const S = U(e, "Editor"), j = U(e, "Node"), H = U(e, "Extension"), N = U(l, "StarterKit"), q = U(s, "TextStyle"), L = U(a, "TableKit"), Y = U(a, "Table"), oe = U(a, "TableRow"), se = U(a, "TableCell"), D = U(a, "TableHeader"), f = U(o, "Highlight"), m = U(n, "Subscript"), u = U(c, "Superscript"), _ = U(r, "Link"), x = U(i, "Image"), B = U(y, "TextAlign"), v = U(p, "Heading"), A = U(h, "Paragraph"), I = U(b, "DOMParser");
|
|
235
|
+
if (!S || !j || !N || !q || !L || !Y || !oe || !se || !D || !f || !m || !u || !_ || !x || !B || !v || !A || !I)
|
|
236
|
+
throw new Error("Failed to resolve one or more Tiptap modules");
|
|
237
|
+
return {
|
|
238
|
+
Editor: S,
|
|
239
|
+
Extension: H,
|
|
240
|
+
ProseMirrorDOMParser: I,
|
|
241
|
+
StarterKit: N,
|
|
242
|
+
ExtendedTextStyle: Jt(q),
|
|
243
|
+
Highlight: f,
|
|
244
|
+
Subscript: m,
|
|
245
|
+
Superscript: u,
|
|
246
|
+
Link: _,
|
|
247
|
+
Image: x,
|
|
248
|
+
TextAlign: B,
|
|
249
|
+
CustomHeading: Yt(v),
|
|
250
|
+
CustomParagraph: Qt(A),
|
|
251
|
+
CustomTableKit: Zt(L, Y, oe, se, D),
|
|
252
|
+
Iframe: er(j)
|
|
253
|
+
};
|
|
254
|
+
}).catch((e) => {
|
|
255
|
+
throw delete t[pe], e;
|
|
256
|
+
})), t[pe];
|
|
257
|
+
}
|
|
258
|
+
function rr(t) {
|
|
259
|
+
let e = !1;
|
|
260
|
+
const l = Je(null), s = $(!1), a = $(""), o = async (i, y = "") => {
|
|
261
|
+
if (!i) return null;
|
|
262
|
+
s.value = !0, a.value = "";
|
|
263
|
+
try {
|
|
264
|
+
const p = await tr();
|
|
265
|
+
if (!p) return null;
|
|
266
|
+
const h = new p.Editor({
|
|
267
|
+
element: i,
|
|
268
|
+
content: y,
|
|
269
|
+
extensions: [
|
|
270
|
+
p.StarterKit.configure({
|
|
271
|
+
history: {
|
|
272
|
+
depth: 100,
|
|
273
|
+
newGroupDelay: 500
|
|
274
|
+
},
|
|
275
|
+
code: {
|
|
276
|
+
HTMLAttributes: {
|
|
277
|
+
class: "editor-code"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
codeBlock: {
|
|
281
|
+
HTMLAttributes: {
|
|
282
|
+
class: "editor-codeblock"
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
paragraph: !1,
|
|
286
|
+
heading: !1,
|
|
287
|
+
link: !1
|
|
288
|
+
}),
|
|
289
|
+
p.Superscript,
|
|
290
|
+
p.Subscript,
|
|
291
|
+
p.ExtendedTextStyle,
|
|
292
|
+
p.CustomParagraph,
|
|
293
|
+
p.CustomHeading,
|
|
294
|
+
p.Highlight,
|
|
295
|
+
p.Image.configure({
|
|
296
|
+
inline: !0,
|
|
297
|
+
allowBase64: !0,
|
|
298
|
+
HTMLAttributes: {
|
|
299
|
+
class: "editor-image"
|
|
300
|
+
}
|
|
301
|
+
}),
|
|
302
|
+
p.TextAlign.configure({
|
|
303
|
+
types: ["heading", "paragraph"]
|
|
304
|
+
}),
|
|
305
|
+
p.Link.configure({
|
|
306
|
+
HTMLAttributes: {
|
|
307
|
+
class: "editor-link"
|
|
308
|
+
},
|
|
309
|
+
openOnClick: !1,
|
|
310
|
+
autolink: !0
|
|
311
|
+
}),
|
|
312
|
+
p.CustomTableKit,
|
|
313
|
+
p.Iframe
|
|
314
|
+
],
|
|
315
|
+
editorProps: {
|
|
316
|
+
handlePaste: (b, S) => Wt(b, S, p.ProseMirrorDOMParser),
|
|
317
|
+
handleKeyDown: (b, S) => {
|
|
318
|
+
if (S.key === "Tab") {
|
|
319
|
+
const j = b.state, { $anchor: H } = j.selection;
|
|
320
|
+
let N = !1;
|
|
321
|
+
for (let q = H.depth; q > 0; q--) {
|
|
322
|
+
const L = H.node(q);
|
|
323
|
+
if (L && (L.type.name === "bulletList" || L.type.name === "orderedList")) {
|
|
324
|
+
N = !0;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return N ? !1 : (S.preventDefault(), !0);
|
|
329
|
+
}
|
|
330
|
+
return !1;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
return l.value = et(h), h;
|
|
335
|
+
} catch (p) {
|
|
336
|
+
return a.value = "Failed to load rich text editor dependencies.", console.error("Failed to initialize rich text editor", p), null;
|
|
337
|
+
} finally {
|
|
338
|
+
s.value = !1;
|
|
339
|
+
}
|
|
340
|
+
}, n = P(() => l.value || null);
|
|
341
|
+
return ue(l, (i) => {
|
|
342
|
+
i && l.value.on("update", (y) => {
|
|
343
|
+
if (!e) {
|
|
344
|
+
e = !0;
|
|
345
|
+
const p = y.editor.getHTML();
|
|
346
|
+
t.modelValue, setTimeout(() => {
|
|
347
|
+
e = !1;
|
|
348
|
+
}, 10);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}), {
|
|
352
|
+
editor: l,
|
|
353
|
+
editorInstance: n,
|
|
354
|
+
focusEditor: () => {
|
|
355
|
+
l.value && !l.value.isFocused && l.value.commands.focus();
|
|
356
|
+
},
|
|
357
|
+
createEditor: o,
|
|
358
|
+
destroyEditor: () => {
|
|
359
|
+
l.value && (l.value.destroy(), l.value = null);
|
|
360
|
+
},
|
|
361
|
+
isLoading: s,
|
|
362
|
+
loadError: a
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function or(t, e, l, {
|
|
366
|
+
toEditorContent: s,
|
|
367
|
+
toSourceContent: a
|
|
368
|
+
} = {}) {
|
|
369
|
+
const o = $(!1), n = $(""), c = $(null);
|
|
370
|
+
return {
|
|
371
|
+
isHtmlMode: o,
|
|
372
|
+
htmlContent: n,
|
|
373
|
+
htmlTextarea: c,
|
|
374
|
+
toggleHtmlMode: async (y) => {
|
|
375
|
+
if (o.value = y, y)
|
|
376
|
+
t.value && (n.value = a ? await a(t.value.getHTML(), e) : t.value.getHTML()), be(() => {
|
|
377
|
+
c.value && c.value.focus?.();
|
|
378
|
+
});
|
|
379
|
+
else if (t.value) {
|
|
380
|
+
const p = s ? await s(n.value, e) : n.value;
|
|
381
|
+
t.value.commands.setContent(p, !0), be(() => {
|
|
382
|
+
t.value?.commands?.focus?.();
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
onHtmlInput: (y) => {
|
|
387
|
+
n.value = y, l && l("update:modelValue", y);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
function lr() {
|
|
392
|
+
const t = $(!1);
|
|
393
|
+
return {
|
|
394
|
+
isFullscreen: t,
|
|
395
|
+
toggleFullscreen: () => {
|
|
396
|
+
t.value = !t.value;
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
const ne = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), xe = (t) => {
|
|
401
|
+
let e = ne(t || "");
|
|
402
|
+
return e = e.replace(/!\[([^\]]*)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g, (l, s, a, o) => {
|
|
403
|
+
const n = o ? ` title="${ne(o)}"` : "";
|
|
404
|
+
return `<img src="${ne(a)}" alt="${ne(s)}"${n}>`;
|
|
405
|
+
}), e = e.replace(/\[([^\]]+)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g, (l, s, a, o) => {
|
|
406
|
+
const n = o ? ` title="${ne(o)}"` : "";
|
|
407
|
+
return `<a href="${ne(a)}"${n} target="_blank" rel="noopener noreferrer">${s}</a>`;
|
|
408
|
+
}), e = e.replace(/`([^`]+)`/g, "<code>$1</code>"), e = e.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), e = e.replace(/__([^_]+)__/g, "<strong>$1</strong>"), e = e.replace(/~~([^~]+)~~/g, "<del>$1</del>"), e = e.replace(/\*([^*\n]+)\*/g, "<em>$1</em>"), e = e.replace(/_([^_\n]+)_/g, "<em>$1</em>"), e;
|
|
409
|
+
}, me = (t) => /^\s*\d+\.\s+/.test(t), Be = (t) => /^\s*[-*+]\s+/.test(t), Ke = (t) => /^\s*[-*+]\s+\[[ xX]\]\s+/.test(t), Se = (t) => /^\s*>\s?/.test(t), Ie = (t) => /^\s*\|?(?:\s*:?-{3,}:?\s*\|)+\s*:?-{3,}:?\s*\|?\s*$/.test(t), ze = (t) => t.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((e) => xe(e.trim())), ar = (t, e) => {
|
|
410
|
+
const l = t[e], s = t[e + 1];
|
|
411
|
+
if (!l || !s || !l.includes("|") || !Ie(s))
|
|
412
|
+
return null;
|
|
413
|
+
const a = ze(l), o = [];
|
|
414
|
+
let n = e + 2;
|
|
415
|
+
for (; n < t.length && t[n].includes("|") && t[n].trim() !== ""; ) {
|
|
416
|
+
const i = ze(t[n]);
|
|
417
|
+
o.push(`<tr>${i.map((y) => `<td>${y}</td>`).join("")}</tr>`), n += 1;
|
|
418
|
+
}
|
|
419
|
+
const c = `<thead><tr>${a.map((i) => `<th>${i}</th>`).join("")}</tr></thead>`, r = o.length ? `<tbody>${o.join("")}</tbody>` : "";
|
|
420
|
+
return {
|
|
421
|
+
html: `<table>${c}${r}</table>`,
|
|
422
|
+
nextIndex: n
|
|
423
|
+
};
|
|
424
|
+
}, sr = (t, e) => {
|
|
425
|
+
const l = me(t[e]), s = l ? "ol" : "ul", a = [];
|
|
426
|
+
let o = e;
|
|
427
|
+
for (; o < t.length; ) {
|
|
428
|
+
const n = t[o];
|
|
429
|
+
if (n.trim() === "" || !(l ? me(n) : (Be(n) || Ke(n)) && !me(n))) break;
|
|
430
|
+
const r = n.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.*)$/);
|
|
431
|
+
if (r) {
|
|
432
|
+
const i = r[1].toLowerCase() === "x";
|
|
433
|
+
a.push(`<li><input type="checkbox" disabled${i ? " checked" : ""}> ${xe(r[2])}</li>`);
|
|
434
|
+
} else {
|
|
435
|
+
const i = n.replace(/^\s*(?:[-*+]|\d+\.)\s+/, "");
|
|
436
|
+
a.push(`<li>${xe(i)}</li>`);
|
|
437
|
+
}
|
|
438
|
+
o += 1;
|
|
439
|
+
}
|
|
440
|
+
return {
|
|
441
|
+
html: `<${s}>${a.join("")}</${s}>`,
|
|
442
|
+
nextIndex: o
|
|
443
|
+
};
|
|
444
|
+
}, nr = (t, e) => {
|
|
445
|
+
const s = t[e].replace(/^```/, "").trim(), a = [];
|
|
446
|
+
let o = e + 1;
|
|
447
|
+
for (; o < t.length && !t[o].startsWith("```"); )
|
|
448
|
+
a.push(t[o]), o += 1;
|
|
449
|
+
return {
|
|
450
|
+
html: `<pre><code${s ? ` class="language-${ne(s)}"` : ""}>${ne(a.join(`
|
|
451
|
+
`))}</code></pre>`,
|
|
452
|
+
nextIndex: o < t.length ? o + 1 : o
|
|
453
|
+
};
|
|
454
|
+
}, ir = (t, e) => {
|
|
455
|
+
const l = [];
|
|
456
|
+
let s = e;
|
|
457
|
+
for (; s < t.length; ) {
|
|
458
|
+
const a = t[s];
|
|
459
|
+
if (a.trim() === "" || a.startsWith("```") || /^#{1,6}\s+/.test(a) || /^---+$/.test(a.trim()) || /^\*\*\*+$/.test(a.trim()) || Se(a) || me(a) || Be(a) || s + 1 < t.length && a.includes("|") && Ie(t[s + 1]))
|
|
460
|
+
break;
|
|
461
|
+
l.push(a.trim()), s += 1;
|
|
462
|
+
}
|
|
463
|
+
return {
|
|
464
|
+
html: `<p>${xe(l.join(" "))}</p>`,
|
|
465
|
+
nextIndex: s
|
|
466
|
+
};
|
|
467
|
+
}, We = (t) => {
|
|
468
|
+
const l = (t || "").replace(/\r\n/g, `
|
|
469
|
+
`).split(`
|
|
470
|
+
`), s = [];
|
|
471
|
+
let a = 0;
|
|
472
|
+
for (; a < l.length; ) {
|
|
473
|
+
const o = l[a], n = o.trim();
|
|
474
|
+
if (!n) {
|
|
475
|
+
a += 1;
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
if (o.startsWith("```")) {
|
|
479
|
+
const i = nr(l, a);
|
|
480
|
+
s.push(i.html), a = i.nextIndex;
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
const c = o.match(/^(#{1,6})\s+(.*)$/);
|
|
484
|
+
if (c) {
|
|
485
|
+
const i = c[1].length;
|
|
486
|
+
s.push(`<h${i}>${xe(c[2])}</h${i}>`), a += 1;
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
if (/^---+$/.test(n) || /^\*\*\*+$/.test(n)) {
|
|
490
|
+
s.push("<hr>"), a += 1;
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
if (o.includes("|") && a + 1 < l.length && Ie(l[a + 1])) {
|
|
494
|
+
const i = ar(l, a);
|
|
495
|
+
if (i) {
|
|
496
|
+
s.push(i.html), a = i.nextIndex;
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (Se(o)) {
|
|
501
|
+
const i = [];
|
|
502
|
+
for (; a < l.length && Se(l[a]); )
|
|
503
|
+
i.push(l[a].replace(/^\s*>\s?/, "")), a += 1;
|
|
504
|
+
s.push(`<blockquote>${We(i.join(`
|
|
505
|
+
`))}</blockquote>`);
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (me(o) || Be(o) || Ke(o)) {
|
|
509
|
+
const i = sr(l, a);
|
|
510
|
+
s.push(i.html), a = i.nextIndex;
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
const r = ir(l, a);
|
|
514
|
+
s.push(r.html), a = r.nextIndex;
|
|
515
|
+
}
|
|
516
|
+
return s.join("");
|
|
517
|
+
}, Ce = (t) => (t.textContent || "").replace(/\u00a0/g, " "), Xe = (t) => Array.from(t.childNodes).map((e) => Ee(e)).join(""), cr = (t) => {
|
|
518
|
+
const e = Array.from(t.querySelectorAll("tr"));
|
|
519
|
+
if (!e.length) return "";
|
|
520
|
+
const l = (c) => `| ${Array.from(c.children).map((i) => Xe(i).trim()).join(" | ")} |`, s = e[0], a = s ? Array.from(s.children).length : 0, o = `| ${Array(Math.max(a, 1)).fill("---").join(" | ")} |`, n = e.slice(1).map((c) => l(c));
|
|
521
|
+
return [l(s), o, ...n].join(`
|
|
522
|
+
`);
|
|
523
|
+
}, Ne = (t, e = !1) => Array.from(t.children).filter((l) => l.nodeType === Node.ELEMENT_NODE).map((l, s) => {
|
|
524
|
+
const a = l, o = a.querySelector('input[type="checkbox"]'), n = Array.from(a.childNodes).filter((c) => !(c instanceof HTMLInputElement)).map((c) => Ee(c)).join("").trim();
|
|
525
|
+
return o ? `- [${o.checked ? "x" : " "}] ${n}` : e ? `${s + 1}. ${n}` : `- ${n}`;
|
|
526
|
+
}).join(`
|
|
527
|
+
`);
|
|
528
|
+
function Ee(t) {
|
|
529
|
+
if (t.nodeType === Node.TEXT_NODE)
|
|
530
|
+
return Ce(t);
|
|
531
|
+
if (t.nodeType !== Node.ELEMENT_NODE)
|
|
532
|
+
return "";
|
|
533
|
+
const e = t, l = e.tagName.toLowerCase(), s = Xe(e);
|
|
534
|
+
switch (l) {
|
|
535
|
+
case "br":
|
|
536
|
+
return `
|
|
537
|
+
`;
|
|
538
|
+
case "p":
|
|
539
|
+
return `${s.trim()}
|
|
540
|
+
|
|
541
|
+
`;
|
|
542
|
+
case "strong":
|
|
543
|
+
case "b":
|
|
544
|
+
return `**${s}**`;
|
|
545
|
+
case "em":
|
|
546
|
+
case "i":
|
|
547
|
+
return `*${s}*`;
|
|
548
|
+
case "del":
|
|
549
|
+
case "s":
|
|
550
|
+
return `~~${s}~~`;
|
|
551
|
+
case "code":
|
|
552
|
+
return e.parentElement?.tagName.toLowerCase() === "pre" ? s : `\`${s}\``;
|
|
553
|
+
case "pre": {
|
|
554
|
+
const a = e.querySelector("code"), c = (a?.className || "").match(/language-([a-z0-9_-]+)/i)?.[1] || "", r = Ce(a || e);
|
|
555
|
+
return `\`\`\`${c}
|
|
556
|
+
${r}
|
|
557
|
+
\`\`\`
|
|
558
|
+
|
|
559
|
+
`;
|
|
560
|
+
}
|
|
561
|
+
case "blockquote":
|
|
562
|
+
return `${s.trim().split(`
|
|
563
|
+
`).map((a) => `> ${a}`).join(`
|
|
564
|
+
`)}
|
|
565
|
+
|
|
566
|
+
`;
|
|
567
|
+
case "h1":
|
|
568
|
+
case "h2":
|
|
569
|
+
case "h3":
|
|
570
|
+
case "h4":
|
|
571
|
+
case "h5":
|
|
572
|
+
case "h6": {
|
|
573
|
+
const a = Number(l[1]);
|
|
574
|
+
return `${"#".repeat(a)} ${s.trim()}
|
|
575
|
+
|
|
576
|
+
`;
|
|
577
|
+
}
|
|
578
|
+
case "ul":
|
|
579
|
+
return `${Ne(e, !1)}
|
|
580
|
+
|
|
581
|
+
`;
|
|
582
|
+
case "ol":
|
|
583
|
+
return `${Ne(e, !0)}
|
|
584
|
+
|
|
585
|
+
`;
|
|
586
|
+
case "a": {
|
|
587
|
+
const a = e.getAttribute("href") || "";
|
|
588
|
+
return `[${s || a}](${a})`;
|
|
589
|
+
}
|
|
590
|
+
case "img": {
|
|
591
|
+
const a = e.getAttribute("alt") || "", o = e.getAttribute("src") || "";
|
|
592
|
+
return o ? `` : "";
|
|
593
|
+
}
|
|
594
|
+
case "hr":
|
|
595
|
+
return `---
|
|
596
|
+
|
|
597
|
+
`;
|
|
598
|
+
case "table":
|
|
599
|
+
return `${cr(e)}
|
|
600
|
+
|
|
601
|
+
`;
|
|
602
|
+
default:
|
|
603
|
+
return s;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
const Ge = (t) => {
|
|
607
|
+
if (!t) return "";
|
|
608
|
+
if (typeof window > "u" || typeof DOMParser > "u")
|
|
609
|
+
return t;
|
|
610
|
+
const l = new DOMParser().parseFromString(t, "text/html");
|
|
611
|
+
return Array.from(l.body.childNodes).map((s) => Ee(s)).join("").replace(/\n{3,}/g, `
|
|
612
|
+
|
|
613
|
+
`).trim();
|
|
614
|
+
}, Ae = async (t, e) => e !== "md" ? t || "" : We(t || ""), dr = async (t, e) => e !== "md" ? t || "" : Ge(t || ""), ur = async (t, e) => e !== "md" ? t || "" : Ge(t || ""), fr = (t) => String(t).trim().toLowerCase().split("-")[0], pr = () => typeof window > "u" ? "uk" : fr(
|
|
615
|
+
localStorage.getItem("language") || localStorage.getItem("locale") || navigator.language || "uk"
|
|
616
|
+
), gr = (t, e) => {
|
|
617
|
+
const l = e.replace(/^form\.richtext\./, "");
|
|
618
|
+
return Me?.[t]?.form?.richtext?.[l] || Me?.uk?.form?.richtext?.[l] || e;
|
|
619
|
+
}, Ve = (t) => t.startsWith("form.richtext.") ? t : `form.richtext.${t}`;
|
|
620
|
+
function _e() {
|
|
621
|
+
const e = tt()?.appContext?.config?.globalProperties, l = e?.$i18n;
|
|
622
|
+
return { t: (a) => {
|
|
623
|
+
const o = e?.$t, n = e?.$te, c = typeof l?.te == "function" ? l.te.bind(l) : null;
|
|
624
|
+
if (typeof o == "function") {
|
|
625
|
+
const r = Ve(a);
|
|
626
|
+
if ((typeof n == "function" ? n(r) : typeof c == "function" ? c(r) : null) !== !1) {
|
|
627
|
+
const y = o(r);
|
|
628
|
+
if (y && y !== r)
|
|
629
|
+
return y;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return gr(pr(), Ve(a));
|
|
633
|
+
} };
|
|
634
|
+
}
|
|
635
|
+
const hr = {
|
|
636
|
+
components: { Quote: pt },
|
|
637
|
+
props: { editor: Object },
|
|
638
|
+
methods: {
|
|
639
|
+
toggleBlockquote() {
|
|
640
|
+
this.editor && this.editor.chain().toggleBlockquote().run();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
function vr(t, e, l, s, a, o) {
|
|
645
|
+
const n = G("Quote");
|
|
646
|
+
return g(), w("button", {
|
|
647
|
+
title: "Blockquote",
|
|
648
|
+
onClick: e[0] || (e[0] = (...c) => o.toggleBlockquote && o.toggleBlockquote(...c)),
|
|
649
|
+
class: T(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none", { "bg-gray-100 text-gray-900": l.editor?.isActive("blockquote") }])
|
|
650
|
+
}, [
|
|
651
|
+
C(n, { class: "h-4 w-4" })
|
|
652
|
+
], 2);
|
|
653
|
+
}
|
|
654
|
+
const mr = /* @__PURE__ */ X(hr, [["render", vr]]), br = {
|
|
655
|
+
components: { List: gt },
|
|
656
|
+
props: { editor: Object },
|
|
657
|
+
methods: {
|
|
658
|
+
toggleBulletList() {
|
|
659
|
+
this.editor && this.editor.chain().focus().toggleBulletList().run();
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
function yr(t, e, l, s, a, o) {
|
|
664
|
+
const n = G("List");
|
|
665
|
+
return g(), w("button", {
|
|
666
|
+
title: "Bullet List",
|
|
667
|
+
onClick: e[0] || (e[0] = (...c) => o.toggleBulletList && o.toggleBulletList(...c)),
|
|
668
|
+
class: T(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": l.editor?.isActive("bulletList") }])
|
|
669
|
+
}, [
|
|
670
|
+
C(n, { class: "h-4 w-4" })
|
|
671
|
+
], 2);
|
|
672
|
+
}
|
|
673
|
+
const xr = /* @__PURE__ */ X(br, [["render", yr]]), wr = {
|
|
674
|
+
components: { ListOrdered: ht },
|
|
675
|
+
props: { editor: Object },
|
|
676
|
+
methods: {
|
|
677
|
+
toggleOrderedList() {
|
|
678
|
+
this.editor && this.editor.chain().focus().toggleOrderedList().run();
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
function kr(t, e, l, s, a, o) {
|
|
683
|
+
const n = G("ListOrdered");
|
|
684
|
+
return g(), w("button", {
|
|
685
|
+
title: "Ordered List",
|
|
686
|
+
onClick: e[0] || (e[0] = (...c) => o.toggleOrderedList && o.toggleOrderedList(...c)),
|
|
687
|
+
class: T(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": l.editor?.isActive("orderedList") }])
|
|
688
|
+
}, [
|
|
689
|
+
C(n, { class: "h-4 w-4" })
|
|
690
|
+
], 2);
|
|
691
|
+
}
|
|
692
|
+
const _r = /* @__PURE__ */ X(wr, [["render", kr]]), $r = {
|
|
693
|
+
components: { CodeXml: vt },
|
|
694
|
+
props: { editor: Object },
|
|
695
|
+
methods: {
|
|
696
|
+
toggleCodeBlock() {
|
|
697
|
+
this.editor && this.editor.chain().focus().toggleCodeBlock().run();
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
function Cr(t, e, l, s, a, o) {
|
|
702
|
+
const n = G("CodeXml");
|
|
703
|
+
return g(), w("button", {
|
|
704
|
+
title: "Code Block",
|
|
705
|
+
onClick: e[0] || (e[0] = (...c) => o.toggleCodeBlock && o.toggleCodeBlock(...c)),
|
|
706
|
+
class: T(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": l.editor?.isActive("codeBlock") }])
|
|
707
|
+
}, [
|
|
708
|
+
C(n, { class: "h-4 w-4" })
|
|
709
|
+
], 2);
|
|
710
|
+
}
|
|
711
|
+
const Ar = /* @__PURE__ */ X($r, [["render", Cr]]), Fr = {
|
|
712
|
+
components: { Bold: mt },
|
|
713
|
+
props: {
|
|
714
|
+
editor: Object
|
|
715
|
+
},
|
|
716
|
+
methods: {
|
|
717
|
+
toggleBold() {
|
|
718
|
+
this.editor && this.editor.commands.toggleBold();
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
function Sr(t, e, l, s, a, o) {
|
|
723
|
+
const n = G("Bold");
|
|
724
|
+
return g(), w("button", {
|
|
725
|
+
title: "Bold Text",
|
|
726
|
+
onClick: e[0] || (e[0] = (...c) => o.toggleBold && o.toggleBold(...c)),
|
|
727
|
+
class: T(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": l.editor?.isActive("bold") }])
|
|
728
|
+
}, [
|
|
729
|
+
C(n, { class: "h-4 w-4" }),
|
|
730
|
+
e[1] || (e[1] = d("span", { class: "sr-only" }, "Bold", -1))
|
|
731
|
+
], 2);
|
|
732
|
+
}
|
|
733
|
+
const Tr = /* @__PURE__ */ X(Fr, [["render", Sr]]), Lr = {
|
|
734
|
+
components: { Italic: bt },
|
|
735
|
+
props: {
|
|
736
|
+
editor: Object
|
|
737
|
+
},
|
|
738
|
+
methods: {
|
|
739
|
+
toggleItalic() {
|
|
740
|
+
this.editor && this.editor.chain().toggleItalic().run();
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
function Br(t, e, l, s, a, o) {
|
|
745
|
+
const n = G("Italic");
|
|
746
|
+
return g(), w("button", {
|
|
747
|
+
title: "Italic Text",
|
|
748
|
+
onClick: e[0] || (e[0] = (...c) => o.toggleItalic && o.toggleItalic(...c)),
|
|
749
|
+
class: T(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": l.editor?.isActive("italic") }])
|
|
750
|
+
}, [
|
|
751
|
+
C(n, { class: "h-4 w-4" }),
|
|
752
|
+
e[1] || (e[1] = d("span", { class: "sr-only" }, "Italic", -1))
|
|
753
|
+
], 2);
|
|
754
|
+
}
|
|
755
|
+
const Ir = /* @__PURE__ */ X(Lr, [["render", Br]]), Er = {
|
|
756
|
+
__name: "vs-editor-underline",
|
|
757
|
+
props: { editor: Object },
|
|
758
|
+
setup(t) {
|
|
759
|
+
const e = t, l = () => {
|
|
760
|
+
e.editor && e.editor.chain().focus().toggleUnderline().run();
|
|
761
|
+
};
|
|
762
|
+
return (s, a) => (g(), w("button", {
|
|
763
|
+
title: "Underline",
|
|
764
|
+
onClick: l,
|
|
765
|
+
class: T(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", [
|
|
766
|
+
t.editor?.isActive("underline") ? "bg-gray-100 text-gray-900" : "text-gray-500"
|
|
767
|
+
]])
|
|
768
|
+
}, [
|
|
769
|
+
C(k(yt), { class: "h-4 w-4" })
|
|
770
|
+
], 2));
|
|
771
|
+
}
|
|
772
|
+
}, jr = {
|
|
773
|
+
__name: "vs-editor-strike",
|
|
774
|
+
props: { editor: Object },
|
|
775
|
+
setup(t) {
|
|
776
|
+
const e = t, l = () => {
|
|
777
|
+
e.editor && e.editor.chain().focus().toggleStrike().run();
|
|
778
|
+
};
|
|
779
|
+
return (s, a) => (g(), w("button", {
|
|
780
|
+
title: "Strikethrough",
|
|
781
|
+
onClick: l,
|
|
782
|
+
class: T(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", [
|
|
783
|
+
t.editor?.isActive("strike") ? "bg-gray-100 text-gray-900" : "text-gray-500"
|
|
784
|
+
]])
|
|
785
|
+
}, [
|
|
786
|
+
C(k(xt), { class: "h-4 w-4" })
|
|
787
|
+
], 2));
|
|
788
|
+
}
|
|
789
|
+
}, Pr = {
|
|
790
|
+
components: { X: Te },
|
|
791
|
+
props: {
|
|
792
|
+
visible: { type: Boolean, default: () => !1 },
|
|
793
|
+
modelValue: { type: Boolean, default: () => !1 },
|
|
794
|
+
title: { type: String, default: () => "" },
|
|
795
|
+
size: { type: String, default: () => "" },
|
|
796
|
+
closeClickBack: { type: Boolean, default: () => !1 }
|
|
797
|
+
},
|
|
798
|
+
emits: ["update:visible", "update:modelValue", "onClose", "confirm", "cancel"],
|
|
799
|
+
inheritAttrs: !1,
|
|
800
|
+
name: "vs-dialog",
|
|
801
|
+
mounted() {
|
|
802
|
+
window.addEventListener("keydown", this.checkKey);
|
|
803
|
+
},
|
|
804
|
+
unmounted() {
|
|
805
|
+
window.removeEventListener("keydown", this.checkKey);
|
|
806
|
+
},
|
|
807
|
+
computed: {
|
|
808
|
+
hasSlot() {
|
|
809
|
+
return !!this.$slots?.footer;
|
|
810
|
+
},
|
|
811
|
+
checkSize() {
|
|
812
|
+
return this.size === "small" ? "md:w-5/12 w-9/12" : this.size === "medium" ? "md:w-6/12 w-9/12" : "lg:w-7/12 w-11/12";
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
methods: {
|
|
816
|
+
checkKey({ key: t }) {
|
|
817
|
+
t === "Escape" && this.handleClose();
|
|
818
|
+
},
|
|
819
|
+
handleClose() {
|
|
820
|
+
this.$emit("update:visible", !1), this.$emit("update:modelValue", !1), this.$emit("onClose");
|
|
821
|
+
},
|
|
822
|
+
handleConfirm() {
|
|
823
|
+
this.$emit("confirm"), this.handleClose();
|
|
824
|
+
},
|
|
825
|
+
handleCancel() {
|
|
826
|
+
this.$emit("cancel"), this.handleClose();
|
|
827
|
+
},
|
|
828
|
+
closeByClickBack(t, e) {
|
|
829
|
+
e && t.target.classList.contains("vs-dialog-overlay") && this.handleClose();
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}, Mr = {
|
|
833
|
+
key: 0,
|
|
834
|
+
class: "vsTailwind ui-dialog__wrapper"
|
|
835
|
+
}, Hr = { class: "py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]" }, zr = { class: "font-medium text-gray-800 dark:text-[#ffffff]" }, Nr = { class: "ui-dialog__content p-4" }, Vr = {
|
|
836
|
+
key: 0,
|
|
837
|
+
class: "flex justify-end gap-x-2"
|
|
838
|
+
};
|
|
839
|
+
function Dr(t, e, l, s, a, o) {
|
|
840
|
+
const n = G("X");
|
|
841
|
+
return g(), K(Oe, { to: "body" }, [
|
|
842
|
+
l.visible || l.modelValue ? (g(), w("div", Mr, [
|
|
843
|
+
d("div", {
|
|
844
|
+
onMousedown: e[1] || (e[1] = (c) => o.closeByClickBack(c, l.closeClickBack)),
|
|
845
|
+
class: "vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"
|
|
846
|
+
}, [
|
|
847
|
+
C(Re, {
|
|
848
|
+
name: "content",
|
|
849
|
+
appear: ""
|
|
850
|
+
}, {
|
|
851
|
+
default: V(() => [
|
|
852
|
+
d("div", {
|
|
853
|
+
class: T(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl", [o.checkSize]])
|
|
854
|
+
}, [
|
|
855
|
+
d("div", Hr, [
|
|
856
|
+
d("h3", zr, W(l.title), 1),
|
|
857
|
+
d("button", {
|
|
858
|
+
type: "button",
|
|
859
|
+
class: "size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",
|
|
860
|
+
onClick: e[0] || (e[0] = (...c) => o.handleClose && o.handleClose(...c))
|
|
861
|
+
}, [
|
|
862
|
+
e[2] || (e[2] = d("span", { class: "sr-only" }, "Close", -1)),
|
|
863
|
+
C(n, { class: "h-4 w-4 flex-shrink-0" })
|
|
864
|
+
])
|
|
865
|
+
]),
|
|
866
|
+
d("div", Nr, [
|
|
867
|
+
he(t.$slots, "default", {}, void 0, !0)
|
|
868
|
+
]),
|
|
869
|
+
o.hasSlot ? (g(), w("div", Vr, [
|
|
870
|
+
he(t.$slots, "footer", {
|
|
871
|
+
handleClose: o.handleClose,
|
|
872
|
+
handleConfirm: o.handleConfirm,
|
|
873
|
+
handleCancel: o.handleCancel
|
|
874
|
+
}, void 0, !0)
|
|
875
|
+
])) : R("", !0)
|
|
876
|
+
], 2)
|
|
877
|
+
]),
|
|
878
|
+
_: 3
|
|
879
|
+
})
|
|
880
|
+
], 32)
|
|
881
|
+
])) : R("", !0)
|
|
882
|
+
]);
|
|
883
|
+
}
|
|
884
|
+
const Ye = /* @__PURE__ */ X(Pr, [["render", Dr], ["__scopeId", "data-v-9395bb47"]]), Or = rt({
|
|
885
|
+
components: {
|
|
886
|
+
IconClose: Te,
|
|
887
|
+
IconSearch: kt,
|
|
888
|
+
IconEmail: wt
|
|
889
|
+
},
|
|
890
|
+
inheritAttrs: !1,
|
|
891
|
+
props: {
|
|
892
|
+
icon: { type: String, default: () => "" },
|
|
893
|
+
disabled: { type: Boolean, default: () => !1 },
|
|
894
|
+
clearable: { type: Boolean, default: () => !1 },
|
|
895
|
+
modelValue: { type: String, default: () => "" },
|
|
896
|
+
placeholder: { type: String, default: () => "" },
|
|
897
|
+
iconPosition: { type: String, default: () => "right" },
|
|
898
|
+
type: { type: String, default: () => "text" },
|
|
899
|
+
style: { type: Object, default: () => null },
|
|
900
|
+
size: { type: String, default: () => "md" },
|
|
901
|
+
attrs: { type: Object, default: () => {
|
|
902
|
+
} }
|
|
903
|
+
},
|
|
904
|
+
emits: ["onInput", "update:modelValue", "blur", "focus"],
|
|
905
|
+
computed: {
|
|
906
|
+
checkSize() {
|
|
907
|
+
return (this.style?.size || this.size) === "xs" ? "h-[32px] text-sm" : (this.style?.size || this.size) === "md" ? "h-[38px] text-sm" : (this.style?.size || this.size) === "lg" ? "h-[46px] text-[20px]" : "h-[38px] text-sm";
|
|
908
|
+
},
|
|
909
|
+
value: {
|
|
910
|
+
get() {
|
|
911
|
+
return this.modelValue;
|
|
912
|
+
},
|
|
913
|
+
set(t) {
|
|
914
|
+
this.$emit("update:modelValue", t.trim());
|
|
915
|
+
}
|
|
916
|
+
},
|
|
917
|
+
clearIconStyle() {
|
|
918
|
+
return [
|
|
919
|
+
{
|
|
920
|
+
"right-8": this.icon && this.iconPosition === "right",
|
|
921
|
+
"right-3": !this.icon || this.iconPosition !== "right",
|
|
922
|
+
"pointer-events-none": this.disabled
|
|
923
|
+
}
|
|
924
|
+
];
|
|
925
|
+
},
|
|
926
|
+
iconStylePosition() {
|
|
927
|
+
return [
|
|
928
|
+
{
|
|
929
|
+
"left-3": this.icon && this.iconPosition === "left",
|
|
930
|
+
"right-3": this.icon && this.iconPosition === "right"
|
|
931
|
+
}
|
|
932
|
+
];
|
|
933
|
+
},
|
|
934
|
+
inputStyle() {
|
|
935
|
+
return [
|
|
936
|
+
{
|
|
937
|
+
"!pr-8": this.clearable && !this.icon,
|
|
938
|
+
"!pr-7": this.clearable,
|
|
939
|
+
"!pr-16": this.clearable && this.icon && this.iconPosition === "right",
|
|
940
|
+
"!pl-8": this.icon && this.iconPosition === "left",
|
|
941
|
+
"!pr-[50px]": this.clearable && this.value && this.icon && this.iconPosition === "right",
|
|
942
|
+
"!cursor-not-allowed bg-slate-100": this.disabled,
|
|
943
|
+
"bg-white": !this.disabled
|
|
944
|
+
}
|
|
945
|
+
];
|
|
946
|
+
}
|
|
947
|
+
},
|
|
948
|
+
methods: {
|
|
949
|
+
// Emits input value to the upper level
|
|
950
|
+
handleInput() {
|
|
951
|
+
this.$emit("onInput", this.modelValue);
|
|
952
|
+
},
|
|
953
|
+
handleBlur() {
|
|
954
|
+
this.$emit("blur");
|
|
955
|
+
},
|
|
956
|
+
handleFocus() {
|
|
957
|
+
this.$emit("focus");
|
|
958
|
+
},
|
|
959
|
+
// Clears input
|
|
960
|
+
clearInput() {
|
|
961
|
+
this.$emit("update:modelValue", ""), this.$emit("onInput", "");
|
|
962
|
+
},
|
|
963
|
+
async inputFocus() {
|
|
964
|
+
await this.$refs.vsText?.focus();
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}), Rr = { class: "vs-form-text relative bg-white rounded-lg" }, Ur = {
|
|
968
|
+
key: 2,
|
|
969
|
+
class: "absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"
|
|
970
|
+
}, qr = ["disabled", "type", "placeholder"];
|
|
971
|
+
function Kr(t, e, l, s, a, o) {
|
|
972
|
+
const n = G("IconClose"), c = G("IconSearch"), r = G("IconEmail");
|
|
973
|
+
return g(), w("div", Rr, [
|
|
974
|
+
t.clearable && t.value ? (g(), w("div", {
|
|
975
|
+
key: 0,
|
|
976
|
+
class: "absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",
|
|
977
|
+
onClick: e[0] || (e[0] = (...i) => t.clearInput && t.clearInput(...i))
|
|
978
|
+
}, [
|
|
979
|
+
C(n, { class: "h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500" })
|
|
980
|
+
])) : R("", !0),
|
|
981
|
+
t.icon && t.icon === "search" ? (g(), w("div", {
|
|
982
|
+
key: 1,
|
|
983
|
+
class: T(["absolute bottom-2/4 translate-y-2/4 cursor-pointer", t.iconStylePosition])
|
|
984
|
+
}, [
|
|
985
|
+
C(c, { class: "h-4 w-4 stroke-gray-500 transition-all" })
|
|
986
|
+
], 2)) : t.icon && t.icon === "email" ? (g(), w("div", Ur, [
|
|
987
|
+
C(r, { class: "h-4 w-4 stroke-gray-500 transition-all" })
|
|
988
|
+
])) : (g(), w("i", {
|
|
989
|
+
key: 3,
|
|
990
|
+
class: T(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer", ["ti " + t.icon, t.iconStylePosition]])
|
|
991
|
+
}, null, 2)),
|
|
992
|
+
t.clearable && t.value ? (g(), w("div", {
|
|
993
|
+
key: 4,
|
|
994
|
+
class: "absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",
|
|
995
|
+
onClick: e[1] || (e[1] = (...i) => t.clearInput && t.clearInput(...i))
|
|
996
|
+
}, [
|
|
997
|
+
C(n, { class: "h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500" })
|
|
998
|
+
])) : R("", !0),
|
|
999
|
+
ie(d("input", ot({
|
|
1000
|
+
ref: "vsText",
|
|
1001
|
+
disabled: t.disabled,
|
|
1002
|
+
type: t.type,
|
|
1003
|
+
onInput: e[2] || (e[2] = (...i) => t.handleInput && t.handleInput(...i)),
|
|
1004
|
+
placeholder: t.placeholder,
|
|
1005
|
+
"onUpdate:modelValue": e[3] || (e[3] = (i) => t.value = i)
|
|
1006
|
+
}, t.style?.attrs || t.attrs || {}, {
|
|
1007
|
+
onFocus: e[4] || (e[4] = (...i) => t.handleFocus && t.handleFocus(...i)),
|
|
1008
|
+
onBlur: e[5] || (e[5] = (...i) => t.handleBlur && t.handleBlur(...i)),
|
|
1009
|
+
class: [[t.inputStyle, t.checkSize], "py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]
|
|
1010
|
+
}), null, 16, qr), [
|
|
1011
|
+
[lt, t.value]
|
|
1012
|
+
])
|
|
1013
|
+
]);
|
|
1014
|
+
}
|
|
1015
|
+
const Qe = /* @__PURE__ */ X(Or, [["render", Kr], ["__scopeId", "data-v-1e382a36"]]), Wr = ["title"], Xr = { class: "flex flex-col gap-3 p-[20px]" }, Gr = { class: "relative flex items-center gap-2" }, Yr = { class: "flex-1" }, Qr = {
|
|
1016
|
+
key: 0,
|
|
1017
|
+
class: "flex items-center gap-2 flex-shrink-0"
|
|
1018
|
+
}, Zr = ["title"], Jr = ["title"], eo = { class: "flex items-center gap-2" }, to = {
|
|
1019
|
+
for: "openInNewTab",
|
|
1020
|
+
class: "text-sm text-gray-700 cursor-pointer"
|
|
1021
|
+
}, ro = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, oo = /* @__PURE__ */ Object.assign({
|
|
1022
|
+
inheritAttrs: !1
|
|
1023
|
+
}, {
|
|
1024
|
+
__name: "vs-editor-link",
|
|
1025
|
+
props: { editor: Object },
|
|
1026
|
+
setup(t) {
|
|
1027
|
+
const { t: e } = _e(), l = t, s = $(!1), a = $(""), o = $(!1), n = $(!1), c = () => {
|
|
1028
|
+
if (!l.editor) return;
|
|
1029
|
+
l.editor.chain().focus().extendMarkRange("link").run();
|
|
1030
|
+
const h = l.editor.getAttributes("link");
|
|
1031
|
+
h.href ? (o.value = !0, a.value = h.href, n.value = h.target === "_blank") : (o.value = !1, a.value = "", n.value = !1), s.value = !0;
|
|
1032
|
+
}, r = () => {
|
|
1033
|
+
s.value = !1, a.value = "", o.value = !1, n.value = !1;
|
|
1034
|
+
}, i = () => {
|
|
1035
|
+
if (!l.editor || !a.value.trim()) return;
|
|
1036
|
+
let h = a.value.trim();
|
|
1037
|
+
h.match(/^https?:\/\//i) || (h = "https://" + h), l.editor.chain().focus().setLink({
|
|
1038
|
+
href: h,
|
|
1039
|
+
target: n.value ? "_blank" : null
|
|
1040
|
+
}).run(), r();
|
|
1041
|
+
}, y = () => {
|
|
1042
|
+
l.editor && (l.editor.chain().focus().unsetLink().run(), r());
|
|
1043
|
+
}, p = () => {
|
|
1044
|
+
if (!a.value) return;
|
|
1045
|
+
let h = a.value.trim();
|
|
1046
|
+
h.match(/^https?:\/\//i) || (h = "https://" + h), window.open(h, "_blank", "noopener,noreferrer");
|
|
1047
|
+
};
|
|
1048
|
+
return (h, b) => (g(), w(re, null, [
|
|
1049
|
+
d("button", {
|
|
1050
|
+
title: k(e)("form.richtext.link") || "Посилання",
|
|
1051
|
+
onClick: c,
|
|
1052
|
+
class: T(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none", { "bg-gray-100 text-gray-900": t.editor?.isActive("link") }])
|
|
1053
|
+
}, [
|
|
1054
|
+
C(k(_t), { class: "h-4 w-4" })
|
|
1055
|
+
], 10, Wr),
|
|
1056
|
+
C(Ye, {
|
|
1057
|
+
title: o.value ? k(e)("form.richtext.editLink") || "Редагувати посилання" : k(e)("form.richtext.linkTitle") || "Додати посилання",
|
|
1058
|
+
visible: s.value,
|
|
1059
|
+
"onUpdate:visible": b[2] || (b[2] = (S) => s.value = S),
|
|
1060
|
+
size: "small"
|
|
1061
|
+
}, {
|
|
1062
|
+
footer: V(() => [
|
|
1063
|
+
d("div", ro, [
|
|
1064
|
+
d("button", {
|
|
1065
|
+
style: { border: "1px solid #000" },
|
|
1066
|
+
onClick: r,
|
|
1067
|
+
class: "py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"
|
|
1068
|
+
}, W(k(e)("form.richtext.cancel") || "Скасувати"), 1),
|
|
1069
|
+
d("button", {
|
|
1070
|
+
onClick: i,
|
|
1071
|
+
class: "py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"
|
|
1072
|
+
}, W(o.value ? k(e)("form.richtext.update") || "Оновити" : k(e)("form.richtext.create") || "Створити"), 1)
|
|
1073
|
+
])
|
|
1074
|
+
]),
|
|
1075
|
+
default: V(() => [
|
|
1076
|
+
d("div", Xr, [
|
|
1077
|
+
d("div", Gr, [
|
|
1078
|
+
d("div", Yr, [
|
|
1079
|
+
C(Qe, {
|
|
1080
|
+
modelValue: a.value,
|
|
1081
|
+
"onUpdate:modelValue": b[0] || (b[0] = (S) => a.value = S),
|
|
1082
|
+
placeholder: k(e)("form.richtext.linkUrl") || "Введіть URL",
|
|
1083
|
+
class: "w-full"
|
|
1084
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
1085
|
+
]),
|
|
1086
|
+
o.value ? (g(), w("div", Qr, [
|
|
1087
|
+
d("button", {
|
|
1088
|
+
onClick: p,
|
|
1089
|
+
class: "text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",
|
|
1090
|
+
title: k(e)("form.richtext.openLink") || "Відкрити посилання"
|
|
1091
|
+
}, [
|
|
1092
|
+
C(k($t), { class: "h-4 w-4" })
|
|
1093
|
+
], 8, Zr),
|
|
1094
|
+
d("button", {
|
|
1095
|
+
onClick: y,
|
|
1096
|
+
class: "text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",
|
|
1097
|
+
title: k(e)("form.richtext.removeLink") || "Видалити посилання"
|
|
1098
|
+
}, [
|
|
1099
|
+
C(k(Ct), { class: "h-4 w-4" })
|
|
1100
|
+
], 8, Jr)
|
|
1101
|
+
])) : R("", !0)
|
|
1102
|
+
]),
|
|
1103
|
+
d("div", eo, [
|
|
1104
|
+
ie(d("input", {
|
|
1105
|
+
type: "checkbox",
|
|
1106
|
+
id: "openInNewTab",
|
|
1107
|
+
"onUpdate:modelValue": b[1] || (b[1] = (S) => n.value = S),
|
|
1108
|
+
class: "w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"
|
|
1109
|
+
}, null, 512), [
|
|
1110
|
+
[at, n.value]
|
|
1111
|
+
]),
|
|
1112
|
+
d("label", to, W(k(e)("form.richtext.openInNewTab") || "Відкривати в новій вкладці"), 1)
|
|
1113
|
+
])
|
|
1114
|
+
])
|
|
1115
|
+
]),
|
|
1116
|
+
_: 1
|
|
1117
|
+
}, 8, ["title", "visible"])
|
|
1118
|
+
], 64));
|
|
1119
|
+
}
|
|
1120
|
+
}), ge = async (t, e, l, s = 10) => {
|
|
1121
|
+
if (!e || !l) return;
|
|
1122
|
+
await be();
|
|
1123
|
+
const a = await l?.getBoundingClientRect(), o = await e?.getBoundingClientRect();
|
|
1124
|
+
if (!o || !a) return;
|
|
1125
|
+
const n = await parseInt(e?.getBoundingClientRect()?.height), c = await parseInt(e?.getBoundingClientRect()?.width), r = await parseInt(l?.getBoundingClientRect()?.height), i = await parseInt(l?.getBoundingClientRect()?.width), y = await window.innerHeight, p = await window.innerWidth;
|
|
1126
|
+
let h = 0, b = 0;
|
|
1127
|
+
const S = o.bottom + s + r;
|
|
1128
|
+
switch (t) {
|
|
1129
|
+
case "top":
|
|
1130
|
+
o.top - a.height - s < 0 ? h = o.top - a.height + s + r + n : h = o.top - a.height - s, p > i + o.right + 30 ? b = o.left - a.width / 2 + o.width / 2 : b = p - 30 - i;
|
|
1131
|
+
break;
|
|
1132
|
+
case "bottom":
|
|
1133
|
+
y > S ? h = o.bottom + s : h = o.bottom - s - r - n, b = o.left - a.width / 2 + o.width / 2;
|
|
1134
|
+
break;
|
|
1135
|
+
case "left":
|
|
1136
|
+
h = o.top - a.height / 2 + o.height / 2, o.left - a.width - s > 0 ? b = o.left - a.width - s : b = 10;
|
|
1137
|
+
break;
|
|
1138
|
+
case "right":
|
|
1139
|
+
h = o.top - a.height / 2 + o.height / 2, p - c > i ? b = o.right + s : b = p - 30 - i;
|
|
1140
|
+
break;
|
|
1141
|
+
case "top-right":
|
|
1142
|
+
o.top - a.height - s < 0 ? h = o.top - a.height + s + r + n : h = o.top - a.height - s, p - c > i ? b = o.right + s : b = p - 30 - i;
|
|
1143
|
+
break;
|
|
1144
|
+
case "top-left":
|
|
1145
|
+
o.top - a.height - s < 0 ? h = o.top - a.height + s + r + n : h = o.top - a.height - s, o.left - a.width - s > 0 ? b = o.left - a.width - s : b = 10;
|
|
1146
|
+
break;
|
|
1147
|
+
case "top-start":
|
|
1148
|
+
o.top - a.height - s < 0 ? h = o.top - a.height + s + r + n : h = o.top - a.height - s, o.left > 0 ? b = o.left : b = 10;
|
|
1149
|
+
break;
|
|
1150
|
+
case "bottom-right":
|
|
1151
|
+
y > S ? h = o.bottom + s : h = o.bottom - s - r - n, p - c > i ? b = o.left : b = p - 30 - i;
|
|
1152
|
+
break;
|
|
1153
|
+
case "bottom-left":
|
|
1154
|
+
y > S ? h = o.bottom + s : h = o.bottom - s - r - n, o.left > 0 ? b = o.right - i : b = 10;
|
|
1155
|
+
break;
|
|
1156
|
+
case "bottom-start":
|
|
1157
|
+
y > S ? h = o.bottom + s : h = o.bottom - s - r - n, o.left > 0 ? b = o.left : b = 10;
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
h + r > y ? h = y - r - s : h < 0 && (h = s), b + i > p ? b = p - i - s : b < 0 && (b = s), l instanceof HTMLElement && (l.style.top = `${h}px`, l.style.left = `${b}px`, l.style.position = "fixed");
|
|
1161
|
+
}, lo = { class: "text-center" }, ao = { class: "py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full" }, ce = /* @__PURE__ */ Object.assign({
|
|
1162
|
+
inheritAttrs: !1
|
|
1163
|
+
}, {
|
|
1164
|
+
__name: "vs-popover",
|
|
1165
|
+
props: {
|
|
1166
|
+
isOpen: { type: Boolean, default: () => !1 },
|
|
1167
|
+
placement: { type: String, default: "top" },
|
|
1168
|
+
gap: { type: Number, default: 8 },
|
|
1169
|
+
width: { type: [String, Number], default: "" },
|
|
1170
|
+
disabled: { type: Boolean, default: !1 },
|
|
1171
|
+
trigger: { type: String, default: "click" },
|
|
1172
|
+
teleport: { type: String, default: "body" }
|
|
1173
|
+
},
|
|
1174
|
+
emits: ["isvisible"],
|
|
1175
|
+
setup(t, { expose: e, emit: l }) {
|
|
1176
|
+
const s = t, a = l, o = $(!1), n = $([]), c = $(null), r = $(null), i = $(null);
|
|
1177
|
+
ue(o, (L) => {
|
|
1178
|
+
L ? (y(), window.addEventListener(
|
|
1179
|
+
"resize",
|
|
1180
|
+
() => ge(s.placement, r.value, i.value)
|
|
1181
|
+
), ge(s.placement, r.value, i.value)) : window.removeEventListener(
|
|
1182
|
+
"resize",
|
|
1183
|
+
() => ge(s.placement, r.value, i.value)
|
|
1184
|
+
), a("isvisible", L);
|
|
1185
|
+
}), fe(() => {
|
|
1186
|
+
window.addEventListener("click", H), window.addEventListener("popstate", N), window.addEventListener("scroll", q, !0), y();
|
|
1187
|
+
}), Ue(() => {
|
|
1188
|
+
window.removeEventListener("click", H), window.removeEventListener("popstate", N), p();
|
|
1189
|
+
});
|
|
1190
|
+
const y = () => {
|
|
1191
|
+
let L = c.value;
|
|
1192
|
+
for (; L && L !== document.body; )
|
|
1193
|
+
(L.scrollHeight > L.clientHeight || L.scrollWidth > L.clientWidth) && (L.addEventListener("scroll", j), n.value.push(L)), L = L.parentElement;
|
|
1194
|
+
document.body && (document.body.addEventListener("scroll", j), n.value.push(document.body));
|
|
1195
|
+
}, p = () => {
|
|
1196
|
+
n.value.forEach((L) => {
|
|
1197
|
+
L.removeEventListener("scroll", j);
|
|
1198
|
+
}), n.value = [];
|
|
1199
|
+
}, h = () => {
|
|
1200
|
+
o.value = !0, ge(s.placement, r.value, i.value);
|
|
1201
|
+
}, b = () => {
|
|
1202
|
+
o.value = !1;
|
|
1203
|
+
}, S = async () => {
|
|
1204
|
+
await ge(s.placement, r.value, i.value), o.value = !o.value;
|
|
1205
|
+
}, j = () => {
|
|
1206
|
+
o.value = !1;
|
|
1207
|
+
}, H = (L) => {
|
|
1208
|
+
if (!L) {
|
|
1209
|
+
o.value = !1;
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
r.value?.contains(L.target) || i.value?.contains(L.target) || (o.value = !1);
|
|
1213
|
+
}, N = () => {
|
|
1214
|
+
o.value && (o.value = !1);
|
|
1215
|
+
}, q = (L) => {
|
|
1216
|
+
o.value && i.value && !i.value.contains(L.target) && (o.value = !1);
|
|
1217
|
+
};
|
|
1218
|
+
return e({
|
|
1219
|
+
togglePopover: S
|
|
1220
|
+
}), (L, Y) => (g(), w("div", {
|
|
1221
|
+
ref_key: "popover",
|
|
1222
|
+
ref: c,
|
|
1223
|
+
class: "vs-popover inline-block"
|
|
1224
|
+
}, [
|
|
1225
|
+
d("div", lo, [
|
|
1226
|
+
t.trigger === "click" ? (g(), w("div", {
|
|
1227
|
+
key: 0,
|
|
1228
|
+
ref_key: "popoverRef",
|
|
1229
|
+
ref: r,
|
|
1230
|
+
onClick: S,
|
|
1231
|
+
class: T({ "pointer-events-none": t.disabled })
|
|
1232
|
+
}, [
|
|
1233
|
+
he(L.$slots, "reference", {}, () => [
|
|
1234
|
+
Y[0] || (Y[0] = d("button", null, "Click me!", -1))
|
|
1235
|
+
])
|
|
1236
|
+
], 2)) : R("", !0),
|
|
1237
|
+
t.trigger === "hover" ? (g(), w("div", {
|
|
1238
|
+
key: 1,
|
|
1239
|
+
ref_key: "popoverRef",
|
|
1240
|
+
ref: r,
|
|
1241
|
+
onMouseover: h,
|
|
1242
|
+
onMouseleave: b,
|
|
1243
|
+
class: T({ "pointer-events-none": t.disabled })
|
|
1244
|
+
}, [
|
|
1245
|
+
he(L.$slots, "reference", {}, () => [
|
|
1246
|
+
Y[1] || (Y[1] = d("button", null, "Click me!", -1))
|
|
1247
|
+
])
|
|
1248
|
+
], 34)) : R("", !0),
|
|
1249
|
+
(g(), K(Oe, { to: t.teleport }, [
|
|
1250
|
+
C(Re, { name: "fade" }, {
|
|
1251
|
+
default: V(() => [
|
|
1252
|
+
ie(d("div", {
|
|
1253
|
+
class: T(["vsTailwind vs-popover__content", t.placement]),
|
|
1254
|
+
ref_key: "contentPop",
|
|
1255
|
+
ref: i,
|
|
1256
|
+
style: ae({
|
|
1257
|
+
width: t.width ? t.width + "px" : "fit-content",
|
|
1258
|
+
zIndex: 100001
|
|
1259
|
+
})
|
|
1260
|
+
}, [
|
|
1261
|
+
d("div", ao, [
|
|
1262
|
+
he(L.$slots, "default", {}, () => [
|
|
1263
|
+
Y[2] || (Y[2] = d("span", null, "Popover content", -1))
|
|
1264
|
+
])
|
|
1265
|
+
])
|
|
1266
|
+
], 6), [
|
|
1267
|
+
[ye, o.value]
|
|
1268
|
+
])
|
|
1269
|
+
]),
|
|
1270
|
+
_: 3
|
|
1271
|
+
})
|
|
1272
|
+
], 8, ["to"]))
|
|
1273
|
+
])
|
|
1274
|
+
], 512));
|
|
1275
|
+
}
|
|
1276
|
+
}), so = { class: "flex flex-col gap-[2px] p-[2px]" }, no = ["onClick"], io = {
|
|
1277
|
+
__name: "vs-editor-table",
|
|
1278
|
+
props: { editor: Object },
|
|
1279
|
+
setup(t) {
|
|
1280
|
+
const { t: e } = _e(), l = t, s = $(!1), a = $("popover"), o = () => {
|
|
1281
|
+
l.editor && (l.editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run(), a.value.togglePopover());
|
|
1282
|
+
}, n = () => {
|
|
1283
|
+
l.editor && (l.editor.chain().focus().addColumnAfter().run(), a.value.togglePopover());
|
|
1284
|
+
}, c = () => {
|
|
1285
|
+
l.editor && (l.editor.chain().focus().addRowAfter().run(), a.value.togglePopover());
|
|
1286
|
+
}, r = () => {
|
|
1287
|
+
l.editor && (l.editor.chain().focus().deleteColumn().run(), a.value.togglePopover());
|
|
1288
|
+
}, i = () => {
|
|
1289
|
+
l.editor && (l.editor.chain().focus().deleteRow().run(), a.value.togglePopover());
|
|
1290
|
+
}, y = () => {
|
|
1291
|
+
l.editor && (l.editor.chain().focus().deleteTable().run(), a.value.togglePopover());
|
|
1292
|
+
}, p = () => {
|
|
1293
|
+
l.editor && (l.editor.chain().focus().mergeCells().run(), a.value.togglePopover());
|
|
1294
|
+
}, h = () => {
|
|
1295
|
+
l.editor && (l.editor.chain().focus().splitCell().run(), a.value.togglePopover());
|
|
1296
|
+
}, b = P(() => [
|
|
1297
|
+
{ text: e("form.richtext.createTable"), function: o },
|
|
1298
|
+
{ text: e("form.richtext.addColumn"), function: n },
|
|
1299
|
+
{ text: e("form.richtext.addRow"), function: c },
|
|
1300
|
+
{ text: e("form.richtext.deleteColumn"), function: r },
|
|
1301
|
+
{ text: e("form.richtext.deleteRow"), function: i },
|
|
1302
|
+
{ text: e("form.richtext.deleteTable"), function: y },
|
|
1303
|
+
{ text: e("form.richtext.mergeCells"), function: p },
|
|
1304
|
+
{ text: e("form.richtext.splitCells"), function: h }
|
|
1305
|
+
]);
|
|
1306
|
+
return (S, j) => (g(), K(ce, {
|
|
1307
|
+
ref_key: "popover",
|
|
1308
|
+
ref: a,
|
|
1309
|
+
placement: "bottom",
|
|
1310
|
+
onIsvisible: j[0] || (j[0] = (H) => s.value = H)
|
|
1311
|
+
}, {
|
|
1312
|
+
reference: V(() => [
|
|
1313
|
+
d("button", {
|
|
1314
|
+
title: "Table",
|
|
1315
|
+
class: T(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100", [s.value ? "bg-gray-100 text-gray-900" : "text-gray-500"]])
|
|
1316
|
+
}, [
|
|
1317
|
+
C(k(At), { class: "h-4 w-4" })
|
|
1318
|
+
], 2)
|
|
1319
|
+
]),
|
|
1320
|
+
default: V(() => [
|
|
1321
|
+
d("div", so, [
|
|
1322
|
+
(g(!0), w(re, null, le(b.value, (H, N) => (g(), w("button", {
|
|
1323
|
+
key: N,
|
|
1324
|
+
onClick: H?.function,
|
|
1325
|
+
class: "px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"
|
|
1326
|
+
}, W(H.text), 9, no))), 128))
|
|
1327
|
+
])
|
|
1328
|
+
]),
|
|
1329
|
+
_: 1
|
|
1330
|
+
}, 512));
|
|
1331
|
+
}
|
|
1332
|
+
}, co = { class: "flex gap-[4px] p-1" }, uo = ["title", "onClick"], fo = {
|
|
1333
|
+
__name: "vs-editor-align",
|
|
1334
|
+
props: { editor: Object },
|
|
1335
|
+
setup(t) {
|
|
1336
|
+
const e = t, l = {
|
|
1337
|
+
left: Lt,
|
|
1338
|
+
center: Tt,
|
|
1339
|
+
right: St,
|
|
1340
|
+
justify: Ft
|
|
1341
|
+
}, s = $(!1), a = $("popover"), o = $("left"), n = P(() => e.editor ? e.editor.isActive("paragraph", { textAlign: "left" }) || e.editor.isActive("heading", { textAlign: "left" }) : !1), c = P(() => e.editor ? e.editor.isActive("paragraph", { textAlign: "right" }) || e.editor.isActive("heading", { textAlign: "right" }) : !1), r = P(() => e.editor ? e.editor.isActive("paragraph", { textAlign: "center" }) || e.editor.isActive("heading", { textAlign: "center" }) : !1), i = P(() => e.editor ? e.editor.isActive("paragraph", { textAlign: "justify" }) || e.editor.isActive("heading", { textAlign: "justify" }) : !1), y = P(() => n.value || c.value || r.value || i.value), p = () => {
|
|
1342
|
+
c.value ? o.value = "right" : r.value ? o.value = "center" : i.value ? o.value = "justify" : o.value = "left";
|
|
1343
|
+
};
|
|
1344
|
+
ue([n, c, r, i], () => {
|
|
1345
|
+
p();
|
|
1346
|
+
}, { immediate: !0 }), fe(() => {
|
|
1347
|
+
e.editor && (e.editor.on("selectionUpdate", p), e.editor.on("update", p));
|
|
1348
|
+
}), ke(() => {
|
|
1349
|
+
e.editor && (e.editor.off("selectionUpdate", p), e.editor.off("update", p));
|
|
1350
|
+
});
|
|
1351
|
+
const h = (S) => {
|
|
1352
|
+
e.editor && (e.editor.chain().focus().setTextAlign(S).run(), o.value = S);
|
|
1353
|
+
}, b = $([
|
|
1354
|
+
{ id: "left", isActive: n },
|
|
1355
|
+
{ id: "center", isActive: r },
|
|
1356
|
+
{ id: "right", isActive: c },
|
|
1357
|
+
{ id: "justify", isActive: i }
|
|
1358
|
+
]);
|
|
1359
|
+
return (S, j) => (g(), K(ce, {
|
|
1360
|
+
ref_key: "popover",
|
|
1361
|
+
ref: a,
|
|
1362
|
+
placement: "bottom",
|
|
1363
|
+
onIsvisible: j[0] || (j[0] = (H) => s.value = H)
|
|
1364
|
+
}, {
|
|
1365
|
+
reference: V(() => [
|
|
1366
|
+
d("button", {
|
|
1367
|
+
title: "Text Align",
|
|
1368
|
+
class: T(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100", [y.value ? "bg-gray-100 text-gray-900" : "text-gray-500"]])
|
|
1369
|
+
}, [
|
|
1370
|
+
(g(), K(Fe(l[o.value]), {
|
|
1371
|
+
height: "16",
|
|
1372
|
+
width: "16"
|
|
1373
|
+
}))
|
|
1374
|
+
], 2)
|
|
1375
|
+
]),
|
|
1376
|
+
default: V(() => [
|
|
1377
|
+
d("div", co, [
|
|
1378
|
+
(g(!0), w(re, null, le(b.value, (H) => (g(), w("button", {
|
|
1379
|
+
title: "Text align " + H?.id,
|
|
1380
|
+
class: T(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": H?.isActive }]),
|
|
1381
|
+
key: H?.id,
|
|
1382
|
+
onClick: (N) => h(H?.id)
|
|
1383
|
+
}, [
|
|
1384
|
+
(g(), K(Fe(l[H?.id]), {
|
|
1385
|
+
height: "16",
|
|
1386
|
+
width: "16"
|
|
1387
|
+
}))
|
|
1388
|
+
], 10, uo))), 128))
|
|
1389
|
+
])
|
|
1390
|
+
]),
|
|
1391
|
+
_: 1
|
|
1392
|
+
}, 512));
|
|
1393
|
+
}
|
|
1394
|
+
}, po = { class: "flex flex-col gap-[2px] p-[2px]" }, go = ["onClick"], ho = {
|
|
1395
|
+
__name: "vs-editor-type-tag",
|
|
1396
|
+
props: { editor: Object },
|
|
1397
|
+
setup(t) {
|
|
1398
|
+
const { t: e } = _e(), l = t, s = $(!1), a = $("popover"), o = () => {
|
|
1399
|
+
l.editor && (l.editor?.chain().focus().setParagraph().run(), a.value.togglePopover());
|
|
1400
|
+
}, n = (r) => {
|
|
1401
|
+
l.editor && (l.editor?.chain().focus().toggleHeading({ level: r }).run(), a.value.togglePopover());
|
|
1402
|
+
}, c = P(() => [
|
|
1403
|
+
{ text: e("form.richtext.heading1"), id: 1, style: "font-[700] text-[30px]" },
|
|
1404
|
+
{ text: e("form.richtext.heading2"), id: 2, style: "font-[700] text-[26px]" },
|
|
1405
|
+
{ text: e("form.richtext.heading3"), id: 3, style: "font-[700] text-[22px]" },
|
|
1406
|
+
{ text: e("form.richtext.heading4"), id: 4, style: "font-[700] text-[18px]" },
|
|
1407
|
+
{ text: e("form.richtext.heading5"), id: 5, style: "font-[500] text-[16px]" },
|
|
1408
|
+
{ text: e("form.richtext.heading6"), id: 6, style: "font-[400] text-[14px]" }
|
|
1409
|
+
]);
|
|
1410
|
+
return (r, i) => (g(), K(ce, {
|
|
1411
|
+
ref_key: "popover",
|
|
1412
|
+
ref: a,
|
|
1413
|
+
placement: "bottom",
|
|
1414
|
+
onIsvisible: i[0] || (i[0] = (y) => s.value = y)
|
|
1415
|
+
}, {
|
|
1416
|
+
reference: V(() => [
|
|
1417
|
+
d("button", {
|
|
1418
|
+
title: "Type Tag",
|
|
1419
|
+
class: T(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100", [s.value ? "bg-gray-100 text-gray-900" : "text-gray-500"]])
|
|
1420
|
+
}, [
|
|
1421
|
+
C(k(Bt), { class: "h-4 w-4" })
|
|
1422
|
+
], 2)
|
|
1423
|
+
]),
|
|
1424
|
+
default: V(() => [
|
|
1425
|
+
d("div", po, [
|
|
1426
|
+
d("button", {
|
|
1427
|
+
onClick: o,
|
|
1428
|
+
class: T(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded", [t.editor?.isActive("paragraph") ? "bg-gray-100" : ""]])
|
|
1429
|
+
}, W(k(e)("form.richtext.paragraph")), 3),
|
|
1430
|
+
(g(!0), w(re, null, le(c.value, (y, p) => (g(), w("button", {
|
|
1431
|
+
key: p,
|
|
1432
|
+
onClick: (h) => n(y?.id),
|
|
1433
|
+
class: T(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]", [
|
|
1434
|
+
y?.style,
|
|
1435
|
+
t.editor?.isActive("heading", { level: y?.id }) ? "bg-gray-100" : ""
|
|
1436
|
+
]])
|
|
1437
|
+
}, W(k(e)(`form.richtext.heading${y?.id}`)), 11, go))), 128))
|
|
1438
|
+
])
|
|
1439
|
+
]),
|
|
1440
|
+
_: 1
|
|
1441
|
+
}, 512));
|
|
1442
|
+
}
|
|
1443
|
+
}, vo = {
|
|
1444
|
+
components: { VsText: Qe },
|
|
1445
|
+
inheritAttrs: !1,
|
|
1446
|
+
events: ["update:modelValue"],
|
|
1447
|
+
props: {
|
|
1448
|
+
modelValue: { type: String },
|
|
1449
|
+
disabled: { type: Boolean, default: () => !1 },
|
|
1450
|
+
clearable: { type: Boolean, default: () => !1 },
|
|
1451
|
+
isTextInputShown: { type: Boolean, default: () => !0 }
|
|
1452
|
+
},
|
|
1453
|
+
computed: {
|
|
1454
|
+
value: {
|
|
1455
|
+
get() {
|
|
1456
|
+
return this.modelValue ?? "";
|
|
1457
|
+
},
|
|
1458
|
+
set(t) {
|
|
1459
|
+
this.$emit("update:modelValue", t);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
}, mo = { class: "flex items-center w-full max-w-[182px]" }, bo = ["disabled"];
|
|
1464
|
+
function yo(t, e, l, s, a, o) {
|
|
1465
|
+
const n = G("vs-text");
|
|
1466
|
+
return g(), w("div", mo, [
|
|
1467
|
+
ie(d("input", {
|
|
1468
|
+
"onUpdate:modelValue": e[0] || (e[0] = (c) => o.value = c),
|
|
1469
|
+
type: "color",
|
|
1470
|
+
class: T(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg", l.disabled ? "cursor-not-allowed" : "cursor-pointer"]),
|
|
1471
|
+
disabled: l.disabled
|
|
1472
|
+
}, null, 10, bo), [
|
|
1473
|
+
[st, o.value]
|
|
1474
|
+
]),
|
|
1475
|
+
l.isTextInputShown ? (g(), K(n, {
|
|
1476
|
+
key: 0,
|
|
1477
|
+
modelValue: o.value,
|
|
1478
|
+
"onUpdate:modelValue": e[1] || (e[1] = (c) => o.value = c),
|
|
1479
|
+
class: "ml-2 w-full",
|
|
1480
|
+
disabled: l.disabled,
|
|
1481
|
+
clearable: l.clearable
|
|
1482
|
+
}, null, 8, ["modelValue", "disabled", "clearable"])) : R("", !0)
|
|
1483
|
+
]);
|
|
1484
|
+
}
|
|
1485
|
+
const Ze = /* @__PURE__ */ X(vo, [["render", yo]]), xo = { class: "flex gap-[4px] mb-[8px]" }, wo = { class: "grid grid-rows-3 grid-cols-7" }, ko = { class: "w-full h-full rounded border border-gray-300 overflow-hidden" }, _o = ["onClick", "title"], $o = {
|
|
1486
|
+
__name: "vs-editor-color",
|
|
1487
|
+
props: {
|
|
1488
|
+
editor: Object
|
|
1489
|
+
},
|
|
1490
|
+
setup(t) {
|
|
1491
|
+
const e = t, l = $(null), s = $("#000000"), a = P(() => e.editor && e.editor.getAttributes("textStyle").color || "#000000"), o = P(() => a.value !== "#000000"), n = () => {
|
|
1492
|
+
e.editor && (s.value = a.value);
|
|
1493
|
+
};
|
|
1494
|
+
fe(() => {
|
|
1495
|
+
e.editor && (e.editor.on("selectionUpdate", n), e.editor.on("update", n), n());
|
|
1496
|
+
}), ke(() => {
|
|
1497
|
+
e.editor && (e.editor.off("selectionUpdate", n), e.editor.off("update", n));
|
|
1498
|
+
});
|
|
1499
|
+
const c = $([
|
|
1500
|
+
"#172B4D",
|
|
1501
|
+
"#0747A6",
|
|
1502
|
+
"#008DA6",
|
|
1503
|
+
"#006644",
|
|
1504
|
+
"#FF991F",
|
|
1505
|
+
"#BF2600",
|
|
1506
|
+
"#403294",
|
|
1507
|
+
"#97A0AF",
|
|
1508
|
+
"#4C9AFF",
|
|
1509
|
+
"#00B8D9",
|
|
1510
|
+
"#36B37E",
|
|
1511
|
+
"#FFC400",
|
|
1512
|
+
"#FF5630",
|
|
1513
|
+
"#6554C0",
|
|
1514
|
+
"#FFFFFF",
|
|
1515
|
+
"#B3D4FF",
|
|
1516
|
+
"#B3F5FF",
|
|
1517
|
+
"#ABF5D1",
|
|
1518
|
+
"#FFF0B3",
|
|
1519
|
+
"#FFBDAD",
|
|
1520
|
+
"#EAE6FF"
|
|
1521
|
+
]), r = (p) => {
|
|
1522
|
+
e.editor && (e.editor.chain().focus().setColor(p).run(), s.value = p, l.value && l.value.togglePopover());
|
|
1523
|
+
}, i = () => {
|
|
1524
|
+
r(s.value);
|
|
1525
|
+
}, y = (p) => ({
|
|
1526
|
+
"#172B4D": "Default",
|
|
1527
|
+
"#0747A6": "Bright blue",
|
|
1528
|
+
"#008DA6": "Bright blue-green",
|
|
1529
|
+
"#006644": "Bright green",
|
|
1530
|
+
"#FF991F": "Bright orange",
|
|
1531
|
+
"#BF2600": "Bright red",
|
|
1532
|
+
"#403294": "Bright purple",
|
|
1533
|
+
"#97A0AF": "Gray",
|
|
1534
|
+
"#4C9AFF": "Blue",
|
|
1535
|
+
"#00B8D9": "Blue-green",
|
|
1536
|
+
"#36B37E": "Green",
|
|
1537
|
+
"#FFC400": "Yellow",
|
|
1538
|
+
"#FF5630": "Red",
|
|
1539
|
+
"#6554C0": "Purple",
|
|
1540
|
+
"#FFFFFF": "White",
|
|
1541
|
+
"#B3D4FF": "Bright blue",
|
|
1542
|
+
"#B3F5FF": "Bright blue-green",
|
|
1543
|
+
"#ABF5D1": "Bright green",
|
|
1544
|
+
"#FFF0B3": "Bright yellow",
|
|
1545
|
+
"#FFBDAD": "Bright red",
|
|
1546
|
+
"#EAE6FF": "Bright purple"
|
|
1547
|
+
})[p] || p;
|
|
1548
|
+
return (p, h) => (g(), K(ce, {
|
|
1549
|
+
ref_key: "popover",
|
|
1550
|
+
ref: l,
|
|
1551
|
+
placement: "bottom"
|
|
1552
|
+
}, {
|
|
1553
|
+
reference: V(() => [
|
|
1554
|
+
d("button", {
|
|
1555
|
+
title: "Text Color",
|
|
1556
|
+
class: T(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex", { "bg-gray-100": o.value }])
|
|
1557
|
+
}, [
|
|
1558
|
+
h[1] || (h[1] = d("span", { class: "leading-none" }, "A", -1)),
|
|
1559
|
+
d("span", {
|
|
1560
|
+
class: "block h-1 w-5",
|
|
1561
|
+
style: ae({ backgroundColor: s.value })
|
|
1562
|
+
}, null, 4)
|
|
1563
|
+
], 2)
|
|
1564
|
+
]),
|
|
1565
|
+
default: V(() => [
|
|
1566
|
+
d("div", null, [
|
|
1567
|
+
d("div", xo, [
|
|
1568
|
+
C(Ze, {
|
|
1569
|
+
modelValue: s.value,
|
|
1570
|
+
"onUpdate:modelValue": h[0] || (h[0] = (b) => s.value = b)
|
|
1571
|
+
}, null, 8, ["modelValue"]),
|
|
1572
|
+
d("button", {
|
|
1573
|
+
onClick: i,
|
|
1574
|
+
class: "h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"
|
|
1575
|
+
}, [
|
|
1576
|
+
C(k(ve), { class: "h-4 w-4 text-white" })
|
|
1577
|
+
])
|
|
1578
|
+
]),
|
|
1579
|
+
d("div", wo, [
|
|
1580
|
+
(g(!0), w(re, null, le(c.value, (b) => (g(), w("div", {
|
|
1581
|
+
key: b,
|
|
1582
|
+
class: "h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"
|
|
1583
|
+
}, [
|
|
1584
|
+
d("div", ko, [
|
|
1585
|
+
d("button", {
|
|
1586
|
+
class: "flex items-center justify-center w-full h-full",
|
|
1587
|
+
style: ae({ backgroundColor: b }),
|
|
1588
|
+
onClick: (S) => r(b),
|
|
1589
|
+
title: y(b)
|
|
1590
|
+
}, [
|
|
1591
|
+
s.value === b ? (g(), K(k(ve), {
|
|
1592
|
+
key: 0,
|
|
1593
|
+
class: "h-4 w-4 text-gray-500"
|
|
1594
|
+
})) : R("", !0)
|
|
1595
|
+
], 12, _o)
|
|
1596
|
+
])
|
|
1597
|
+
]))), 128))
|
|
1598
|
+
])
|
|
1599
|
+
])
|
|
1600
|
+
]),
|
|
1601
|
+
_: 1
|
|
1602
|
+
}, 512));
|
|
1603
|
+
}
|
|
1604
|
+
}, Co = { class: "flex gap-[4px] mb-[8px]" }, Ao = { class: "grid grid-rows-3 grid-cols-7" }, Fo = { class: "w-full h-full rounded border border-gray-300 overflow-hidden" }, So = ["onClick", "title"], To = ["onClick", "title"], Lo = {
|
|
1605
|
+
__name: "vs-editor-background-color",
|
|
1606
|
+
props: {
|
|
1607
|
+
editor: Object
|
|
1608
|
+
},
|
|
1609
|
+
setup(t) {
|
|
1610
|
+
const e = t, l = $(null), s = $("transparent"), a = P(() => e.editor && e.editor.getAttributes("textStyle").backgroundColor || "transparent"), o = P(() => a.value !== "transparent" && a.value !== ""), n = () => {
|
|
1611
|
+
e.editor && (s.value = a.value);
|
|
1612
|
+
};
|
|
1613
|
+
fe(() => {
|
|
1614
|
+
e.editor && (e.editor.on("selectionUpdate", n), e.editor.on("update", n), n());
|
|
1615
|
+
}), ke(() => {
|
|
1616
|
+
e.editor && (e.editor.off("selectionUpdate", n), e.editor.off("update", n));
|
|
1617
|
+
});
|
|
1618
|
+
const c = $([
|
|
1619
|
+
"#172B4D",
|
|
1620
|
+
"#0747A6",
|
|
1621
|
+
"#008DA6",
|
|
1622
|
+
"#006644",
|
|
1623
|
+
"#FF991F",
|
|
1624
|
+
"#BF2600",
|
|
1625
|
+
"#403294",
|
|
1626
|
+
"#97A0AF",
|
|
1627
|
+
"#4C9AFF",
|
|
1628
|
+
"#00B8D9",
|
|
1629
|
+
"#36B37E",
|
|
1630
|
+
"#FFC400",
|
|
1631
|
+
"#FF5630",
|
|
1632
|
+
"#6554C0",
|
|
1633
|
+
"#FFFFFF",
|
|
1634
|
+
"#B3D4FF",
|
|
1635
|
+
"#B3F5FF",
|
|
1636
|
+
"#ABF5D1",
|
|
1637
|
+
"#FFF0B3",
|
|
1638
|
+
"#FFBDAD",
|
|
1639
|
+
"#EAE6FF"
|
|
1640
|
+
]), r = (p) => {
|
|
1641
|
+
e.editor && (e.editor.chain().focus().setBackgroundColor(p).run(), s.value = p, l.value && l.value.togglePopover());
|
|
1642
|
+
}, i = () => {
|
|
1643
|
+
r(s.value);
|
|
1644
|
+
}, y = (p) => ({
|
|
1645
|
+
"#172B4D": "Default",
|
|
1646
|
+
"#0747A6": "Bright blue",
|
|
1647
|
+
"#008DA6": "Bright blue-green",
|
|
1648
|
+
"#006644": "Bright green",
|
|
1649
|
+
"#FF991F": "Bright orange",
|
|
1650
|
+
"#BF2600": "Bright red",
|
|
1651
|
+
"#403294": "Bright purple",
|
|
1652
|
+
"#97A0AF": "Gray",
|
|
1653
|
+
"#4C9AFF": "Blue",
|
|
1654
|
+
"#00B8D9": "Blue-green",
|
|
1655
|
+
"#36B37E": "Green",
|
|
1656
|
+
"#FFC400": "Yellow",
|
|
1657
|
+
"#FF5630": "Red",
|
|
1658
|
+
"#6554C0": "Purple",
|
|
1659
|
+
transparent: "Transparent",
|
|
1660
|
+
"#B3D4FF": "Bright blue",
|
|
1661
|
+
"#B3F5FF": "Bright blue-green",
|
|
1662
|
+
"#ABF5D1": "Bright green",
|
|
1663
|
+
"#FFF0B3": "Bright yellow",
|
|
1664
|
+
"#FFBDAD": "Bright red",
|
|
1665
|
+
"#EAE6FF": "Bright purple"
|
|
1666
|
+
})[p] || p;
|
|
1667
|
+
return (p, h) => (g(), K(ce, {
|
|
1668
|
+
ref_key: "popover",
|
|
1669
|
+
ref: l,
|
|
1670
|
+
placement: "bottom"
|
|
1671
|
+
}, {
|
|
1672
|
+
reference: V(() => [
|
|
1673
|
+
d("button", {
|
|
1674
|
+
title: "Background Color",
|
|
1675
|
+
class: T(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex", { "bg-gray-100": o.value }])
|
|
1676
|
+
}, [
|
|
1677
|
+
C(k(Et), { class: "h-4 w-4" }),
|
|
1678
|
+
d("span", {
|
|
1679
|
+
class: "block h-1 w-5",
|
|
1680
|
+
style: ae({ backgroundColor: s.value })
|
|
1681
|
+
}, null, 4)
|
|
1682
|
+
], 2)
|
|
1683
|
+
]),
|
|
1684
|
+
default: V(() => [
|
|
1685
|
+
d("div", null, [
|
|
1686
|
+
d("div", Co, [
|
|
1687
|
+
C(Ze, {
|
|
1688
|
+
modelValue: s.value,
|
|
1689
|
+
"onUpdate:modelValue": h[0] || (h[0] = (b) => s.value = b)
|
|
1690
|
+
}, null, 8, ["modelValue"]),
|
|
1691
|
+
d("button", {
|
|
1692
|
+
onClick: i,
|
|
1693
|
+
class: "h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"
|
|
1694
|
+
}, [
|
|
1695
|
+
C(k(ve), { class: "h-4 w-4 text-white" })
|
|
1696
|
+
])
|
|
1697
|
+
]),
|
|
1698
|
+
d("div", Ao, [
|
|
1699
|
+
d("button", {
|
|
1700
|
+
onClick: h[1] || (h[1] = (b) => r("transparent")),
|
|
1701
|
+
class: "col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"
|
|
1702
|
+
}, [
|
|
1703
|
+
C(k(It), { class: "h-4 w-4" }),
|
|
1704
|
+
h[2] || (h[2] = d("p", null, "no color", -1))
|
|
1705
|
+
]),
|
|
1706
|
+
(g(!0), w(re, null, le(c.value, (b) => (g(), w("div", {
|
|
1707
|
+
key: b,
|
|
1708
|
+
class: "h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"
|
|
1709
|
+
}, [
|
|
1710
|
+
d("div", Fo, [
|
|
1711
|
+
b !== "transparent" ? (g(), w("button", {
|
|
1712
|
+
key: 0,
|
|
1713
|
+
class: "flex items-center justify-center w-full h-full",
|
|
1714
|
+
style: ae({ backgroundColor: b }),
|
|
1715
|
+
onClick: (S) => r(b),
|
|
1716
|
+
title: y(b)
|
|
1717
|
+
}, [
|
|
1718
|
+
s.value === b ? (g(), K(k(ve), {
|
|
1719
|
+
key: 0,
|
|
1720
|
+
class: "h-4 w-4 text-gray-500"
|
|
1721
|
+
})) : R("", !0)
|
|
1722
|
+
], 12, So)) : R("", !0),
|
|
1723
|
+
b === "transparent" ? (g(), w("button", {
|
|
1724
|
+
key: 1,
|
|
1725
|
+
class: "flex items-center justify-center w-full h-full",
|
|
1726
|
+
onClick: (S) => r(b),
|
|
1727
|
+
title: y(b)
|
|
1728
|
+
}, [
|
|
1729
|
+
s.value === b ? (g(), K(k(ve), {
|
|
1730
|
+
key: 0,
|
|
1731
|
+
class: "h-4 w-4 text-gray-500"
|
|
1732
|
+
})) : R("", !0)
|
|
1733
|
+
], 8, To)) : R("", !0)
|
|
1734
|
+
])
|
|
1735
|
+
]))), 128))
|
|
1736
|
+
])
|
|
1737
|
+
])
|
|
1738
|
+
]),
|
|
1739
|
+
_: 1
|
|
1740
|
+
}, 512));
|
|
1741
|
+
}
|
|
1742
|
+
}, Bo = {
|
|
1743
|
+
__name: "vs-editor-highlight",
|
|
1744
|
+
props: {
|
|
1745
|
+
editor: Object
|
|
1746
|
+
},
|
|
1747
|
+
setup(t) {
|
|
1748
|
+
const e = t, l = P(() => e.editor?.isActive("highlight")), s = () => {
|
|
1749
|
+
e.editor && e.editor.chain().focus().toggleHighlight().run();
|
|
1750
|
+
};
|
|
1751
|
+
return (a, o) => (g(), w("button", {
|
|
1752
|
+
title: "Highlight",
|
|
1753
|
+
onClick: s,
|
|
1754
|
+
class: T(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex", { "bg-gray-200": l.value }])
|
|
1755
|
+
}, [
|
|
1756
|
+
C(k(jt), { class: "h-4 w-4" })
|
|
1757
|
+
], 2));
|
|
1758
|
+
}
|
|
1759
|
+
}, Io = { class: "truncate" }, Eo = { class: "w-[200px]" }, jo = { class: "max-h-[200px] overflow-y-auto" }, Po = ["onClick"], Mo = {
|
|
1760
|
+
__name: "vs-editor-font-family",
|
|
1761
|
+
props: {
|
|
1762
|
+
editor: Object
|
|
1763
|
+
},
|
|
1764
|
+
setup(t) {
|
|
1765
|
+
const e = t, l = $("popover"), s = $(!1), a = $([
|
|
1766
|
+
{ label: "Arial", value: "Arial, sans-serif" },
|
|
1767
|
+
{ label: "Helvetica", value: "Helvetica, sans-serif" },
|
|
1768
|
+
{ label: "Times New Roman", value: "Times New Roman, serif" },
|
|
1769
|
+
{ label: "Georgia", value: "Georgia, serif" },
|
|
1770
|
+
{ label: "Verdana", value: "Verdana, sans-serif" },
|
|
1771
|
+
{ label: "Courier New", value: "Courier New, monospace" },
|
|
1772
|
+
{ label: "Comic Sans MS", value: "Comic Sans MS, cursive" },
|
|
1773
|
+
{ label: "Impact", value: "Impact, sans-serif" },
|
|
1774
|
+
{ label: "Trebuchet MS", value: "Trebuchet MS, sans-serif" },
|
|
1775
|
+
{ label: "Palatino", value: "Palatino, serif" }
|
|
1776
|
+
]), o = P(() => {
|
|
1777
|
+
if (!e.editor) return "Arial, sans-serif";
|
|
1778
|
+
for (const i of a.value)
|
|
1779
|
+
if (e.editor.isActive("textStyle", { fontFamily: i.value }))
|
|
1780
|
+
return i.value;
|
|
1781
|
+
return "Arial, sans-serif";
|
|
1782
|
+
}), n = P(() => a.value.find((y) => y.value === o.value)?.label || "Arial"), c = (i) => e.editor ? e.editor.isActive("textStyle", { fontFamily: i }) : !1, r = (i) => {
|
|
1783
|
+
e.editor && (e.editor.chain().focus().setFontFamily(i).run(), l.value && l.value.togglePopover());
|
|
1784
|
+
};
|
|
1785
|
+
return (i, y) => (g(), K(ce, {
|
|
1786
|
+
ref_key: "popover",
|
|
1787
|
+
ref: l,
|
|
1788
|
+
placement: "bottom",
|
|
1789
|
+
onIsvisible: y[0] || (y[0] = (p) => s.value = p)
|
|
1790
|
+
}, {
|
|
1791
|
+
reference: V(() => [
|
|
1792
|
+
d("button", {
|
|
1793
|
+
title: "Font Family",
|
|
1794
|
+
class: T(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm", [s.value ? "bg-gray-100 text-gray-900" : "text-gray-700"]]),
|
|
1795
|
+
style: ae({ fontFamily: o.value })
|
|
1796
|
+
}, [
|
|
1797
|
+
d("span", Io, W(n.value), 1),
|
|
1798
|
+
C(k(Le), { class: "ml-1 h-3 w-3 text-gray-400" })
|
|
1799
|
+
], 6)
|
|
1800
|
+
]),
|
|
1801
|
+
default: V(() => [
|
|
1802
|
+
d("div", Eo, [
|
|
1803
|
+
d("ul", jo, [
|
|
1804
|
+
(g(!0), w(re, null, le(a.value, (p) => (g(), w("li", {
|
|
1805
|
+
key: p.value,
|
|
1806
|
+
class: T(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm", { "bg-gray-100": c(p.value) }]),
|
|
1807
|
+
style: ae({ fontFamily: p.value }),
|
|
1808
|
+
onClick: (h) => r(p.value)
|
|
1809
|
+
}, W(p.label), 15, Po))), 128))
|
|
1810
|
+
])
|
|
1811
|
+
])
|
|
1812
|
+
]),
|
|
1813
|
+
_: 1
|
|
1814
|
+
}, 512));
|
|
1815
|
+
}
|
|
1816
|
+
}, Ho = { class: "w-[120px]" }, zo = { class: "max-h-[200px] overflow-y-auto" }, No = ["onClick"], Vo = {
|
|
1817
|
+
__name: "vs-editor-font-size",
|
|
1818
|
+
props: {
|
|
1819
|
+
editor: Object
|
|
1820
|
+
},
|
|
1821
|
+
setup(t) {
|
|
1822
|
+
const e = t, l = $("popover"), s = $("14px"), a = P(() => e.editor && e.editor.getAttributes("textStyle").fontSize || "14px"), o = P(() => a.value !== "14px"), n = () => {
|
|
1823
|
+
e.editor && (s.value = a.value);
|
|
1824
|
+
};
|
|
1825
|
+
fe(() => {
|
|
1826
|
+
e.editor && (e.editor.on("selectionUpdate", n), e.editor.on("update", n), n());
|
|
1827
|
+
}), ke(() => {
|
|
1828
|
+
e.editor && (e.editor.off("selectionUpdate", n), e.editor.off("update", n));
|
|
1829
|
+
});
|
|
1830
|
+
const c = $([
|
|
1831
|
+
{ label: "8px", value: "8px" },
|
|
1832
|
+
{ label: "9px", value: "9px" },
|
|
1833
|
+
{ label: "10px", value: "10px" },
|
|
1834
|
+
{ label: "11px", value: "11px" },
|
|
1835
|
+
{ label: "12px", value: "12px" },
|
|
1836
|
+
{ label: "14px", value: "14px" },
|
|
1837
|
+
{ label: "16px", value: "16px" },
|
|
1838
|
+
{ label: "18px", value: "18px" },
|
|
1839
|
+
{ label: "20px", value: "20px" },
|
|
1840
|
+
{ label: "24px", value: "24px" },
|
|
1841
|
+
{ label: "28px", value: "28px" },
|
|
1842
|
+
{ label: "32px", value: "32px" },
|
|
1843
|
+
{ label: "36px", value: "36px" },
|
|
1844
|
+
{ label: "48px", value: "48px" },
|
|
1845
|
+
{ label: "72px", value: "72px" }
|
|
1846
|
+
]), r = (i) => {
|
|
1847
|
+
e.editor && (e.editor.chain().focus().setFontSize(i).run(), s.value = i, l.value && l.value.togglePopover());
|
|
1848
|
+
};
|
|
1849
|
+
return (i, y) => (g(), K(ce, {
|
|
1850
|
+
ref_key: "popover",
|
|
1851
|
+
ref: l,
|
|
1852
|
+
placement: "bottom"
|
|
1853
|
+
}, {
|
|
1854
|
+
reference: V(() => [
|
|
1855
|
+
d("button", {
|
|
1856
|
+
title: "Font Size",
|
|
1857
|
+
class: T(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1", { "bg-gray-100 text-gray-900": o.value }])
|
|
1858
|
+
}, [
|
|
1859
|
+
C(k(Pt), { class: "h-4 w-4" }),
|
|
1860
|
+
C(k(Le), { class: "h-3 w-3 text-gray-400" })
|
|
1861
|
+
], 2)
|
|
1862
|
+
]),
|
|
1863
|
+
default: V(() => [
|
|
1864
|
+
d("div", Ho, [
|
|
1865
|
+
d("ul", zo, [
|
|
1866
|
+
(g(!0), w(re, null, le(c.value, (p) => (g(), w("li", {
|
|
1867
|
+
key: p.value,
|
|
1868
|
+
class: "px-3 py-2 hover:bg-gray-100 cursor-pointer",
|
|
1869
|
+
onClick: (h) => r(p.value)
|
|
1870
|
+
}, W(p.label), 9, No))), 128))
|
|
1871
|
+
])
|
|
1872
|
+
])
|
|
1873
|
+
]),
|
|
1874
|
+
_: 1
|
|
1875
|
+
}, 512));
|
|
1876
|
+
}
|
|
1877
|
+
}, Do = {
|
|
1878
|
+
components: { Superscript: Mt },
|
|
1879
|
+
props: {
|
|
1880
|
+
editor: Object
|
|
1881
|
+
},
|
|
1882
|
+
methods: {
|
|
1883
|
+
toggleSuperscript() {
|
|
1884
|
+
this.editor && this.editor.commands.toggleSuperscript();
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
};
|
|
1888
|
+
function Oo(t, e, l, s, a, o) {
|
|
1889
|
+
const n = G("Superscript");
|
|
1890
|
+
return g(), w("button", {
|
|
1891
|
+
title: "Superscript",
|
|
1892
|
+
onClick: e[0] || (e[0] = (...c) => o.toggleSuperscript && o.toggleSuperscript(...c)),
|
|
1893
|
+
class: T(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": l.editor?.isActive("superscript") }])
|
|
1894
|
+
}, [
|
|
1895
|
+
C(n, { class: "h-4 w-4" }),
|
|
1896
|
+
e[1] || (e[1] = d("span", { class: "sr-only" }, "Superscript", -1))
|
|
1897
|
+
], 2);
|
|
1898
|
+
}
|
|
1899
|
+
const Ro = /* @__PURE__ */ X(Do, [["render", Oo]]), Uo = {
|
|
1900
|
+
components: { Subscript: Ht },
|
|
1901
|
+
props: {
|
|
1902
|
+
editor: Object
|
|
1903
|
+
},
|
|
1904
|
+
methods: {
|
|
1905
|
+
toggleSubscript() {
|
|
1906
|
+
this.editor && this.editor.commands.toggleSubscript();
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
function qo(t, e, l, s, a, o) {
|
|
1911
|
+
const n = G("Subscript");
|
|
1912
|
+
return g(), w("button", {
|
|
1913
|
+
title: "Subscript",
|
|
1914
|
+
onClick: e[0] || (e[0] = (...c) => o.toggleSubscript && o.toggleSubscript(...c)),
|
|
1915
|
+
class: T(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": l.editor?.isActive("subscript") }])
|
|
1916
|
+
}, [
|
|
1917
|
+
C(n, { class: "h-4 w-4" }),
|
|
1918
|
+
e[1] || (e[1] = d("span", { class: "sr-only" }, "Subscript", -1))
|
|
1919
|
+
], 2);
|
|
1920
|
+
}
|
|
1921
|
+
const Ko = /* @__PURE__ */ X(Uo, [["render", qo]]), Wo = {
|
|
1922
|
+
title: "Heading",
|
|
1923
|
+
class: "h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"
|
|
1924
|
+
}, Xo = { class: "truncate" }, Go = { class: "max-h-[200px] overflow-y-auto" }, Yo = ["onClick"], Qo = {
|
|
1925
|
+
__name: "vs-editor-heading",
|
|
1926
|
+
props: {
|
|
1927
|
+
editor: Object
|
|
1928
|
+
},
|
|
1929
|
+
setup(t) {
|
|
1930
|
+
const e = t, l = $("popover"), s = $([
|
|
1931
|
+
{ label: "Heading 1", value: 1 },
|
|
1932
|
+
{ label: "Heading 2", value: 2 },
|
|
1933
|
+
{ label: "Heading 3", value: 3 },
|
|
1934
|
+
{ label: "Heading 4", value: 4 },
|
|
1935
|
+
{ label: "Heading 5", value: 5 },
|
|
1936
|
+
{ label: "Heading 6", value: 6 }
|
|
1937
|
+
]), a = P(() => {
|
|
1938
|
+
if (!e.editor) return "Paragraph";
|
|
1939
|
+
for (let r = 1; r <= 6; r++)
|
|
1940
|
+
if (e.editor.isActive("heading", { level: r }))
|
|
1941
|
+
return `H ${r}`;
|
|
1942
|
+
return "P";
|
|
1943
|
+
}), o = (r) => ({
|
|
1944
|
+
1: "font-weight:700; font-size:30px;",
|
|
1945
|
+
2: "font-weight:700; font-size:26px;",
|
|
1946
|
+
3: "font-weight:700; font-size:22px;",
|
|
1947
|
+
4: "font-weight:700; font-size:18px;",
|
|
1948
|
+
5: "font-weight:500; font-size:16px;",
|
|
1949
|
+
6: "font-weight:400; font-size:14px;"
|
|
1950
|
+
})[r] || "", n = (r) => {
|
|
1951
|
+
e.editor && (e.editor.chain().focus().setHeading({ level: r }).run(), l.value && l.value.togglePopover());
|
|
1952
|
+
}, c = () => {
|
|
1953
|
+
e.editor && (e.editor.chain().focus().setParagraph().run(), l.value && l.value.togglePopover());
|
|
1954
|
+
};
|
|
1955
|
+
return (r, i) => (g(), K(ce, {
|
|
1956
|
+
ref_key: "popover",
|
|
1957
|
+
ref: l,
|
|
1958
|
+
placement: "bottom"
|
|
1959
|
+
}, {
|
|
1960
|
+
reference: V(() => [
|
|
1961
|
+
d("button", Wo, [
|
|
1962
|
+
d("span", Xo, W(a.value), 1),
|
|
1963
|
+
C(k(Le), { class: "ml-1 h-3 w-3 text-gray-400" })
|
|
1964
|
+
])
|
|
1965
|
+
]),
|
|
1966
|
+
default: V(() => [
|
|
1967
|
+
d("div", null, [
|
|
1968
|
+
d("ul", Go, [
|
|
1969
|
+
(g(!0), w(re, null, le(s.value, (y) => (g(), w("li", {
|
|
1970
|
+
key: y.value,
|
|
1971
|
+
class: T(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm", `heading-level-${y.value}`]),
|
|
1972
|
+
style: ae(o(y.value)),
|
|
1973
|
+
onClick: (p) => n(y.value)
|
|
1974
|
+
}, W(y.label), 15, Yo))), 128)),
|
|
1975
|
+
d("li", {
|
|
1976
|
+
class: "px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",
|
|
1977
|
+
onClick: c
|
|
1978
|
+
}, " Paragraph ")
|
|
1979
|
+
])
|
|
1980
|
+
])
|
|
1981
|
+
]),
|
|
1982
|
+
_: 1
|
|
1983
|
+
}, 512));
|
|
1984
|
+
}
|
|
1985
|
+
}, Zo = /* @__PURE__ */ X(Qo, [["__scopeId", "data-v-46380488"]]), Jo = {
|
|
1986
|
+
components: { RemoveFormatting: zt },
|
|
1987
|
+
props: {
|
|
1988
|
+
editor: Object
|
|
1989
|
+
},
|
|
1990
|
+
methods: {
|
|
1991
|
+
clearFormatting() {
|
|
1992
|
+
this.editor && this.editor.commands.unsetAllMarks();
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
function el(t, e, l, s, a, o) {
|
|
1997
|
+
const n = G("RemoveFormatting");
|
|
1998
|
+
return g(), w("button", {
|
|
1999
|
+
title: "Clear Formatting",
|
|
2000
|
+
onClick: e[0] || (e[0] = (...c) => o.clearFormatting && o.clearFormatting(...c)),
|
|
2001
|
+
class: "h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"
|
|
2002
|
+
}, [
|
|
2003
|
+
C(n, { class: "h-4 w-4" }),
|
|
2004
|
+
e[1] || (e[1] = d("span", { class: "sr-only" }, "Clear Formatting", -1))
|
|
2005
|
+
]);
|
|
2006
|
+
}
|
|
2007
|
+
const tl = /* @__PURE__ */ X(Jo, [["render", el]]), rl = { class: "relative" }, ol = {
|
|
2008
|
+
key: 0,
|
|
2009
|
+
class: "mt-4"
|
|
2010
|
+
}, ll = ["src", "alt", "title"], al = {
|
|
2011
|
+
key: 0,
|
|
2012
|
+
class: "text-sm text-red-500"
|
|
2013
|
+
}, sl = {
|
|
2014
|
+
key: 1,
|
|
2015
|
+
class: "mt-4"
|
|
2016
|
+
}, nl = { class: "text-sm text-gray-600 mb-2" }, il = { class: "flex flex-wrap gap-2" }, cl = ["src", "alt", "onError"], dl = ["onClick"], ul = { class: "flex justify-end gap-x-2 p-[20px]" }, fl = /* @__PURE__ */ Object.assign({
|
|
2017
|
+
inheritAttrs: !1
|
|
2018
|
+
}, {
|
|
2019
|
+
__name: "vs-editor-image",
|
|
2020
|
+
props: {
|
|
2021
|
+
editor: {
|
|
2022
|
+
type: Object,
|
|
2023
|
+
required: !0
|
|
2024
|
+
}
|
|
2025
|
+
},
|
|
2026
|
+
setup(t) {
|
|
2027
|
+
const e = t, l = $(!1), s = $(!1), a = $({}), o = $(!1), n = $([]), c = $(null), r = $({
|
|
2028
|
+
src: "",
|
|
2029
|
+
file: [],
|
|
2030
|
+
// Завжди масив
|
|
2031
|
+
alt: "",
|
|
2032
|
+
title: "",
|
|
2033
|
+
width: "",
|
|
2034
|
+
height: "",
|
|
2035
|
+
link: "",
|
|
2036
|
+
openInNewTab: !1
|
|
2037
|
+
}), i = P(() => {
|
|
2038
|
+
if (Array.isArray(r.value.file)) {
|
|
2039
|
+
const f = r.value.file.filter((_) => _ instanceof File), m = r.value.file.filter((_) => typeof _ == "string" && _.trim() !== "");
|
|
2040
|
+
return f.length + m.length > 1;
|
|
2041
|
+
}
|
|
2042
|
+
return r.value.file instanceof FileList ? r.value.file.length > 1 : !1;
|
|
2043
|
+
}), y = P(() => Array.isArray(r.value.file) ? r.value.file.filter((f) => f instanceof File).length === 1 : r.value.file instanceof FileList ? r.value.file.length === 1 : r.value.file instanceof File), p = P(() => {
|
|
2044
|
+
if (i.value)
|
|
2045
|
+
return "";
|
|
2046
|
+
if (r.value.src)
|
|
2047
|
+
return r.value.src;
|
|
2048
|
+
if (y.value) {
|
|
2049
|
+
let f = null;
|
|
2050
|
+
if (Array.isArray(r.value.file) || r.value.file instanceof FileList ? f = r.value.file[0] : r.value.file instanceof File && (f = r.value.file), f instanceof File) {
|
|
2051
|
+
const m = n.value.find((u) => u.file === f);
|
|
2052
|
+
return m ? m.preview : "";
|
|
2053
|
+
} else if (typeof f == "string")
|
|
2054
|
+
return f;
|
|
2055
|
+
}
|
|
2056
|
+
return "";
|
|
2057
|
+
}), h = P(() => [
|
|
2058
|
+
{
|
|
2059
|
+
name: "src",
|
|
2060
|
+
label: "URL зображення",
|
|
2061
|
+
type: "text",
|
|
2062
|
+
required: !1,
|
|
2063
|
+
placeholder: "https://example.com/image.png"
|
|
2064
|
+
},
|
|
2065
|
+
{
|
|
2066
|
+
name: "file",
|
|
2067
|
+
label: "Файл (можна вибрати кілька)",
|
|
2068
|
+
type: "file",
|
|
2069
|
+
multiple: !0,
|
|
2070
|
+
required: !1,
|
|
2071
|
+
placeholder: "Шлях до файлу зображення",
|
|
2072
|
+
accept: "image/*"
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
name: "width",
|
|
2076
|
+
label: "Ширина",
|
|
2077
|
+
type: "number",
|
|
2078
|
+
required: !1,
|
|
2079
|
+
placeholder: "Ширина зображення",
|
|
2080
|
+
clearable: !0,
|
|
2081
|
+
min: 0
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
name: "height",
|
|
2085
|
+
label: "Висота",
|
|
2086
|
+
type: "number",
|
|
2087
|
+
required: !1,
|
|
2088
|
+
placeholder: "Висота зображення",
|
|
2089
|
+
clearable: !0,
|
|
2090
|
+
min: 0
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
name: "alt",
|
|
2094
|
+
label: "Альтернативний текст",
|
|
2095
|
+
type: "text",
|
|
2096
|
+
required: !1,
|
|
2097
|
+
placeholder: "Опис зображення"
|
|
2098
|
+
},
|
|
2099
|
+
{
|
|
2100
|
+
name: "title",
|
|
2101
|
+
label: "Заголовок (необов'язково)",
|
|
2102
|
+
type: "text",
|
|
2103
|
+
required: !1,
|
|
2104
|
+
placeholder: "Заголовок зображення"
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
name: "link",
|
|
2108
|
+
label: "Посилання",
|
|
2109
|
+
type: "text",
|
|
2110
|
+
required: !1,
|
|
2111
|
+
placeholder: "https://example.com"
|
|
2112
|
+
},
|
|
2113
|
+
{
|
|
2114
|
+
name: "openInNewTab",
|
|
2115
|
+
label: "Відкривати у новій вкладці?",
|
|
2116
|
+
type: "switcher",
|
|
2117
|
+
required: !1
|
|
2118
|
+
}
|
|
2119
|
+
]), b = () => {
|
|
2120
|
+
if (!e.editor) return;
|
|
2121
|
+
if (e.editor.isActive("image")) {
|
|
2122
|
+
const { state: m } = e.editor, { selection: u } = m, { $from: _ } = u;
|
|
2123
|
+
let x = null, B = null;
|
|
2124
|
+
if (_.parent.type.name === "image")
|
|
2125
|
+
x = _.before(_.depth), B = _.parent;
|
|
2126
|
+
else
|
|
2127
|
+
for (let M = _.depth; M > 0; M--) {
|
|
2128
|
+
const Q = _.node(M), O = _.before(M);
|
|
2129
|
+
Q.type.name === "paragraph" && Q.forEach((de, $e) => {
|
|
2130
|
+
if (de.type.name === "image") {
|
|
2131
|
+
const je = O + $e + 1;
|
|
2132
|
+
(x === null || Math.abs(je - u.$from.pos) < Math.abs(x - u.$from.pos)) && (x = je, B = de);
|
|
2133
|
+
}
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
if (x !== null && B) {
|
|
2137
|
+
try {
|
|
2138
|
+
e.editor.chain().focus().setNodeSelection(x).run();
|
|
2139
|
+
} catch {
|
|
2140
|
+
e.editor.chain().focus().setTextSelection(x).run();
|
|
2141
|
+
}
|
|
2142
|
+
c.value = x;
|
|
2143
|
+
} else {
|
|
2144
|
+
e.editor.chain().focus().selectParentNode().run();
|
|
2145
|
+
const { state: M } = e.editor;
|
|
2146
|
+
c.value = M.selection.$from.pos;
|
|
2147
|
+
}
|
|
2148
|
+
const v = B ? B.attrs : e.editor.getAttributes("image");
|
|
2149
|
+
o.value = !0;
|
|
2150
|
+
let A = "", I = !1;
|
|
2151
|
+
const z = e.editor.getAttributes("link");
|
|
2152
|
+
z && z.href && (A = z.href, I = z.target === "_blank");
|
|
2153
|
+
const E = v.src || "", F = E ? [E] : [];
|
|
2154
|
+
r.value = {
|
|
2155
|
+
src: E,
|
|
2156
|
+
file: F,
|
|
2157
|
+
// Масив з поточним зображенням
|
|
2158
|
+
alt: v.alt || "",
|
|
2159
|
+
title: v.title || "",
|
|
2160
|
+
width: v.width || "",
|
|
2161
|
+
height: v.height || "",
|
|
2162
|
+
link: A,
|
|
2163
|
+
openInNewTab: I
|
|
2164
|
+
};
|
|
2165
|
+
} else
|
|
2166
|
+
o.value = !1, r.value = {
|
|
2167
|
+
src: "",
|
|
2168
|
+
file: [],
|
|
2169
|
+
// Завжди масив
|
|
2170
|
+
alt: "",
|
|
2171
|
+
title: "",
|
|
2172
|
+
width: "",
|
|
2173
|
+
height: "",
|
|
2174
|
+
link: "",
|
|
2175
|
+
openInNewTab: !1
|
|
2176
|
+
};
|
|
2177
|
+
s.value = !1, l.value = !0;
|
|
2178
|
+
}, S = () => {
|
|
2179
|
+
l.value = !1, s.value = !1, o.value = !1, n.value = [], c.value = null, r.value = {
|
|
2180
|
+
src: "",
|
|
2181
|
+
file: [],
|
|
2182
|
+
// Завжди масив
|
|
2183
|
+
alt: "",
|
|
2184
|
+
title: "",
|
|
2185
|
+
width: "",
|
|
2186
|
+
height: "",
|
|
2187
|
+
link: "",
|
|
2188
|
+
openInNewTab: !1
|
|
2189
|
+
};
|
|
2190
|
+
}, j = async (f) => {
|
|
2191
|
+
if (!f || f.length === 0)
|
|
2192
|
+
return;
|
|
2193
|
+
const m = [];
|
|
2194
|
+
for (const u of f)
|
|
2195
|
+
if (u && u.type && u.type.startsWith("image/") && !n.value.some((x) => x.file === u)) {
|
|
2196
|
+
const x = new Promise((B, v) => {
|
|
2197
|
+
const A = new FileReader();
|
|
2198
|
+
A.onload = (I) => {
|
|
2199
|
+
n.value.push({
|
|
2200
|
+
file: u,
|
|
2201
|
+
preview: I.target.result,
|
|
2202
|
+
error: !1
|
|
2203
|
+
}), B();
|
|
2204
|
+
}, A.onerror = v, A.readAsDataURL(u);
|
|
2205
|
+
});
|
|
2206
|
+
m.push(x);
|
|
2207
|
+
}
|
|
2208
|
+
await Promise.all(m);
|
|
2209
|
+
}, H = (f) => {
|
|
2210
|
+
n.value.splice(f, 1), Array.isArray(r.value.file) && r.value.file.splice(f, 1);
|
|
2211
|
+
}, N = () => {
|
|
2212
|
+
const f = r.value.width !== null && r.value.width !== void 0 && r.value.width !== "" && String(r.value.width).trim() !== "" ? String(r.value.width).trim() : "", m = r.value.height !== null && r.value.height !== void 0 && r.value.height !== "" && String(r.value.height).trim() !== "" ? String(r.value.height).trim() : "", u = {};
|
|
2213
|
+
return f && m ? (u.width = f, u.height = m, u.style = `width: ${f}px; height: ${m}px; object-fit: fill;`) : f ? (u.width = f, u.height = void 0) : m ? (u.height = m, u.width = void 0) : (u.width = void 0, u.height = void 0), u;
|
|
2214
|
+
}, q = (f, m = null, u = 50) => {
|
|
2215
|
+
const _ = () => {
|
|
2216
|
+
const { view: v } = f;
|
|
2217
|
+
if (!v || !v.dom) return;
|
|
2218
|
+
v.dom.querySelectorAll("img.editor-image[width][height]").forEach((z) => {
|
|
2219
|
+
if (z instanceof HTMLImageElement) {
|
|
2220
|
+
const E = z.getAttribute("width"), F = z.getAttribute("height");
|
|
2221
|
+
E && F && E !== "auto" && F !== "auto" && E !== "" && F !== "" && !isNaN(Number(E)) && !isNaN(Number(F)) && (z.style.cssText = `
|
|
2222
|
+
width: ${E}px !important;
|
|
2223
|
+
height: ${F}px !important;
|
|
2224
|
+
max-width: none !important;
|
|
2225
|
+
max-height: none !important;
|
|
2226
|
+
min-width: auto !important;
|
|
2227
|
+
min-height: auto !important;
|
|
2228
|
+
object-fit: fill !important;
|
|
2229
|
+
`.replace(/\s+/g, " ").trim());
|
|
2230
|
+
}
|
|
2231
|
+
});
|
|
2232
|
+
}, x = r.value.width, B = r.value.height;
|
|
2233
|
+
x && B && x !== "" && B !== "" ? [0, u, u * 2, u * 3, u * 4].forEach((A) => {
|
|
2234
|
+
setTimeout(_, A);
|
|
2235
|
+
}) : (_(), setTimeout(_, u));
|
|
2236
|
+
}, L = async () => {
|
|
2237
|
+
let f = [], m = [];
|
|
2238
|
+
if (Array.isArray(r.value.file) ? (f = r.value.file.filter((v) => v instanceof File), m = r.value.file.filter((v) => typeof v == "string" && v.trim() !== "")) : r.value.file instanceof FileList ? f = Array.from(r.value.file) : r.value.file instanceof File ? f = [r.value.file] : typeof r.value.file == "string" && r.value.file.trim() !== "" && (m = [r.value.file]), f.length === 0 && m.length === 0 && a.value && a.value.file) {
|
|
2239
|
+
const v = a.value.file;
|
|
2240
|
+
Array.isArray(v) ? (f = v.filter((A) => A instanceof File), m = v.filter((A) => typeof A == "string" && A.trim() !== "")) : v instanceof FileList ? f = Array.from(v) : v instanceof File ? f = [v] : typeof v == "string" && v.trim() !== "" && (m = [v]);
|
|
2241
|
+
}
|
|
2242
|
+
if (m.length > 0 && !o.value) {
|
|
2243
|
+
for (const v of m)
|
|
2244
|
+
n.value.some((A) => A.url === v) || n.value.push({
|
|
2245
|
+
url: v,
|
|
2246
|
+
preview: v,
|
|
2247
|
+
error: !1
|
|
2248
|
+
});
|
|
2249
|
+
if (f.length === 0 && n.value.length > 0) {
|
|
2250
|
+
await oe();
|
|
2251
|
+
return;
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
const u = f.length, _ = u + m.length;
|
|
2255
|
+
if (!(o.value && u <= 1)) {
|
|
2256
|
+
if (u > 0) {
|
|
2257
|
+
const v = f.filter(
|
|
2258
|
+
(A) => !n.value.some((I) => I.file === A)
|
|
2259
|
+
);
|
|
2260
|
+
v.length > 0 && await j(v);
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
if (!o.value) {
|
|
2264
|
+
if (_ > 1 || i.value || n.value.length > 1) {
|
|
2265
|
+
if (n.value.length > 0) {
|
|
2266
|
+
await oe();
|
|
2267
|
+
return;
|
|
2268
|
+
} else if (u > 0) {
|
|
2269
|
+
if (await j(f), n.value.length > 0) {
|
|
2270
|
+
await oe();
|
|
2271
|
+
return;
|
|
2272
|
+
}
|
|
2273
|
+
} else if (m.length > 0) {
|
|
2274
|
+
await oe();
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
} else if (n.value.length > 1) {
|
|
2278
|
+
await oe();
|
|
2279
|
+
return;
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
let x = r.value.src;
|
|
2283
|
+
if (y.value) {
|
|
2284
|
+
let v = null;
|
|
2285
|
+
if (Array.isArray(r.value.file) || r.value.file instanceof FileList ? v = r.value.file[0] : (r.value.file instanceof File || typeof r.value.file == "string") && (v = r.value.file), v instanceof File)
|
|
2286
|
+
try {
|
|
2287
|
+
const A = new FileReader(), I = await new Promise((z, E) => {
|
|
2288
|
+
A.onload = (F) => z(F.target.result), A.onerror = E, A.readAsDataURL(v);
|
|
2289
|
+
});
|
|
2290
|
+
x = I, o.value && (r.value.src = I);
|
|
2291
|
+
} catch (A) {
|
|
2292
|
+
console.error("Помилка при читанні файлу:", A), we({
|
|
2293
|
+
type: "error",
|
|
2294
|
+
title: "Помилка",
|
|
2295
|
+
message: "Не вдалося прочитати файл"
|
|
2296
|
+
});
|
|
2297
|
+
return;
|
|
2298
|
+
}
|
|
2299
|
+
else typeof v == "string" && v.trim() !== "" && (x = v.trim(), o.value && v.trim() !== r.value.src && (r.value.src = v.trim(), x = v.trim()));
|
|
2300
|
+
} else if (Array.isArray(r.value.file) && r.value.file.length === 1) {
|
|
2301
|
+
const v = r.value.file[0];
|
|
2302
|
+
typeof v == "string" && v.trim() !== "" && (x = v.trim(), (!r.value.src || r.value.src !== v.trim()) && (r.value.src = v.trim()));
|
|
2303
|
+
} else typeof r.value.file == "string" && r.value.file.trim() !== "" && (x = r.value.file.trim(), (!r.value.src || r.value.src !== r.value.file.trim()) && (r.value.src = r.value.file.trim()));
|
|
2304
|
+
const B = x || Array.isArray(r.value.file) && r.value.file.length > 0 && (r.value.file.some((v) => v instanceof File) || r.value.file.some((v) => typeof v == "string" && v.trim() !== "")) || r.value.file instanceof FileList && r.value.file.length > 0 || typeof r.value.file == "string" && r.value.file.trim() !== "";
|
|
2305
|
+
if (!x && !B) {
|
|
2306
|
+
we({
|
|
2307
|
+
type: "warning",
|
|
2308
|
+
title: "Попередження",
|
|
2309
|
+
message: "Будь ласка, введіть URL зображення або виберіть файл"
|
|
2310
|
+
});
|
|
2311
|
+
return;
|
|
2312
|
+
}
|
|
2313
|
+
if (!i.value && !B && await a.value.validate()) {
|
|
2314
|
+
we({
|
|
2315
|
+
type: "warning",
|
|
2316
|
+
title: "Попередження",
|
|
2317
|
+
message: "Будь ласка, заповніть всі обов'язкові поля"
|
|
2318
|
+
});
|
|
2319
|
+
return;
|
|
2320
|
+
}
|
|
2321
|
+
if (e.editor && x)
|
|
2322
|
+
if (o.value && c.value !== null) {
|
|
2323
|
+
const { state: v } = e.editor;
|
|
2324
|
+
try {
|
|
2325
|
+
e.editor.chain().focus().setNodeSelection(c.value).run();
|
|
2326
|
+
} catch {
|
|
2327
|
+
e.editor.chain().focus().setTextSelection(c.value).run();
|
|
2328
|
+
}
|
|
2329
|
+
const A = e.editor.getAttributes("link"), I = A && A.href, z = N(), E = {
|
|
2330
|
+
src: x,
|
|
2331
|
+
alt: r.value.alt || "",
|
|
2332
|
+
title: r.value.title || "",
|
|
2333
|
+
...z
|
|
2334
|
+
};
|
|
2335
|
+
if ((!r.value.width || r.value.width === "") && (E.width = void 0), (!r.value.height || r.value.height === "") && (E.height = void 0), e.editor.chain().focus().updateAttributes("image", E).run(), setTimeout(() => {
|
|
2336
|
+
const { view: F } = e.editor;
|
|
2337
|
+
if (!F || !F.dom) return;
|
|
2338
|
+
F.dom.querySelectorAll("img.editor-image").forEach((O) => {
|
|
2339
|
+
if (O instanceof HTMLImageElement) {
|
|
2340
|
+
const de = O.getAttribute("src") || O.src;
|
|
2341
|
+
(de === x || de.includes(x.split("/").pop())) && (r.value.width && r.value.height ? (O.style.setProperty("width", `${r.value.width}px`, "important"), O.style.setProperty("height", `${r.value.height}px`, "important"), O.style.setProperty("object-fit", "fill", "important"), O.style.setProperty("max-width", "none", "important"), O.style.setProperty("max-height", "none", "important")) : (O.style.removeProperty("width"), O.style.removeProperty("height"), O.style.removeProperty("object-fit"), O.style.removeProperty("max-width"), O.style.removeProperty("max-height")));
|
|
2342
|
+
}
|
|
2343
|
+
});
|
|
2344
|
+
}, 20), r.value.link && r.value.link.trim() !== "") {
|
|
2345
|
+
let F = r.value.link.trim();
|
|
2346
|
+
F.match(/^https?:\/\//i) || (F = "https://" + F), I ? e.editor.chain().focus().extendMarkRange("link").setLink({
|
|
2347
|
+
href: F,
|
|
2348
|
+
target: r.value.openInNewTab ? "_blank" : null
|
|
2349
|
+
}).run() : e.editor.chain().focus().selectParentNode().setLink({
|
|
2350
|
+
href: F,
|
|
2351
|
+
target: r.value.openInNewTab ? "_blank" : null
|
|
2352
|
+
}).run();
|
|
2353
|
+
} else I && e.editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
2354
|
+
} else {
|
|
2355
|
+
const { state: v } = e.editor, { selection: A } = v, { $anchor: I } = A;
|
|
2356
|
+
let z = null;
|
|
2357
|
+
for (let F = I.depth; F > 0; F--) {
|
|
2358
|
+
const M = I.node(F);
|
|
2359
|
+
if (M && M.type.name === "paragraph") {
|
|
2360
|
+
z = M;
|
|
2361
|
+
break;
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
if (z && z.content.content.some(
|
|
2365
|
+
(F) => F.type.name === "image"
|
|
2366
|
+
)) {
|
|
2367
|
+
const F = Y(z, I.before(I.depth));
|
|
2368
|
+
if (F !== null) {
|
|
2369
|
+
const M = N(), Q = v.schema.nodes.image.create({
|
|
2370
|
+
src: x,
|
|
2371
|
+
alt: r.value.alt || "",
|
|
2372
|
+
title: r.value.title || "",
|
|
2373
|
+
...M
|
|
2374
|
+
});
|
|
2375
|
+
if (r.value.link && r.value.link.trim() !== "") {
|
|
2376
|
+
let O = r.value.link.trim();
|
|
2377
|
+
O.match(/^https?:\/\//i) || (O = "https://" + O);
|
|
2378
|
+
const de = v.schema.marks.link.create({
|
|
2379
|
+
href: O,
|
|
2380
|
+
target: r.value.openInNewTab ? "_blank" : null
|
|
2381
|
+
}), $e = Q.type.create(Q.attrs, Q.content, [de]);
|
|
2382
|
+
e.editor.chain().focus().insertContentAt(F + 1, $e).run(), q(e.editor, x);
|
|
2383
|
+
} else
|
|
2384
|
+
e.editor.chain().focus().insertContentAt(F + 1, Q).run(), q(e.editor, x);
|
|
2385
|
+
} else if (r.value.link && r.value.link.trim() !== "") {
|
|
2386
|
+
const M = N();
|
|
2387
|
+
e.editor.chain().focus().setImage({
|
|
2388
|
+
src: x,
|
|
2389
|
+
alt: r.value.alt || "",
|
|
2390
|
+
title: r.value.title || "",
|
|
2391
|
+
...M
|
|
2392
|
+
}).run(), setTimeout(() => {
|
|
2393
|
+
let Q = r.value.link.trim();
|
|
2394
|
+
Q.match(/^https?:\/\//i) || (Q = "https://" + Q), e.editor.chain().focus().selectParentNode().setLink({
|
|
2395
|
+
href: Q,
|
|
2396
|
+
target: r.value.openInNewTab ? "_blank" : null
|
|
2397
|
+
}).run(), q(e.editor, x, 20);
|
|
2398
|
+
}, 10);
|
|
2399
|
+
} else {
|
|
2400
|
+
const M = N();
|
|
2401
|
+
e.editor.chain().focus().setImage({
|
|
2402
|
+
src: x,
|
|
2403
|
+
alt: r.value.alt || "",
|
|
2404
|
+
title: r.value.title || "",
|
|
2405
|
+
...M
|
|
2406
|
+
}).run(), q(e.editor, x);
|
|
2407
|
+
}
|
|
2408
|
+
} else if (r.value.link && r.value.link.trim() !== "") {
|
|
2409
|
+
const F = N();
|
|
2410
|
+
e.editor.chain().focus().setImage({
|
|
2411
|
+
src: x,
|
|
2412
|
+
alt: r.value.alt || "",
|
|
2413
|
+
title: r.value.title || "",
|
|
2414
|
+
...F
|
|
2415
|
+
}).run(), setTimeout(() => {
|
|
2416
|
+
let M = r.value.link.trim();
|
|
2417
|
+
M.match(/^https?:\/\//i) || (M = "https://" + M), e.editor.chain().focus().selectParentNode().setLink({
|
|
2418
|
+
href: M,
|
|
2419
|
+
target: r.value.openInNewTab ? "_blank" : null
|
|
2420
|
+
}).run(), q(e.editor, x, 20);
|
|
2421
|
+
}, 10);
|
|
2422
|
+
} else {
|
|
2423
|
+
const F = N();
|
|
2424
|
+
e.editor.chain().focus().setImage({
|
|
2425
|
+
src: x,
|
|
2426
|
+
alt: r.value.alt || "",
|
|
2427
|
+
title: r.value.title || "",
|
|
2428
|
+
...F
|
|
2429
|
+
}).run(), q(e.editor, x);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
S();
|
|
2433
|
+
}, Y = (f, m) => {
|
|
2434
|
+
let u = null;
|
|
2435
|
+
return f.forEach((_, x) => {
|
|
2436
|
+
_.type.name === "image" && (u = m + x + 1);
|
|
2437
|
+
}), u;
|
|
2438
|
+
}, oe = async () => {
|
|
2439
|
+
if (e.editor) {
|
|
2440
|
+
if (n.value.length === 0)
|
|
2441
|
+
if (Array.isArray(r.value.file) && r.value.file.length > 0) {
|
|
2442
|
+
const f = r.value.file.filter((u) => typeof u == "string" && u.trim() !== ""), m = r.value.file.filter((u) => u instanceof File);
|
|
2443
|
+
for (const u of f)
|
|
2444
|
+
n.value.some((_) => _.url === u || _.preview === u) || n.value.push({
|
|
2445
|
+
url: u,
|
|
2446
|
+
preview: u,
|
|
2447
|
+
error: !1
|
|
2448
|
+
});
|
|
2449
|
+
m.length > 0 && await j(m);
|
|
2450
|
+
} else i.value && await j(r.value.file);
|
|
2451
|
+
if (n.value.length !== 0)
|
|
2452
|
+
try {
|
|
2453
|
+
const f = [], m = N();
|
|
2454
|
+
for (const u of n.value) {
|
|
2455
|
+
const _ = u.url || u.preview || "";
|
|
2456
|
+
if (!_) continue;
|
|
2457
|
+
const x = e.editor.schema.nodes.image.create({
|
|
2458
|
+
src: _,
|
|
2459
|
+
alt: r.value.alt || "",
|
|
2460
|
+
title: r.value.title || "",
|
|
2461
|
+
...m
|
|
2462
|
+
});
|
|
2463
|
+
f.push(x);
|
|
2464
|
+
}
|
|
2465
|
+
f.length > 0 && (e.editor.chain().focus().command(({ tr: u, dispatch: _ }) => {
|
|
2466
|
+
if (_) {
|
|
2467
|
+
const { selection: x } = u, { $anchor: B } = x;
|
|
2468
|
+
let v = x.$anchor.pos, A = null, I = null;
|
|
2469
|
+
for (let E = B.depth; E > 0; E--) {
|
|
2470
|
+
const F = B.node(E);
|
|
2471
|
+
if (F && F.type.name === "paragraph") {
|
|
2472
|
+
A = F, I = B.start(E);
|
|
2473
|
+
break;
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
if (A) {
|
|
2477
|
+
let E = null;
|
|
2478
|
+
A.forEach((F, M) => {
|
|
2479
|
+
F.type.name === "image" && (E = I + M + 1);
|
|
2480
|
+
}), E !== null ? v = E + 1 : v = I + A.content.size;
|
|
2481
|
+
}
|
|
2482
|
+
let z = v;
|
|
2483
|
+
return f.forEach((E) => {
|
|
2484
|
+
u.insert(z, E), z += E.nodeSize;
|
|
2485
|
+
}), !0;
|
|
2486
|
+
}
|
|
2487
|
+
return !1;
|
|
2488
|
+
}).run(), r.value.width && r.value.height && setTimeout(() => {
|
|
2489
|
+
const { view: u } = e.editor;
|
|
2490
|
+
u && u.dom && u.dom.querySelectorAll("img.editor-image").forEach((B) => {
|
|
2491
|
+
B instanceof HTMLImageElement && Array.from(n.value).some((A) => {
|
|
2492
|
+
const I = A.url || A.preview || "", z = B.src || B.getAttribute("src") || "";
|
|
2493
|
+
return z === I || z.includes(I.split("/").pop());
|
|
2494
|
+
}) && (B.style.setProperty("width", `${r.value.width}px`, "important"), B.style.setProperty("height", `${r.value.height}px`, "important"), B.style.setProperty("object-fit", "fill", "important"), B.style.setProperty("max-width", "none", "important"), B.style.setProperty("max-height", "none", "important"));
|
|
2495
|
+
});
|
|
2496
|
+
}, 50)), S();
|
|
2497
|
+
} catch (f) {
|
|
2498
|
+
console.error("Помилка при додаванні зображень:", f), we({
|
|
2499
|
+
type: "error",
|
|
2500
|
+
title: "Помилка",
|
|
2501
|
+
message: "Не вдалося додати зображення"
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
}, se = async () => {
|
|
2506
|
+
await L();
|
|
2507
|
+
}, D = () => {
|
|
2508
|
+
S();
|
|
2509
|
+
};
|
|
2510
|
+
return ue(() => r.value.file, async (f, m) => {
|
|
2511
|
+
if (s.value = !1, !(o.value && Array.isArray(f) && f.length === 1 && typeof f[0] == "string" && !f.some((_) => _ instanceof File)))
|
|
2512
|
+
if (Array.isArray(f) && f.length > 0) {
|
|
2513
|
+
const u = f.filter((x) => x instanceof File), _ = f.filter((x) => typeof x == "string" && x.trim() !== "");
|
|
2514
|
+
if (u.length > 0 && (o.value ? o.value && u.length === 1 && _.length === 0 && (n.value = []) : n.value = [], (!o.value || u.length > 1 || _.length > 0) && await j(u), o.value && u.length === 1 && _.length === 0)) {
|
|
2515
|
+
const x = new FileReader();
|
|
2516
|
+
x.onload = (B) => {
|
|
2517
|
+
r.value.src = B.target.result;
|
|
2518
|
+
}, x.readAsDataURL(u[0]);
|
|
2519
|
+
}
|
|
2520
|
+
if (_.length > 0)
|
|
2521
|
+
if (o.value)
|
|
2522
|
+
o.value && _.length === 1 && u.length === 0 && (r.value.src = _[0]);
|
|
2523
|
+
else {
|
|
2524
|
+
u.length === 0 && (n.value = []);
|
|
2525
|
+
for (const x of _)
|
|
2526
|
+
n.value.some((B) => B.url === x || B.preview === x) || n.value.push({
|
|
2527
|
+
url: x,
|
|
2528
|
+
preview: x,
|
|
2529
|
+
error: !1
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
2532
|
+
} else f && typeof f == "object" && f instanceof FileList ? (o.value || (n.value = []), await j(Array.from(f))) : f && typeof f == "object" && !Array.isArray(f) && f instanceof File ? (o.value || (n.value = []), await j([f])) : o.value || (n.value = []);
|
|
2533
|
+
}, { immediate: !1 }), ue(() => r.value.src, () => {
|
|
2534
|
+
s.value = !1;
|
|
2535
|
+
}), (f, m) => (g(), w("div", rl, [
|
|
2536
|
+
d("button", {
|
|
2537
|
+
onClick: b,
|
|
2538
|
+
class: T([
|
|
2539
|
+
"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",
|
|
2540
|
+
t.editor?.isActive("image") ? "bg-gray-200 text-gray-900" : ""
|
|
2541
|
+
]),
|
|
2542
|
+
title: "Додати зображення"
|
|
2543
|
+
}, [
|
|
2544
|
+
C(k(Nt), { class: "h-4 w-4" }),
|
|
2545
|
+
m[4] || (m[4] = d("span", { class: "sr-only" }, "Додати зображення", -1))
|
|
2546
|
+
], 2),
|
|
2547
|
+
C(Ye, {
|
|
2548
|
+
modelValue: l.value,
|
|
2549
|
+
"onUpdate:modelValue": m[3] || (m[3] = (u) => l.value = u),
|
|
2550
|
+
title: o.value ? "Редагувати зображення" : "Додати зображення"
|
|
2551
|
+
}, {
|
|
2552
|
+
footer: V(() => [
|
|
2553
|
+
d("div", ul, [
|
|
2554
|
+
d("button", {
|
|
2555
|
+
onClick: D,
|
|
2556
|
+
type: "button",
|
|
2557
|
+
class: "px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
2558
|
+
}, " Скасувати "),
|
|
2559
|
+
d("button", {
|
|
2560
|
+
onClick: se,
|
|
2561
|
+
type: "button",
|
|
2562
|
+
class: "px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
2563
|
+
}, W(o.value ? "Оновити зображення" : "Додати зображення"), 1)
|
|
2564
|
+
])
|
|
2565
|
+
]),
|
|
2566
|
+
default: V(() => [
|
|
2567
|
+
C(ut, {
|
|
2568
|
+
modelValue: r.value,
|
|
2569
|
+
"onUpdate:modelValue": m[0] || (m[0] = (u) => r.value = u),
|
|
2570
|
+
schema: h.value,
|
|
2571
|
+
form: a.value,
|
|
2572
|
+
"onUpdate:form": m[1] || (m[1] = (u) => a.value = u)
|
|
2573
|
+
}, null, 8, ["modelValue", "schema", "form"]),
|
|
2574
|
+
p.value && !i.value ? (g(), w("div", ol, [
|
|
2575
|
+
m[5] || (m[5] = d("p", { class: "text-sm text-gray-600 mb-2" }, "Попередній перегляд:", -1)),
|
|
2576
|
+
ie(d("img", {
|
|
2577
|
+
src: p.value,
|
|
2578
|
+
alt: r.value.alt || "Попередній перегляд зображення",
|
|
2579
|
+
title: r.value.title,
|
|
2580
|
+
class: "max-w-full h-auto max-h-32 rounded border",
|
|
2581
|
+
onError: m[2] || (m[2] = (u) => s.value = !0)
|
|
2582
|
+
}, null, 40, ll), [
|
|
2583
|
+
[ye, !s.value]
|
|
2584
|
+
]),
|
|
2585
|
+
s.value ? (g(), w("p", al, " Не вдалося завантажити попередній перегляд зображення ")) : R("", !0)
|
|
2586
|
+
])) : R("", !0),
|
|
2587
|
+
n.value.length > 0 ? (g(), w("div", sl, [
|
|
2588
|
+
d("p", nl, "Попередній перегляд (" + W(n.value.length) + " зображень):", 1),
|
|
2589
|
+
m[6] || (m[6] = d("p", { class: "text-xs text-gray-500 mb-2" }, " Зображення будуть розміщені в ряд, якщо вони помістяться по ширині ", -1)),
|
|
2590
|
+
d("div", il, [
|
|
2591
|
+
(g(!0), w(re, null, le(n.value, (u, _) => (g(), w("div", {
|
|
2592
|
+
key: _,
|
|
2593
|
+
class: "relative"
|
|
2594
|
+
}, [
|
|
2595
|
+
ie(d("img", {
|
|
2596
|
+
src: u.preview,
|
|
2597
|
+
alt: `Попередній перегляд ${_ + 1}`,
|
|
2598
|
+
class: "max-w-[100px] max-h-[100px] rounded border object-contain",
|
|
2599
|
+
onError: (x) => u.error = !0
|
|
2600
|
+
}, null, 40, cl), [
|
|
2601
|
+
[ye, !u.error]
|
|
2602
|
+
]),
|
|
2603
|
+
d("button", {
|
|
2604
|
+
onClick: (x) => H(_),
|
|
2605
|
+
class: "absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs hover:bg-red-600",
|
|
2606
|
+
type: "button"
|
|
2607
|
+
}, " × ", 8, dl)
|
|
2608
|
+
]))), 128))
|
|
2609
|
+
])
|
|
2610
|
+
])) : R("", !0)
|
|
2611
|
+
]),
|
|
2612
|
+
_: 1
|
|
2613
|
+
}, 8, ["modelValue", "title"])
|
|
2614
|
+
]));
|
|
2615
|
+
}
|
|
2616
|
+
}), pl = { class: "flex items-center" }, gl = ["disabled"], hl = ["disabled"], vl = /* @__PURE__ */ Object.assign({
|
|
2617
|
+
inheritAttrs: !1
|
|
2618
|
+
}, {
|
|
2619
|
+
__name: "vs-editor-history",
|
|
2620
|
+
props: { editor: Object },
|
|
2621
|
+
setup(t) {
|
|
2622
|
+
const e = t, l = () => {
|
|
2623
|
+
e.editor?.can().undo() && e.editor.chain().focus().undo().run();
|
|
2624
|
+
}, s = () => {
|
|
2625
|
+
e.editor?.can().redo() && e.editor.chain().focus().redo().run();
|
|
2626
|
+
};
|
|
2627
|
+
return (a, o) => (g(), w("div", pl, [
|
|
2628
|
+
d("button", {
|
|
2629
|
+
onClick: l,
|
|
2630
|
+
class: T(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200", [
|
|
2631
|
+
t.editor?.can().undo() ? "text-gray-500" : "text-gray-300 cursor-not-allowed"
|
|
2632
|
+
]]),
|
|
2633
|
+
disabled: !t.editor?.can().undo(),
|
|
2634
|
+
title: "Undo (Ctrl+Z)"
|
|
2635
|
+
}, [
|
|
2636
|
+
C(k(Vt), { class: "h-4 w-4" })
|
|
2637
|
+
], 10, gl),
|
|
2638
|
+
d("button", {
|
|
2639
|
+
onClick: s,
|
|
2640
|
+
class: T(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100", [
|
|
2641
|
+
t.editor?.can().redo() ? "text-gray-500" : "text-gray-300 cursor-not-allowed"
|
|
2642
|
+
]]),
|
|
2643
|
+
disabled: !t.editor?.can().redo(),
|
|
2644
|
+
title: "Redo (Ctrl+Y)"
|
|
2645
|
+
}, [
|
|
2646
|
+
C(k(Dt), { class: "h-4 w-4" })
|
|
2647
|
+
], 10, hl)
|
|
2648
|
+
]));
|
|
2649
|
+
}
|
|
2650
|
+
}), ml = /* @__PURE__ */ X(vl, [["__scopeId", "data-v-2cd0a908"]]), bl = { class: "relative" }, yl = { class: "p-6" }, xl = { class: "flex justify-between items-center mb-4" }, wl = /* @__PURE__ */ Object.assign({
|
|
2651
|
+
inheritAttrs: !1
|
|
2652
|
+
}, {
|
|
2653
|
+
__name: "vs-editor-help",
|
|
2654
|
+
props: { editor: Object },
|
|
2655
|
+
setup(t) {
|
|
2656
|
+
const e = $(!1), l = $(null), s = () => {
|
|
2657
|
+
e.value = !e.value;
|
|
2658
|
+
}, a = () => {
|
|
2659
|
+
e.value = !1;
|
|
2660
|
+
};
|
|
2661
|
+
return (o, n) => (g(), w("div", bl, [
|
|
2662
|
+
d("button", {
|
|
2663
|
+
ref_key: "helpButton",
|
|
2664
|
+
ref: l,
|
|
2665
|
+
onClick: s,
|
|
2666
|
+
class: T(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500", [e.value ? "bg-gray-100 text-gray-900" : "text-gray-500"]]),
|
|
2667
|
+
title: "Markdown Shortcuts Help"
|
|
2668
|
+
}, [
|
|
2669
|
+
C(k(Ot), { class: "h-4 w-4" })
|
|
2670
|
+
], 2),
|
|
2671
|
+
e.value ? (g(), w("div", {
|
|
2672
|
+
key: 0,
|
|
2673
|
+
class: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",
|
|
2674
|
+
onClick: a
|
|
2675
|
+
}, [
|
|
2676
|
+
d("div", {
|
|
2677
|
+
class: "bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",
|
|
2678
|
+
onClick: n[0] || (n[0] = nt(() => {
|
|
2679
|
+
}, ["stop"]))
|
|
2680
|
+
}, [
|
|
2681
|
+
d("div", yl, [
|
|
2682
|
+
d("div", xl, [
|
|
2683
|
+
n[1] || (n[1] = d("h2", { class: "text-xl font-semibold text-gray-900" }, "Common Markdown Syntax & Shortcuts", -1)),
|
|
2684
|
+
d("button", {
|
|
2685
|
+
onClick: a,
|
|
2686
|
+
class: "text-gray-400 hover:text-gray-600 transition-colors"
|
|
2687
|
+
}, [
|
|
2688
|
+
C(k(Te), { class: "h-6 w-6" })
|
|
2689
|
+
])
|
|
2690
|
+
]),
|
|
2691
|
+
n[2] || (n[2] = it('<div class="space-y-6" data-v-38077376><div data-v-38077376><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-38077376>Markdown Syntax</h3><div class="overflow-x-auto" data-v-38077376><table class="w-full border-collapse" data-v-38077376><thead data-v-38077376><tr class="bg-gray-50" data-v-38077376><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-38077376>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-38077376>Example</th></tr></thead><tbody class="text-sm" data-v-38077376><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>_italic text_</code></td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>###### Heading 6</code></td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-38077376> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-38077376> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>1. First item</code>). </td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-38077376> Start with a greater-than sign (>) followed by a space. </td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-38077376> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>`</code>). </td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-38077376> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Images</td><td class="border border-gray-200 px-3 py-2" data-v-38077376> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376></code> syntax. </td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Links</td><td class="border border-gray-200 px-3 py-2" data-v-38077376> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-38077376> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-38077376><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-38077376>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-38077376><table class="w-full border-collapse" data-v-38077376><thead data-v-38077376><tr class="bg-gray-50" data-v-38077376><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-38077376>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-38077376>Action</th></tr></thead><tbody class="text-sm" data-v-38077376><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Select all text</td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Apply bold formatting</td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Copy selected text</td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Apply italic formatting</td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Save the current document</td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Paste copied text</td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Cut selected text</td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Redo the last action</td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Redo the last action</td></tr><tr data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Undo the last action</td></tr><tr class="bg-gray-25" data-v-38077376><td class="border border-gray-200 px-3 py-2 font-medium" data-v-38077376><code class="bg-gray-100 px-2 py-1 rounded" data-v-38077376>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-38077376>Undo the last action</td></tr></tbody></table></div></div></div>', 1))
|
|
2692
|
+
])
|
|
2693
|
+
])
|
|
2694
|
+
])) : R("", !0)
|
|
2695
|
+
]));
|
|
2696
|
+
}
|
|
2697
|
+
}), kl = /* @__PURE__ */ X(wl, [["__scopeId", "data-v-38077376"]]), _l = {
|
|
2698
|
+
__name: "vs-editor-horizontal-rule",
|
|
2699
|
+
props: {
|
|
2700
|
+
editor: Object
|
|
2701
|
+
},
|
|
2702
|
+
setup(t) {
|
|
2703
|
+
const e = t, l = () => {
|
|
2704
|
+
e.editor && e.editor.chain().focus().setHorizontalRule().run();
|
|
2705
|
+
};
|
|
2706
|
+
return (s, a) => (g(), w("button", {
|
|
2707
|
+
title: "Horizontal Rule",
|
|
2708
|
+
onClick: l,
|
|
2709
|
+
class: "flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"
|
|
2710
|
+
}, [
|
|
2711
|
+
C(k(Rt), { class: "h-4 w-4" })
|
|
2712
|
+
]));
|
|
2713
|
+
}
|
|
2714
|
+
}, $l = {
|
|
2715
|
+
__name: "vs-editor-fullscreen",
|
|
2716
|
+
props: {
|
|
2717
|
+
editor: Object
|
|
2718
|
+
},
|
|
2719
|
+
emits: ["toggle-fullscreen"],
|
|
2720
|
+
setup(t, { emit: e }) {
|
|
2721
|
+
const l = e, s = () => {
|
|
2722
|
+
l("toggle-fullscreen");
|
|
2723
|
+
};
|
|
2724
|
+
return (a, o) => (g(), w("button", {
|
|
2725
|
+
title: "Fullscreen",
|
|
2726
|
+
onClick: s,
|
|
2727
|
+
class: "w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"
|
|
2728
|
+
}, [
|
|
2729
|
+
C(k(Ut), { class: "h-4 w-4" })
|
|
2730
|
+
]));
|
|
2731
|
+
}
|
|
2732
|
+
}, Cl = /* @__PURE__ */ Object.assign({
|
|
2733
|
+
inheritAttrs: !1
|
|
2734
|
+
}, {
|
|
2735
|
+
__name: "vs-editor-tab",
|
|
2736
|
+
props: {
|
|
2737
|
+
editor: {
|
|
2738
|
+
type: Object,
|
|
2739
|
+
required: !0
|
|
2740
|
+
}
|
|
2741
|
+
},
|
|
2742
|
+
setup(t) {
|
|
2743
|
+
const e = t, l = () => {
|
|
2744
|
+
e.editor && (e.editor.isActive("bulletList") || e.editor.isActive("orderedList")) && e.editor.chain().focus().sinkListItem("listItem").run();
|
|
2745
|
+
};
|
|
2746
|
+
return (s, a) => (g(), w("button", {
|
|
2747
|
+
title: "Tab (Increase List Indent)",
|
|
2748
|
+
onClick: l,
|
|
2749
|
+
class: "text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"
|
|
2750
|
+
}, [
|
|
2751
|
+
C(k(qt), { class: "h-4 w-4" })
|
|
2752
|
+
]));
|
|
2753
|
+
}
|
|
2754
|
+
}), Al = {
|
|
2755
|
+
bold: Tr,
|
|
2756
|
+
italic: Ir,
|
|
2757
|
+
color: $o,
|
|
2758
|
+
background_color: Lo,
|
|
2759
|
+
highlight: Bo,
|
|
2760
|
+
bullet_list: xr,
|
|
2761
|
+
ordered_list: _r,
|
|
2762
|
+
blockquote: mr,
|
|
2763
|
+
codeblock: Ar,
|
|
2764
|
+
underline: Er,
|
|
2765
|
+
strike: jr,
|
|
2766
|
+
link: oo,
|
|
2767
|
+
table: io,
|
|
2768
|
+
text_align: fo,
|
|
2769
|
+
type_tag: ho,
|
|
2770
|
+
font_family: Mo,
|
|
2771
|
+
font_size: Vo,
|
|
2772
|
+
superscript: Ro,
|
|
2773
|
+
subscript: Ko,
|
|
2774
|
+
heading: Zo,
|
|
2775
|
+
clear_formatting: tl,
|
|
2776
|
+
image: fl,
|
|
2777
|
+
history: ml,
|
|
2778
|
+
help: kl,
|
|
2779
|
+
horizontal_rule: _l,
|
|
2780
|
+
fullscreen: $l,
|
|
2781
|
+
tab: Cl
|
|
2782
|
+
}, De = {
|
|
2783
|
+
// Базовий набір - мінімальний функціонал
|
|
2784
|
+
basic: [
|
|
2785
|
+
"history",
|
|
2786
|
+
"font_family",
|
|
2787
|
+
"font_size",
|
|
2788
|
+
"bold",
|
|
2789
|
+
"italic",
|
|
2790
|
+
"underline",
|
|
2791
|
+
"strike",
|
|
2792
|
+
"text_align",
|
|
2793
|
+
"bullet_list",
|
|
2794
|
+
"ordered_list",
|
|
2795
|
+
"link",
|
|
2796
|
+
"image",
|
|
2797
|
+
"clear_formatting",
|
|
2798
|
+
"help"
|
|
2799
|
+
],
|
|
2800
|
+
// Стандартний набір - рекомендований для більшості випадків
|
|
2801
|
+
default: [
|
|
2802
|
+
"history",
|
|
2803
|
+
"heading",
|
|
2804
|
+
"font_family",
|
|
2805
|
+
"font_size",
|
|
2806
|
+
"bold",
|
|
2807
|
+
"italic",
|
|
2808
|
+
"underline",
|
|
2809
|
+
"strike",
|
|
2810
|
+
"superscript",
|
|
2811
|
+
"subscript",
|
|
2812
|
+
"color",
|
|
2813
|
+
"background_color",
|
|
2814
|
+
"highlight",
|
|
2815
|
+
"text_align",
|
|
2816
|
+
"bullet_list",
|
|
2817
|
+
"ordered_list",
|
|
2818
|
+
"blockquote",
|
|
2819
|
+
"codeblock",
|
|
2820
|
+
"table",
|
|
2821
|
+
"link",
|
|
2822
|
+
"image",
|
|
2823
|
+
"horizontal_rule",
|
|
2824
|
+
"clear_formatting",
|
|
2825
|
+
"fullscreen",
|
|
2826
|
+
"help"
|
|
2827
|
+
],
|
|
2828
|
+
// Повний набір - всі доступні функції
|
|
2829
|
+
full: [
|
|
2830
|
+
"history",
|
|
2831
|
+
"heading",
|
|
2832
|
+
"font_family",
|
|
2833
|
+
"font_size",
|
|
2834
|
+
"bold",
|
|
2835
|
+
"italic",
|
|
2836
|
+
"underline",
|
|
2837
|
+
"strike",
|
|
2838
|
+
"color",
|
|
2839
|
+
"background_color",
|
|
2840
|
+
"highlight",
|
|
2841
|
+
"text_align",
|
|
2842
|
+
"bullet_list",
|
|
2843
|
+
"ordered_list",
|
|
2844
|
+
"blockquote",
|
|
2845
|
+
"codeblock",
|
|
2846
|
+
"table",
|
|
2847
|
+
"link",
|
|
2848
|
+
"image",
|
|
2849
|
+
"horizontal_rule",
|
|
2850
|
+
"superscript",
|
|
2851
|
+
"subscript",
|
|
2852
|
+
"clear_formatting",
|
|
2853
|
+
"fullscreen",
|
|
2854
|
+
"help"
|
|
2855
|
+
]
|
|
2856
|
+
}, Fl = { class: "flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent" }, Sl = { class: "rich-text-scroll-wrapper" }, Tl = {
|
|
2857
|
+
key: 0,
|
|
2858
|
+
class: "richtext-loading text-sm text-gray-500"
|
|
2859
|
+
}, Ll = {
|
|
2860
|
+
key: 1,
|
|
2861
|
+
class: "richtext-error text-sm text-red-600"
|
|
2862
|
+
}, Bl = { class: "html-source-editor" }, Il = { class: "flex justify-end border-t border-[#e5e7eb] bg-[#f8fafc] px-4 min-h-[38px] items-start overflow-visible" }, El = { class: "inline-flex items-stretch -mt-px" }, zl = /* @__PURE__ */ Object.assign({
|
|
2863
|
+
inheritAttrs: !1
|
|
2864
|
+
}, {
|
|
2865
|
+
__name: "vs-richtext",
|
|
2866
|
+
props: /* @__PURE__ */ Pe({
|
|
2867
|
+
modelValue: { type: String, default: () => "" },
|
|
2868
|
+
height: { type: String, default: () => "300px" },
|
|
2869
|
+
format: { type: String, default: () => "html" },
|
|
2870
|
+
toolbar: {
|
|
2871
|
+
type: [Array, String],
|
|
2872
|
+
default: () => "default"
|
|
2873
|
+
}
|
|
2874
|
+
}, {
|
|
2875
|
+
modelValue: {},
|
|
2876
|
+
modelModifiers: {}
|
|
2877
|
+
}),
|
|
2878
|
+
emits: /* @__PURE__ */ Pe(["update:modelValue"], ["update:modelValue"]),
|
|
2879
|
+
setup(t) {
|
|
2880
|
+
const e = t, l = ct(t, "modelValue"), s = $(null), { t: a } = _e(), o = P(() => e.format === "md" ? "markdown" : "html"), n = P(
|
|
2881
|
+
() => e.format === "md" ? a("form.richtext.markdown") : a("form.richtext.html")
|
|
2882
|
+
), { editor: c, editorInstance: r, focusEditor: i, createEditor: y, destroyEditor: p, isLoading: h, loadError: b } = rr(e), { isHtmlMode: S, htmlContent: j, htmlTextarea: H, toggleHtmlMode: N } = or(
|
|
2883
|
+
c,
|
|
2884
|
+
e.format,
|
|
2885
|
+
(D, f) => {
|
|
2886
|
+
D === "update:modelValue" && (l.value = f);
|
|
2887
|
+
},
|
|
2888
|
+
{
|
|
2889
|
+
toEditorContent: Ae,
|
|
2890
|
+
toSourceContent: dr
|
|
2891
|
+
}
|
|
2892
|
+
), { isFullscreen: q, toggleFullscreen: L } = lr(), Y = P(() => typeof e.toolbar == "string" ? De[e.toolbar] || De.default : e.toolbar), oe = P(() => Y.value.map((D) => Al[D]).filter(Boolean));
|
|
2893
|
+
ue(
|
|
2894
|
+
() => e.modelValue,
|
|
2895
|
+
async (D) => {
|
|
2896
|
+
if (c.value) {
|
|
2897
|
+
const f = await Ae(D || "", e.format), m = c.value.getHTML();
|
|
2898
|
+
f !== m && f !== "<p></p>" && c.value.commands.setContent(f, !1);
|
|
2899
|
+
}
|
|
2900
|
+
},
|
|
2901
|
+
{ immediate: !0 }
|
|
2902
|
+
);
|
|
2903
|
+
const se = (D) => {
|
|
2904
|
+
if (!D || !D.view || !D.view.dom) return;
|
|
2905
|
+
D.view.dom.querySelectorAll("img.editor-image[width][height]").forEach((m) => {
|
|
2906
|
+
if (m instanceof HTMLImageElement) {
|
|
2907
|
+
const u = m.getAttribute("width"), _ = m.getAttribute("height");
|
|
2908
|
+
u && _ && u !== "auto" && _ !== "auto" && u !== "" && _ !== "" && !isNaN(Number(u)) && !isNaN(Number(_)) && (m.style.cssText = `
|
|
2909
|
+
width: ${u}px !important;
|
|
2910
|
+
height: ${_}px !important;
|
|
2911
|
+
max-width: none !important;
|
|
2912
|
+
max-height: none !important;
|
|
2913
|
+
min-width: auto !important;
|
|
2914
|
+
min-height: auto !important;
|
|
2915
|
+
object-fit: fill !important;
|
|
2916
|
+
`.replace(/\s+/g, " ").trim());
|
|
2917
|
+
}
|
|
2918
|
+
});
|
|
2919
|
+
};
|
|
2920
|
+
return ue(c, (D) => {
|
|
2921
|
+
D && (be(() => {
|
|
2922
|
+
se(c.value);
|
|
2923
|
+
}), c.value.on("update", async (f) => {
|
|
2924
|
+
const m = f.editor.getHTML(), u = await ur(m, e.format);
|
|
2925
|
+
u !== e.modelValue && m !== "<p></p>" && (l.value = u), setTimeout(() => {
|
|
2926
|
+
se(f.editor);
|
|
2927
|
+
}, 10);
|
|
2928
|
+
}));
|
|
2929
|
+
}), fe(async () => {
|
|
2930
|
+
const D = await Ae(e.modelValue || "", e.format);
|
|
2931
|
+
await y(s.value, D), be(() => {
|
|
2932
|
+
c.value && setTimeout(() => {
|
|
2933
|
+
se(c.value);
|
|
2934
|
+
}, 100);
|
|
2935
|
+
});
|
|
2936
|
+
}), Ue(() => {
|
|
2937
|
+
p();
|
|
2938
|
+
}), (D, f) => (g(), w("div", {
|
|
2939
|
+
class: T(["bg-white rounded-md w-full", { "fixed left-0 right-0 top-0 bottom-0 z-[100000]": k(q) }])
|
|
2940
|
+
}, [
|
|
2941
|
+
d("div", Fl, [
|
|
2942
|
+
(g(!0), w(re, null, le(oe.value, (m) => (g(), w(re, { key: m }, [
|
|
2943
|
+
k(c) ? (g(), K(Fe(m), {
|
|
2944
|
+
key: 0,
|
|
2945
|
+
editor: k(r),
|
|
2946
|
+
onToggleFullscreen: k(L)
|
|
2947
|
+
}, null, 40, ["editor", "onToggleFullscreen"])) : R("", !0)
|
|
2948
|
+
], 64))), 128))
|
|
2949
|
+
]),
|
|
2950
|
+
d("div", {
|
|
2951
|
+
onClick: f[1] || (f[1] = (...m) => k(i) && k(i)(...m)),
|
|
2952
|
+
class: "relative w-full px-4 py-2 bg-white rounded-b-lg editor-content",
|
|
2953
|
+
style: ae({ height: k(q) ? "calc(95vh - 44px)" : t.height })
|
|
2954
|
+
}, [
|
|
2955
|
+
ie(d("div", Sl, [
|
|
2956
|
+
d("div", {
|
|
2957
|
+
ref_key: "editorElement",
|
|
2958
|
+
ref: s,
|
|
2959
|
+
class: "relative w-full"
|
|
2960
|
+
}, null, 512),
|
|
2961
|
+
k(h) ? (g(), w("div", Tl, "Loading editor...")) : R("", !0),
|
|
2962
|
+
k(b) ? (g(), w("div", Ll, W(k(b)), 1)) : R("", !0)
|
|
2963
|
+
], 512), [
|
|
2964
|
+
[ye, !k(S)]
|
|
2965
|
+
]),
|
|
2966
|
+
ie(d("div", Bl, [
|
|
2967
|
+
C(ft, {
|
|
2968
|
+
ref_key: "htmlTextarea",
|
|
2969
|
+
ref: H,
|
|
2970
|
+
modelValue: k(j),
|
|
2971
|
+
"onUpdate:modelValue": f[0] || (f[0] = (m) => dt(j) ? j.value = m : null),
|
|
2972
|
+
height: "100%",
|
|
2973
|
+
syntax: o.value,
|
|
2974
|
+
theme: "vs-light"
|
|
2975
|
+
}, null, 8, ["modelValue", "syntax"])
|
|
2976
|
+
], 512), [
|
|
2977
|
+
[ye, k(S)]
|
|
2978
|
+
])
|
|
2979
|
+
], 4),
|
|
2980
|
+
d("div", Il, [
|
|
2981
|
+
d("div", El, [
|
|
2982
|
+
d("button", {
|
|
2983
|
+
type: "button",
|
|
2984
|
+
class: T([
|
|
2985
|
+
"min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-bl-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",
|
|
2986
|
+
k(S) ? "text-[#8f99aa]" : "!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]"
|
|
2987
|
+
]),
|
|
2988
|
+
onClick: f[2] || (f[2] = (m) => k(N)(!1))
|
|
2989
|
+
}, W(k(a)("form.richtext.editor")), 3),
|
|
2990
|
+
d("button", {
|
|
2991
|
+
type: "button",
|
|
2992
|
+
class: T([
|
|
2993
|
+
"min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] border-l-0 bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-br-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",
|
|
2994
|
+
k(S) ? "!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]" : "text-[#8f99aa]"
|
|
2995
|
+
]),
|
|
2996
|
+
onClick: f[3] || (f[3] = (m) => k(N)(!0))
|
|
2997
|
+
}, W(n.value), 3)
|
|
2998
|
+
])
|
|
2999
|
+
])
|
|
3000
|
+
], 2));
|
|
3001
|
+
}
|
|
3002
|
+
});
|
|
3003
|
+
export {
|
|
3004
|
+
zl as default
|
|
3005
|
+
};
|