cosey 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/components/audio-card/audio-card.js +1 -1
- package/components/close/close.js +1 -1
- package/components/col/col.api.d.ts +1 -1
- package/components/context-menu/content.js +1 -1
- package/components/dnd-sort/dnd-sort-item.js +1 -1
- package/components/editor/button-group.d.ts +2 -0
- package/components/editor/button-group.js +20 -0
- package/components/editor/button-select.d.ts +14 -0
- package/components/editor/button-select.js +51 -0
- package/components/editor/button-split.d.ts +25 -0
- package/components/editor/button-split.js +68 -0
- package/components/editor/button.d.ts +19 -0
- package/components/editor/button.js +40 -0
- package/components/editor/contents/content-code-block.d.ts +18 -0
- package/components/editor/contents/content-code-block.js +47 -0
- package/components/editor/contents/content-formula.d.ts +12 -0
- package/components/editor/contents/content-formula.js +48 -0
- package/components/editor/contents/content-formula.style.js +14 -0
- package/components/editor/contents/content-image.d.ts +29 -0
- package/components/editor/contents/content-image.js +89 -0
- package/components/editor/{components/list/list.style.d.ts → contents/content-image.style.d.ts} +1 -1
- package/components/editor/contents/content-image.style.js +20 -0
- package/components/editor/contents/content-link.d.ts +16 -0
- package/components/editor/contents/content-link.js +74 -0
- package/components/editor/contents/content-link.stye.d.ts +4 -0
- package/components/editor/contents/content-link.stye.js +17 -0
- package/components/editor/contents/content-list-item.d.ts +21 -0
- package/components/editor/contents/content-list-item.js +41 -0
- package/components/editor/contents/content-list-item.style.d.ts +4 -0
- package/components/editor/contents/content-list-item.style.js +52 -0
- package/components/editor/contents/content-placeholder.d.ts +2 -0
- package/components/editor/contents/content-placeholder.js +24 -0
- package/components/editor/contents/content-placeholder.style.d.ts +4 -0
- package/components/editor/contents/content-placeholder.style.js +19 -0
- package/components/editor/contents/content-table.d.ts +2 -0
- package/components/editor/contents/content-table.js +133 -0
- package/components/editor/contents/content-table.style.d.ts +4 -0
- package/components/editor/contents/content-table.style.js +21 -0
- package/components/editor/contents/content-video.d.ts +26 -0
- package/components/editor/contents/content-video.js +73 -0
- package/components/editor/contents/content-video.style.d.ts +4 -0
- package/components/editor/contents/content-video.style.js +20 -0
- package/components/editor/contents/resize.d.ts +37 -0
- package/components/editor/contents/resize.js +133 -0
- package/components/editor/{components/resize → contents}/resize.style.d.ts +1 -1
- package/components/editor/{components/resize → contents}/resize.style.js +14 -34
- package/components/editor/contents/upload.d.ts +17 -0
- package/components/editor/contents/upload.js +80 -0
- package/components/editor/contents/upload.style.d.ts +4 -0
- package/components/editor/contents/upload.style.js +38 -0
- package/components/editor/contents/widget-popover.d.ts +389 -0
- package/components/editor/contents/widget-popover.js +36 -0
- package/components/editor/contents/widget-popover.style.d.ts +4 -0
- package/components/editor/contents/widget-popover.style.js +15 -0
- package/components/editor/editor.api.d.ts +14 -6
- package/components/editor/editor.api.js +10 -6
- package/components/editor/editor.d.ts +15 -8
- package/components/editor/editor.js +178 -76
- package/components/editor/editor.style.d.ts +5 -1
- package/components/editor/editor.style.js +120 -253
- package/components/editor/{components/color-picker/color-picker.js → formats/color-picker.api.js} +3 -3
- package/components/editor/formats/color-picker.d.ts +20 -0
- package/components/editor/formats/color-picker.js +154 -0
- package/components/editor/{components/color-picker → formats}/color-picker.style.d.ts +1 -1
- package/components/editor/{components/color-picker → formats}/color-picker.style.js +1 -1
- package/components/editor/formats/format-align.d.ts +22 -0
- package/components/editor/formats/format-align.js +38 -0
- package/components/editor/formats/format-background.d.ts +2 -0
- package/components/editor/formats/format-background.js +60 -0
- package/components/editor/formats/format-block-quote.d.ts +2 -0
- package/components/editor/formats/format-block-quote.js +27 -0
- package/components/editor/formats/format-clear.d.ts +2 -0
- package/components/editor/formats/format-clear.js +25 -0
- package/components/editor/formats/format-code-block.d.ts +2 -0
- package/components/editor/formats/format-code-block.js +27 -0
- package/components/editor/formats/format-color.d.ts +2 -0
- package/components/editor/formats/format-color.js +59 -0
- package/components/editor/formats/format-font.d.ts +2 -0
- package/components/editor/formats/format-font.js +46 -0
- package/components/editor/formats/format-formula.d.ts +2 -0
- package/components/editor/formats/format-formula.js +133 -0
- package/components/editor/formats/format-heading.d.ts +2 -0
- package/components/editor/formats/format-heading.js +52 -0
- package/components/editor/formats/format-image.d.ts +2 -0
- package/components/editor/formats/format-image.js +140 -0
- package/components/editor/formats/format-indent.d.ts +20 -0
- package/components/editor/formats/format-indent.js +35 -0
- package/components/editor/formats/format-link.d.ts +2 -0
- package/components/editor/formats/format-link.js +114 -0
- package/components/editor/formats/format-list.d.ts +22 -0
- package/components/editor/formats/format-list.js +39 -0
- package/components/editor/formats/format-mark.d.ts +20 -0
- package/components/editor/formats/format-mark.js +38 -0
- package/components/editor/formats/format-size-delta.d.ts +24 -0
- package/components/editor/formats/format-size-delta.js +43 -0
- package/components/editor/formats/format-size.d.ts +2 -0
- package/components/editor/formats/format-size.js +51 -0
- package/components/editor/formats/format-source.d.ts +2 -0
- package/components/editor/formats/format-source.js +69 -0
- package/components/editor/formats/format-table.d.ts +2 -0
- package/components/editor/formats/format-table.js +85 -0
- package/components/editor/formats/format-table.style.d.ts +4 -0
- package/components/editor/{components/toolbar/formats/table.style.js → formats/format-table.style.js} +2 -2
- package/components/editor/formats/format-video.d.ts +2 -0
- package/components/editor/formats/format-video.js +117 -0
- package/components/editor/formats/picker.d.ts +45 -0
- package/components/editor/formats/picker.js +91 -0
- package/components/editor/{components/picker → formats}/picker.style.d.ts +1 -1
- package/components/editor/{components/picker → formats}/picker.style.js +1 -1
- package/components/editor/formats/select-list.d.ts +28 -0
- package/components/editor/formats/select-list.js +47 -0
- package/components/editor/formats/select-list.style.d.ts +4 -0
- package/components/editor/{components/list/list.style.js → formats/select-list.style.js} +2 -2
- package/components/editor/formats/select.d.ts +32 -0
- package/components/editor/formats/select.js +61 -0
- package/components/editor/hooks/useBlockValueActive.d.ts +1 -0
- package/components/editor/hooks/useBlockValueActive.js +21 -0
- package/components/editor/hooks/useFocus.d.ts +5 -0
- package/components/editor/hooks/useFocus.js +18 -0
- package/components/editor/{components/color-picker → hooks}/useHistoryColor.js +1 -1
- package/components/editor/hooks/useMarkActive.d.ts +1 -0
- package/components/editor/hooks/useMarkActive.js +13 -0
- package/components/editor/hooks/useMarkValue.d.ts +1 -0
- package/components/editor/hooks/useMarkValue.js +21 -0
- package/components/editor/index.d.ts +25 -13
- package/components/editor/index.js +3 -21
- package/components/editor/plugins/align.d.ts +8 -0
- package/components/editor/plugins/align.js +13 -0
- package/components/editor/plugins/background.d.ts +7 -0
- package/components/editor/plugins/background.js +19 -0
- package/components/editor/plugins/block-quote.d.ts +8 -0
- package/components/editor/plugins/block-quote.js +34 -0
- package/components/editor/plugins/clear.d.ts +7 -0
- package/components/editor/plugins/clear.js +53 -0
- package/components/editor/plugins/code-block.d.ts +13 -0
- package/components/editor/plugins/code-block.js +348 -0
- package/components/editor/plugins/color.d.ts +7 -0
- package/components/editor/plugins/color.js +21 -0
- package/components/editor/plugins/font.d.ts +7 -0
- package/components/editor/plugins/font.js +17 -0
- package/components/editor/plugins/formula.d.ts +11 -0
- package/components/editor/{components/toolbar/formats → plugins}/formula.js +50 -1
- package/components/editor/plugins/heading.d.ts +9 -0
- package/components/editor/plugins/heading.js +70 -0
- package/components/editor/plugins/html.d.ts +7 -0
- package/components/editor/plugins/html.js +30 -0
- package/components/editor/plugins/image.d.ts +8 -0
- package/components/editor/plugins/image.js +63 -0
- package/components/editor/plugins/indent.d.ts +7 -0
- package/components/editor/plugins/indent.js +47 -0
- package/components/editor/plugins/index.d.ts +2 -0
- package/components/editor/plugins/index.js +50 -0
- package/components/editor/plugins/keyboard.d.ts +41 -0
- package/components/editor/plugins/keyboard.js +120 -0
- package/components/editor/plugins/link.d.ts +8 -0
- package/components/editor/plugins/link.js +56 -0
- package/components/editor/plugins/list/deserialize.d.ts +3 -0
- package/components/editor/plugins/list/deserialize.js +106 -0
- package/components/editor/plugins/list/format.d.ts +3 -0
- package/components/editor/plugins/list/format.js +155 -0
- package/components/editor/plugins/list/indent.d.ts +2 -0
- package/components/editor/plugins/list/indent.js +38 -0
- package/components/editor/plugins/list/index.d.ts +10 -0
- package/components/editor/plugins/list/index.js +61 -0
- package/components/editor/plugins/list/insert-break.d.ts +2 -0
- package/components/editor/plugins/list/insert-break.js +19 -0
- package/components/editor/plugins/list/normalize.d.ts +3 -0
- package/components/editor/plugins/list/normalize.js +168 -0
- package/components/editor/plugins/list/serialize.d.ts +3 -0
- package/components/editor/plugins/list/serialize.js +63 -0
- package/components/editor/plugins/list/utils.d.ts +6 -0
- package/components/editor/plugins/list/utils.js +24 -0
- package/components/editor/plugins/mark.d.ts +7 -0
- package/components/editor/plugins/mark.js +27 -0
- package/components/editor/plugins/render.d.ts +11 -0
- package/components/editor/plugins/render.js +54 -0
- package/components/editor/plugins/serialize.d.ts +10 -0
- package/components/editor/plugins/serialize.js +342 -0
- package/components/editor/plugins/size.d.ts +8 -0
- package/components/editor/plugins/size.js +47 -0
- package/components/editor/plugins/table.d.ts +21 -0
- package/components/editor/plugins/table.js +702 -0
- package/components/editor/plugins/video.d.ts +8 -0
- package/components/editor/plugins/video.js +40 -0
- package/components/editor/toolbar.d.ts +2 -0
- package/components/editor/toolbar.js +20 -0
- package/components/editor/types.d.ts +194 -0
- package/components/editor/types.js +55 -0
- package/components/editor/usePopoverContainer.d.ts +8 -0
- package/components/editor/usePopoverContainer.js +31 -0
- package/components/editor/utils.d.ts +77 -0
- package/components/editor/utils.js +165 -0
- package/components/field/components/checkbox-group/checkbox-group.vue.js +1 -1
- package/components/field/components/editor/editor.d.ts +16 -0
- package/components/field/components/editor/editor.vue.d.ts +4 -0
- package/components/field/components/editor/editor.vue.js +21 -0
- package/components/field/components/password/password.vue.js +1 -1
- package/components/field/components/select/select.vue.js +1 -1
- package/components/field/field.api.d.ts +3 -0
- package/components/field/field.api.js +18 -16
- package/components/file-card/file-card.js +1 -1
- package/components/form/form-item.vue.js +2 -2
- package/components/form/form.api.d.ts +3 -3
- package/components/form/form.api.js +1 -1
- package/components/form/form.d.ts +6 -6
- package/components/form/index.d.ts +17 -17
- package/components/form/useBubbleTemplate.js +1 -1
- package/components/form-dialog/form-dialog.api.js +1 -1
- package/components/form-dialog/form-dialog.d.ts +5 -5
- package/components/form-drawer/form-drawer.d.ts +5 -5
- package/components/form-drawer/index.d.ts +15 -15
- package/components/form-group/form-group.api.d.ts +9 -4
- package/components/form-group/form-group.api.js +4 -1
- package/components/form-group/form-group.d.ts +8 -2
- package/components/form-group/form-group.js +13 -3
- package/components/form-group/form-group.style.js +5 -0
- package/components/form-group/index.d.ts +12 -3
- package/components/form-list/index.d.ts +5 -5
- package/components/form-query/form-query.d.ts +5 -5
- package/components/form-query/form-query.js +1 -1
- package/components/form-query/index.d.ts +15 -15
- package/components/highlight/highlight.api.d.ts +30 -12
- package/components/highlight/highlight.api.js +3 -19
- package/components/highlight/highlight.d.ts +7 -3
- package/components/highlight/highlight.js +4 -5
- package/components/highlight/highlight.style.js +285 -50
- package/components/highlight/index.d.ts +15 -6
- package/components/highlight/index.js +1 -1
- package/components/icon/icon.api.d.ts +11 -0
- package/components/icon/icon.api.js +10 -0
- package/components/icon/icon.d.ts +16 -5
- package/components/icon/icon.js +59 -0
- package/components/icon/icon.style.d.ts +4 -0
- package/components/icon/{style/index.js → icon.style.js} +1 -1
- package/components/icon/index.d.ts +24 -7
- package/components/icon/index.js +2 -1
- package/components/iconify-icon/iconify-icon.api.d.ts +15 -0
- package/components/iconify-icon/iconify-icon.api.js +20 -0
- package/components/iconify-icon/iconify-icon.d.ts +21 -6
- package/components/iconify-icon/iconify-icon.js +22 -8
- package/components/iconify-icon/index.d.ts +37 -4
- package/components/iconify-icon/index.js +2 -2
- package/components/index.d.ts +1 -0
- package/components/index.js +5 -4
- package/components/input-number-range/index.d.ts +39 -30
- package/components/input-number-range/input-number-range.api.d.ts +10 -10
- package/components/input-number-range/input-number-range.d.ts +23 -20
- package/components/input-number-range/input-number-range.js +1 -1
- package/components/snug-menu/snug-menu-item.vue.js +2 -2
- package/components/stack-dialog/index.d.ts +3 -3
- package/components/stack-dialog/stack-dialog.d.ts +1 -1
- package/components/svg-icon/index.d.ts +16 -4
- package/components/svg-icon/index.js +2 -1
- package/components/svg-icon/svg-icon.api.d.ts +7 -0
- package/components/svg-icon/svg-icon.api.js +7 -0
- package/components/svg-icon/svg-icon.d.ts +10 -3
- package/components/svg-icon/svg-icon.js +18 -0
- package/components/table/index.d.ts +12 -12
- package/components/table/table-column/table-column.js +1 -1
- package/components/table/table-export/table-export.d.ts +5 -5
- package/components/table/table-query/table-query.d.ts +5 -5
- package/components/table/table.d.ts +5 -5
- package/components/table/table.js +1 -1
- package/components/table/table.vue.d.ts +7 -7
- package/components/table/table.vue.js +5 -5
- package/components/table-action/item.js +1 -1
- package/components/toggle/toggle.js +1 -1
- package/components/upload/index.d.ts +3 -4
- package/components/upload/index.js +0 -1
- package/components/upload/upload-item.js +1 -1
- package/components/upload/upload.api.d.ts +2 -2
- package/components/upload/upload.d.ts +2 -2
- package/components/upload/upload.js +4 -4
- package/components/video-card/video-card.js +1 -1
- package/config/root-config-provider.js +2 -2
- package/{components/upload-context.d.ts → config/upload.d.ts} +2 -2
- package/{components/upload-context.js → config/upload.js} +3 -3
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +2 -0
- package/hooks/useObjectUrl.d.ts +2 -0
- package/hooks/useObjectUrl.js +27 -0
- package/hooks/useSingleUpload.d.ts +15 -0
- package/hooks/useSingleUpload.js +64 -0
- package/layout/layout-menu/style/index.js +1 -1
- package/locale/lang/ar.d.ts +2 -0
- package/locale/lang/ar.js +3 -1
- package/locale/lang/en.d.ts +2 -0
- package/locale/lang/en.js +3 -1
- package/locale/lang/zh-cn.d.ts +2 -0
- package/locale/lang/zh-cn.js +3 -1
- package/package.json +11 -7
- package/utils/array.d.ts +1 -1
- package/utils/browser.d.ts +1 -0
- package/utils/browser.js +3 -2
- package/utils/file.d.ts +5 -0
- package/utils/file.js +24 -1
- package/utils/index.js +2 -2
- package/utils/url.d.ts +4 -0
- package/utils/url.js +10 -0
- package/components/editor/components/button-group.vue.d.ts +0 -12
- package/components/editor/components/button-group.vue.js +0 -19
- package/components/editor/components/button.vue.d.ts +0 -17
- package/components/editor/components/button.vue.js +0 -35
- package/components/editor/components/color-picker/color-picker.vue.d.ts +0 -23
- package/components/editor/components/color-picker/color-picker.vue.js +0 -181
- package/components/editor/components/list/list.d.ts +0 -6
- package/components/editor/components/list/list.vue.d.ts +0 -11
- package/components/editor/components/list/list.vue.js +0 -51
- package/components/editor/components/picker/picker.vue.d.ts +0 -25
- package/components/editor/components/picker/picker.vue.js +0 -95
- package/components/editor/components/resize/resize.d.ts +0 -23
- package/components/editor/components/resize/resize.js +0 -88
- package/components/editor/components/resize/resize.vue.d.ts +0 -2
- package/components/editor/components/resize/resize.vue.js +0 -204
- package/components/editor/components/select-button.vue.d.ts +0 -15
- package/components/editor/components/select-button.vue.js +0 -46
- package/components/editor/components/select.vue.d.ts +0 -14
- package/components/editor/components/select.vue.js +0 -67
- package/components/editor/components/split-button.vue.d.ts +0 -22
- package/components/editor/components/split-button.vue.js +0 -69
- package/components/editor/components/table-toolbar/table-toolbar.style.d.ts +0 -4
- package/components/editor/components/table-toolbar/table-toolbar.style.js +0 -22
- package/components/editor/components/table-toolbar/table-toolbar.vue.d.ts +0 -2
- package/components/editor/components/table-toolbar/table-toolbar.vue.js +0 -182
- package/components/editor/components/toolbar/formats/align.vue.d.ts +0 -5
- package/components/editor/components/toolbar/formats/align.vue.js +0 -52
- package/components/editor/components/toolbar/formats/background.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/background.vue.js +0 -70
- package/components/editor/components/toolbar/formats/blockquote.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/blockquote.vue.js +0 -39
- package/components/editor/components/toolbar/formats/bold.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/bold.vue.js +0 -39
- package/components/editor/components/toolbar/formats/clean.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/clean.vue.js +0 -26
- package/components/editor/components/toolbar/formats/code-block.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/code-block.vue.js +0 -39
- package/components/editor/components/toolbar/formats/code.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/code.vue.js +0 -39
- package/components/editor/components/toolbar/formats/color.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/color.vue.js +0 -69
- package/components/editor/components/toolbar/formats/font.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/font.vue.js +0 -59
- package/components/editor/components/toolbar/formats/formula.d.ts +0 -4
- package/components/editor/components/toolbar/formats/formula.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/formula.vue.js +0 -154
- package/components/editor/components/toolbar/formats/header.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/header.vue.js +0 -68
- package/components/editor/components/toolbar/formats/image.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/image.vue.js +0 -26
- package/components/editor/components/toolbar/formats/indent.vue.d.ts +0 -5
- package/components/editor/components/toolbar/formats/indent.vue.js +0 -36
- package/components/editor/components/toolbar/formats/italic.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/italic.vue.js +0 -39
- package/components/editor/components/toolbar/formats/link.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/link.vue.js +0 -218
- package/components/editor/components/toolbar/formats/list.vue.d.ts +0 -5
- package/components/editor/components/toolbar/formats/list.vue.js +0 -50
- package/components/editor/components/toolbar/formats/script.vue.d.ts +0 -5
- package/components/editor/components/toolbar/formats/script.vue.js +0 -50
- package/components/editor/components/toolbar/formats/size-delta.vue.d.ts +0 -5
- package/components/editor/components/toolbar/formats/size-delta.vue.js +0 -79
- package/components/editor/components/toolbar/formats/size.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/size.vue.js +0 -56
- package/components/editor/components/toolbar/formats/source.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/source.vue.js +0 -78
- package/components/editor/components/toolbar/formats/strike.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/strike.vue.js +0 -39
- package/components/editor/components/toolbar/formats/strikethrough.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/strikethrough.vue.js +0 -39
- package/components/editor/components/toolbar/formats/table.style.d.ts +0 -4
- package/components/editor/components/toolbar/formats/table.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/table.vue.js +0 -100
- package/components/editor/components/toolbar/formats/underline.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/underline.vue.js +0 -39
- package/components/editor/components/toolbar/formats/video.vue.d.ts +0 -2
- package/components/editor/components/toolbar/formats/video.vue.js +0 -123
- package/components/editor/components/toolbar/toolbar.d.ts +0 -36
- package/components/editor/components/toolbar/toolbar.js +0 -137
- package/components/editor/components/toolbar/toolbar.vue.d.ts +0 -3
- package/components/editor/components/toolbar/toolbar.vue.js +0 -130
- package/components/editor/components/toolbar/toolbarContext.d.ts +0 -8
- package/components/editor/components/toolbar/toolbarContext.js +0 -3
- package/components/editor/formats/align.d.ts +0 -2
- package/components/editor/formats/align.js +0 -6
- package/components/editor/formats/font.d.ts +0 -7
- package/components/editor/formats/font.js +0 -36
- package/components/editor/formats/formula.d.ts +0 -9
- package/components/editor/formats/formula.js +0 -29
- package/components/editor/formats/image.d.ts +0 -13
- package/components/editor/formats/image.js +0 -46
- package/components/editor/formats/indent.d.ts +0 -10
- package/components/editor/formats/indent.js +0 -37
- package/components/editor/formats/kbd.d.ts +0 -7
- package/components/editor/formats/kbd.js +0 -13
- package/components/editor/formats/link.d.ts +0 -28
- package/components/editor/formats/link.js +0 -51
- package/components/editor/formats/list.d.ts +0 -13
- package/components/editor/formats/list.js +0 -57
- package/components/editor/formats/size.d.ts +0 -3
- package/components/editor/formats/size.js +0 -9
- package/components/editor/formats/video.d.ts +0 -16
- package/components/editor/formats/video.js +0 -44
- package/components/editor/modules/custom-list.d.ts +0 -5
- package/components/editor/modules/custom-list.js +0 -23
- package/components/editor/modules/image-uploader/formats/image-loading.d.ts +0 -16
- package/components/editor/modules/image-uploader/formats/image-loading.js +0 -31
- package/components/editor/modules/image-uploader/formats/image-loading.style.d.ts +0 -2
- package/components/editor/modules/image-uploader/formats/image-loading.style.js +0 -46
- package/components/editor/modules/image-uploader/image-uploader.d.ts +0 -18
- package/components/editor/modules/image-uploader/image-uploader.js +0 -134
- package/components/editor/modules/syntax/index.d.ts +0 -2
- package/components/editor/modules/syntax/index.js +0 -1
- package/components/editor/modules/syntax/syntaxOptions.d.ts +0 -8
- package/components/editor/modules/syntax/syntaxOptions.js +0 -23
- package/components/editor/quill.d.ts +0 -1
- package/components/editor/quill.js +0 -33
- package/components/editor/quillContext.d.ts +0 -6
- package/components/editor/quillContext.js +0 -3
- package/components/icon/icon.vue.d.ts +0 -13
- package/components/icon/icon.vue.js +0 -76
- package/components/iconify-icon/iconify-icon.vue.d.ts +0 -3
- package/components/iconify-icon/iconify-icon.vue.js +0 -38
- package/components/svg-icon/svg-icon.vue.d.ts +0 -3
- package/components/svg-icon/svg-icon.vue.js +0 -29
- /package/components/{icon/style/index.d.ts → editor/contents/content-formula.style.d.ts} +0 -0
- /package/components/editor/{components/color-picker/color-picker.d.ts → formats/color-picker.api.d.ts} +0 -0
- /package/components/editor/{components/picker/picker.d.ts → formats/picker.api.d.ts} +0 -0
- /package/components/editor/{components/picker/picker.js → formats/picker.api.js} +0 -0
- /package/components/editor/{components/color-picker → hooks}/useHistoryColor.d.ts +0 -0
- /package/components/{editor/components/list/list.js → field/components/editor/editor.js} +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { h } from 'vue';
|
|
2
|
+
import stdin_default from '../contents/content-video.js';
|
|
3
|
+
import { useInheritRef } from 'slate-vue3';
|
|
4
|
+
|
|
5
|
+
const insertVideo = (editor, url, width, height) => {
|
|
6
|
+
const video = { type: "video", url, width, height, children: [{ text: "" }] };
|
|
7
|
+
editor.insertNodes(video);
|
|
8
|
+
editor.move();
|
|
9
|
+
};
|
|
10
|
+
function withVideo(editor) {
|
|
11
|
+
const { isInline, isVoid, renderElement } = editor;
|
|
12
|
+
editor.isInline = (element) => {
|
|
13
|
+
return element.type === "video" ? true : isInline(element);
|
|
14
|
+
};
|
|
15
|
+
editor.isVoid = (element) => {
|
|
16
|
+
return element.type === "video" ? true : isVoid(element);
|
|
17
|
+
};
|
|
18
|
+
editor.renderElement = (props) => {
|
|
19
|
+
const { attributes, children, element } = props;
|
|
20
|
+
if (element.type === "video") {
|
|
21
|
+
return h(
|
|
22
|
+
stdin_default,
|
|
23
|
+
{
|
|
24
|
+
...useInheritRef(attributes),
|
|
25
|
+
url: element.url,
|
|
26
|
+
width: element.width,
|
|
27
|
+
height: element.height
|
|
28
|
+
},
|
|
29
|
+
() => children
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return renderElement(props);
|
|
33
|
+
};
|
|
34
|
+
editor.insertVideo = (url, width, height) => {
|
|
35
|
+
insertVideo(editor, url, width, height);
|
|
36
|
+
};
|
|
37
|
+
return editor;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { withVideo };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineComponent, createVNode } from 'vue';
|
|
2
|
+
import { useComponentConfig } from '../config-provider/config-provider.api.js';
|
|
3
|
+
|
|
4
|
+
var stdin_default = defineComponent({
|
|
5
|
+
name: "CoEditorToolbar",
|
|
6
|
+
setup(props, {
|
|
7
|
+
slots
|
|
8
|
+
}) {
|
|
9
|
+
const {
|
|
10
|
+
prefixCls
|
|
11
|
+
} = useComponentConfig("editor-toolbar");
|
|
12
|
+
return () => {
|
|
13
|
+
return createVNode("div", {
|
|
14
|
+
"class": prefixCls.value
|
|
15
|
+
}, [slots.default?.()]);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export { stdin_default as default };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Descendant, BaseEditor, BaseRange } from 'slate-vue3/core';
|
|
2
|
+
import type { DOMEditor } from 'slate-vue3/dom';
|
|
3
|
+
import { type FormatAlign } from './plugins/align';
|
|
4
|
+
export type ListType = 'numbered-list' | 'bulleted-list';
|
|
5
|
+
export type NestedListType = 'nested-numbered-list' | 'nested-bulleted-list';
|
|
6
|
+
export declare const HEADING_TYPES: readonly ["heading-one", "heading-two", "heading-three", "heading-four", "heading-five", "heading-six"];
|
|
7
|
+
export declare const HEADING_WITH_PARA_TYPES: readonly ["paragraph", "heading-one", "heading-two", "heading-three", "heading-four", "heading-five", "heading-six"];
|
|
8
|
+
export type HeadingParagraphType = (typeof HEADING_WITH_PARA_TYPES)[number];
|
|
9
|
+
export type HeadingType = (typeof HEADING_TYPES)[number];
|
|
10
|
+
export declare const NORMAL_BLOCK_TYPES: readonly ["paragraph", "heading-one", "heading-two", "heading-three", "heading-four", "heading-five", "heading-six", "block-quote"];
|
|
11
|
+
export type NormalBlockType = (typeof NORMAL_BLOCK_TYPES)[number];
|
|
12
|
+
export declare const mapElementTypeTagName: Record<string, string>;
|
|
13
|
+
export declare const tagToElementTypeMap: {
|
|
14
|
+
P: string;
|
|
15
|
+
BLOCKQUOTE: string;
|
|
16
|
+
H1: string;
|
|
17
|
+
H2: string;
|
|
18
|
+
H3: string;
|
|
19
|
+
H4: string;
|
|
20
|
+
H5: string;
|
|
21
|
+
H6: string;
|
|
22
|
+
UL: string;
|
|
23
|
+
OL: string;
|
|
24
|
+
LI: string;
|
|
25
|
+
PRE: string;
|
|
26
|
+
TABLE: string;
|
|
27
|
+
THEAD: string;
|
|
28
|
+
TBODY: string;
|
|
29
|
+
TR: string;
|
|
30
|
+
TD: string;
|
|
31
|
+
TH: string;
|
|
32
|
+
};
|
|
33
|
+
export type ParagraphElement = {
|
|
34
|
+
type: 'paragraph';
|
|
35
|
+
children: Descendant[];
|
|
36
|
+
align?: FormatAlign;
|
|
37
|
+
indent?: number;
|
|
38
|
+
};
|
|
39
|
+
export type HeadingOneElement = {
|
|
40
|
+
type: 'heading-one';
|
|
41
|
+
children: Descendant[];
|
|
42
|
+
align?: FormatAlign;
|
|
43
|
+
indent?: number;
|
|
44
|
+
};
|
|
45
|
+
export type HeadingTwoElement = {
|
|
46
|
+
type: 'heading-two';
|
|
47
|
+
children: Descendant[];
|
|
48
|
+
align?: FormatAlign;
|
|
49
|
+
indent?: number;
|
|
50
|
+
};
|
|
51
|
+
export type HeadingThreeElement = {
|
|
52
|
+
type: 'heading-three';
|
|
53
|
+
children: Descendant[];
|
|
54
|
+
align?: FormatAlign;
|
|
55
|
+
indent?: number;
|
|
56
|
+
};
|
|
57
|
+
export type HeadingFourElement = {
|
|
58
|
+
type: 'heading-four';
|
|
59
|
+
children: Descendant[];
|
|
60
|
+
align?: FormatAlign;
|
|
61
|
+
indent?: number;
|
|
62
|
+
};
|
|
63
|
+
export type HeadingFiveElement = {
|
|
64
|
+
type: 'heading-five';
|
|
65
|
+
children: Descendant[];
|
|
66
|
+
align?: FormatAlign;
|
|
67
|
+
indent?: number;
|
|
68
|
+
};
|
|
69
|
+
export type HeadingSixElement = {
|
|
70
|
+
type: 'heading-six';
|
|
71
|
+
children: Descendant[];
|
|
72
|
+
align?: FormatAlign;
|
|
73
|
+
indent?: number;
|
|
74
|
+
};
|
|
75
|
+
export type BlockQuoteElement = {
|
|
76
|
+
type: 'block-quote';
|
|
77
|
+
children: Descendant[];
|
|
78
|
+
align?: FormatAlign;
|
|
79
|
+
indent?: number;
|
|
80
|
+
};
|
|
81
|
+
export type BulletedListElement = {
|
|
82
|
+
type: 'bulleted-list';
|
|
83
|
+
children: ListItemElement[];
|
|
84
|
+
};
|
|
85
|
+
export type NumberedListElement = {
|
|
86
|
+
type: 'numbered-list';
|
|
87
|
+
children: ListItemElement[];
|
|
88
|
+
};
|
|
89
|
+
export type ListItemElement = {
|
|
90
|
+
type: 'list-item';
|
|
91
|
+
listType: 'bulleted-list' | 'numbered-list';
|
|
92
|
+
children: Descendant[];
|
|
93
|
+
level: number;
|
|
94
|
+
};
|
|
95
|
+
export type NestedBulletedListElement = {
|
|
96
|
+
type: 'nested-bulleted-list';
|
|
97
|
+
children: NestedListItemElement[];
|
|
98
|
+
parent: NestedListItemElement | null;
|
|
99
|
+
};
|
|
100
|
+
export type NestedNumberedListElement = {
|
|
101
|
+
type: 'nested-numbered-list';
|
|
102
|
+
children: NestedListItemElement[];
|
|
103
|
+
parent: NestedListItemElement | null;
|
|
104
|
+
};
|
|
105
|
+
export type NestedListItemElement = {
|
|
106
|
+
type: 'nested-list-item';
|
|
107
|
+
children: Descendant[];
|
|
108
|
+
parent: NestedBulletedListElement | NestedNumberedListElement | null;
|
|
109
|
+
};
|
|
110
|
+
export type TableElement = {
|
|
111
|
+
type: 'table';
|
|
112
|
+
children: Descendant[];
|
|
113
|
+
};
|
|
114
|
+
export type TableHeadElement = {
|
|
115
|
+
type: 'table-head';
|
|
116
|
+
children: Descendant[];
|
|
117
|
+
};
|
|
118
|
+
export type TableBodyElement = {
|
|
119
|
+
type: 'table-body';
|
|
120
|
+
children: Descendant[];
|
|
121
|
+
};
|
|
122
|
+
export type TableRowElement = {
|
|
123
|
+
type: 'table-row';
|
|
124
|
+
children: Descendant[];
|
|
125
|
+
};
|
|
126
|
+
export type TableCellElement = {
|
|
127
|
+
type: 'table-cell';
|
|
128
|
+
children: Descendant[];
|
|
129
|
+
};
|
|
130
|
+
export type ImageElement = {
|
|
131
|
+
type: 'image';
|
|
132
|
+
url: string;
|
|
133
|
+
width?: string | number;
|
|
134
|
+
height?: string | number;
|
|
135
|
+
file?: File;
|
|
136
|
+
children: EmptyText[];
|
|
137
|
+
};
|
|
138
|
+
export type VideoElement = {
|
|
139
|
+
type: 'video';
|
|
140
|
+
url: string;
|
|
141
|
+
width?: string | number;
|
|
142
|
+
height?: string | number;
|
|
143
|
+
children: EmptyText[];
|
|
144
|
+
};
|
|
145
|
+
export type LinkElement = {
|
|
146
|
+
type: 'link';
|
|
147
|
+
url: string;
|
|
148
|
+
target: string;
|
|
149
|
+
children: Descendant[];
|
|
150
|
+
};
|
|
151
|
+
export type FormulaElement = {
|
|
152
|
+
type: 'formula';
|
|
153
|
+
formula: string;
|
|
154
|
+
children: EmptyText[];
|
|
155
|
+
};
|
|
156
|
+
export type CodeBlockElement = {
|
|
157
|
+
type: 'code-block';
|
|
158
|
+
language: string;
|
|
159
|
+
children: Descendant[];
|
|
160
|
+
};
|
|
161
|
+
export type CodeLineElement = {
|
|
162
|
+
type: 'code-line';
|
|
163
|
+
children: Descendant[];
|
|
164
|
+
};
|
|
165
|
+
export type HeadingElement = HeadingOneElement | HeadingTwoElement | HeadingThreeElement | HeadingFourElement | HeadingFiveElement | HeadingSixElement;
|
|
166
|
+
export type CustomElement = ParagraphElement | HeadingOneElement | HeadingTwoElement | HeadingThreeElement | HeadingFourElement | HeadingFiveElement | HeadingSixElement | BlockQuoteElement | BulletedListElement | NumberedListElement | ListItemElement | NestedBulletedListElement | NestedNumberedListElement | NestedListItemElement | ImageElement | VideoElement | LinkElement | FormulaElement | TableElement | TableHeadElement | TableBodyElement | TableRowElement | TableCellElement | CodeBlockElement | CodeLineElement;
|
|
167
|
+
export type CustomText = {
|
|
168
|
+
text: string;
|
|
169
|
+
bold?: boolean;
|
|
170
|
+
italic?: boolean;
|
|
171
|
+
underline?: boolean;
|
|
172
|
+
strikethrough?: boolean;
|
|
173
|
+
code?: boolean;
|
|
174
|
+
superscript?: boolean;
|
|
175
|
+
subscript?: boolean;
|
|
176
|
+
font?: string;
|
|
177
|
+
size?: string;
|
|
178
|
+
color?: string;
|
|
179
|
+
background?: string;
|
|
180
|
+
};
|
|
181
|
+
export type EmptyText = {
|
|
182
|
+
text: string;
|
|
183
|
+
} & CustomText;
|
|
184
|
+
export type CustomEditor = BaseEditor & DOMEditor;
|
|
185
|
+
declare module 'slate-vue3/core' {
|
|
186
|
+
interface CustomTypes {
|
|
187
|
+
Editor: CustomEditor;
|
|
188
|
+
Element: CustomElement;
|
|
189
|
+
Text: CustomText | EmptyText;
|
|
190
|
+
Range: BaseRange & {
|
|
191
|
+
[key: string]: unknown;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const HEADING_TYPES = [
|
|
2
|
+
"heading-one",
|
|
3
|
+
"heading-two",
|
|
4
|
+
"heading-three",
|
|
5
|
+
"heading-four",
|
|
6
|
+
"heading-five",
|
|
7
|
+
"heading-six"
|
|
8
|
+
];
|
|
9
|
+
const HEADING_WITH_PARA_TYPES = ["paragraph", ...HEADING_TYPES];
|
|
10
|
+
const NORMAL_BLOCK_TYPES = [...HEADING_WITH_PARA_TYPES, "block-quote"];
|
|
11
|
+
const mapElementTypeTagName = {
|
|
12
|
+
paragraph: "p",
|
|
13
|
+
"heading-one": "h1",
|
|
14
|
+
"heading-two": "h2",
|
|
15
|
+
"heading-three": "h3",
|
|
16
|
+
"heading-four": "h4",
|
|
17
|
+
"heading-five": "h5",
|
|
18
|
+
"heading-six": "h6",
|
|
19
|
+
"block-quote": "blockquote",
|
|
20
|
+
"bulleted-list": "ul",
|
|
21
|
+
"numbered-list": "ol",
|
|
22
|
+
"list-item": "li",
|
|
23
|
+
"nested-bulleted-list": "ul",
|
|
24
|
+
"nested-numbered-list": "ol",
|
|
25
|
+
"nested-list-item": "li",
|
|
26
|
+
"code-block": "pre",
|
|
27
|
+
table: "table",
|
|
28
|
+
"table-head": "thead",
|
|
29
|
+
"table-body": "tbody",
|
|
30
|
+
"table-row": "tr",
|
|
31
|
+
"table-cell": "td",
|
|
32
|
+
formula: "math"
|
|
33
|
+
};
|
|
34
|
+
const tagToElementTypeMap = {
|
|
35
|
+
P: "paragraph",
|
|
36
|
+
BLOCKQUOTE: "block-quote",
|
|
37
|
+
H1: "heading-one",
|
|
38
|
+
H2: "heading-two",
|
|
39
|
+
H3: "heading-three",
|
|
40
|
+
H4: "heading-four",
|
|
41
|
+
H5: "heading-five",
|
|
42
|
+
H6: "heading-six",
|
|
43
|
+
UL: "bulleted-list",
|
|
44
|
+
OL: "numbered-list",
|
|
45
|
+
LI: "list-item",
|
|
46
|
+
PRE: "code-block",
|
|
47
|
+
TABLE: "table",
|
|
48
|
+
THEAD: "table-head",
|
|
49
|
+
TBODY: "table-body",
|
|
50
|
+
TR: "table-row",
|
|
51
|
+
TD: "table-cell",
|
|
52
|
+
TH: "table-cell"
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { HEADING_TYPES, HEADING_WITH_PARA_TYPES, NORMAL_BLOCK_TYPES, mapElementTypeTagName, tagToElementTypeMap };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
export interface PopoverContainerContext {
|
|
3
|
+
popoverWrapper: HTMLDivElement;
|
|
4
|
+
}
|
|
5
|
+
export declare const popoverContainerContextKey: InjectionKey<PopoverContainerContext>;
|
|
6
|
+
export declare function usePopoverContainer(): {
|
|
7
|
+
mountPoint: import("vue").ShallowRef<HTMLDivElement | undefined, HTMLDivElement | undefined>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { shallowRef, onMounted, provide } from 'vue';
|
|
2
|
+
|
|
3
|
+
const popoverContainerContextKey = Symbol(
|
|
4
|
+
"editorContext"
|
|
5
|
+
);
|
|
6
|
+
function usePopoverContainer() {
|
|
7
|
+
const popoverContainer = document.createElement("div");
|
|
8
|
+
const popoverWrapper = document.createElement("div");
|
|
9
|
+
popoverContainer.append(popoverWrapper);
|
|
10
|
+
Object.assign(popoverContainer.style, {
|
|
11
|
+
position: "absolute",
|
|
12
|
+
inset: 0,
|
|
13
|
+
overflow: "hidden",
|
|
14
|
+
pointerEvents: "none"
|
|
15
|
+
});
|
|
16
|
+
Object.assign(popoverWrapper.style, {
|
|
17
|
+
pointerEvents: "auto"
|
|
18
|
+
});
|
|
19
|
+
const mountPoint = shallowRef();
|
|
20
|
+
onMounted(() => {
|
|
21
|
+
mountPoint.value.append(popoverContainer);
|
|
22
|
+
});
|
|
23
|
+
provide(popoverContainerContextKey, {
|
|
24
|
+
popoverWrapper
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
mountPoint
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { popoverContainerContextKey, usePopoverContainer };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Editor, Location, MaximizeMode, Node, NodeEntry, NodeMatch, Path, Point, Range } from 'slate-vue3/core';
|
|
2
|
+
import { CustomElement, HeadingElement } from './types';
|
|
3
|
+
export declare function isParagraph(n: unknown): n is CustomElement;
|
|
4
|
+
export declare function isNormalBlock(n: unknown): boolean;
|
|
5
|
+
export declare function isHeading(n: unknown): n is HeadingElement;
|
|
6
|
+
export declare function isBlockElement(editor: Editor, n: unknown): n is CustomElement;
|
|
7
|
+
export declare function getPointingOptions(editor: Editor, type: CustomElement['type']): {
|
|
8
|
+
at?: Location;
|
|
9
|
+
match?: NodeMatch<CustomElement>;
|
|
10
|
+
mode?: MaximizeMode;
|
|
11
|
+
};
|
|
12
|
+
export declare function isPointingAt(editor: Editor, type: CustomElement['type']): boolean;
|
|
13
|
+
export declare function toggleBlockAttr(editor: Editor, key: string, value: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* 判断光标是否指向某个块元素的最后
|
|
16
|
+
* @param editor 编辑器实例对象
|
|
17
|
+
* @param type 元素类型
|
|
18
|
+
* @param callback 可选的回调,在满足条件时调用,并接收此元素和其路径
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function isPointAtEndOfElement(editor: Editor, type: CustomElement['type'], callback?: (match: NodeEntry) => void): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 判断两范围是否相等
|
|
24
|
+
*
|
|
25
|
+
* 不像 Range.equals 需要anchor和focus的位置相同;此函数在anchor和focus相反时也能返回真。
|
|
26
|
+
*
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export declare function isRangeEqual(r1: Range, r2: Range): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 判断某个 point 是否在指定块元素的首行
|
|
32
|
+
*/
|
|
33
|
+
export declare function isPointAtFirstLine(editor: Editor, elementPath: Path, point: Point): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 判断某个 point 是否在指定块元素的尾行
|
|
36
|
+
*/
|
|
37
|
+
export declare function isPointAtLastLine(editor: Editor, elementPath: Path, point: Point): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 接收 range,返回排序后的 range
|
|
40
|
+
*/
|
|
41
|
+
export declare function getSortedRange(range: Range): Range;
|
|
42
|
+
export declare enum RangePosition {
|
|
43
|
+
BEFORE = 2340,
|
|
44
|
+
BEFORE_BEGIN = 2324,
|
|
45
|
+
INTERSECT_BEGIN = 2316,
|
|
46
|
+
AFTER_BEGIN = 1292,
|
|
47
|
+
CONTAIN = 780,
|
|
48
|
+
BEFORE_END = 778,
|
|
49
|
+
INTERSECT_END = 777,
|
|
50
|
+
AFTER_END = 649,
|
|
51
|
+
AFTER = 585,
|
|
52
|
+
COVER = 1290,
|
|
53
|
+
COVER_BEGIN = 2314,
|
|
54
|
+
COVER_END = 1289,
|
|
55
|
+
COVER_BOTH = 2313,
|
|
56
|
+
BEGIN = 1300,
|
|
57
|
+
END = 650
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 获取目标相较于当前范围的位置
|
|
61
|
+
*/
|
|
62
|
+
export declare function getRangePosition(range: Range, target: Range): RangePosition;
|
|
63
|
+
/**
|
|
64
|
+
* 获取上一个同级节点,找不到则返回 undefined
|
|
65
|
+
*/
|
|
66
|
+
export declare function getPreviousSibling<T extends Node>(editor: Editor, path: Path, options?: {
|
|
67
|
+
quit?: (node: Node, path: Path) => boolean;
|
|
68
|
+
match?: NodeMatch<T>;
|
|
69
|
+
}): NodeEntry<T> | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* 获取下一个同级节点,找不到则返回 undefined
|
|
72
|
+
*/
|
|
73
|
+
export declare function getNextSibling<T extends Node>(editor: Editor, path: Path, options?: {
|
|
74
|
+
quit?: (node: Node, path: Path) => boolean;
|
|
75
|
+
match?: (node: Node, path: Path) => boolean;
|
|
76
|
+
}): NodeEntry<T> | undefined;
|
|
77
|
+
export declare function isEdgesEqual(edges: [Point, Point], another: [Point, Point]): boolean;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { Element, Path, Editor, Range, Point } from 'slate-vue3/core';
|
|
2
|
+
import { NORMAL_BLOCK_TYPES, HEADING_TYPES } from './types.js';
|
|
3
|
+
|
|
4
|
+
function isParagraph(n) {
|
|
5
|
+
return Element.isElementType(n, "paragraph");
|
|
6
|
+
}
|
|
7
|
+
function isNormalBlock(n) {
|
|
8
|
+
return Element.isElement(n) && NORMAL_BLOCK_TYPES.includes(n.type);
|
|
9
|
+
}
|
|
10
|
+
function isHeading(n) {
|
|
11
|
+
return Element.isElement(n) && HEADING_TYPES.includes(n.type);
|
|
12
|
+
}
|
|
13
|
+
function isBlockElement(editor, n) {
|
|
14
|
+
return Element.isElement(n) && editor.isBlock(n);
|
|
15
|
+
}
|
|
16
|
+
function getPointingOptions(editor, type) {
|
|
17
|
+
const selection = editor.selection;
|
|
18
|
+
return {
|
|
19
|
+
at: selection,
|
|
20
|
+
match: (n, path) => Element.isElementType(n, type) && Path.isAncestor(path, selection.anchor.path) && Path.isAncestor(path, selection.focus.path),
|
|
21
|
+
mode: "lowest"
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function isPointingAt(editor, type) {
|
|
25
|
+
if (!editor.selection) return false;
|
|
26
|
+
const nodes = editor.nodes(getPointingOptions(editor, type));
|
|
27
|
+
return !nodes.next().done;
|
|
28
|
+
}
|
|
29
|
+
function toggleBlockAttr(editor, key, value) {
|
|
30
|
+
if (!editor.selection) return;
|
|
31
|
+
const [match] = Array.from(
|
|
32
|
+
editor.nodes({
|
|
33
|
+
at: Editor.unhangRange(editor, editor.selection),
|
|
34
|
+
match: (n) => {
|
|
35
|
+
return !Editor.isEditor(n) && Element.isElement(n) && n[key] === value;
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
const active = !!match;
|
|
40
|
+
editor.setNodes({
|
|
41
|
+
[key]: active ? void 0 : value
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function isPointAtEndOfElement(editor, type, callback) {
|
|
45
|
+
const selection = editor.selection;
|
|
46
|
+
if (!selection || !Range.isCollapsed(selection)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const [match] = Array.from(
|
|
50
|
+
editor.nodes({
|
|
51
|
+
match: (n) => Element.isElement(n) && n.type === type
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
const result = !!(match && Point.equals(Editor.end(editor, match[1]), selection.focus));
|
|
55
|
+
if (result && callback) {
|
|
56
|
+
callback(match);
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
function isRangeEqual(r1, r2) {
|
|
61
|
+
return Point.equals(r1.anchor, r2.anchor) && Point.equals(r1.focus, r2.focus) || Point.equals(r1.anchor, r2.focus) && Point.equals(r1.focus, r2.anchor);
|
|
62
|
+
}
|
|
63
|
+
function isPointAtFirstLine(editor, elementPath, point) {
|
|
64
|
+
const [currentBlock] = editor.nodes({
|
|
65
|
+
at: point,
|
|
66
|
+
mode: "lowest",
|
|
67
|
+
match: (n) => isBlockElement(editor, n)
|
|
68
|
+
});
|
|
69
|
+
const previousBlock = editor.previous({
|
|
70
|
+
at: currentBlock[1],
|
|
71
|
+
match: (n, path) => isBlockElement(editor, n) && Path.isAncestor(elementPath, path)
|
|
72
|
+
});
|
|
73
|
+
return !previousBlock;
|
|
74
|
+
}
|
|
75
|
+
function isPointAtLastLine(editor, elementPath, point) {
|
|
76
|
+
const [currentBlock] = editor.nodes({
|
|
77
|
+
at: point,
|
|
78
|
+
mode: "lowest",
|
|
79
|
+
match: (n) => isBlockElement(editor, n)
|
|
80
|
+
});
|
|
81
|
+
const nextBlock = editor.next({
|
|
82
|
+
at: currentBlock[1],
|
|
83
|
+
match: (n, path) => isBlockElement(editor, n) && Path.isAncestor(elementPath, path)
|
|
84
|
+
});
|
|
85
|
+
return !nextBlock;
|
|
86
|
+
}
|
|
87
|
+
function getSortedRange(range) {
|
|
88
|
+
return Range.isBackward(range) ? {
|
|
89
|
+
anchor: range.focus,
|
|
90
|
+
focus: range.anchor
|
|
91
|
+
} : range;
|
|
92
|
+
}
|
|
93
|
+
function pathCompare(path, another) {
|
|
94
|
+
const min = Math.min(path.length, another.length);
|
|
95
|
+
for (let i = 0; i < min; i++) {
|
|
96
|
+
if (path[i] < another[i]) return 4;
|
|
97
|
+
if (path[i] > another[i]) return 1;
|
|
98
|
+
}
|
|
99
|
+
return 2;
|
|
100
|
+
}
|
|
101
|
+
function pointCompare(point, another) {
|
|
102
|
+
const result = pathCompare(point.path, another.path);
|
|
103
|
+
if (result === 2) {
|
|
104
|
+
if (point.offset < another.offset) return 4;
|
|
105
|
+
if (point.offset > another.offset) return 1;
|
|
106
|
+
return 2;
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
var RangePosition = /* @__PURE__ */ ((RangePosition2) => {
|
|
111
|
+
RangePosition2[RangePosition2["BEFORE"] = 2340] = "BEFORE";
|
|
112
|
+
RangePosition2[RangePosition2["BEFORE_BEGIN"] = 2324] = "BEFORE_BEGIN";
|
|
113
|
+
RangePosition2[RangePosition2["INTERSECT_BEGIN"] = 2316] = "INTERSECT_BEGIN";
|
|
114
|
+
RangePosition2[RangePosition2["AFTER_BEGIN"] = 1292] = "AFTER_BEGIN";
|
|
115
|
+
RangePosition2[RangePosition2["CONTAIN"] = 780] = "CONTAIN";
|
|
116
|
+
RangePosition2[RangePosition2["BEFORE_END"] = 778] = "BEFORE_END";
|
|
117
|
+
RangePosition2[RangePosition2["INTERSECT_END"] = 777] = "INTERSECT_END";
|
|
118
|
+
RangePosition2[RangePosition2["AFTER_END"] = 649] = "AFTER_END";
|
|
119
|
+
RangePosition2[RangePosition2["AFTER"] = 585] = "AFTER";
|
|
120
|
+
RangePosition2[RangePosition2["COVER"] = 1290] = "COVER";
|
|
121
|
+
RangePosition2[RangePosition2["COVER_BEGIN"] = 2314] = "COVER_BEGIN";
|
|
122
|
+
RangePosition2[RangePosition2["COVER_END"] = 1289] = "COVER_END";
|
|
123
|
+
RangePosition2[RangePosition2["COVER_BOTH"] = 2313] = "COVER_BOTH";
|
|
124
|
+
RangePosition2[RangePosition2["BEGIN"] = 1300] = "BEGIN";
|
|
125
|
+
RangePosition2[RangePosition2["END"] = 650] = "END";
|
|
126
|
+
return RangePosition2;
|
|
127
|
+
})(RangePosition || {});
|
|
128
|
+
function getRangePosition(range, target) {
|
|
129
|
+
const ss = pointCompare(target.anchor, range.anchor);
|
|
130
|
+
const se = pointCompare(target.anchor, range.focus);
|
|
131
|
+
const es = pointCompare(target.focus, range.anchor);
|
|
132
|
+
const ee = pointCompare(target.focus, range.focus);
|
|
133
|
+
return ss << 9 | se << 6 | es << 3 | ee;
|
|
134
|
+
}
|
|
135
|
+
function getPreviousSibling(editor, path, options = {}) {
|
|
136
|
+
const { match, quit } = options;
|
|
137
|
+
const [parentNode, parentPath] = editor.parent(path);
|
|
138
|
+
for (let i = path[path.length - 1] - 1; i >= 0; i--) {
|
|
139
|
+
const childNode = parentNode.children[i];
|
|
140
|
+
const childPath = [...parentPath, i];
|
|
141
|
+
if (!childNode) return;
|
|
142
|
+
if (quit && quit(childNode, childPath)) return;
|
|
143
|
+
if (!match || match(childNode, childPath)) {
|
|
144
|
+
return [childNode, childPath];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function getNextSibling(editor, path, options = {}) {
|
|
149
|
+
const { match = () => true, quit } = options;
|
|
150
|
+
const [parentNode, parentPath] = editor.parent(path);
|
|
151
|
+
for (let i = path[path.length - 1] + 1; i < parentNode.children.length; i++) {
|
|
152
|
+
const childNode = parentNode.children[i];
|
|
153
|
+
const childPath = [...parentPath, i];
|
|
154
|
+
if (!childNode) return;
|
|
155
|
+
if (quit && quit(childNode, childPath)) return;
|
|
156
|
+
if (match(childNode, childPath)) {
|
|
157
|
+
return [childNode, childPath];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function isEdgesEqual(edges, another) {
|
|
162
|
+
return Point.equals(edges[0], another[0]) && Point.equals(edges[1], another[1]);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { RangePosition, getNextSibling, getPointingOptions, getPreviousSibling, getRangePosition, getSortedRange, isBlockElement, isEdgesEqual, isHeading, isNormalBlock, isParagraph, isPointAtEndOfElement, isPointAtFirstLine, isPointAtLastLine, isPointingAt, isRangeEqual, toggleBlockAttr };
|
|
@@ -4,8 +4,8 @@ import { fieldCheckboxGroupOmitKeys } from './checkbox-group.js';
|
|
|
4
4
|
import stdin_default$1 from './panel.vue.js';
|
|
5
5
|
import { omit } from 'lodash-es';
|
|
6
6
|
import { useProps } from '../../../../hooks/useProps.js';
|
|
7
|
-
import { isNumber, isFunction } from '../../../../utils/is.js';
|
|
8
7
|
import { getLabelByValue } from '../../../../utils/collection.js';
|
|
8
|
+
import { isNumber, isFunction } from '../../../../utils/is.js';
|
|
9
9
|
import { addNullablePlaceholder } from '../../../../utils/vue.js';
|
|
10
10
|
|
|
11
11
|
var stdin_default = defineComponent((props, {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type FieldComponentCommonProps } from '../common';
|
|
2
|
+
import type { EditorEmits, EditorProps } from '../../../editor';
|
|
3
|
+
export interface FieldEditorProps extends FieldComponentCommonProps {
|
|
4
|
+
componentProps?: Partial<EditorProps> & {
|
|
5
|
+
'onUpdate:modelValue'?: (value: string) => void;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
[key: PropertyKey]: any;
|
|
8
|
+
};
|
|
9
|
+
componentSlots?: Partial<FieldEditorSlots>;
|
|
10
|
+
}
|
|
11
|
+
export interface FieldEditorSlots {
|
|
12
|
+
}
|
|
13
|
+
export interface FieldEditorEmits extends EditorEmits {
|
|
14
|
+
}
|
|
15
|
+
export interface FieldEditorExpose {
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type SlotsType } from 'vue';
|
|
2
|
+
import { type FieldEditorProps, type FieldEditorSlots } from './editor';
|
|
3
|
+
declare const _default: import("vue").DefineSetupFnComponent<FieldEditorProps, {}, SlotsType<FieldEditorSlots>, FieldEditorProps & {}, import("vue").PublicProps>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { Editor as _Editor } from '../../../editor/index.js';
|
|
3
|
+
import { addNullablePlaceholder } from '../../../../utils/vue.js';
|
|
4
|
+
|
|
5
|
+
var stdin_default = defineComponent((props, {
|
|
6
|
+
slots
|
|
7
|
+
}) => {
|
|
8
|
+
return () => {
|
|
9
|
+
if (props.readonly) {
|
|
10
|
+
return addNullablePlaceholder(props.componentProps?.modelValue);
|
|
11
|
+
}
|
|
12
|
+
return h(_Editor, props.componentProps, slots);
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
15
|
+
name: "CoFieldEditor",
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
props: ["componentProps", "componentSlots", "readonly"],
|
|
18
|
+
slots: {}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export { stdin_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useNamespace,
|
|
1
|
+
import { useNamespace, ElIcon, ElInput } from 'element-plus';
|
|
2
2
|
import { defineComponent, ref, computed, h, mergeProps } from 'vue';
|
|
3
3
|
import { View, Hide } from '@element-plus/icons-vue';
|
|
4
4
|
import { useLocale } from '../../../../hooks/useLocale.js';
|
|
@@ -5,8 +5,8 @@ import { omit } from 'lodash-es';
|
|
|
5
5
|
import { useLocale } from '../../../../hooks/useLocale.js';
|
|
6
6
|
import { useProps } from '../../../../hooks/useProps.js';
|
|
7
7
|
import { addNullablePlaceholder } from '../../../../utils/vue.js';
|
|
8
|
-
import { isFunction } from '../../../../utils/is.js';
|
|
9
8
|
import { getLabelByValue } from '../../../../utils/collection.js';
|
|
9
|
+
import { isFunction } from '../../../../utils/is.js';
|
|
10
10
|
|
|
11
11
|
var stdin_default = defineComponent((props, {
|
|
12
12
|
slots
|