@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,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Menu 菜单
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Menu 菜单
|
|
6
|
+
|
|
7
|
+
`Menu` 组件是 `kaitify-react` 的重要 `UI` 组件,该组件与编辑器具体的功能无关,它仅仅提供了操作的事件和 `UI` 属性,让我们在做编辑器的功能栏时无需在 `UI` 方面花费心思
|
|
8
|
+
|
|
9
|
+
`Menu` 组件必须放置在 `Wrapper` 组件的插槽中,无论是放在 `before`、`after` 还是 `children` 插槽都是可以的
|
|
10
|
+
|
|
11
|
+
## 基本使用
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { useState } from 'react'
|
|
15
|
+
import { Wrapper, Menu } from '@kaitify/react'
|
|
16
|
+
|
|
17
|
+
export default function App() {
|
|
18
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
19
|
+
return <Wrapper value={content} onChange={v => setContent(v)} placeholder='输入正文内容...' before={<Menu>菜单按钮</Menu>}></Wrapper>
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Props 参数
|
|
24
|
+
|
|
25
|
+
##### disabled <Badge type="danger" text="boolean" />
|
|
26
|
+
|
|
27
|
+
是否禁用菜单,默认为 `false`
|
|
28
|
+
|
|
29
|
+
##### active <Badge type="danger" text="boolean" />
|
|
30
|
+
|
|
31
|
+
是否显示激活状态,默认为 `false`
|
|
32
|
+
|
|
33
|
+
##### popover <Badge type="danger" text="boolean" />
|
|
34
|
+
|
|
35
|
+
是否为带浮层的菜单,默认为 `false`
|
|
36
|
+
|
|
37
|
+
##### popoverProps <Badge type="danger" text="PopoverPropsType" />
|
|
38
|
+
|
|
39
|
+
浮层属性配置,包含以下属性:
|
|
40
|
+
|
|
41
|
+
- width <Badge type="danger" text="string | number" />:浮层宽度,默认自适应
|
|
42
|
+
- minWidth <Badge type="danger" text="string | number" />:浮层最小宽度
|
|
43
|
+
- maxHeight <Badge type="danger" text="string | number" />:浮层最大高度
|
|
44
|
+
- placement <Badge type="danger" text="PopoverPlacementType" /> 浮层默认显示位置,可取值 `'auto' | 'auto-start' | 'auto-end' | 'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end' | 'left-start' | 'left' | 'left-end' | 'right-start' | 'right' | 'right-end'`,如果指定位置的空间不足以显示浮层,会自适应匹配其他位置
|
|
45
|
+
- arrow <Badge type="danger" text="boolean" />:浮层是否显示三角形
|
|
46
|
+
- trigger <Badge type="danger" text="hover | click | custom" />:浮层触发显示的方式,如果指定为 `custom`,则需要手动调用 `showPopover`/`hidePopover` 方法
|
|
47
|
+
- animation <Badge type="danger" text="'fade' | 'translate' | string" />:浮层显示动画,默认支持 `fade` 和 `translate`,可以自定义其他动画名称,例如定义动画名称`'a'`,则对应的 `Transition` 组件 `name` 值为 `kaitify-popover-a`
|
|
48
|
+
- zIndex <Badge type="danger" text="number" />:浮层的 `z-index` 层级,默认为 10
|
|
49
|
+
- onShow <Badge type="danger" text="(el: Element) => void" />:浮层显示前触发的事件
|
|
50
|
+
- onShowing <Badge type="danger" text="(el: Element) => void" />:浮层显示时触发的事件
|
|
51
|
+
- onShown <Badge type="danger" text="(el: Element) => void" />:浮层显示后触发的事件
|
|
52
|
+
- onHide <Badge type="danger" text="(el: Element) => void" />:浮层隐藏前触发的事件
|
|
53
|
+
- onHiding <Badge type="danger" text="(el: Element) => void" />:浮层隐藏时触发的事件
|
|
54
|
+
- onHidden <Badge type="danger" text="(el: Element) => void" />:浮层隐藏后触发的事件
|
|
55
|
+
|
|
56
|
+
##### data <Badge type="danger" text="MenuDataType[]" />
|
|
57
|
+
|
|
58
|
+
浮层显示的列表数据,是一个数组,数组中每一项包含如下属性:
|
|
59
|
+
|
|
60
|
+
- label <Badge type="danger" text="string" />:选项内容
|
|
61
|
+
- value <Badge type="danger" text="string | number" />:选项的值
|
|
62
|
+
- icon <Badge type="danger" text="string | number" />:选项左侧显示的图标,只能是 `kaitify-react` 内置的图标名称,如果需要自定义图标只能通过 `icon` 插槽来实现
|
|
63
|
+
|
|
64
|
+
##### itemDisabled <Badge type="danger" text="(item: MenuDataType) => boolean" />
|
|
65
|
+
|
|
66
|
+
浮层选项是否禁用,该属性是一个函数,返回一个 `boolean` 值,回调参数为当前选项数据
|
|
67
|
+
|
|
68
|
+
##### itemActive <Badge type="danger" text="(item: MenuDataType) => boolean" />
|
|
69
|
+
|
|
70
|
+
浮层选项是否激活,该属性是一个函数,返回一个 `boolean` 值,回调参数为当前选项数据
|
|
71
|
+
|
|
72
|
+
##### shortcut <Badge type="danger" text="((e: KeyboardEvent) => boolean) | { [key: MenuDataType['value']]: (e: KeyboardEvent) => boolean }" />
|
|
73
|
+
|
|
74
|
+
菜单快捷键实现,如果该菜单是一个普通的按钮菜单,则该属性是一个函数,回调参数为键盘事件,需要返回一个 `boolean` 值,如果该菜单是一个带浮层的选项菜单,则该属性是一个对象,对象的 `key` 是选项的 `value` 值,对象的值是一个函数,回调参数为键盘事件,需要返回一个 `boolean` 值
|
|
75
|
+
|
|
76
|
+
函数返回 `true` 值,表示触发菜单的 `operate` 或者 `select` 事件
|
|
77
|
+
|
|
78
|
+
##### onOperate <Badge type="danger" text="() => void" />
|
|
79
|
+
|
|
80
|
+
非浮层类型的菜单按钮点击触发的事件
|
|
81
|
+
|
|
82
|
+
##### onSelect <Badge type="danger" text="(value: MenuDataType) => void" />
|
|
83
|
+
|
|
84
|
+
浮层类型的菜单按钮点击选项触发的事件
|
|
85
|
+
|
|
86
|
+
##### children <Badge type="danger" text="ReactNode" />
|
|
87
|
+
|
|
88
|
+
菜单的子组件内容
|
|
89
|
+
|
|
90
|
+
##### customPopover <Badge type="danger" text="ReactNode" />
|
|
91
|
+
|
|
92
|
+
自定义浮层内容
|
|
93
|
+
|
|
94
|
+
##### customIcon <Badge type="danger" text="ReactNode | ((option: MenuDataType) => ReactNode)" />
|
|
95
|
+
|
|
96
|
+
自定义选项图标
|
|
97
|
+
|
|
98
|
+
##### customLabel <Badge type="danger" text="ReactNode | ((option: MenuDataType) => ReactNode)" />
|
|
99
|
+
|
|
100
|
+
自定义选项内容
|
|
101
|
+
|
|
102
|
+
## API 组件属性/方法
|
|
103
|
+
|
|
104
|
+
`Menu` 提供了部分属性/方法可以通过组件实例来调用
|
|
105
|
+
|
|
106
|
+
##### showPopover <Badge type="danger" text="() => void" />
|
|
107
|
+
|
|
108
|
+
显示浮层的方法
|
|
109
|
+
|
|
110
|
+
##### hidePopover <Badge type="danger" text="() => void" />
|
|
111
|
+
|
|
112
|
+
隐藏浮层的方法
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 快速上手
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# 快速上手
|
|
6
|
+
|
|
7
|
+
## 构建一个编辑器
|
|
8
|
+
|
|
9
|
+
直接使用 `kaitify-react` 提供的 `Wrapper` 组件来渲染编辑器
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { useState } from 'react'
|
|
13
|
+
import { Wrapper } from '@kaitify/react'
|
|
14
|
+
|
|
15
|
+
export default function App() {
|
|
16
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
17
|
+
return <Wrapper value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'></Wrapper>
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 基本组件
|
|
22
|
+
|
|
23
|
+
我们提供了如下的基本组件,可以很好的帮助我们在 `React` 项目中使用 `kaitify-react`
|
|
24
|
+
|
|
25
|
+
##### Wrapper
|
|
26
|
+
|
|
27
|
+
`Wrapper` 组件是编辑器的核心组件,它直接渲染一个编辑器,是对 `kaitify` 的二次包装,无需我们使用原生 `js` 的方式去构建编辑器
|
|
28
|
+
|
|
29
|
+
具体的属性配置和使用方法,参考 [Wrapper 组件](/guide/wrapper)
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { useState } from 'react'
|
|
33
|
+
import { Wrapper } from '@kaitify/react'
|
|
34
|
+
|
|
35
|
+
export default function App() {
|
|
36
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
37
|
+
return <Wrapper value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'></Wrapper>
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
##### Bubble
|
|
42
|
+
|
|
43
|
+
`Bubble` 气泡栏组件是编辑器内置的组件,它会跟随编辑器光标进行浮动显示,我们可以通过直接引入 `Bubble` 组件并在 `Wrapper` 组件的 `default` 插槽中放置来使用
|
|
44
|
+
|
|
45
|
+
具体的属性配置和使用方法,参考 [Bubble 组件](/guide/bubble)
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { useState } from 'react'
|
|
49
|
+
import { Wrapper, Bubble } from '@kaitify/react'
|
|
50
|
+
|
|
51
|
+
export default function App() {
|
|
52
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
53
|
+
return (
|
|
54
|
+
<Wrapper value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'>
|
|
55
|
+
<Bubble visible={true}>我是气泡栏</Bubble>
|
|
56
|
+
</Wrapper>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
##### Menu
|
|
62
|
+
|
|
63
|
+
`Menu` 菜单组件是编辑器内置的组件,它提供了一个基本的菜单按钮的样式,可以节省我们的工作,Menu 组件必须在 `Wrapper` 组件的插槽中使用
|
|
64
|
+
|
|
65
|
+
具体的属性配置和使用方法,参考 [Menu 组件](/guide/menu)
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import { useState } from 'react'
|
|
69
|
+
import { Wrapper,Menu } from '@kaitify/react'
|
|
70
|
+
|
|
71
|
+
export default function App() {
|
|
72
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
73
|
+
return <Wrapper value={content} onChange={v => setContent(v)} placeholder='输入正文内容...' before={<Menu>菜单按钮</Menu>}></Wrapper>
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 菜单快捷键
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# 菜单快捷键
|
|
6
|
+
|
|
7
|
+
`shortcut` 是 `Menu` 组件的一个参数,这里我们单独讲一下如何设置菜单的快捷键
|
|
8
|
+
|
|
9
|
+
## 普通菜单的快捷键绑定
|
|
10
|
+
|
|
11
|
+
普通菜单的 `shortcut` 属性是一个函数,返回 `boolean` 值,当返回 `true` 时会触发 `operate` 事件
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { useState } from 'react'
|
|
15
|
+
import { Wrapper, Menu } from '@kaitify/react'
|
|
16
|
+
|
|
17
|
+
export default function App() {
|
|
18
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
19
|
+
|
|
20
|
+
const shortcut = (e: KeyboardEvent) => {
|
|
21
|
+
//按下ctrl + b 触发
|
|
22
|
+
return e => e.key == 'b' && e.ctrlKey
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//除了点击触发此事件外,当你按下 ctrl + b 也会触发此事件
|
|
26
|
+
const onOperate = () => {
|
|
27
|
+
console.log('菜单点击')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Wrapper
|
|
32
|
+
value={content}
|
|
33
|
+
onChange={v => setContent(v)}
|
|
34
|
+
placeholder='输入正文内容...'
|
|
35
|
+
before={
|
|
36
|
+
<Menu onOperate={onOperate} shortcut={shortcut}>
|
|
37
|
+
菜单
|
|
38
|
+
</Menu>
|
|
39
|
+
}
|
|
40
|
+
></Wrapper>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 有浮层的菜单的快捷键绑定
|
|
46
|
+
|
|
47
|
+
浮层菜单的 `shortcut` 属性是一个对象,对象的 `key` 是 `data` 的 `value` 值,对象的值是一个函数,返回 `boolean` 值,当返回 `true` 时会触发 `operate` 事件
|
|
48
|
+
|
|
49
|
+
如果是自定义浮层内容的菜单,即没有配置 `data` 属性,通过 `popover` 插槽设置内容,此时无法通过 `shortcut` 绑定快捷键
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { useState } from 'react'
|
|
53
|
+
import { Wrapper,Menu } from '@kaitify/react'
|
|
54
|
+
|
|
55
|
+
export default function App() {
|
|
56
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
57
|
+
|
|
58
|
+
const shortcut = {
|
|
59
|
+
//按下 ctrl + b 选择第一项,触发select事件
|
|
60
|
+
0: e => e.key == 'b' && e.ctrlKey
|
|
61
|
+
//按下 ctrl + w 选择第二项,触发select事件
|
|
62
|
+
1: e => e.key == 'w' && e.ctrlKey
|
|
63
|
+
//按下 ctrl + e 选择第三项,触发select事件
|
|
64
|
+
2: e => e.key == 'e' && e.ctrlKey
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const onSelect = (item) => {
|
|
68
|
+
console.log('选项选择',item)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return <Wrapper value={content} onChange={v => setContent(v)} placeholder='输入正文内容...' before={<Menu onOperate={onOperate} shortcut={shortcut} popover data={[
|
|
72
|
+
{ label: '选项1', value: 0 },
|
|
73
|
+
{ label: '选项2', value: 1 },
|
|
74
|
+
{ label: '选项3', value: 2 }
|
|
75
|
+
]}>菜单</Menu>}></Wrapper>
|
|
76
|
+
}
|
|
77
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Tabs 选项卡
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Tabs 选项卡
|
|
6
|
+
|
|
7
|
+
`Tabs` 组件是 `kaitify-react` 的一个 `UI` 组件,该组件与编辑器具体的功能无关,它一般用于带浮层的菜单中,用来分区域展示不同的内容
|
|
8
|
+
|
|
9
|
+
## 基本使用
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Tabs } from '@kaitify/react'
|
|
13
|
+
export default function App() {
|
|
14
|
+
return (
|
|
15
|
+
<Tabs
|
|
16
|
+
default-value='A'
|
|
17
|
+
data={[
|
|
18
|
+
{ label: '我是A', value: 'A' },
|
|
19
|
+
{ label: '我是B', value: 'B' }
|
|
20
|
+
]}
|
|
21
|
+
>
|
|
22
|
+
{current => {
|
|
23
|
+
current
|
|
24
|
+
}}
|
|
25
|
+
</Tabs>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Props 参数
|
|
31
|
+
|
|
32
|
+
##### data <Badge type="danger" text="{ label: string; value: string | number }[]" />
|
|
33
|
+
|
|
34
|
+
选项卡数据配置,是一个数组,数组项的 `label` 表示选项卡显示的名称,`value` 表示选项卡对应的值
|
|
35
|
+
|
|
36
|
+
##### defaultValue <Badge type="danger" text="string | number" />
|
|
37
|
+
|
|
38
|
+
默认展示的选项卡,这里只需要设置其 `value` 对应的值即可
|
|
39
|
+
|
|
40
|
+
##### children <Badge type="danger" text="ReactNode | ((current: string | number) => ReactNode)" />
|
|
41
|
+
|
|
42
|
+
子组件内容
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Wrapper 包裹器
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Wrapper 包裹器
|
|
6
|
+
|
|
7
|
+
`Wrapper` 组件是 `kaitify-react` 的核心组件,顾名思义,它作为一个包裹器,在组件加载时,自动帮助我们创建一个编辑器实例,无需我们手动调用底层的方法去构建编辑器
|
|
8
|
+
|
|
9
|
+
## 基本使用
|
|
10
|
+
|
|
11
|
+
使用 `value` / `onChange` 来使得编辑器受控,通过 `placeholder` 属性设置占位符内容
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { useState } from 'react'
|
|
15
|
+
import { Wrapper } from '@kaitify/react'
|
|
16
|
+
|
|
17
|
+
export default function App() {
|
|
18
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
19
|
+
return <Wrapper value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'></Wrapper>
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
使用 `disabled` 来禁用编辑器,此时编辑器不可编辑
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { useState } from 'react'
|
|
27
|
+
import { Wrapper } from '@kaitify/react'
|
|
28
|
+
|
|
29
|
+
export default function App() {
|
|
30
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
31
|
+
return <Wrapper disabled value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'></Wrapper>
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
使用 `autofocus` 来设置编辑器在初始化后自动聚焦
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { useState } from 'react'
|
|
39
|
+
import { Wrapper } from '@kaitify/react'
|
|
40
|
+
|
|
41
|
+
export default function App() {
|
|
42
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
43
|
+
return <Wrapper autofocus value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'></Wrapper>
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
使用 `dark` 来设置编辑器为深色风格
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { useState } from 'react'
|
|
51
|
+
import { Wrapper } from '@kaitify/react'
|
|
52
|
+
|
|
53
|
+
export default function App() {
|
|
54
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
55
|
+
return <Wrapper dark value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'></Wrapper>
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
编辑器的宽度和高度可以直接通过 `css` 样式来设置
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { useState } from 'react'
|
|
63
|
+
import { Wrapper } from '@kaitify/react'
|
|
64
|
+
|
|
65
|
+
export default function App() {
|
|
66
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
67
|
+
return <Wrapper style={{ width: 500, height: 500 }} value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'></Wrapper>
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Props 参数
|
|
72
|
+
|
|
73
|
+
`Wrapper` 包裹器提供除了以上提到的属性以外, 具体完整的属性如下:
|
|
74
|
+
|
|
75
|
+
##### value <Badge type="danger" text="string" />
|
|
76
|
+
|
|
77
|
+
编辑器的字符串内容
|
|
78
|
+
|
|
79
|
+
##### style <Badge type="danger" text="CSSProperties" />
|
|
80
|
+
|
|
81
|
+
编辑器的样式
|
|
82
|
+
|
|
83
|
+
##### className <Badge type="danger" text="string" />
|
|
84
|
+
|
|
85
|
+
编辑器的样式类
|
|
86
|
+
|
|
87
|
+
##### disabled <Badge type="danger" text="boolean" />
|
|
88
|
+
|
|
89
|
+
是否禁用编辑器,禁用后编辑器不可编辑,默认为 `false`
|
|
90
|
+
|
|
91
|
+
##### locale <Badge type="danger" text="LocaleType" />
|
|
92
|
+
|
|
93
|
+
编辑器语言环境,取值范围是 `zh-CN` `en-US` `ko-KR` `ja-JP`,分别表示中文简体和英文语言、韩语、日语环境,默认为 `zh-CN`
|
|
94
|
+
|
|
95
|
+
##### children <Badge type="danger" text="ReactNode | ((state: StateType) => ReactNode)" />
|
|
96
|
+
|
|
97
|
+
编辑器的子元素,用于渲染气泡栏组件
|
|
98
|
+
|
|
99
|
+
##### appendBeforeTo <Badge type="danger" text="string | HTMLElement" />
|
|
100
|
+
|
|
101
|
+
`before` 插槽挂载的元素,如果不设置,则就放置在编辑器前面
|
|
102
|
+
|
|
103
|
+
##### appendAfterTo <Badge type="danger" text="string | HTMLElement" />
|
|
104
|
+
|
|
105
|
+
`after` 插槽挂载的元素,如果不设置,则就放置在编辑器后面
|
|
106
|
+
|
|
107
|
+
##### before <Badge type="danger" text=" ReactNode | ((state: StateType) => ReactNode)" />
|
|
108
|
+
|
|
109
|
+
展示在编辑器前面的内容
|
|
110
|
+
|
|
111
|
+
##### after <Badge type="danger" text=" ReactNode | ((state: StateType) => ReactNode)" />
|
|
112
|
+
|
|
113
|
+
展示在编辑器后面的内容
|
|
114
|
+
|
|
115
|
+
##### autofocus <Badge type="danger" text="boolean" />
|
|
116
|
+
|
|
117
|
+
编辑器渲染后是否自动聚焦,默认为 `false`
|
|
118
|
+
|
|
119
|
+
##### placeholder <Badge type="danger" text="string" />
|
|
120
|
+
|
|
121
|
+
编辑器内容仅有一个默认的段落时,用来占位的内容
|
|
122
|
+
|
|
123
|
+
##### dark <Badge type="danger" text="boolean" />
|
|
124
|
+
|
|
125
|
+
编辑器是否呈现深色风格,默认为 `false`,此属性对编辑器相关的所有组件都有影响
|
|
126
|
+
|
|
127
|
+
##### allowCopy <Badge type="danger" text="boolean" />
|
|
128
|
+
|
|
129
|
+
是否允许复制操作,默认为 `true`
|
|
130
|
+
|
|
131
|
+
##### allowPaste <Badge type="danger" text="boolean" />
|
|
132
|
+
|
|
133
|
+
是否允许粘贴操作,默认为 `true`
|
|
134
|
+
|
|
135
|
+
##### allowCut <Badge type="danger" text="boolean" />
|
|
136
|
+
|
|
137
|
+
是否允许剪切操作,默认为 `true`
|
|
138
|
+
|
|
139
|
+
##### allowPasteHtml <Badge type="danger" text="boolean" />
|
|
140
|
+
|
|
141
|
+
是否允许粘贴 `html`,即粘贴内容时是否携带样式,默认为 `false`
|
|
142
|
+
|
|
143
|
+
##### priorityPasteFiles <Badge type="danger" text="boolean" />
|
|
144
|
+
|
|
145
|
+
剪切板同时存在文件和 `html/text` 时,是否优先粘贴文件,默认为 `false`
|
|
146
|
+
|
|
147
|
+
##### textRenderTag <Badge type="danger" text="string" />
|
|
148
|
+
|
|
149
|
+
自定义编辑器内渲染文本节点的真实标签,默认为 `span`
|
|
150
|
+
|
|
151
|
+
##### blockRenderTag <Badge type="danger" text="string" />
|
|
152
|
+
|
|
153
|
+
自定义编辑内渲染默认块级节点的真实标签,即段落标签,默认为 `p`
|
|
154
|
+
|
|
155
|
+
##### emptyRenderTags <Badge type="danger" text="string[]" />
|
|
156
|
+
|
|
157
|
+
自定义编辑器内定义需要置空的标签
|
|
158
|
+
|
|
159
|
+
##### extraKeepTags <Badge type="danger" text="string[]" />
|
|
160
|
+
|
|
161
|
+
自定义编辑器内额外保留的标签
|
|
162
|
+
|
|
163
|
+
##### extensions <Badge type="danger" text="Extension[]" />
|
|
164
|
+
|
|
165
|
+
自定义插件数组
|
|
166
|
+
|
|
167
|
+
##### formatRules <Badge type="danger" text="RuleFunctionType[]" />
|
|
168
|
+
|
|
169
|
+
自定义节点数组格式化规则
|
|
170
|
+
|
|
171
|
+
##### onChange <Badge type="danger" text="(value: string) => void" />
|
|
172
|
+
|
|
173
|
+
编辑器值发生变更时触发的事件,回调参数为编辑器的字符串值,与 `value` 一起组成受控模式
|
|
174
|
+
|
|
175
|
+
##### onCreated <Badge type="danger" text="(editor: Editor) => void" />
|
|
176
|
+
|
|
177
|
+
编辑器创建完成后触发的事件,回调参数是编辑器实例对象
|
|
178
|
+
|
|
179
|
+
##### onDomParseNode <Badge type="danger" text="(this: Editor, node: KNode) => KNode" />
|
|
180
|
+
|
|
181
|
+
自定义 `dom` 转为非文本节点的后续处理
|
|
182
|
+
|
|
183
|
+
##### onPasteKeepMarks <Badge type="danger" text="(this: Editor, node: KNode) => KNodeMarksType" />
|
|
184
|
+
|
|
185
|
+
节点粘贴保留标记的自定义方法
|
|
186
|
+
|
|
187
|
+
##### onPasteKeepStyles <Badge type="danger" text="(this: Editor, node: KNode) => KNodeStylesType" />
|
|
188
|
+
|
|
189
|
+
节点粘贴保留样式的自定义方法
|
|
190
|
+
|
|
191
|
+
##### onPasteText <Badge type="danger" text="(this: Editor, text: string) => boolean | Promise<boolean>" />
|
|
192
|
+
|
|
193
|
+
编辑器粘贴纯文本时触发,如果返回 `true` 则表示继续使用默认逻辑,返回 `false` 则不走默认逻辑,需要进行自定义处理
|
|
194
|
+
|
|
195
|
+
##### onPasteHtml <Badge type="danger" text="(this: Editor, nodes: KNode[], html: string) => boolean | Promise<boolean>" />
|
|
196
|
+
|
|
197
|
+
编辑器粘贴 `html` 内容时触发,如果返回 `true` 则表示继续使用默认逻辑,返回 `false` 则不走默认逻辑,需要进行自定义处理
|
|
198
|
+
|
|
199
|
+
##### onPasteImage <Badge type="danger" text="(this: Editor, file: File) => boolean | Promise<boolean>" />
|
|
200
|
+
|
|
201
|
+
编辑器粘贴图片时触发,如果返回 `true` 则表示继续使用默认逻辑,返回 `false` 则不走默认逻辑,需要进行自定义处理
|
|
202
|
+
|
|
203
|
+
##### onPasteVideo <Badge type="danger" text="(this: Editor, file: File) => boolean | Promise<boolean>" />
|
|
204
|
+
|
|
205
|
+
编辑器粘贴视频时触发,如果返回 `true` 则表示继续使用默认逻辑,返回 `false` 则不走默认逻辑,需要进行自定义处理
|
|
206
|
+
|
|
207
|
+
##### onPasteFile <Badge type="danger" text="(this: Editor, file: File) => void | Promise<void>" />
|
|
208
|
+
|
|
209
|
+
编辑器粘贴除了图片和视频以外的文件时触发,需要自定义处理
|
|
210
|
+
|
|
211
|
+
##### onDetachMentBlockFromParent <Badge type="danger" text="(this: Editor, node: KNode) => boolean" />
|
|
212
|
+
|
|
213
|
+
在删除和换行操作中块节点节点从其父节点中抽离出去成为与父节点同级的节点后触发,如果返回 `true` 则表示继续使用默认逻辑,会将该节点转为段落,返回 `false` 则不走默认逻辑,需要自定义处理
|
|
214
|
+
|
|
215
|
+
##### onBeforePatchNodeToFormat <Badge type="danger" text="(this: Editor, node: KNode) => KNode" />
|
|
216
|
+
|
|
217
|
+
编辑器 `updateView` 执行时,通过比对新旧节点数组获取需要格式化的节点,在这些节点被格式化前,触发此方法,回调参数即当前需要被格式化的节点,该方法返回一个节点,返回的节点将会被格式化,如果你不需要任何特殊处理,返回入参提供的节点即可
|
|
218
|
+
|
|
219
|
+
##### onSelectionUpdate <Badge type="danger" text="(this: Editor, selection: Selection) => void" />
|
|
220
|
+
|
|
221
|
+
编辑器光标发生变化触发的事件,回调参数为编辑器的 `Selection` 对象实例
|
|
222
|
+
|
|
223
|
+
##### onInsertParagraph <Badge type="danger" text="(this: Editor, node: KNode) => void" />
|
|
224
|
+
|
|
225
|
+
编辑器进行换行时触发的事件,回调参数为换行后光标所在的块节点
|
|
226
|
+
|
|
227
|
+
##### onDeleteComplete <Badge type="danger" text="(this: Editor) => void" />
|
|
228
|
+
|
|
229
|
+
编辑器执行删除操作完成的时候触发的事件
|
|
230
|
+
|
|
231
|
+
##### onKeydown <Badge type="danger" text="(this: Editor, event: KeyboardEvent) => void" />
|
|
232
|
+
|
|
233
|
+
编辑器内键盘按下触发的事件,回调参数为 `KeyboardEvent`
|
|
234
|
+
|
|
235
|
+
##### onKeyup <Badge type="danger" text="(this: Editor, event: KeyboardEvent) => void" />
|
|
236
|
+
|
|
237
|
+
编辑器内键盘松开触发的事件,回调参数为 `KeyboardEvent`
|
|
238
|
+
|
|
239
|
+
##### onFocus <Badge type="danger" text="(this: Editor, event: FocusEvent) => void" />
|
|
240
|
+
|
|
241
|
+
编辑器获取光标触发的事件,回调参数为 `FocusEvent`
|
|
242
|
+
|
|
243
|
+
##### onBlur <Badge type="danger" text="(this: Editor, event: FocusEvent) => void" />
|
|
244
|
+
|
|
245
|
+
编辑器失去光标触发的事件,回调参数为 `FocusEvent`
|
|
246
|
+
|
|
247
|
+
##### onBeforeUpdateView <Badge type="danger" text="(this: Editor) => void" />
|
|
248
|
+
|
|
249
|
+
编辑器视图更新前触发的事件
|
|
250
|
+
|
|
251
|
+
##### onAfterUpdateView <Badge type="danger" text="(this: Editor) => void" />
|
|
252
|
+
|
|
253
|
+
编辑器视图更新后触发的事件
|
|
254
|
+
|
|
255
|
+
> 上述的属性部分继承于 kaitify 的 Editor 构建属性(同名属性),如果需要深入了解,可以去查看 kaitify 的文档
|
|
256
|
+
|
|
257
|
+
## API 组件属性/方法
|
|
258
|
+
|
|
259
|
+
`Wrapper` 提供了部分属性/方法可以通过组件实例来调用
|
|
260
|
+
|
|
261
|
+
##### elRef <Badge type="danger" text="React.MutableRefObject<HTMLDivElement | null>" />
|
|
262
|
+
|
|
263
|
+
获取组件实例即编辑器的 `dom` 元素
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
import { useRef, useState } from 'react'
|
|
267
|
+
import { Wrapper, WrapperRefType } from '@kaitify/react'
|
|
268
|
+
|
|
269
|
+
export default function App() {
|
|
270
|
+
const wrapperRef = useRef<WrapperRefType | null>(null)
|
|
271
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
272
|
+
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
//获取编辑器的dom元素
|
|
275
|
+
console.log(wrapperRef.current?.elRef.current)
|
|
276
|
+
}, [])
|
|
277
|
+
|
|
278
|
+
return <Wrapper ref={wrapperRef} value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'></Wrapper>
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
##### state <Badge type="danger" text="StateType" />
|
|
283
|
+
|
|
284
|
+
`Wrapper` 组件内部返回的关于编辑器状态的相关数据,包含 `editor` `selection` 两个属性,分别表示当前编辑器的 `Editor` 实例,当前编辑器的 `Selection` 实例
|
|
285
|
+
|
|
286
|
+
该数据是响应式的数据,所以我们每次通过该数据的 `editor` 属性调用 `kaitify` 编辑器的方法都是响应式的效果
|
|
287
|
+
|
|
288
|
+
```tsx
|
|
289
|
+
import { useRef, useState } from 'react'
|
|
290
|
+
import { Wrapper, WrapperRefType } from '@kaitify/react'
|
|
291
|
+
|
|
292
|
+
export default function App() {
|
|
293
|
+
const wrapperRef = useRef<WrapperRefType | null>(null)
|
|
294
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
295
|
+
|
|
296
|
+
useEffect(() => {
|
|
297
|
+
//获取编辑器的实例
|
|
298
|
+
console.log(wrapperRef.current?.state.editor.value)
|
|
299
|
+
}, [wrapperRef.current?.state.editor])
|
|
300
|
+
|
|
301
|
+
return <Wrapper ref={wrapperRef} value={content} onChange={v => setContent(v)} placeholder='输入正文内容...'></Wrapper>
|
|
302
|
+
}
|
|
303
|
+
```
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: false
|
|
3
|
+
aside: false
|
|
4
|
+
layout: home
|
|
5
|
+
title: 主页
|
|
6
|
+
|
|
7
|
+
hero:
|
|
8
|
+
name: kaitify for react
|
|
9
|
+
text: 一个简单的react富文本编辑器核心库
|
|
10
|
+
tagline: 轻松构建一个L1级别的react富文本编辑器...
|
|
11
|
+
image:
|
|
12
|
+
src: https://www.so-better.cn/docs/kaitify-core/logo.png
|
|
13
|
+
width: 288
|
|
14
|
+
actions:
|
|
15
|
+
- theme: brand
|
|
16
|
+
text: Get Started
|
|
17
|
+
link: /guide/introduction
|
|
18
|
+
- theme: alt
|
|
19
|
+
text: View on GitHub
|
|
20
|
+
link: https://github.com/so-better/kaitify-react
|
|
21
|
+
|
|
22
|
+
features:
|
|
23
|
+
- title: '@kaitify/core'
|
|
24
|
+
details: 基于原生JS的富文本编辑器核心库
|
|
25
|
+
link: https://www.so-better.cn/docs/kaitify-core/
|
|
26
|
+
- title: '@kaitify/vue'
|
|
27
|
+
details: 基于kaitify开发的vue富文本编辑器核心库
|
|
28
|
+
link: https://www.so-better.cn/docs/kaitify-vue/
|
|
29
|
+
- title: dap-util
|
|
30
|
+
details: 一个轻量的前端JavaScript工具库,专注于JavaScript,不关心UI
|
|
31
|
+
link: https://www.so-better.cn/docs/dap-util/
|
|
32
|
+
- title: animator-clip
|
|
33
|
+
details: 一个基于 JavaScript 的 requestAnimationFrame API 封装的轻量级 JS 动画插件
|
|
34
|
+
link: https://www.so-better.cn/docs/animator-clip/
|
|
35
|
+
- title: rem-fit
|
|
36
|
+
details: 一款使用rem适配web页面的轻量级插件
|
|
37
|
+
link: https://www.so-better.cn/docs/rem-fit/
|
|
38
|
+
- title: ruax
|
|
39
|
+
details: 一个轻量级的Javascript异步数据请求库
|
|
40
|
+
link: https://www.so-better.cn/docs/ruax/
|
|
41
|
+
---
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: align-center 居中对齐
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# align-center 居中对齐
|
|
6
|
+
|
|
7
|
+
设置/取消块节点的居中对齐效果
|
|
8
|
+
|
|
9
|
+
## 使用方法
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { useState } from 'react'
|
|
13
|
+
import { Wrapper, AlignCenterMenu } from '@kaitify/react'
|
|
14
|
+
|
|
15
|
+
export default function App() {
|
|
16
|
+
const [content, setContent] = useState('<p>hello</p>')
|
|
17
|
+
return <Wrapper value={content} onChange={v => setContent(v)} before={<AlignCenterMenu />}></Wrapper>
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Props 参数
|
|
22
|
+
|
|
23
|
+
##### disabled <Badge type="danger" text="boolean" />
|
|
24
|
+
|
|
25
|
+
是否禁用该菜单,默认为 `false`
|
|
26
|
+
|
|
27
|
+
##### shortcut <Badge type="danger" text="(e: KeyboardEvent) => boolean" />
|
|
28
|
+
|
|
29
|
+
菜单快捷键实现,继承自 `Menu` 组件的同名属性,具体使用可参考 [Menu 组件的 shortcut](/guide/menu#shortcut)
|