@kaitify/react 0.0.1-beta.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/LICENSE +21 -0
- package/README.md +3 -0
- package/docs/.vitepress/cache/deps/_metadata.json +52 -0
- package/docs/.vitepress/cache/deps/chunk-Q2AYPHVK.js +9719 -0
- package/docs/.vitepress/cache/deps/chunk-Q2AYPHVK.js.map +7 -0
- package/docs/.vitepress/cache/deps/chunk-QAXAIFA7.js +12705 -0
- package/docs/.vitepress/cache/deps/chunk-QAXAIFA7.js.map +7 -0
- package/docs/.vitepress/cache/deps/package.json +3 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4505 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +583 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1145 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1665 -0
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js +1813 -0
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
- package/docs/.vitepress/cache/deps/vue.js +343 -0
- package/docs/.vitepress/cache/deps/vue.js.map +7 -0
- package/docs/.vitepress/config.ts +185 -0
- package/docs/.vitepress/global.d.ts +1 -0
- package/docs/.vitepress/theme/index.ts +6 -0
- package/docs/.vitepress/theme/style.less +17 -0
- package/docs/.vitepress/tsconfig.json +12 -0
- package/docs/changelog.md +10 -0
- package/docs/guide/bubble.md +71 -0
- package/docs/guide/checkbox.md +38 -0
- package/docs/guide/divider.md +41 -0
- package/docs/guide/icon.md +34 -0
- package/docs/guide/install.md +70 -0
- package/docs/guide/introduction.md +28 -0
- package/docs/guide/locale.md +67 -0
- package/docs/guide/menu.md +112 -0
- package/docs/guide/quick-start.md +76 -0
- package/docs/guide/shortcut.md +77 -0
- package/docs/guide/tabs.md +42 -0
- package/docs/guide/wrapper.md +303 -0
- package/docs/index.md +41 -0
- package/docs/menus/built-in/align-center.md +29 -0
- package/docs/menus/built-in/align-justify.md +29 -0
- package/docs/menus/built-in/align-left.md +29 -0
- package/docs/menus/built-in/align-right.md +29 -0
- package/docs/menus/built-in/attachment.md +41 -0
- package/docs/menus/built-in/back-color.md +33 -0
- package/docs/menus/built-in/blockquote.md +29 -0
- package/docs/menus/built-in/bold.md +29 -0
- package/docs/menus/built-in/clear-format.md +29 -0
- package/docs/menus/built-in/code-block-languages.md +37 -0
- package/docs/menus/built-in/code-block.md +29 -0
- package/docs/menus/built-in/code.md +29 -0
- package/docs/menus/built-in/color.md +33 -0
- package/docs/menus/built-in/decrease-indent.md +29 -0
- package/docs/menus/built-in/emoji.md +35 -0
- package/docs/menus/built-in/font-family.md +44 -0
- package/docs/menus/built-in/font-size.md +44 -0
- package/docs/menus/built-in/full-screen.md +39 -0
- package/docs/menus/built-in/heading.md +66 -0
- package/docs/menus/built-in/horizontal.md +29 -0
- package/docs/menus/built-in/image.md +41 -0
- package/docs/menus/built-in/increase-indent.md +29 -0
- package/docs/menus/built-in/italic.md +29 -0
- package/docs/menus/built-in/line-height.md +44 -0
- package/docs/menus/built-in/link-unset.md +29 -0
- package/docs/menus/built-in/link.md +29 -0
- package/docs/menus/built-in/math.md +29 -0
- package/docs/menus/built-in/ordered-list.md +29 -0
- package/docs/menus/built-in/redo.md +25 -0
- package/docs/menus/built-in/strikethrough.md +29 -0
- package/docs/menus/built-in/subscript.md +29 -0
- package/docs/menus/built-in/superscript.md +29 -0
- package/docs/menus/built-in/table-add-column.md +33 -0
- package/docs/menus/built-in/table-add-row.md +33 -0
- package/docs/menus/built-in/table-delete-column.md +29 -0
- package/docs/menus/built-in/table-delete-row.md +29 -0
- package/docs/menus/built-in/table-merge-cell.md +33 -0
- package/docs/menus/built-in/table-unset.md +29 -0
- package/docs/menus/built-in/table.md +37 -0
- package/docs/menus/built-in/task.md +29 -0
- package/docs/menus/built-in/underline.md +29 -0
- package/docs/menus/built-in/undo.md +25 -0
- package/docs/menus/built-in/unordered-list.md +29 -0
- package/docs/menus/built-in/video-controls.md +29 -0
- package/docs/menus/built-in/video-loop.md +29 -0
- package/docs/menus/built-in/video-muted.md +29 -0
- package/docs/menus/built-in/video.md +41 -0
- package/docs/menus/built-in/wrap-down.md +33 -0
- package/docs/menus/built-in/wrap-up.md +33 -0
- package/docs/menus/introduction.md +27 -0
- package/examples/App.tsx +179 -0
- package/examples/main.tsx +9 -0
- package/examples/style.less +21 -0
- package/index.html +13 -0
- package/lib/core/button/button.d.ts +5 -0
- package/lib/core/button/index.d.ts +3 -0
- package/lib/core/button/props.d.ts +38 -0
- package/lib/core/checkbox/checkbox.d.ts +5 -0
- package/lib/core/checkbox/index.d.ts +3 -0
- package/lib/core/checkbox/props.d.ts +21 -0
- package/lib/core/divider/divider.d.ts +4 -0
- package/lib/core/divider/index.d.ts +2 -0
- package/lib/core/icon/icon.d.ts +5 -0
- package/lib/core/icon/index.d.ts +3 -0
- package/lib/core/icon/props.d.ts +22 -0
- package/lib/core/popover/index.d.ts +3 -0
- package/lib/core/popover/popover.d.ts +7 -0
- package/lib/core/popover/props.d.ts +94 -0
- package/lib/core/tabs/index.d.ts +3 -0
- package/lib/core/tabs/props.d.ts +21 -0
- package/lib/core/tabs/tabs.d.ts +2 -0
- package/lib/core/teleport/index.d.ts +3 -0
- package/lib/core/teleport/props.d.ts +11 -0
- package/lib/core/teleport/teleport.d.ts +5 -0
- package/lib/editor/bubble/bubble.d.ts +6 -0
- package/lib/editor/bubble/index.d.ts +3 -0
- package/lib/editor/bubble/props.d.ts +63 -0
- package/lib/editor/menu/built-in/align-center/align-center.d.ts +2 -0
- package/lib/editor/menu/built-in/align-center/index.d.ts +3 -0
- package/lib/editor/menu/built-in/align-center/props.d.ts +10 -0
- package/lib/editor/menu/built-in/align-justify/align-justify.d.ts +2 -0
- package/lib/editor/menu/built-in/align-justify/index.d.ts +3 -0
- package/lib/editor/menu/built-in/align-justify/props.d.ts +10 -0
- package/lib/editor/menu/built-in/align-left/align-left.d.ts +2 -0
- package/lib/editor/menu/built-in/align-left/index.d.ts +3 -0
- package/lib/editor/menu/built-in/align-left/props.d.ts +10 -0
- package/lib/editor/menu/built-in/align-right/align-right.d.ts +2 -0
- package/lib/editor/menu/built-in/align-right/index.d.ts +3 -0
- package/lib/editor/menu/built-in/align-right/props.d.ts +10 -0
- package/lib/editor/menu/built-in/attachment/attachment.d.ts +2 -0
- package/lib/editor/menu/built-in/attachment/index.d.ts +3 -0
- package/lib/editor/menu/built-in/attachment/props.d.ts +26 -0
- package/lib/editor/menu/built-in/back-color/back-color.d.ts +2 -0
- package/lib/editor/menu/built-in/back-color/index.d.ts +3 -0
- package/lib/editor/menu/built-in/back-color/props.d.ts +15 -0
- package/lib/editor/menu/built-in/blockquote/blockquote.d.ts +2 -0
- package/lib/editor/menu/built-in/blockquote/index.d.ts +3 -0
- package/lib/editor/menu/built-in/blockquote/props.d.ts +10 -0
- package/lib/editor/menu/built-in/bold/bold.d.ts +2 -0
- package/lib/editor/menu/built-in/bold/index.d.ts +3 -0
- package/lib/editor/menu/built-in/bold/props.d.ts +10 -0
- package/lib/editor/menu/built-in/clear-format/clear-format.d.ts +2 -0
- package/lib/editor/menu/built-in/clear-format/index.d.ts +3 -0
- package/lib/editor/menu/built-in/clear-format/props.d.ts +10 -0
- package/lib/editor/menu/built-in/code/code.d.ts +2 -0
- package/lib/editor/menu/built-in/code/index.d.ts +3 -0
- package/lib/editor/menu/built-in/code/props.d.ts +10 -0
- package/lib/editor/menu/built-in/code-block/code-block-languages.d.ts +2 -0
- package/lib/editor/menu/built-in/code-block/code-block.d.ts +2 -0
- package/lib/editor/menu/built-in/code-block/index.d.ts +4 -0
- package/lib/editor/menu/built-in/code-block/props.d.ts +32 -0
- package/lib/editor/menu/built-in/color/color.d.ts +2 -0
- package/lib/editor/menu/built-in/color/index.d.ts +3 -0
- package/lib/editor/menu/built-in/color/props.d.ts +15 -0
- package/lib/editor/menu/built-in/decrease-indent/decrease-indent.d.ts +2 -0
- package/lib/editor/menu/built-in/decrease-indent/index.d.ts +3 -0
- package/lib/editor/menu/built-in/decrease-indent/props.d.ts +10 -0
- package/lib/editor/menu/built-in/emoji/emoji.d.ts +2 -0
- package/lib/editor/menu/built-in/emoji/index.d.ts +3 -0
- package/lib/editor/menu/built-in/emoji/props.d.ts +15 -0
- package/lib/editor/menu/built-in/font-family/font-family.d.ts +2 -0
- package/lib/editor/menu/built-in/font-family/index.d.ts +3 -0
- package/lib/editor/menu/built-in/font-family/props.d.ts +21 -0
- package/lib/editor/menu/built-in/font-size/font-size.d.ts +2 -0
- package/lib/editor/menu/built-in/font-size/index.d.ts +3 -0
- package/lib/editor/menu/built-in/font-size/props.d.ts +21 -0
- package/lib/editor/menu/built-in/full-screen/full-screen.d.ts +2 -0
- package/lib/editor/menu/built-in/full-screen/index.d.ts +3 -0
- package/lib/editor/menu/built-in/full-screen/props.d.ts +18 -0
- package/lib/editor/menu/built-in/heading/heading.d.ts +2 -0
- package/lib/editor/menu/built-in/heading/index.d.ts +3 -0
- package/lib/editor/menu/built-in/heading/props.d.ts +21 -0
- package/lib/editor/menu/built-in/horizontal/horizontal.d.ts +2 -0
- package/lib/editor/menu/built-in/horizontal/index.d.ts +3 -0
- package/lib/editor/menu/built-in/horizontal/props.d.ts +10 -0
- package/lib/editor/menu/built-in/image/image.d.ts +2 -0
- package/lib/editor/menu/built-in/image/index.d.ts +3 -0
- package/lib/editor/menu/built-in/image/props.d.ts +26 -0
- package/lib/editor/menu/built-in/increase-indent/increase-indent.d.ts +2 -0
- package/lib/editor/menu/built-in/increase-indent/index.d.ts +3 -0
- package/lib/editor/menu/built-in/increase-indent/props.d.ts +10 -0
- package/lib/editor/menu/built-in/index.d.ts +38 -0
- package/lib/editor/menu/built-in/italic/index.d.ts +3 -0
- package/lib/editor/menu/built-in/italic/italic.d.ts +2 -0
- package/lib/editor/menu/built-in/italic/props.d.ts +10 -0
- package/lib/editor/menu/built-in/line-height/index.d.ts +3 -0
- package/lib/editor/menu/built-in/line-height/line-height.d.ts +2 -0
- package/lib/editor/menu/built-in/line-height/props.d.ts +21 -0
- package/lib/editor/menu/built-in/link/index.d.ts +4 -0
- package/lib/editor/menu/built-in/link/link-unset.d.ts +2 -0
- package/lib/editor/menu/built-in/link/link.d.ts +2 -0
- package/lib/editor/menu/built-in/link/props.d.ts +21 -0
- package/lib/editor/menu/built-in/math/index.d.ts +3 -0
- package/lib/editor/menu/built-in/math/math.d.ts +2 -0
- package/lib/editor/menu/built-in/math/props.d.ts +11 -0
- package/lib/editor/menu/built-in/ordered-list/index.d.ts +3 -0
- package/lib/editor/menu/built-in/ordered-list/ordered-list.d.ts +2 -0
- package/lib/editor/menu/built-in/ordered-list/props.d.ts +11 -0
- package/lib/editor/menu/built-in/redo/index.d.ts +3 -0
- package/lib/editor/menu/built-in/redo/props.d.ts +6 -0
- package/lib/editor/menu/built-in/redo/redo.d.ts +2 -0
- package/lib/editor/menu/built-in/strikethrough/index.d.ts +3 -0
- package/lib/editor/menu/built-in/strikethrough/props.d.ts +10 -0
- package/lib/editor/menu/built-in/strikethrough/strikethrough.d.ts +2 -0
- package/lib/editor/menu/built-in/subscript/index.d.ts +3 -0
- package/lib/editor/menu/built-in/subscript/props.d.ts +10 -0
- package/lib/editor/menu/built-in/subscript/subscript.d.ts +2 -0
- package/lib/editor/menu/built-in/superscript/index.d.ts +3 -0
- package/lib/editor/menu/built-in/superscript/props.d.ts +10 -0
- package/lib/editor/menu/built-in/superscript/superscript.d.ts +2 -0
- package/lib/editor/menu/built-in/table/index.d.ts +9 -0
- package/lib/editor/menu/built-in/table/props.d.ts +97 -0
- package/lib/editor/menu/built-in/table/table-add-column.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-add-row.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-delete-column.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-delete-row.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-merge-cell.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table-unset.d.ts +2 -0
- package/lib/editor/menu/built-in/table/table.d.ts +2 -0
- package/lib/editor/menu/built-in/task/index.d.ts +3 -0
- package/lib/editor/menu/built-in/task/props.d.ts +10 -0
- package/lib/editor/menu/built-in/task/task.d.ts +2 -0
- package/lib/editor/menu/built-in/underline/index.d.ts +3 -0
- package/lib/editor/menu/built-in/underline/props.d.ts +10 -0
- package/lib/editor/menu/built-in/underline/underline.d.ts +2 -0
- package/lib/editor/menu/built-in/undo/index.d.ts +3 -0
- package/lib/editor/menu/built-in/undo/props.d.ts +6 -0
- package/lib/editor/menu/built-in/undo/undo.d.ts +2 -0
- package/lib/editor/menu/built-in/unordered-list/index.d.ts +3 -0
- package/lib/editor/menu/built-in/unordered-list/props.d.ts +11 -0
- package/lib/editor/menu/built-in/unordered-list/unordered-list.d.ts +2 -0
- package/lib/editor/menu/built-in/video/index.d.ts +6 -0
- package/lib/editor/menu/built-in/video/props.d.ts +56 -0
- package/lib/editor/menu/built-in/video/video-controls.d.ts +2 -0
- package/lib/editor/menu/built-in/video/video-loop.d.ts +2 -0
- package/lib/editor/menu/built-in/video/video-muted.d.ts +2 -0
- package/lib/editor/menu/built-in/video/video.d.ts +2 -0
- package/lib/editor/menu/built-in/wrap-down/index.d.ts +3 -0
- package/lib/editor/menu/built-in/wrap-down/props.d.ts +15 -0
- package/lib/editor/menu/built-in/wrap-down/wrap-down.d.ts +2 -0
- package/lib/editor/menu/built-in/wrap-up/index.d.ts +3 -0
- package/lib/editor/menu/built-in/wrap-up/props.d.ts +15 -0
- package/lib/editor/menu/built-in/wrap-up/wrap-up.d.ts +2 -0
- package/lib/editor/menu/index.d.ts +4 -0
- package/lib/editor/menu/menu.d.ts +6 -0
- package/lib/editor/menu/props.d.ts +89 -0
- package/lib/editor/wrapper/index.d.ts +3 -0
- package/lib/editor/wrapper/props.d.ts +206 -0
- package/lib/editor/wrapper/render.d.ts +18 -0
- package/lib/editor/wrapper/wrapper.d.ts +6 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/use-editor.d.ts +32 -0
- package/lib/index.d.ts +9 -0
- package/lib/kaitify-react.es.js +47868 -0
- package/lib/kaitify-react.umd.js +30 -0
- package/lib/locale/en-us.d.ts +31 -0
- package/lib/locale/index.d.ts +2 -0
- package/lib/locale/ja-jp.d.ts +31 -0
- package/lib/locale/ko-kr.d.ts +31 -0
- package/package.json +56 -0
- package/src/core/button/button.tsx +29 -0
- package/src/core/button/index.ts +3 -0
- package/src/core/button/props.ts +39 -0
- package/src/core/button/style.module.less +57 -0
- package/src/core/checkbox/checkbox.tsx +39 -0
- package/src/core/checkbox/index.ts +3 -0
- package/src/core/checkbox/props.ts +21 -0
- package/src/core/checkbox/style.module.less +99 -0
- package/src/core/divider/divider.tsx +17 -0
- package/src/core/divider/index.ts +2 -0
- package/src/core/divider/style.module.less +12 -0
- package/src/core/icon/icon.tsx +14 -0
- package/src/core/icon/index.ts +3 -0
- package/src/core/icon/props.ts +23 -0
- package/src/core/icon/style.module.less +19 -0
- package/src/core/popover/index.ts +3 -0
- package/src/core/popover/popover.tsx +286 -0
- package/src/core/popover/props.ts +97 -0
- package/src/core/popover/style.module.less +247 -0
- package/src/core/tabs/index.ts +3 -0
- package/src/core/tabs/props.ts +19 -0
- package/src/core/tabs/style.module.less +62 -0
- package/src/core/tabs/tabs.tsx +35 -0
- package/src/core/teleport/index.ts +3 -0
- package/src/core/teleport/props.ts +12 -0
- package/src/core/teleport/teleport.tsx +23 -0
- package/src/editor/bubble/bubble.tsx +244 -0
- package/src/editor/bubble/index.ts +3 -0
- package/src/editor/bubble/props.ts +65 -0
- package/src/editor/bubble/style.module.less +33 -0
- package/src/editor/menu/built-in/align-center/align-center.tsx +37 -0
- package/src/editor/menu/built-in/align-center/index.ts +3 -0
- package/src/editor/menu/built-in/align-center/props.ts +10 -0
- package/src/editor/menu/built-in/align-justify/align-justify.tsx +37 -0
- package/src/editor/menu/built-in/align-justify/index.ts +3 -0
- package/src/editor/menu/built-in/align-justify/props.ts +10 -0
- package/src/editor/menu/built-in/align-left/align-left.tsx +37 -0
- package/src/editor/menu/built-in/align-left/index.ts +3 -0
- package/src/editor/menu/built-in/align-left/props.ts +10 -0
- package/src/editor/menu/built-in/align-right/align-right.tsx +37 -0
- package/src/editor/menu/built-in/align-right/index.ts +3 -0
- package/src/editor/menu/built-in/align-right/props.ts +10 -0
- package/src/editor/menu/built-in/attachment/attachment.tsx +190 -0
- package/src/editor/menu/built-in/attachment/index.ts +3 -0
- package/src/editor/menu/built-in/attachment/props.ts +27 -0
- package/src/editor/menu/built-in/attachment/style.module.less +138 -0
- package/src/editor/menu/built-in/back-color/back-color.tsx +97 -0
- package/src/editor/menu/built-in/back-color/index.ts +3 -0
- package/src/editor/menu/built-in/back-color/props.ts +16 -0
- package/src/editor/menu/built-in/back-color/style.module.less +62 -0
- package/src/editor/menu/built-in/blockquote/blockquote.tsx +36 -0
- package/src/editor/menu/built-in/blockquote/index.ts +3 -0
- package/src/editor/menu/built-in/blockquote/props.ts +10 -0
- package/src/editor/menu/built-in/bold/bold.tsx +45 -0
- package/src/editor/menu/built-in/bold/index.ts +3 -0
- package/src/editor/menu/built-in/bold/props.ts +10 -0
- package/src/editor/menu/built-in/clear-format/clear-format.tsx +28 -0
- package/src/editor/menu/built-in/clear-format/index.ts +3 -0
- package/src/editor/menu/built-in/clear-format/props.ts +10 -0
- package/src/editor/menu/built-in/code/code.tsx +49 -0
- package/src/editor/menu/built-in/code/index.ts +3 -0
- package/src/editor/menu/built-in/code/props.ts +10 -0
- package/src/editor/menu/built-in/code-block/code-block-languages.tsx +73 -0
- package/src/editor/menu/built-in/code-block/code-block.tsx +36 -0
- package/src/editor/menu/built-in/code-block/index.ts +4 -0
- package/src/editor/menu/built-in/code-block/props.ts +32 -0
- package/src/editor/menu/built-in/color/color.tsx +96 -0
- package/src/editor/menu/built-in/color/index.ts +3 -0
- package/src/editor/menu/built-in/color/props.ts +16 -0
- package/src/editor/menu/built-in/color/style.module.less +62 -0
- package/src/editor/menu/built-in/decrease-indent/decrease-indent.tsx +31 -0
- package/src/editor/menu/built-in/decrease-indent/index.ts +3 -0
- package/src/editor/menu/built-in/decrease-indent/props.ts +10 -0
- package/src/editor/menu/built-in/emoji/emoji.tsx +143 -0
- package/src/editor/menu/built-in/emoji/index.ts +3 -0
- package/src/editor/menu/built-in/emoji/props.ts +16 -0
- package/src/editor/menu/built-in/emoji/style.module.less +26 -0
- package/src/editor/menu/built-in/font-family/font-family.tsx +99 -0
- package/src/editor/menu/built-in/font-family/index.ts +3 -0
- package/src/editor/menu/built-in/font-family/props.ts +20 -0
- package/src/editor/menu/built-in/font-size/font-size.tsx +110 -0
- package/src/editor/menu/built-in/font-size/index.ts +3 -0
- package/src/editor/menu/built-in/font-size/props.ts +20 -0
- package/src/editor/menu/built-in/full-screen/full-screen.tsx +66 -0
- package/src/editor/menu/built-in/full-screen/index.ts +3 -0
- package/src/editor/menu/built-in/full-screen/props.ts +18 -0
- package/src/editor/menu/built-in/heading/heading.tsx +101 -0
- package/src/editor/menu/built-in/heading/index.ts +3 -0
- package/src/editor/menu/built-in/heading/props.ts +20 -0
- package/src/editor/menu/built-in/horizontal/horizontal.tsx +40 -0
- package/src/editor/menu/built-in/horizontal/index.ts +3 -0
- package/src/editor/menu/built-in/horizontal/props.ts +10 -0
- package/src/editor/menu/built-in/image/image.tsx +189 -0
- package/src/editor/menu/built-in/image/index.ts +3 -0
- package/src/editor/menu/built-in/image/props.ts +27 -0
- package/src/editor/menu/built-in/image/style.module.less +138 -0
- package/src/editor/menu/built-in/increase-indent/increase-indent.tsx +31 -0
- package/src/editor/menu/built-in/increase-indent/index.ts +3 -0
- package/src/editor/menu/built-in/increase-indent/props.ts +10 -0
- package/src/editor/menu/built-in/index.ts +38 -0
- package/src/editor/menu/built-in/italic/index.ts +3 -0
- package/src/editor/menu/built-in/italic/italic.tsx +45 -0
- package/src/editor/menu/built-in/italic/props.ts +10 -0
- package/src/editor/menu/built-in/line-height/index.ts +3 -0
- package/src/editor/menu/built-in/line-height/line-height.tsx +81 -0
- package/src/editor/menu/built-in/line-height/props.ts +20 -0
- package/src/editor/menu/built-in/link/index.ts +4 -0
- package/src/editor/menu/built-in/link/link-unset.tsx +30 -0
- package/src/editor/menu/built-in/link/link.tsx +147 -0
- package/src/editor/menu/built-in/link/props.ts +23 -0
- package/src/editor/menu/built-in/link/style.module.less +51 -0
- package/src/editor/menu/built-in/math/index.ts +3 -0
- package/src/editor/menu/built-in/math/math.tsx +98 -0
- package/src/editor/menu/built-in/math/props.ts +12 -0
- package/src/editor/menu/built-in/math/style.module.less +54 -0
- package/src/editor/menu/built-in/ordered-list/index.ts +3 -0
- package/src/editor/menu/built-in/ordered-list/ordered-list.tsx +85 -0
- package/src/editor/menu/built-in/ordered-list/props.ts +12 -0
- package/src/editor/menu/built-in/ordered-list/style.module.less +16 -0
- package/src/editor/menu/built-in/redo/index.ts +3 -0
- package/src/editor/menu/built-in/redo/props.ts +6 -0
- package/src/editor/menu/built-in/redo/redo.tsx +30 -0
- package/src/editor/menu/built-in/strikethrough/index.ts +3 -0
- package/src/editor/menu/built-in/strikethrough/props.ts +10 -0
- package/src/editor/menu/built-in/strikethrough/strikethrough.tsx +45 -0
- package/src/editor/menu/built-in/subscript/index.ts +3 -0
- package/src/editor/menu/built-in/subscript/props.ts +10 -0
- package/src/editor/menu/built-in/subscript/subscript.tsx +45 -0
- package/src/editor/menu/built-in/superscript/index.ts +3 -0
- package/src/editor/menu/built-in/superscript/props.ts +10 -0
- package/src/editor/menu/built-in/superscript/superscript.tsx +45 -0
- package/src/editor/menu/built-in/table/index.ts +9 -0
- package/src/editor/menu/built-in/table/props.ts +105 -0
- package/src/editor/menu/built-in/table/style.module.less +63 -0
- package/src/editor/menu/built-in/table/table-add-column.tsx +31 -0
- package/src/editor/menu/built-in/table/table-add-row.tsx +31 -0
- package/src/editor/menu/built-in/table/table-delete-column.tsx +31 -0
- package/src/editor/menu/built-in/table/table-delete-row.tsx +31 -0
- package/src/editor/menu/built-in/table/table-merge-cell.tsx +34 -0
- package/src/editor/menu/built-in/table/table-unset.tsx +31 -0
- package/src/editor/menu/built-in/table/table.tsx +144 -0
- package/src/editor/menu/built-in/task/index.ts +3 -0
- package/src/editor/menu/built-in/task/props.ts +10 -0
- package/src/editor/menu/built-in/task/task.tsx +36 -0
- package/src/editor/menu/built-in/underline/index.ts +3 -0
- package/src/editor/menu/built-in/underline/props.ts +10 -0
- package/src/editor/menu/built-in/underline/underline.tsx +46 -0
- package/src/editor/menu/built-in/undo/index.ts +3 -0
- package/src/editor/menu/built-in/undo/props.ts +6 -0
- package/src/editor/menu/built-in/undo/undo.tsx +31 -0
- package/src/editor/menu/built-in/unordered-list/index.ts +3 -0
- package/src/editor/menu/built-in/unordered-list/props.ts +12 -0
- package/src/editor/menu/built-in/unordered-list/style.module.less +16 -0
- package/src/editor/menu/built-in/unordered-list/unordered-list.tsx +85 -0
- package/src/editor/menu/built-in/video/index.ts +6 -0
- package/src/editor/menu/built-in/video/props.ts +60 -0
- package/src/editor/menu/built-in/video/style.module.less +92 -0
- package/src/editor/menu/built-in/video/video-controls.tsx +44 -0
- package/src/editor/menu/built-in/video/video-loop.tsx +47 -0
- package/src/editor/menu/built-in/video/video-muted.tsx +48 -0
- package/src/editor/menu/built-in/video/video.tsx +138 -0
- package/src/editor/menu/built-in/wrap-down/index.ts +3 -0
- package/src/editor/menu/built-in/wrap-down/props.ts +16 -0
- package/src/editor/menu/built-in/wrap-down/wrap-down.tsx +49 -0
- package/src/editor/menu/built-in/wrap-up/index.ts +3 -0
- package/src/editor/menu/built-in/wrap-up/props.ts +16 -0
- package/src/editor/menu/built-in/wrap-up/wrap-up.tsx +52 -0
- package/src/editor/menu/index.ts +4 -0
- package/src/editor/menu/menu.tsx +176 -0
- package/src/editor/menu/props.ts +90 -0
- package/src/editor/menu/style.module.less +80 -0
- package/src/editor/wrapper/index.ts +3 -0
- package/src/editor/wrapper/props.ts +209 -0
- package/src/editor/wrapper/render.ts +79 -0
- package/src/editor/wrapper/style.module.less +10 -0
- package/src/editor/wrapper/wrapper.tsx +220 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-editor.ts +47 -0
- package/src/iconfont/iconfont.css +247 -0
- package/src/iconfont/iconfont.ttf +0 -0
- package/src/iconfont/iconfont.woff +0 -0
- package/src/index.ts +20 -0
- package/src/locale/en-us.ts +30 -0
- package/src/locale/index.ts +18 -0
- package/src/locale/ja-jp.ts +30 -0
- package/src/locale/ko-kr.ts +30 -0
- package/src/var.less +19 -0
- package/tsconfig.json +32 -0
- package/tsconfig.node.json +11 -0
- package/vite-env.d.ts +5 -0
- package/vite.config.ts +58 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import { KNode } from '@kaitify/core'
|
|
3
|
+
import { useEditor } from '@/hooks'
|
|
4
|
+
import { Icon } from '@/core/icon'
|
|
5
|
+
import Menu from '../../menu'
|
|
6
|
+
import { WrapDownMenuPropsType } from './props'
|
|
7
|
+
|
|
8
|
+
export default function WrapDownMenu(props: WrapDownMenuPropsType) {
|
|
9
|
+
const { state } = useEditor()
|
|
10
|
+
|
|
11
|
+
//是否禁用
|
|
12
|
+
const isDisabled = useMemo(() => {
|
|
13
|
+
const matchNode = state.editor.value?.getMatchNodeBySelection(props.match)
|
|
14
|
+
if (!matchNode || !matchNode.isBlock() || matchNode.void || matchNode.fixed || matchNode.nested) {
|
|
15
|
+
return true
|
|
16
|
+
}
|
|
17
|
+
return props.disabled ?? false
|
|
18
|
+
}, [state.editor, props.disabled])
|
|
19
|
+
|
|
20
|
+
//方法
|
|
21
|
+
const onOperate = () => {
|
|
22
|
+
if (!props.match) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
const matchNode = state.editor.value?.getMatchNodeBySelection(props.match)
|
|
26
|
+
if (!matchNode || !matchNode.isBlock() || matchNode.void || matchNode.fixed || matchNode.nested) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
const paragraph = KNode.create({
|
|
30
|
+
type: 'block',
|
|
31
|
+
tag: state.editor.value?.blockRenderTag,
|
|
32
|
+
children: [
|
|
33
|
+
{
|
|
34
|
+
type: 'closed',
|
|
35
|
+
tag: 'br'
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
state.editor.value?.addNodeAfter(paragraph, matchNode)
|
|
40
|
+
state.editor.value?.setSelectionBefore(paragraph, 'all')
|
|
41
|
+
state.editor.value?.updateView()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Menu disabled={isDisabled} active={false} onOperate={onOperate} shortcut={props.shortcut}>
|
|
46
|
+
<Icon name='kaitify-icon-wrap-down' />
|
|
47
|
+
</Menu>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { KNodeMatchOptionType } from '@/index'
|
|
2
|
+
|
|
3
|
+
export type WrapUpMenuPropsType = {
|
|
4
|
+
/**
|
|
5
|
+
* 是否禁用
|
|
6
|
+
*/
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
/**
|
|
9
|
+
* 指定换行的块节点条件
|
|
10
|
+
*/
|
|
11
|
+
match: KNodeMatchOptionType
|
|
12
|
+
/**
|
|
13
|
+
* 快捷键设置
|
|
14
|
+
*/
|
|
15
|
+
shortcut?: (e: KeyboardEvent) => boolean
|
|
16
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import { KNode } from '@kaitify/core'
|
|
3
|
+
import { useEditor } from '@/hooks'
|
|
4
|
+
import { Icon } from '@/core/icon'
|
|
5
|
+
import Menu from '../../menu'
|
|
6
|
+
import { WrapUpMenuPropsType } from './props'
|
|
7
|
+
|
|
8
|
+
export default function WrapUpMenu(props: WrapUpMenuPropsType) {
|
|
9
|
+
const { state } = useEditor()
|
|
10
|
+
|
|
11
|
+
//是否禁用
|
|
12
|
+
const isDisabled = useMemo(() => {
|
|
13
|
+
if (!state.editor.value?.selection.focused() || !props.match) {
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
const matchNode = state.editor.value.getMatchNodeBySelection(props.match)
|
|
17
|
+
if (!matchNode || !matchNode.isBlock() || matchNode.void || matchNode.fixed || matchNode.nested) {
|
|
18
|
+
return true
|
|
19
|
+
}
|
|
20
|
+
return props.disabled ?? false
|
|
21
|
+
}, [state.editor, props.disabled])
|
|
22
|
+
|
|
23
|
+
//方法
|
|
24
|
+
const onOperate = () => {
|
|
25
|
+
if (!props.match) {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
const matchNode = state.editor.value?.getMatchNodeBySelection(props.match)
|
|
29
|
+
if (!matchNode || !matchNode.isBlock() || matchNode.void || matchNode.fixed || matchNode.nested) {
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
const paragraph = KNode.create({
|
|
33
|
+
type: 'block',
|
|
34
|
+
tag: state.editor.value?.blockRenderTag,
|
|
35
|
+
children: [
|
|
36
|
+
{
|
|
37
|
+
type: 'closed',
|
|
38
|
+
tag: 'br'
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
})
|
|
42
|
+
state.editor.value?.addNodeBefore(paragraph, matchNode)
|
|
43
|
+
state.editor.value?.setSelectionBefore(paragraph, 'all')
|
|
44
|
+
state.editor.value?.updateView()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Menu disabled={isDisabled} active={false} onOperate={onOperate} shortcut={props.shortcut}>
|
|
49
|
+
<Icon name='kaitify-icon-wrap-up' />
|
|
50
|
+
</Menu>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { forwardRef, ReactNode, useEffect, useId, useImperativeHandle, useRef, useState } from 'react'
|
|
2
|
+
import { event as DapEvent, common as DapCommon } from 'dap-util'
|
|
3
|
+
import classNames from 'classnames'
|
|
4
|
+
import { Popover, PopoverRefType } from '@/core/popover'
|
|
5
|
+
import { Icon } from '@/core/icon'
|
|
6
|
+
import { Button } from '@/core/button'
|
|
7
|
+
import { useEditor } from '@/hooks'
|
|
8
|
+
import { MenuDataType, MenuPropsType, MenuRefType } from './props'
|
|
9
|
+
import styles from './style.module.less'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 菜单组件
|
|
13
|
+
*/
|
|
14
|
+
const Menu = forwardRef<MenuRefType, MenuPropsType>(
|
|
15
|
+
(
|
|
16
|
+
{
|
|
17
|
+
data = [],
|
|
18
|
+
popover = false,
|
|
19
|
+
popoverProps = {
|
|
20
|
+
width: 'auto',
|
|
21
|
+
placement: 'bottom-start',
|
|
22
|
+
arrow: false,
|
|
23
|
+
trigger: 'click',
|
|
24
|
+
animation: 'translate'
|
|
25
|
+
},
|
|
26
|
+
...props
|
|
27
|
+
}: MenuPropsType,
|
|
28
|
+
ref
|
|
29
|
+
) => {
|
|
30
|
+
const uid = useId()
|
|
31
|
+
const { el, dark } = useEditor()
|
|
32
|
+
//popover组件实例
|
|
33
|
+
const popoverRef = useRef<PopoverRefType | null>(null)
|
|
34
|
+
//popover浮层是否显示
|
|
35
|
+
const [popoverVisible, setPopoverVisible] = useState(false)
|
|
36
|
+
|
|
37
|
+
//关闭浮层
|
|
38
|
+
const hidePopover = () => {
|
|
39
|
+
popoverRef.current?.hidePopover()
|
|
40
|
+
}
|
|
41
|
+
//显示浮层
|
|
42
|
+
const showPopover = () => {
|
|
43
|
+
popoverRef.current?.showPopover()
|
|
44
|
+
}
|
|
45
|
+
//浮层选项数据点击
|
|
46
|
+
const onSelect = (item: MenuDataType) => {
|
|
47
|
+
if (props.disabled || props.itemDisabled?.(item)) {
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
props.onSelect?.(item)
|
|
51
|
+
hidePopover()
|
|
52
|
+
}
|
|
53
|
+
//按钮点击
|
|
54
|
+
const onOperate = () => {
|
|
55
|
+
if (props.disabled || popover) {
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
props.onOperate?.()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//渲染插槽
|
|
62
|
+
const renderSlot = (option: MenuDataType, value?: ReactNode | ((option: MenuDataType) => ReactNode)) => {
|
|
63
|
+
if (typeof value === 'function') {
|
|
64
|
+
return value(option)
|
|
65
|
+
}
|
|
66
|
+
return value
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
useImperativeHandle(ref, () => ({
|
|
70
|
+
showPopover,
|
|
71
|
+
hidePopover
|
|
72
|
+
}))
|
|
73
|
+
|
|
74
|
+
//设置快捷键
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (el && props.shortcut) {
|
|
77
|
+
DapEvent.off(el, `keydown.kaitify_menu_${uid}`)
|
|
78
|
+
DapEvent.on(el, `keydown.kaitify_menu_${uid}`, e => {
|
|
79
|
+
//popover的菜单
|
|
80
|
+
if (popover && DapCommon.isObject(props.shortcut)) {
|
|
81
|
+
const shortcut = props.shortcut as { [key: MenuDataType['value']]: (e: KeyboardEvent) => boolean }
|
|
82
|
+
data.forEach(item => {
|
|
83
|
+
if (typeof shortcut[item.value] == 'function') {
|
|
84
|
+
if (shortcut[item.value](e as KeyboardEvent)) {
|
|
85
|
+
onSelect(item)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
} else if (typeof props.shortcut == 'function') {
|
|
90
|
+
if (props.shortcut(e as KeyboardEvent)) {
|
|
91
|
+
onOperate()
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
}, [el])
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
return () => {
|
|
100
|
+
if (el) {
|
|
101
|
+
DapEvent.off(el, `keydown.kaitify_menu_${uid}`)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, [])
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div className={styles['kaitify-menu']}>
|
|
108
|
+
<Popover
|
|
109
|
+
ref={popoverRef}
|
|
110
|
+
delay={100}
|
|
111
|
+
disabled={props.disabled || !popover}
|
|
112
|
+
zIndex={popoverProps.zIndex ?? 10}
|
|
113
|
+
animation={popoverProps.animation ?? 'translate'}
|
|
114
|
+
arrow={popoverProps.arrow}
|
|
115
|
+
placement={popoverProps.placement ?? 'bottom-start'}
|
|
116
|
+
trigger={popoverProps.trigger ?? 'click'}
|
|
117
|
+
width={popoverProps.width}
|
|
118
|
+
maxHeight={popoverProps.maxHeight}
|
|
119
|
+
minWidth={popoverProps.minWidth}
|
|
120
|
+
onShow={el => {
|
|
121
|
+
popoverProps.onShow?.(el)
|
|
122
|
+
setPopoverVisible(true)
|
|
123
|
+
}}
|
|
124
|
+
onShowing={popoverProps.onShowing}
|
|
125
|
+
onShown={popoverProps.onShown}
|
|
126
|
+
onHide={el => {
|
|
127
|
+
popoverProps.onHide?.(el)
|
|
128
|
+
setPopoverVisible(false)
|
|
129
|
+
}}
|
|
130
|
+
onHiding={popoverProps.onHiding}
|
|
131
|
+
onHidden={popoverProps.onHidden}
|
|
132
|
+
refer={
|
|
133
|
+
<Button onClick={onOperate} disabled={props.disabled} active={props.active}>
|
|
134
|
+
{props.children}
|
|
135
|
+
{popover && (
|
|
136
|
+
<Icon
|
|
137
|
+
name='kaitify-icon-caret-down'
|
|
138
|
+
className={classNames(styles['kaitify-menu-caret'], {
|
|
139
|
+
[styles['kaitify-menu-caret-rotate']]: popoverVisible
|
|
140
|
+
})}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
143
|
+
</Button>
|
|
144
|
+
}
|
|
145
|
+
>
|
|
146
|
+
{/* 自定义浮层内容 */}
|
|
147
|
+
{props.customPopover}
|
|
148
|
+
{/* 可选浮层内容 */}
|
|
149
|
+
{!props.customPopover && data.length > 0 && (
|
|
150
|
+
<div
|
|
151
|
+
className={classNames(styles['kaitify-menu-options'], {
|
|
152
|
+
[styles['kaitify-dark']]: dark
|
|
153
|
+
})}
|
|
154
|
+
>
|
|
155
|
+
{data.map(item => (
|
|
156
|
+
<div
|
|
157
|
+
key={item.value}
|
|
158
|
+
onClick={() => onSelect(item)}
|
|
159
|
+
className={classNames(styles['kaitify-menu-option'], {
|
|
160
|
+
[styles['kaitify-menu-option-active']]: props.itemActive?.(item),
|
|
161
|
+
[styles['kaitify-disabled']]: props.itemDisabled?.(item)
|
|
162
|
+
})}
|
|
163
|
+
>
|
|
164
|
+
{props.customIcon ? renderSlot(item, props.customIcon) : !!item.icon && <Icon name={item.icon} className={styles['kaitify-menu-option-icon']} />}
|
|
165
|
+
{props.customLabel ? renderSlot(item, props.customLabel) : <span>{item.label}</span>}
|
|
166
|
+
</div>
|
|
167
|
+
))}
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
</Popover>
|
|
171
|
+
</div>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
export default Menu
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { PopoverPropsType } from '@/core/popover'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 菜单可选数据的类型
|
|
6
|
+
*/
|
|
7
|
+
export type MenuDataType = {
|
|
8
|
+
/**
|
|
9
|
+
* 显示的文字
|
|
10
|
+
*/
|
|
11
|
+
label: string
|
|
12
|
+
/**
|
|
13
|
+
* 表示的值
|
|
14
|
+
*/
|
|
15
|
+
value: string | number
|
|
16
|
+
/**
|
|
17
|
+
* 左侧显示的图标
|
|
18
|
+
*/
|
|
19
|
+
icon?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 菜单组件的属性类型
|
|
24
|
+
*/
|
|
25
|
+
export type MenuPropsType = {
|
|
26
|
+
/**
|
|
27
|
+
* 是否禁用
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean
|
|
30
|
+
/**
|
|
31
|
+
* 是否激活
|
|
32
|
+
*/
|
|
33
|
+
active?: boolean
|
|
34
|
+
/**
|
|
35
|
+
* 选项禁用
|
|
36
|
+
*/
|
|
37
|
+
itemDisabled?: (item: MenuDataType) => boolean
|
|
38
|
+
/**
|
|
39
|
+
* 选项是否激活
|
|
40
|
+
*/
|
|
41
|
+
itemActive?: (item: MenuDataType) => boolean
|
|
42
|
+
/**
|
|
43
|
+
* 是否有浮层
|
|
44
|
+
*/
|
|
45
|
+
popover?: boolean
|
|
46
|
+
/**
|
|
47
|
+
* 浮层属性
|
|
48
|
+
*/
|
|
49
|
+
popoverProps?: Omit<PopoverPropsType, 'disabled' | 'delay' | 'refer' | 'children'>
|
|
50
|
+
/**
|
|
51
|
+
* 可选数据
|
|
52
|
+
*/
|
|
53
|
+
data?: MenuDataType[]
|
|
54
|
+
/**
|
|
55
|
+
* 快捷键设置
|
|
56
|
+
*/
|
|
57
|
+
shortcut?: ((e: KeyboardEvent) => boolean) | { [key: MenuDataType['value']]: (e: KeyboardEvent) => boolean }
|
|
58
|
+
/**
|
|
59
|
+
* 非浮层类型的菜单按钮点击触发的事件
|
|
60
|
+
*/
|
|
61
|
+
onOperate?: () => void
|
|
62
|
+
/**
|
|
63
|
+
* 浮层类型的菜单按钮点击选项触发的事件
|
|
64
|
+
*/
|
|
65
|
+
onSelect?: (value: MenuDataType) => void
|
|
66
|
+
/**
|
|
67
|
+
* 默认插槽
|
|
68
|
+
*/
|
|
69
|
+
children: ReactNode
|
|
70
|
+
/**
|
|
71
|
+
* 自定义浮层内容
|
|
72
|
+
*/
|
|
73
|
+
customPopover?: ReactNode
|
|
74
|
+
/**
|
|
75
|
+
* 自定义选项图标
|
|
76
|
+
*/
|
|
77
|
+
customIcon?: ReactNode | ((option: MenuDataType) => ReactNode)
|
|
78
|
+
/**
|
|
79
|
+
* 自定义选项内容
|
|
80
|
+
*/
|
|
81
|
+
customLabel?: ReactNode | ((option: MenuDataType) => ReactNode)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 菜单组件实例类型
|
|
86
|
+
*/
|
|
87
|
+
export type MenuRefType = {
|
|
88
|
+
showPopover: () => void
|
|
89
|
+
hidePopover: () => void
|
|
90
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
.kaitify-menu {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
justify-content: flex-start;
|
|
4
|
+
align-items: center;
|
|
5
|
+
padding: 2px;
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
&,
|
|
9
|
+
*,
|
|
10
|
+
*::before,
|
|
11
|
+
*::after {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
outline: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.kaitify-menu-caret {
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
transform: scale(0.72);
|
|
19
|
+
margin-left: 4px;
|
|
20
|
+
transition: transform 300ms linear;
|
|
21
|
+
|
|
22
|
+
&.kaitify-menu-caret-rotate {
|
|
23
|
+
transform: scale(0.72) rotate(180deg);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.kaitify-menu-options {
|
|
29
|
+
padding: @small-padding 0;
|
|
30
|
+
|
|
31
|
+
&,
|
|
32
|
+
*,
|
|
33
|
+
*::before,
|
|
34
|
+
*::after {
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.kaitify-menu-option {
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: flex-start;
|
|
42
|
+
align-items: center;
|
|
43
|
+
padding: @small-padding @padding;
|
|
44
|
+
font-size: @font-size;
|
|
45
|
+
line-height: @line-height;
|
|
46
|
+
color: @font-color;
|
|
47
|
+
transition: background 300ms, color 300ms;
|
|
48
|
+
|
|
49
|
+
.kaitify-menu-option-icon {
|
|
50
|
+
margin-right: 4px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:not(.kaitify-disabled):hover {
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
background: @lightest-theme;
|
|
56
|
+
color: @theme;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:not(.kaitify-disabled):active {
|
|
60
|
+
background: @lighter-theme;
|
|
61
|
+
color: @theme;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:not(.kaitify-disabled).kaitify-menu-option-active {
|
|
65
|
+
background: @lighter-theme;
|
|
66
|
+
color: @theme;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.kaitify-disabled {
|
|
70
|
+
opacity: 0.6;
|
|
71
|
+
cursor: not-allowed;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.kaitify-dark {
|
|
76
|
+
.kaitify-menu-option {
|
|
77
|
+
color: @font-color-dark;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { LocaleType } from '@/locale'
|
|
2
|
+
import { Editor, Selection, EditorConfigureOptionType } from '@kaitify/core'
|
|
3
|
+
import { CSSProperties, ReactNode } from 'react'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 编辑器参数类型
|
|
7
|
+
*/
|
|
8
|
+
export type WrapperPropsType = {
|
|
9
|
+
/**
|
|
10
|
+
* 编辑器的值
|
|
11
|
+
*/
|
|
12
|
+
value?: string
|
|
13
|
+
/**
|
|
14
|
+
* 样式
|
|
15
|
+
*/
|
|
16
|
+
style?: CSSProperties
|
|
17
|
+
/**
|
|
18
|
+
* 样式类
|
|
19
|
+
*/
|
|
20
|
+
className?: string
|
|
21
|
+
/**
|
|
22
|
+
* 编辑器是否禁用
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
/**
|
|
26
|
+
* 语言环境
|
|
27
|
+
*/
|
|
28
|
+
locale?: LocaleType
|
|
29
|
+
/**
|
|
30
|
+
* 子元素,用于渲染气泡栏组件
|
|
31
|
+
*/
|
|
32
|
+
children?: ReactNode | ((state: StateType) => ReactNode)
|
|
33
|
+
/**
|
|
34
|
+
* before插槽挂载的元素,如果不设置,则就放置在编辑器前面
|
|
35
|
+
*/
|
|
36
|
+
appendBeforeTo?: string | HTMLElement
|
|
37
|
+
/**
|
|
38
|
+
* after插槽挂载的元素,如果不设置,则就放置在编辑器后面
|
|
39
|
+
*/
|
|
40
|
+
appendAfterTo?: string | HTMLElement
|
|
41
|
+
/**
|
|
42
|
+
* before插槽
|
|
43
|
+
*/
|
|
44
|
+
before?: ReactNode | ((state: StateType) => ReactNode)
|
|
45
|
+
/**
|
|
46
|
+
* after插槽
|
|
47
|
+
*/
|
|
48
|
+
after?: ReactNode | ((state: StateType) => ReactNode)
|
|
49
|
+
/**
|
|
50
|
+
* 是否自动聚焦
|
|
51
|
+
*/
|
|
52
|
+
autofocus?: EditorConfigureOptionType['autofocus']
|
|
53
|
+
/**
|
|
54
|
+
* 编辑器内容只有一个段落时的默认文本
|
|
55
|
+
*/
|
|
56
|
+
placeholder?: EditorConfigureOptionType['placeholder']
|
|
57
|
+
/**
|
|
58
|
+
* 是否深色模式
|
|
59
|
+
*/
|
|
60
|
+
dark?: EditorConfigureOptionType['dark']
|
|
61
|
+
/**
|
|
62
|
+
* 是否允许复制
|
|
63
|
+
*/
|
|
64
|
+
allowCopy?: EditorConfigureOptionType['allowCopy']
|
|
65
|
+
/**
|
|
66
|
+
* 是否允许粘贴
|
|
67
|
+
*/
|
|
68
|
+
allowPaste?: EditorConfigureOptionType['allowPaste']
|
|
69
|
+
/**
|
|
70
|
+
* 是否允许剪切
|
|
71
|
+
*/
|
|
72
|
+
allowCut?: EditorConfigureOptionType['allowCut']
|
|
73
|
+
/**
|
|
74
|
+
* 是否允许粘贴html
|
|
75
|
+
*/
|
|
76
|
+
allowPasteHtml?: EditorConfigureOptionType['allowPasteHtml']
|
|
77
|
+
/**
|
|
78
|
+
* 剪切板同时存在文件和html/text时,是否优先粘贴文件
|
|
79
|
+
*/
|
|
80
|
+
priorityPasteFiles?: EditorConfigureOptionType['priorityPasteFiles']
|
|
81
|
+
/**
|
|
82
|
+
* 自定义编辑器内渲染文本节点的真实标签
|
|
83
|
+
*/
|
|
84
|
+
textRenderTag?: EditorConfigureOptionType['textRenderTag']
|
|
85
|
+
/**
|
|
86
|
+
* 自定义编辑内渲染默认块级节点的真实标签,即段落标签
|
|
87
|
+
*/
|
|
88
|
+
blockRenderTag?: EditorConfigureOptionType['blockRenderTag']
|
|
89
|
+
/**
|
|
90
|
+
* 自定义编辑器内定义需要置空的标签
|
|
91
|
+
*/
|
|
92
|
+
emptyRenderTags?: EditorConfigureOptionType['emptyRenderTags']
|
|
93
|
+
/**
|
|
94
|
+
* 自定义编辑器内额外保留的标签
|
|
95
|
+
*/
|
|
96
|
+
extraKeepTags?: EditorConfigureOptionType['extraKeepTags']
|
|
97
|
+
/**
|
|
98
|
+
* 自定义插件数组
|
|
99
|
+
*/
|
|
100
|
+
extensions?: EditorConfigureOptionType['extensions']
|
|
101
|
+
/**
|
|
102
|
+
* 自定义节点数组格式化规则
|
|
103
|
+
*/
|
|
104
|
+
formatRules?: EditorConfigureOptionType['formatRules']
|
|
105
|
+
/**
|
|
106
|
+
* 编辑器值改变事件
|
|
107
|
+
*/
|
|
108
|
+
onChange?: (value: string) => void
|
|
109
|
+
/**
|
|
110
|
+
* 编辑器创建完成后触发的事件
|
|
111
|
+
*/
|
|
112
|
+
onCreated?: (editor: Editor) => void
|
|
113
|
+
/**
|
|
114
|
+
* 自定义dom转为非文本节点的后续处理
|
|
115
|
+
*/
|
|
116
|
+
onDomParseNode?: EditorConfigureOptionType['onDomParseNode']
|
|
117
|
+
/**
|
|
118
|
+
* 节点粘贴保留标记的自定义方法
|
|
119
|
+
*/
|
|
120
|
+
onPasteKeepMarks?: EditorConfigureOptionType['onPasteKeepMarks']
|
|
121
|
+
/**
|
|
122
|
+
* 节点粘贴保留样式的自定义方法
|
|
123
|
+
*/
|
|
124
|
+
onPasteKeepStyles?: EditorConfigureOptionType['onPasteKeepStyles']
|
|
125
|
+
/**
|
|
126
|
+
* 编辑器粘贴纯文本时触发,如果返回true则表示继续使用默认逻辑,返回false则不走默认逻辑,需要进行自定义处理
|
|
127
|
+
*/
|
|
128
|
+
onPasteText?: EditorConfigureOptionType['onPasteText']
|
|
129
|
+
/**
|
|
130
|
+
* 编辑器粘贴html内容时触发,如果返回true则表示继续使用默认逻辑,返回false则不走默认逻辑,需要进行自定义处理
|
|
131
|
+
*/
|
|
132
|
+
onPasteHtml?: EditorConfigureOptionType['onPasteHtml']
|
|
133
|
+
/**
|
|
134
|
+
* 编辑器粘贴图片时触发,如果返回true则表示继续使用默认逻辑,返回false则不走默认逻辑,需要进行自定义处理
|
|
135
|
+
*/
|
|
136
|
+
onPasteImage?: EditorConfigureOptionType['onPasteImage']
|
|
137
|
+
/**
|
|
138
|
+
* 编辑器粘贴视频时触发,如果返回true则表示继续使用默认逻辑,返回false则不走默认逻辑,需要进行自定义处理
|
|
139
|
+
*/
|
|
140
|
+
onPasteVideo?: EditorConfigureOptionType['onPasteVideo']
|
|
141
|
+
/**
|
|
142
|
+
* 编辑器粘贴除了图片和视频以外的文件时触发,需要自定义处理
|
|
143
|
+
*/
|
|
144
|
+
onPasteFile?: EditorConfigureOptionType['onPasteFile']
|
|
145
|
+
/**
|
|
146
|
+
* 在删除和换行操作中块节点节点从其父节点中抽离出去成为与父节点同级的节点后触发,如果返回true则表示继续使用默认逻辑,会将该节点转为段落,返回false则不走默认逻辑,需要自定义处理
|
|
147
|
+
*/
|
|
148
|
+
onDetachMentBlockFromParent?: EditorConfigureOptionType['onDetachMentBlockFromParent']
|
|
149
|
+
/**
|
|
150
|
+
* 编辑器updateView执行时,通过比对新旧节点数组获取需要格式化的节点,在这些节点被格式化前,触发此方法,回调参数即当前需要被格式化的节点,该方法返回一个节点,返回的节点将会被格式化,如果你不需要任何特殊处理,返回入参提供的节点即可
|
|
151
|
+
*/
|
|
152
|
+
onBeforePatchNodeToFormat?: EditorConfigureOptionType['onBeforePatchNodeToFormat']
|
|
153
|
+
/**
|
|
154
|
+
* 编辑器光标发生变化触发的事件
|
|
155
|
+
*/
|
|
156
|
+
onSelectionUpdate?: EditorConfigureOptionType['onSelectionUpdate']
|
|
157
|
+
/**
|
|
158
|
+
* 编辑器进行换行时触发的事件
|
|
159
|
+
*/
|
|
160
|
+
onInsertParagraph?: EditorConfigureOptionType['onInsertParagraph']
|
|
161
|
+
/**
|
|
162
|
+
* 编辑器执行删除操作完成的时候触发的事件
|
|
163
|
+
*/
|
|
164
|
+
onDeleteComplete?: EditorConfigureOptionType['onDeleteComplete']
|
|
165
|
+
/**
|
|
166
|
+
* 编辑器内键盘按下触发的事件
|
|
167
|
+
*/
|
|
168
|
+
onKeydown?: EditorConfigureOptionType['onKeydown']
|
|
169
|
+
/**
|
|
170
|
+
* 编辑器内键盘松开触发的事件
|
|
171
|
+
*/
|
|
172
|
+
onKeyup?: EditorConfigureOptionType['onKeyup']
|
|
173
|
+
/**
|
|
174
|
+
* 编辑器获取光标触发的事件
|
|
175
|
+
*/
|
|
176
|
+
onFocus?: EditorConfigureOptionType['onFocus']
|
|
177
|
+
/**
|
|
178
|
+
* 编辑器失去光标触发的事件
|
|
179
|
+
*/
|
|
180
|
+
onBlur?: EditorConfigureOptionType['onBlur']
|
|
181
|
+
/**
|
|
182
|
+
* 编辑器视图更新前触发的事件
|
|
183
|
+
*/
|
|
184
|
+
onBeforeUpdateView?: EditorConfigureOptionType['onBeforeUpdateView']
|
|
185
|
+
/**
|
|
186
|
+
* 编辑器视图更新后触发的事件
|
|
187
|
+
*/
|
|
188
|
+
onAfterUpdateView?: EditorConfigureOptionType['onAfterUpdateView']
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* 编辑器状态对象
|
|
193
|
+
*/
|
|
194
|
+
export type StateType = {
|
|
195
|
+
editor: {
|
|
196
|
+
value?: Editor
|
|
197
|
+
}
|
|
198
|
+
selection: {
|
|
199
|
+
value?: Selection
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* 编辑器实例对象
|
|
205
|
+
*/
|
|
206
|
+
export type WrapperRefType = {
|
|
207
|
+
elRef: React.MutableRefObject<HTMLDivElement | null>
|
|
208
|
+
state: StateType
|
|
209
|
+
}
|