cosey 0.9.5 → 0.10.1
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 +1 -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 +51 -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 +121 -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 +356 -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.js +1 -1
- 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 +6 -6
- package/components/highlight/highlight.style.d.ts +1 -0
- package/components/highlight/highlight.style.js +288 -54
- 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,155 @@
|
|
|
1
|
+
import { Element, Path } from 'slate-vue3/core';
|
|
2
|
+
import { getListTypeAtStartPoint, isList, isListItem } from './utils.js';
|
|
3
|
+
import { isBlockElement } from '../../utils.js';
|
|
4
|
+
|
|
5
|
+
const replaceableElements = [
|
|
6
|
+
"block",
|
|
7
|
+
"paragraph",
|
|
8
|
+
"block-quote",
|
|
9
|
+
"heading-one",
|
|
10
|
+
"heading-two",
|
|
11
|
+
"heading-three",
|
|
12
|
+
"heading-four",
|
|
13
|
+
"heading-five",
|
|
14
|
+
"heading-six"
|
|
15
|
+
];
|
|
16
|
+
function isSameParent(path, another) {
|
|
17
|
+
return Path.equals(Path.parent(path), Path.parent(another));
|
|
18
|
+
}
|
|
19
|
+
function findConsecutiveListItems(editor) {
|
|
20
|
+
const groups = [];
|
|
21
|
+
let currentGroup = [];
|
|
22
|
+
const nodes = Array.from(
|
|
23
|
+
editor.nodes({
|
|
24
|
+
match: (n) => isBlockElement(editor, n)
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
nodes.forEach(([node, path]) => {
|
|
28
|
+
if (isListItem(node) && !isList(editor.parent(path)[0])) {
|
|
29
|
+
if (currentGroup.length === 0 || isSameParent(currentGroup[0].path, path)) {
|
|
30
|
+
currentGroup.push({ node, path });
|
|
31
|
+
} else {
|
|
32
|
+
groups.push([...currentGroup]);
|
|
33
|
+
currentGroup = [{ node, path }];
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
if (currentGroup.length > 0) {
|
|
37
|
+
groups.push([...currentGroup]);
|
|
38
|
+
currentGroup = [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
if (currentGroup.length > 0) {
|
|
43
|
+
groups.push(currentGroup);
|
|
44
|
+
}
|
|
45
|
+
return groups;
|
|
46
|
+
}
|
|
47
|
+
function wrapListItems(editor, type) {
|
|
48
|
+
const [match] = editor.nodes({
|
|
49
|
+
match: (n, path) => isListItem(n) && !isList(editor.parent(path)[0])
|
|
50
|
+
});
|
|
51
|
+
if (!match) return;
|
|
52
|
+
const liGroups = findConsecutiveListItems(editor);
|
|
53
|
+
for (let i = liGroups.length - 1; i >= 0; i--) {
|
|
54
|
+
const group = liGroups[i];
|
|
55
|
+
if (group.length > 0) {
|
|
56
|
+
editor.wrapNodes(
|
|
57
|
+
{
|
|
58
|
+
type,
|
|
59
|
+
children: []
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
at: {
|
|
63
|
+
anchor: editor.start(group[0].path),
|
|
64
|
+
focus: editor.end(group[group.length - 1].path)
|
|
65
|
+
},
|
|
66
|
+
match: isListItem,
|
|
67
|
+
mode: "lowest",
|
|
68
|
+
voids: false
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function getSameLevelSiblings(editor, [node, path]) {
|
|
75
|
+
const [parentNode, parentPath] = editor.parent(path);
|
|
76
|
+
const siblings = [[node, path]];
|
|
77
|
+
const currentIndex = path[path.length - 1];
|
|
78
|
+
for (let i = currentIndex - 1; i >= 0; i--) {
|
|
79
|
+
const childNode = parentNode.children[i];
|
|
80
|
+
if (childNode) {
|
|
81
|
+
if (childNode.level < node.level) {
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
if (childNode.level === node.level) {
|
|
85
|
+
siblings.unshift([childNode, [...parentPath, i]]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (let i = currentIndex + 1; i < parentNode.children.length; i++) {
|
|
90
|
+
const childNode = parentNode.children[i];
|
|
91
|
+
if (childNode) {
|
|
92
|
+
if (childNode.level < node.level) {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (childNode.level === node.level) {
|
|
96
|
+
siblings.push([childNode, [...parentPath, i]]);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return siblings;
|
|
101
|
+
}
|
|
102
|
+
function formatList(editor, value) {
|
|
103
|
+
if (!editor.selection) return;
|
|
104
|
+
const listType = getListTypeAtStartPoint(editor);
|
|
105
|
+
if (listType === value) {
|
|
106
|
+
editor.unwrapNodes({
|
|
107
|
+
match: isList,
|
|
108
|
+
split: true
|
|
109
|
+
});
|
|
110
|
+
editor.setNodes(
|
|
111
|
+
{
|
|
112
|
+
type: "paragraph"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
match: isListItem
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
} else {
|
|
119
|
+
const nodeEntries = Array.from(
|
|
120
|
+
editor.nodes({
|
|
121
|
+
match: isListItem
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
editor.withoutNormalizing(() => {
|
|
125
|
+
for (const nodeEntry of nodeEntries) {
|
|
126
|
+
const siblings = getSameLevelSiblings(editor, nodeEntry);
|
|
127
|
+
siblings.forEach(([siblingNode, siblingPath]) => {
|
|
128
|
+
if (siblingNode.listType !== value) {
|
|
129
|
+
editor.setNodes(
|
|
130
|
+
{
|
|
131
|
+
listType: value
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
at: siblingPath
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
editor.setNodes(
|
|
141
|
+
{
|
|
142
|
+
type: "list-item",
|
|
143
|
+
level: 0,
|
|
144
|
+
listType: value
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
match: (n) => Element.isElement(n) && replaceableElements.includes(n.type)
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
wrapListItems(editor, value);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export { formatList };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isListItem, LIST_MAX_LEVEL, isList } from './utils.js';
|
|
2
|
+
|
|
3
|
+
function formatIndent(editor, value) {
|
|
4
|
+
const listItemNodes = Array.from(
|
|
5
|
+
editor.nodes({
|
|
6
|
+
match: isListItem
|
|
7
|
+
})
|
|
8
|
+
).map(([node, path]) => [node, editor.pathRef(path)]);
|
|
9
|
+
for (const [node, path] of listItemNodes) {
|
|
10
|
+
const nextLevel = Math.min((node.level || 0) + value, LIST_MAX_LEVEL - 1);
|
|
11
|
+
if (nextLevel < 0) {
|
|
12
|
+
editor.unwrapNodes({
|
|
13
|
+
match: isList,
|
|
14
|
+
split: true,
|
|
15
|
+
at: path.current
|
|
16
|
+
});
|
|
17
|
+
editor.setNodes(
|
|
18
|
+
{
|
|
19
|
+
type: "paragraph"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
at: path.unref()
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
} else if (node.level !== nextLevel) {
|
|
26
|
+
editor.setNodes(
|
|
27
|
+
{
|
|
28
|
+
level: nextLevel
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
at: path.unref()
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { formatIndent };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Editor } from 'slate-vue3/core';
|
|
2
|
+
import { ListItemElement, ListType } from '../../types';
|
|
3
|
+
declare module 'slate-vue3/core' {
|
|
4
|
+
interface BaseEditor {
|
|
5
|
+
formatList: (value: ListType) => void;
|
|
6
|
+
isListItem: (element: unknown) => element is ListItemElement;
|
|
7
|
+
getListTypeAtStartPoint: () => ListType | undefined;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare function withList(editor: Editor): import("../../types").CustomEditor;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import stdin_default from '../../contents/content-list-item.js';
|
|
2
|
+
import { h } from 'vue';
|
|
3
|
+
import { useInheritRef } from 'slate-vue3';
|
|
4
|
+
import { normalizeNode } from './normalize.js';
|
|
5
|
+
import { isListItem, getListTypeAtStartPoint } from './utils.js';
|
|
6
|
+
import { formatList } from './format.js';
|
|
7
|
+
import { formatIndent } from './indent.js';
|
|
8
|
+
import { insertBreak } from './insert-break.js';
|
|
9
|
+
|
|
10
|
+
function withList(editor) {
|
|
11
|
+
const {
|
|
12
|
+
insertBreak: srcInsertBreak,
|
|
13
|
+
renderElement,
|
|
14
|
+
formatIndent: srcFormatIndent,
|
|
15
|
+
normalizeNode: srcNormalizeNode
|
|
16
|
+
} = editor;
|
|
17
|
+
editor.renderElement = (props) => {
|
|
18
|
+
const { attributes, children, element } = props;
|
|
19
|
+
switch (element.type) {
|
|
20
|
+
case "bulleted-list":
|
|
21
|
+
return h("ul", attributes, children);
|
|
22
|
+
case "numbered-list":
|
|
23
|
+
return h("ol", attributes, children);
|
|
24
|
+
case "list-item":
|
|
25
|
+
return h(
|
|
26
|
+
stdin_default,
|
|
27
|
+
{
|
|
28
|
+
...useInheritRef(attributes),
|
|
29
|
+
level: element.level,
|
|
30
|
+
listType: element.listType
|
|
31
|
+
},
|
|
32
|
+
() => children
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return renderElement(props);
|
|
36
|
+
};
|
|
37
|
+
editor.formatIndent = (value) => {
|
|
38
|
+
formatIndent(editor, value);
|
|
39
|
+
srcFormatIndent(value);
|
|
40
|
+
};
|
|
41
|
+
editor.insertBreak = () => {
|
|
42
|
+
if (!insertBreak(editor)) {
|
|
43
|
+
srcInsertBreak();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
editor.formatList = (value) => {
|
|
47
|
+
formatList(editor, value);
|
|
48
|
+
};
|
|
49
|
+
editor.isListItem = isListItem;
|
|
50
|
+
editor.normalizeNode = (entry, options) => {
|
|
51
|
+
if (!normalizeNode(editor, entry)) {
|
|
52
|
+
srcNormalizeNode(entry, options);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
editor.getListTypeAtStartPoint = () => {
|
|
56
|
+
return getListTypeAtStartPoint(editor);
|
|
57
|
+
};
|
|
58
|
+
return editor;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { withList };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Editor } from 'slate-vue3/core';
|
|
2
|
+
import { isListItem } from './utils.js';
|
|
3
|
+
import { formatIndent } from './indent.js';
|
|
4
|
+
|
|
5
|
+
function insertBreak(editor) {
|
|
6
|
+
const [match] = editor.nodes({
|
|
7
|
+
match: isListItem,
|
|
8
|
+
mode: "lowest"
|
|
9
|
+
});
|
|
10
|
+
if (match) {
|
|
11
|
+
const [node] = match;
|
|
12
|
+
if (Editor.isEmpty(editor, node)) {
|
|
13
|
+
formatIndent(editor, -1);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { insertBreak };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Text, Node, Element } from 'slate-vue3/core';
|
|
2
|
+
import { getPreviousSibling, getNextSibling } from '../../utils.js';
|
|
3
|
+
import { isList, isListItem } from './utils.js';
|
|
4
|
+
|
|
5
|
+
function mergeListWithPreviousSiblingList(editor, [node, path]) {
|
|
6
|
+
if (!isList(node)) return;
|
|
7
|
+
const previousSibling = editor.previous({
|
|
8
|
+
at: path
|
|
9
|
+
});
|
|
10
|
+
if (!previousSibling) return;
|
|
11
|
+
const [previousSiblingNode] = previousSibling;
|
|
12
|
+
if (!isList(previousSiblingNode)) return;
|
|
13
|
+
if (previousSiblingNode.type !== node.type) return;
|
|
14
|
+
editor.mergeNodes({
|
|
15
|
+
at: path
|
|
16
|
+
});
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
function getPreviousSameLevelSibling(editor, [node, path]) {
|
|
20
|
+
return getPreviousSibling(editor, path, {
|
|
21
|
+
quit(n) {
|
|
22
|
+
return isListItem(n) && n.level < node.level;
|
|
23
|
+
},
|
|
24
|
+
match(n) {
|
|
25
|
+
return isListItem(n) && n.level === node.level;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function getNextSameLevelSibling(editor, [node, path]) {
|
|
30
|
+
return getNextSibling(editor, path, {
|
|
31
|
+
quit(n) {
|
|
32
|
+
return isListItem(n) && n.level < node.level;
|
|
33
|
+
},
|
|
34
|
+
match(n) {
|
|
35
|
+
return isListItem(n) && n.level === node.level;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function keepSameWithSibling(editor, entry, sibling) {
|
|
40
|
+
const [node, path] = entry;
|
|
41
|
+
const [siblingNode] = sibling;
|
|
42
|
+
if (siblingNode.listType !== node.listType) {
|
|
43
|
+
editor.setNodes(
|
|
44
|
+
{
|
|
45
|
+
listType: siblingNode.listType
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
at: path
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function normalizeSiblingLists(editor, entry) {
|
|
55
|
+
const normalized = mergeListWithPreviousSiblingList(editor, entry);
|
|
56
|
+
if (normalized) return true;
|
|
57
|
+
const [, path] = entry;
|
|
58
|
+
const nextSibling = editor.next({
|
|
59
|
+
at: path
|
|
60
|
+
});
|
|
61
|
+
if (nextSibling) {
|
|
62
|
+
return mergeListWithPreviousSiblingList(editor, nextSibling);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function normalizeSameTypeWithSibling(editor, entry) {
|
|
66
|
+
const [node] = entry;
|
|
67
|
+
if (!isListItem(node)) return;
|
|
68
|
+
const prevSibling = getPreviousSameLevelSibling(editor, entry);
|
|
69
|
+
if (prevSibling) {
|
|
70
|
+
const normalized = keepSameWithSibling(
|
|
71
|
+
editor,
|
|
72
|
+
entry,
|
|
73
|
+
prevSibling
|
|
74
|
+
);
|
|
75
|
+
if (normalized) return true;
|
|
76
|
+
const nextSibling = getNextSameLevelSibling(editor, entry);
|
|
77
|
+
if (nextSibling) {
|
|
78
|
+
return keepSameWithSibling(editor, nextSibling, entry);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
const nextSibling = getNextSameLevelSibling(editor, entry);
|
|
82
|
+
if (nextSibling) {
|
|
83
|
+
return keepSameWithSibling(editor, entry, nextSibling);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function normalizeLisItemChildren(editor, [node, path]) {
|
|
88
|
+
if (!isListItem(node)) return;
|
|
89
|
+
const children = Array.from(Node.children(editor, path));
|
|
90
|
+
for (const [childNode, childPath] of children) {
|
|
91
|
+
if (Element.isElement(childNode) && !editor.isInline(childNode)) {
|
|
92
|
+
editor.unwrapNodes({
|
|
93
|
+
at: childPath
|
|
94
|
+
});
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function normalizeLisItem(editor, entry) {
|
|
100
|
+
const [node, path] = entry;
|
|
101
|
+
if (!isListItem(node)) return;
|
|
102
|
+
if (!isList(Node.parent(editor, path))) {
|
|
103
|
+
editor.setNodes(
|
|
104
|
+
{
|
|
105
|
+
type: "paragraph"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
at: path
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function normalizeList(editor, [node, path]) {
|
|
115
|
+
if (!isList(node)) return;
|
|
116
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
117
|
+
const childNode = node.children[i];
|
|
118
|
+
if (!isListItem(childNode)) {
|
|
119
|
+
if (Text.isText(childNode)) {
|
|
120
|
+
editor.wrapNodes(
|
|
121
|
+
{
|
|
122
|
+
type: "list-item",
|
|
123
|
+
level: 0,
|
|
124
|
+
listType: node.type,
|
|
125
|
+
children: []
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
at: [...path, i]
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
editor.setNodes(
|
|
134
|
+
{
|
|
135
|
+
type: "list-item",
|
|
136
|
+
level: 0,
|
|
137
|
+
listType: node.type
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
at: [...path, i]
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const topLevelChildNodes = node.children.filter(
|
|
147
|
+
(item) => isListItem(item) && item.level === 0
|
|
148
|
+
);
|
|
149
|
+
if (topLevelChildNodes.length > 0) {
|
|
150
|
+
const listType = topLevelChildNodes[0].listType;
|
|
151
|
+
if (listType !== node.type) {
|
|
152
|
+
editor.setNodes(
|
|
153
|
+
{
|
|
154
|
+
type: listType
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
at: path
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function normalizeNode(editor, entry) {
|
|
165
|
+
return normalizeList(editor, entry) || normalizeSiblingLists(editor, entry) || normalizeLisItem(editor, entry) || normalizeSameTypeWithSibling(editor, entry) || normalizeLisItemChildren(editor, entry);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export { normalizeNode };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function findSameLevelListType(items, index, level) {
|
|
2
|
+
for (let i = index; i < items.length; i++) {
|
|
3
|
+
const item = items[i];
|
|
4
|
+
if (item.level === level) {
|
|
5
|
+
return `nested-${items[i].listType}`;
|
|
6
|
+
}
|
|
7
|
+
if (item.level < level) {
|
|
8
|
+
return "nested-bulleted-list";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return "nested-bulleted-list";
|
|
12
|
+
}
|
|
13
|
+
function serializeList(node, serialize) {
|
|
14
|
+
const rootListItem = {
|
|
15
|
+
type: "nested-list-item",
|
|
16
|
+
children: [],
|
|
17
|
+
parent: null
|
|
18
|
+
};
|
|
19
|
+
let currentList = null;
|
|
20
|
+
let prevLevel = -1;
|
|
21
|
+
let prevListItem = rootListItem;
|
|
22
|
+
node.children.forEach((childNode, index) => {
|
|
23
|
+
const level = childNode.level;
|
|
24
|
+
let diffLevel = level - prevLevel;
|
|
25
|
+
if (diffLevel > 0) {
|
|
26
|
+
while (--diffLevel) {
|
|
27
|
+
currentList = {
|
|
28
|
+
type: findSameLevelListType(node.children, index, level - diffLevel),
|
|
29
|
+
children: [],
|
|
30
|
+
parent: prevListItem
|
|
31
|
+
};
|
|
32
|
+
prevListItem.children.push(currentList);
|
|
33
|
+
prevListItem = {
|
|
34
|
+
type: "nested-list-item",
|
|
35
|
+
children: [{ text: "" }],
|
|
36
|
+
parent: currentList
|
|
37
|
+
};
|
|
38
|
+
currentList.children.push(prevListItem);
|
|
39
|
+
}
|
|
40
|
+
currentList = {
|
|
41
|
+
type: `nested-${childNode.listType}`,
|
|
42
|
+
children: [],
|
|
43
|
+
parent: prevListItem
|
|
44
|
+
};
|
|
45
|
+
prevListItem.children.push(currentList);
|
|
46
|
+
} else if (diffLevel < 0) {
|
|
47
|
+
while (diffLevel++) {
|
|
48
|
+
currentList = currentList.parent.parent;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const listItemNode = {
|
|
52
|
+
type: "nested-list-item",
|
|
53
|
+
children: [...childNode.children],
|
|
54
|
+
parent: currentList
|
|
55
|
+
};
|
|
56
|
+
currentList.children.push(listItemNode);
|
|
57
|
+
prevListItem = listItemNode;
|
|
58
|
+
prevLevel = level;
|
|
59
|
+
});
|
|
60
|
+
return serialize(rootListItem.children[0]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { serializeList };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Editor } from 'slate-vue3/core';
|
|
2
|
+
import { BulletedListElement, ListItemElement, ListType, NumberedListElement } from '../../types';
|
|
3
|
+
export declare const LIST_MAX_LEVEL = 6;
|
|
4
|
+
export declare function isListItem(element: unknown): element is ListItemElement;
|
|
5
|
+
export declare function isList(element: unknown): element is BulletedListElement | NumberedListElement;
|
|
6
|
+
export declare function getListTypeAtStartPoint(editor: Editor): ListType | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Element } from 'slate-vue3/core';
|
|
2
|
+
|
|
3
|
+
const LIST_MAX_LEVEL = 6;
|
|
4
|
+
function isListItem(element) {
|
|
5
|
+
return Element.isElementType(element, "list-item");
|
|
6
|
+
}
|
|
7
|
+
function isList(element) {
|
|
8
|
+
return Element.isElement(element) && (element.type === "numbered-list" || element.type === "bulleted-list");
|
|
9
|
+
}
|
|
10
|
+
function getListTypeAtStartPoint(editor) {
|
|
11
|
+
if (!editor.selection) return;
|
|
12
|
+
const [start] = editor.edges(editor.selection);
|
|
13
|
+
const [entry] = Array.from(
|
|
14
|
+
editor.nodes({
|
|
15
|
+
at: start,
|
|
16
|
+
match: isListItem
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
if (entry) {
|
|
20
|
+
return entry[0].listType;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { LIST_MAX_LEVEL, getListTypeAtStartPoint, isList, isListItem };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Range, Editor } from 'slate-vue3/core';
|
|
2
|
+
|
|
3
|
+
function formatMark(editor, mark) {
|
|
4
|
+
if (!editor.selection) return;
|
|
5
|
+
if (Range.isCollapsed(editor.selection)) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const marks = Editor.marks(editor);
|
|
9
|
+
if ("superscript" in marks && mark === "subscript") {
|
|
10
|
+
Editor.removeMark(editor, "superscript");
|
|
11
|
+
} else if ("subscript" in marks && mark === "superscript") {
|
|
12
|
+
Editor.removeMark(editor, "subscript");
|
|
13
|
+
}
|
|
14
|
+
if (marks[mark]) {
|
|
15
|
+
Editor.removeMark(editor, mark);
|
|
16
|
+
} else {
|
|
17
|
+
Editor.addMark(editor, mark, true);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function withMark(editor) {
|
|
21
|
+
editor.formatMark = (mark) => {
|
|
22
|
+
formatMark(editor, mark);
|
|
23
|
+
};
|
|
24
|
+
return editor;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { withMark };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
import { type RenderElementProps, type RenderLeafProps } from 'slate-vue3';
|
|
3
|
+
import { Editor } from 'slate-vue3/core';
|
|
4
|
+
export declare const INDENT_DELTA = 40;
|
|
5
|
+
declare module 'slate-vue3/core' {
|
|
6
|
+
interface BaseEditor {
|
|
7
|
+
renderElement: (props: RenderElementProps) => VNode;
|
|
8
|
+
renderLeaf: (props: RenderLeafProps) => VNode;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare function withRender(editor: Editor): import("../types").CustomEditor;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { h } from 'vue';
|
|
2
|
+
import { mapElementTypeTagName } from '../types.js';
|
|
3
|
+
|
|
4
|
+
const INDENT_DELTA = 40;
|
|
5
|
+
const renderElement = ({ attributes: attrs, children, element }) => {
|
|
6
|
+
const attributes = {
|
|
7
|
+
...attrs,
|
|
8
|
+
style: {
|
|
9
|
+
textAlign: "align" in element ? element.align : void 0,
|
|
10
|
+
paddingLeft: "indent" in element && element.indent ? element.indent * INDENT_DELTA + "px" : ""
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const tagName = mapElementTypeTagName[element.type] || mapElementTypeTagName.paragraph;
|
|
14
|
+
return h(tagName, attributes, children);
|
|
15
|
+
};
|
|
16
|
+
const renderLeaf = ({ leaf, attributes, children }) => {
|
|
17
|
+
const {
|
|
18
|
+
text,
|
|
19
|
+
bold,
|
|
20
|
+
italic,
|
|
21
|
+
underline,
|
|
22
|
+
strikethrough,
|
|
23
|
+
code,
|
|
24
|
+
superscript,
|
|
25
|
+
subscript,
|
|
26
|
+
font,
|
|
27
|
+
size,
|
|
28
|
+
color,
|
|
29
|
+
background,
|
|
30
|
+
...rest
|
|
31
|
+
} = leaf;
|
|
32
|
+
const style = {
|
|
33
|
+
fontWeight: bold ? "bold" : void 0,
|
|
34
|
+
fontStyle: italic ? "italic" : void 0,
|
|
35
|
+
borderBottom: underline ? "1px solid black" : void 0,
|
|
36
|
+
textDecoration: strikethrough ? "line-through" : void 0,
|
|
37
|
+
fontFamily: font ? font : void 0,
|
|
38
|
+
fontSize: size ? size : void 0,
|
|
39
|
+
color: color ? color : void 0,
|
|
40
|
+
background: background ? background : void 0
|
|
41
|
+
};
|
|
42
|
+
return h(
|
|
43
|
+
code ? "code" : superscript ? "sup" : subscript ? "sub" : "span",
|
|
44
|
+
{ ...attributes, style, class: Object.keys(rest).join(" ") },
|
|
45
|
+
children
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
function withRender(editor) {
|
|
49
|
+
editor.renderLeaf = renderLeaf;
|
|
50
|
+
editor.renderElement = renderElement;
|
|
51
|
+
return editor;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { INDENT_DELTA, withRender };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Descendant, Editor } from 'slate-vue3/core';
|
|
2
|
+
declare module 'slate-vue3/core' {
|
|
3
|
+
interface BaseEditor {
|
|
4
|
+
serialize: () => string;
|
|
5
|
+
deserialize: (html: string) => Descendant[];
|
|
6
|
+
setContent: (html: string) => void;
|
|
7
|
+
getContent: () => string;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare function withSerialize(editor: Editor): import("../types").CustomEditor;
|