@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,79 @@
|
|
|
1
|
+
import { Editor, getNodeRenderOptions, KNodeMarksType, KNodeRenderOptionType } from '@kaitify/core'
|
|
2
|
+
import React, { ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
//原生属性和react属性对照表
|
|
5
|
+
export const ATTR_MAP: Record<string, string> = {
|
|
6
|
+
class: 'className',
|
|
7
|
+
for: 'htmlFor',
|
|
8
|
+
maxlength: 'maxLength',
|
|
9
|
+
minlength: 'minLength',
|
|
10
|
+
readonly: 'readOnly',
|
|
11
|
+
tabindex: 'tabIndex',
|
|
12
|
+
colspan: 'colSpan',
|
|
13
|
+
rowspan: 'rowSpan',
|
|
14
|
+
contenteditable: 'contentEditable',
|
|
15
|
+
autofocus: 'autoFocus',
|
|
16
|
+
enctype: 'encType',
|
|
17
|
+
novalidate: 'noValidate',
|
|
18
|
+
formnovalidate: 'formNoValidate',
|
|
19
|
+
defaultchecked: 'defaultChecked',
|
|
20
|
+
defaultvalue: 'defaultValue',
|
|
21
|
+
frameborder: 'frameBorder',
|
|
22
|
+
allowfullscreen: 'allowFullScreen',
|
|
23
|
+
autoplay: 'autoPlay',
|
|
24
|
+
controlslist: 'controlsList',
|
|
25
|
+
crossorigin: 'crossOrigin',
|
|
26
|
+
playsinline: 'playsInline',
|
|
27
|
+
acceptcharset: 'acceptCharset',
|
|
28
|
+
spellcheck: 'spellCheck',
|
|
29
|
+
srcdoc: 'srcDoc',
|
|
30
|
+
viewbox: 'viewBox',
|
|
31
|
+
preserveaspectratio: 'preserveAspectRatio'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 替换 attrs 的属性名为 React 识别的形式
|
|
36
|
+
*/
|
|
37
|
+
export const normalizeAttrs = (attrs: KNodeMarksType) => {
|
|
38
|
+
const newAttrs: KNodeMarksType = {}
|
|
39
|
+
for (const key in attrs) {
|
|
40
|
+
if (!Object.prototype.hasOwnProperty.call(attrs, key)) continue
|
|
41
|
+
const newKey = ATTR_MAP[key] ?? key
|
|
42
|
+
newAttrs[newKey] = attrs[key]
|
|
43
|
+
}
|
|
44
|
+
return newAttrs
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 生成ReactNode
|
|
49
|
+
*/
|
|
50
|
+
export const createReactNode = (options: KNodeRenderOptionType) => {
|
|
51
|
+
const children: ReactNode[] = []
|
|
52
|
+
if (options.children && options.children.length) {
|
|
53
|
+
options.children.forEach(item => {
|
|
54
|
+
children.push(createReactNode(item))
|
|
55
|
+
})
|
|
56
|
+
} else if (options.textContent) {
|
|
57
|
+
children.push(options.textContent)
|
|
58
|
+
}
|
|
59
|
+
options.attrs = normalizeAttrs(options.attrs)
|
|
60
|
+
if (Object.prototype.hasOwnProperty.call(options.attrs, 'contentEditable')) {
|
|
61
|
+
options.attrs['suppressContentEditableWarning'] = 'true'
|
|
62
|
+
}
|
|
63
|
+
return React.createElement(
|
|
64
|
+
options.tag,
|
|
65
|
+
{
|
|
66
|
+
key: options.key,
|
|
67
|
+
...options.attrs,
|
|
68
|
+
style: options.styles
|
|
69
|
+
},
|
|
70
|
+
children.length === 0 ? undefined : children
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 创建ReactNode数组
|
|
76
|
+
*/
|
|
77
|
+
export const createReactNodes = (editor: Editor): ReactNode[] => {
|
|
78
|
+
return editor.stackNodes.map(item => createReactNode(getNodeRenderOptions(editor, item)))
|
|
79
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { forwardRef, ReactNode, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'
|
|
2
|
+
import { flushSync } from 'react-dom'
|
|
3
|
+
import { createRoot, Root } from 'react-dom/client'
|
|
4
|
+
import { Editor } from '@kaitify/core'
|
|
5
|
+
import classNames from 'classnames'
|
|
6
|
+
import { translate } from '@/locale'
|
|
7
|
+
import { Teleport } from '@/core/teleport'
|
|
8
|
+
import { EditorContext } from '@/hooks/use-editor'
|
|
9
|
+
import { StateType, WrapperPropsType, WrapperRefType } from './props'
|
|
10
|
+
import { createReactNodes } from './render'
|
|
11
|
+
import styles from './style.module.less'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 编辑器编辑区域组件
|
|
15
|
+
*/
|
|
16
|
+
const Wrapper = forwardRef<WrapperRefType, WrapperPropsType>((props, ref) => {
|
|
17
|
+
//dom
|
|
18
|
+
const elRef = useRef<HTMLDivElement | null>(null)
|
|
19
|
+
//编辑器实例
|
|
20
|
+
const editor = useRef<Editor | undefined>(undefined)
|
|
21
|
+
//是否编辑器内部修改值
|
|
22
|
+
const [internalModification, setInternalModification] = useState(false)
|
|
23
|
+
//是否鼠标按下
|
|
24
|
+
const [isMouseDown, setIsMouseDown] = useState(false)
|
|
25
|
+
//编辑器更新标记
|
|
26
|
+
const [updateKey, setUpdateKey] = useState(0)
|
|
27
|
+
//编辑器响应式对象
|
|
28
|
+
const state = useMemo<StateType>(() => {
|
|
29
|
+
return {
|
|
30
|
+
editor: {
|
|
31
|
+
value: editor.current
|
|
32
|
+
},
|
|
33
|
+
selection: {
|
|
34
|
+
value: editor.current?.selection
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, [updateKey])
|
|
38
|
+
//编辑器是否创建完成
|
|
39
|
+
const isCreated = useRef(false)
|
|
40
|
+
const rootRef = useRef<Root | null>(null)
|
|
41
|
+
|
|
42
|
+
//渲染插槽
|
|
43
|
+
const renderSlot = (value?: ReactNode | ((props: StateType) => ReactNode)) => {
|
|
44
|
+
if (typeof value === 'function') {
|
|
45
|
+
return value(state)
|
|
46
|
+
}
|
|
47
|
+
return value
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//渲染编辑器内容
|
|
51
|
+
const renderChildrenSync = () => {
|
|
52
|
+
return new Promise<void>(resolve => {
|
|
53
|
+
//在微任务里调用 flushSync,避开渲染栈限制
|
|
54
|
+
queueMicrotask(() => {
|
|
55
|
+
//使用flushSync能够捕获render完成
|
|
56
|
+
flushSync(() => {
|
|
57
|
+
//初始创建
|
|
58
|
+
if (!rootRef.current) {
|
|
59
|
+
rootRef.current = createRoot(elRef.current!)
|
|
60
|
+
}
|
|
61
|
+
rootRef.current.render(<>{createReactNodes(editor.current!)}</>)
|
|
62
|
+
})
|
|
63
|
+
resolve()
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//创建编辑器
|
|
69
|
+
const createEditor = async () => {
|
|
70
|
+
//StrictMode模式下第二次渲染存在这个了,则阻止创建
|
|
71
|
+
if (editor.current) {
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
Editor.configure({
|
|
75
|
+
el: elRef.current!,
|
|
76
|
+
value: props.value ?? '',
|
|
77
|
+
placeholder: props.placeholder,
|
|
78
|
+
dark: props.dark,
|
|
79
|
+
editable: !props.disabled,
|
|
80
|
+
autofocus: props.autofocus,
|
|
81
|
+
allowCopy: props.allowCopy,
|
|
82
|
+
allowCut: props.allowCut,
|
|
83
|
+
allowPaste: props.allowPaste,
|
|
84
|
+
allowPasteHtml: props.allowPasteHtml,
|
|
85
|
+
priorityPasteFiles: props.priorityPasteFiles,
|
|
86
|
+
textRenderTag: props.textRenderTag,
|
|
87
|
+
blockRenderTag: props.blockRenderTag,
|
|
88
|
+
emptyRenderTags: props.emptyRenderTags,
|
|
89
|
+
extraKeepTags: props.extraKeepTags,
|
|
90
|
+
extensions: [...(props.extensions ?? [])],
|
|
91
|
+
formatRules: props.formatRules,
|
|
92
|
+
onDomParseNode: props.onDomParseNode,
|
|
93
|
+
onPasteKeepMarks: props.onPasteKeepMarks,
|
|
94
|
+
onPasteKeepStyles: props.onPasteKeepStyles,
|
|
95
|
+
onPasteText: props.onPasteText,
|
|
96
|
+
onPasteHtml: props.onPasteHtml,
|
|
97
|
+
onPasteImage: props.onPasteImage,
|
|
98
|
+
onPasteVideo: props.onPasteVideo,
|
|
99
|
+
onPasteFile: props.onPasteFile,
|
|
100
|
+
onDetachMentBlockFromParent: props.onDetachMentBlockFromParent,
|
|
101
|
+
onBeforePatchNodeToFormat: props.onBeforePatchNodeToFormat,
|
|
102
|
+
onInsertParagraph: props.onInsertParagraph,
|
|
103
|
+
onDeleteComplete: props.onDeleteComplete,
|
|
104
|
+
onKeydown: props.onKeydown,
|
|
105
|
+
onKeyup: props.onKeyup,
|
|
106
|
+
onFocus: props.onFocus,
|
|
107
|
+
onBlur: props.onBlur,
|
|
108
|
+
onBeforeUpdateView: props.onBeforeUpdateView,
|
|
109
|
+
onAfterUpdateView: props.onAfterUpdateView,
|
|
110
|
+
onCreate(ed) {
|
|
111
|
+
editor.current = ed
|
|
112
|
+
setUpdateKey(oldValue => oldValue + 1)
|
|
113
|
+
},
|
|
114
|
+
onCreated(ed) {
|
|
115
|
+
props.onCreated?.(ed)
|
|
116
|
+
setUpdateKey(oldValue => oldValue + 1)
|
|
117
|
+
isCreated.current = true
|
|
118
|
+
},
|
|
119
|
+
onSelectionUpdate(selection) {
|
|
120
|
+
props.onSelectionUpdate?.apply(this, [selection])
|
|
121
|
+
setUpdateKey(oldValue => oldValue + 1)
|
|
122
|
+
},
|
|
123
|
+
async onUpdateView() {
|
|
124
|
+
//渲染内容并等待视图渲染完成后
|
|
125
|
+
await renderChildrenSync()
|
|
126
|
+
//阻止默认渲染
|
|
127
|
+
return false
|
|
128
|
+
},
|
|
129
|
+
onChange: v => {
|
|
130
|
+
setInternalModification(true)
|
|
131
|
+
props.onChange?.(v)
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
useImperativeHandle(ref, () => ({
|
|
137
|
+
elRef,
|
|
138
|
+
state
|
|
139
|
+
}))
|
|
140
|
+
|
|
141
|
+
//监听编辑器的值
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (editor.current && isCreated.current) {
|
|
144
|
+
//内部改变
|
|
145
|
+
if (internalModification) {
|
|
146
|
+
setInternalModification(false)
|
|
147
|
+
setUpdateKey(oldValue => oldValue + 1)
|
|
148
|
+
}
|
|
149
|
+
//外部改变,进行视图更新
|
|
150
|
+
else {
|
|
151
|
+
editor.current.review(props.value ?? '').then(() => {
|
|
152
|
+
if (!props.disabled && props.autofocus) {
|
|
153
|
+
editor.current?.setSelectionAfter()
|
|
154
|
+
editor.current?.updateRealSelection()
|
|
155
|
+
setUpdateKey(oldValue => oldValue + 1)
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}, [props.value])
|
|
161
|
+
|
|
162
|
+
//监听以下属性变化,对编辑器进行更新
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if (editor.current && isCreated.current) {
|
|
165
|
+
editor.current.setEditable(!props.disabled)
|
|
166
|
+
editor.current.setDark(props.dark ?? false)
|
|
167
|
+
editor.current.allowCopy = props.allowCopy ?? true
|
|
168
|
+
editor.current.allowCut = props.allowCut ?? true
|
|
169
|
+
editor.current.allowPaste = props.allowPaste ?? true
|
|
170
|
+
editor.current.allowPasteHtml = props.allowPasteHtml ?? false
|
|
171
|
+
editor.current.priorityPasteFiles = props.priorityPasteFiles ?? false
|
|
172
|
+
setUpdateKey(oldValue => oldValue + 1)
|
|
173
|
+
}
|
|
174
|
+
}, [props.disabled, props.dark, props.allowCopy, props.allowCut, props.allowPaste, props.allowPasteHtml, props.priorityPasteFiles])
|
|
175
|
+
|
|
176
|
+
//初始化
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
//创建编辑器
|
|
179
|
+
createEditor()
|
|
180
|
+
//卸载时销毁编辑器
|
|
181
|
+
return () => {
|
|
182
|
+
//解决StrictMode模式下第一次还没创建完成就销毁导致的一系列问题,只有创建完成了才能进行销毁
|
|
183
|
+
if (isCreated.current) {
|
|
184
|
+
editor.current?.destroy()
|
|
185
|
+
editor.current = undefined
|
|
186
|
+
//放到微任务中去执行
|
|
187
|
+
queueMicrotask(() => {
|
|
188
|
+
rootRef.current?.unmount()
|
|
189
|
+
rootRef.current = null
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}, [])
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<EditorContext.Provider
|
|
197
|
+
value={{
|
|
198
|
+
state,
|
|
199
|
+
isMouseDown,
|
|
200
|
+
disabled: props.disabled ?? false,
|
|
201
|
+
el: elRef.current,
|
|
202
|
+
t: (key: string) => translate(props.locale ?? 'zh-CN', key),
|
|
203
|
+
dark: props.dark ?? false
|
|
204
|
+
}}
|
|
205
|
+
>
|
|
206
|
+
<>
|
|
207
|
+
{/* before */}
|
|
208
|
+
{!!props.appendBeforeTo ? <Teleport to={props.appendBeforeTo}>{renderSlot(props.before)}</Teleport> : renderSlot(props.before)}
|
|
209
|
+
{/* 编辑区域 */}
|
|
210
|
+
<div ref={elRef} className={classNames(styles['kaitify-border'], props.className)} style={props.style} onMouseDown={() => setIsMouseDown(true)} onMouseUp={() => setIsMouseDown(false)} />
|
|
211
|
+
{/* after */}
|
|
212
|
+
{!!props.appendAfterTo ? <Teleport to={props.appendAfterTo}>{renderSlot(props.after)}</Teleport> : renderSlot(props.after)}
|
|
213
|
+
{/* 插槽 */}
|
|
214
|
+
{renderSlot(props.children)}
|
|
215
|
+
</>
|
|
216
|
+
</EditorContext.Provider>
|
|
217
|
+
)
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
export default Wrapper
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useEditor } from './use-editor'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { StateType } from '@/editor/wrapper'
|
|
2
|
+
import { translate } from '@/locale'
|
|
3
|
+
import { createContext, useContext } from 'react'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 上下文数据类型
|
|
7
|
+
*/
|
|
8
|
+
export type EditorContextType = {
|
|
9
|
+
/**
|
|
10
|
+
* 编辑器状态数据
|
|
11
|
+
*/
|
|
12
|
+
state: StateType
|
|
13
|
+
/**
|
|
14
|
+
* 编辑器是否禁用
|
|
15
|
+
*/
|
|
16
|
+
disabled: boolean
|
|
17
|
+
/**
|
|
18
|
+
* 编辑器内鼠标是否按下
|
|
19
|
+
*/
|
|
20
|
+
isMouseDown: boolean
|
|
21
|
+
/**
|
|
22
|
+
* 编辑器元素
|
|
23
|
+
*/
|
|
24
|
+
el: HTMLDivElement | null
|
|
25
|
+
/**
|
|
26
|
+
* 翻译函数
|
|
27
|
+
*/
|
|
28
|
+
t: (key: string) => string
|
|
29
|
+
/**
|
|
30
|
+
* 是否深色模式
|
|
31
|
+
*/
|
|
32
|
+
dark: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const EditorContext = createContext<EditorContextType>({
|
|
36
|
+
state: {
|
|
37
|
+
editor: {},
|
|
38
|
+
selection: {}
|
|
39
|
+
},
|
|
40
|
+
disabled: false,
|
|
41
|
+
isMouseDown: false,
|
|
42
|
+
el: null,
|
|
43
|
+
t: (key: string) => translate('zh-CN', key),
|
|
44
|
+
dark: false
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
export const useEditor = () => useContext(EditorContext)
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
.kaitify-icon-emoji:before {
|
|
2
|
+
content: '\e623';
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.kaitify-icon-full-screen:before {
|
|
6
|
+
content: '\e62a';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.kaitify-icon-unlink:before {
|
|
10
|
+
content: '\e604';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.kaitify-icon-wrap-down:before {
|
|
14
|
+
content: '\e672';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.kaitify-icon-wrap-up:before {
|
|
18
|
+
content: '\e673';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.kaitify-icon-list-square:before {
|
|
22
|
+
content: '\e659';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.kaitify-icon-list-circle:before {
|
|
26
|
+
content: '\e65a';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.kaitify-icon-list-disc:before {
|
|
30
|
+
content: '\e65b';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.kaitify-icon-list-cjk-ideographic:before {
|
|
34
|
+
content: '\e658';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.kaitify-icon-list-lower-roman:before {
|
|
38
|
+
content: '\e653';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.kaitify-icon-list-lower-greek:before {
|
|
42
|
+
content: '\e654';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.kaitify-icon-list-upper-roman:before {
|
|
46
|
+
content: '\e655';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.kaitify-icon-list-decimal:before {
|
|
50
|
+
content: '\e656';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.kaitify-icon-list-lower-alpha:before {
|
|
54
|
+
content: '\e657';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kaitify-icon-list-upper-alpha:before {
|
|
58
|
+
content: '\e651';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.kaitify-icon-merge-cells-top:before {
|
|
62
|
+
content: '\e73e';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.kaitify-icon-merge-cells-left:before {
|
|
66
|
+
content: '\e741';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.kaitify-icon-merge-cells-right:before {
|
|
70
|
+
content: '\e73f';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.kaitify-icon-merge-cells-bottom:before {
|
|
74
|
+
content: '\e740';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.kaitify-icon-mathformula:before {
|
|
78
|
+
content: '\e616';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.kaitify-icon-separator:before {
|
|
82
|
+
content: '\e6e5';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.kaitify-icon-attachment:before {
|
|
86
|
+
content: '\e689';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.kaitify-icon-task:before {
|
|
90
|
+
content: '\e605';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.kaitify-icon-upload:before {
|
|
94
|
+
content: '\e637';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.kaitify-icon-remove:before {
|
|
98
|
+
content: '\e852';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.kaitify-icon-code:before {
|
|
102
|
+
content: '\e6a0';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.kaitify-icon-loop:before {
|
|
106
|
+
content: '\e621';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.kaitify-icon-muted:before {
|
|
110
|
+
content: '\ea0f';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.kaitify-icon-controls:before {
|
|
114
|
+
content: '\e627';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.kaitify-icon-video:before {
|
|
118
|
+
content: '\e622';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.kaitify-icon-delete:before {
|
|
122
|
+
content: '\e60f';
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.kaitify-icon-image:before {
|
|
126
|
+
content: '\e6ed';
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.kaitify-icon-brush:before {
|
|
130
|
+
content: '\e71c';
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.kaitify-icon-check:before {
|
|
134
|
+
content: '\e6cc';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.kaitify-icon-italic:before {
|
|
138
|
+
content: '\e69f';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.kaitify-icon-redo:before {
|
|
142
|
+
content: '\e6df';
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.kaitify-icon-undo:before {
|
|
146
|
+
content: '\e713';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.kaitify-icon-code-block:before {
|
|
150
|
+
content: '\e620';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.kaitify-icon-table:before {
|
|
154
|
+
content: '\e6c4';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.kaitify-icon-delete-table:before {
|
|
158
|
+
content: '\e7a2';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.kaitify-icon-align-center:before {
|
|
162
|
+
content: '\e783';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.kaitify-icon-align-justify:before {
|
|
166
|
+
content: '\e786';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.kaitify-icon-align-left:before {
|
|
170
|
+
content: '\e787';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.kaitify-icon-bold:before {
|
|
174
|
+
content: '\e78d';
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.kaitify-icon-align-right:before {
|
|
178
|
+
content: '\e78f';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.kaitify-icon-font-color:before {
|
|
182
|
+
content: '\e792';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.kaitify-icon-format-clear:before {
|
|
186
|
+
content: '\e793';
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.kaitify-icon-indent-increase:before {
|
|
190
|
+
content: '\e798';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.kaitify-icon-quote:before {
|
|
194
|
+
content: '\e79b';
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.kaitify-icon-indent-decrease:before {
|
|
198
|
+
content: '\e79c';
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.kaitify-icon-link:before {
|
|
202
|
+
content: '\e7a1';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.kaitify-icon-subscript:before {
|
|
206
|
+
content: '\e7a5';
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.kaitify-icon-superscript:before {
|
|
210
|
+
content: '\e7a6';
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.kaitify-icon-strikethrough:before {
|
|
214
|
+
content: '\e7a7';
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.kaitify-icon-underline:before {
|
|
218
|
+
content: '\e7a8';
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.kaitify-icon-caret-down:before {
|
|
222
|
+
content: '\e78c';
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.kaitify-icon-delete-column:before {
|
|
226
|
+
content: '\e784';
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.kaitify-icon-delete-row:before {
|
|
230
|
+
content: '\e785';
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.kaitify-icon-insert-column-left:before {
|
|
234
|
+
content: '\e788';
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.kaitify-icon-insert-column-right:before {
|
|
238
|
+
content: '\e789';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.kaitify-icon-insert-row-bottom:before {
|
|
242
|
+
content: '\e78a';
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.kaitify-icon-insert-row-top:before {
|
|
246
|
+
content: '\e78b';
|
|
247
|
+
}
|
|
Binary file
|
|
Binary file
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//字体图标
|
|
2
|
+
import './iconfont/iconfont.css'
|
|
3
|
+
//编辑器核心库
|
|
4
|
+
export * from '@kaitify/core'
|
|
5
|
+
//分隔线
|
|
6
|
+
export * from './core/divider'
|
|
7
|
+
//选项卡
|
|
8
|
+
export * from './core/tabs'
|
|
9
|
+
//复选框
|
|
10
|
+
export * from './core/checkbox'
|
|
11
|
+
//图标
|
|
12
|
+
export * from './core/icon'
|
|
13
|
+
//编辑器
|
|
14
|
+
export * from './editor/wrapper'
|
|
15
|
+
//气泡栏
|
|
16
|
+
export * from './editor/bubble'
|
|
17
|
+
//菜单
|
|
18
|
+
export * from './editor/menu'
|
|
19
|
+
//hooks
|
|
20
|
+
export * from './hooks'
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
本地上传: 'Local Upload',
|
|
3
|
+
远程地址: 'Remote Address',
|
|
4
|
+
附件名称: 'Attachment Name',
|
|
5
|
+
附件地址: 'Attachment Address',
|
|
6
|
+
附件: 'Attachment',
|
|
7
|
+
插入: 'Insert',
|
|
8
|
+
更新: 'Update',
|
|
9
|
+
默认颜色: 'Default Color',
|
|
10
|
+
默认字体: 'Default Font',
|
|
11
|
+
默认字号: 'Default Font Size',
|
|
12
|
+
默认行高: 'Default Line Height',
|
|
13
|
+
正文: 'Paragraph',
|
|
14
|
+
图片名称: 'Image Name',
|
|
15
|
+
图片地址: 'Image Address',
|
|
16
|
+
图片: 'Image',
|
|
17
|
+
链接地址: 'Link Address',
|
|
18
|
+
新窗口打开: 'New Window',
|
|
19
|
+
链接文字: 'Link Text',
|
|
20
|
+
是否自动播放: 'AutoPlay',
|
|
21
|
+
视频地址: 'Video Address',
|
|
22
|
+
输入Latex数学公式: 'Enter Latex Mathematical Formulas',
|
|
23
|
+
一级标题: 'Heading 1',
|
|
24
|
+
二级标题: 'Heading 2',
|
|
25
|
+
三级标题: 'Heading 3',
|
|
26
|
+
四级标题: 'Heading 4',
|
|
27
|
+
五级标题: 'Heading 5',
|
|
28
|
+
六级标题: 'Heading 6',
|
|
29
|
+
自动识别: 'Auto Detection'
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import enUS from './en-us'
|
|
2
|
+
import jaJP from './ja-jp'
|
|
3
|
+
import koKR from './ko-kr'
|
|
4
|
+
|
|
5
|
+
export type LocaleType = 'zh-CN' | 'en-US' | 'ko-KR' | 'ja-JP'
|
|
6
|
+
|
|
7
|
+
const localeMap = {
|
|
8
|
+
'en-US': enUS as typeof enUS & { [key: string]: string },
|
|
9
|
+
'ko-KR': koKR as typeof koKR & { [key: string]: string },
|
|
10
|
+
'ja-JP': jaJP as typeof jaJP & { [key: string]: string }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const translate = (locale: LocaleType, key: string) => {
|
|
14
|
+
if (locale == 'zh-CN') {
|
|
15
|
+
return key
|
|
16
|
+
}
|
|
17
|
+
return localeMap[locale][key] ?? key
|
|
18
|
+
}
|