From 00b52c5e15dd1bcd0d74975c1d399a7d445bd542 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Sun, 9 Apr 2023 13:24:34 +0800 Subject: [PATCH] fix lint --- packages/client/.eslintrc.js | 16 ++++++++++++++- .../components/admin/system-config/index.tsx | 3 ++- .../admin/system-config/mail/index.tsx | 4 +++- .../admin/system-config/system/index.tsx | 4 +++- .../client/src/components/banner/index.tsx | 4 +++- .../src/components/color-picker/index.tsx | 4 +++- .../src/components/data-render/constant.tsx | 6 ++++-- .../src/components/data-render/index.tsx | 3 ++- .../src/components/data-render/loading.tsx | 3 ++- .../src/components/document-creator/index.tsx | 4 +++- .../src/components/document/actions/index.tsx | 5 ++++- .../src/components/document/card/index.tsx | 5 ++++- .../document/collaboration/index.tsx | 4 +++- .../document/comments/comments/index.tsx | 3 ++- .../document/comments/comments/item/index.tsx | 5 ++++- .../components/document/comments/index.tsx | 10 +++++++--- .../src/components/document/create/index.tsx | 5 ++++- .../src/components/document/delete/index.tsx | 4 +++- .../src/components/document/editor/editor.tsx | 7 +++++-- .../src/components/document/editor/index.tsx | 5 ++++- .../src/components/document/export/index.tsx | 15 +++++++++----- .../components/document/fullscreen/index.tsx | 9 ++++++--- .../src/components/document/link/index.tsx | 5 ++++- .../src/components/document/reader/author.tsx | 5 ++++- .../src/components/document/reader/index.tsx | 10 +++++++--- .../src/components/document/share/index.tsx | 5 ++++- .../src/components/document/star/index.tsx | 13 +++++++----- .../src/components/document/style/index.tsx | 4 +++- .../src/components/document/version/index.tsx | 7 +++++-- .../src/components/emoji-picker/index.tsx | 5 ++++- packages/client/src/components/empty.tsx | 3 ++- .../components/grid-select/grid-select.tsx | 3 ++- .../src/components/icons/IconDocument.tsx | 3 ++- .../src/components/icons/IconDocumentFill.tsx | 3 ++- .../src/components/icons/IconMessage.tsx | 3 ++- .../src/components/icons/IconOverview.tsx | 3 ++- .../src/components/icons/IconSearch.tsx | 3 ++- .../src/components/icons/IconSetting.tsx | 3 ++- .../client/src/components/icons/IconShare.tsx | 3 ++- .../src/components/image-uploader/index.tsx | 6 ++++-- .../client/src/components/image-viewer.tsx | 1 + .../src/components/locale-time/index.tsx | 1 + packages/client/src/components/logo/index.tsx | 1 + .../client/src/components/members/add.tsx | 6 ++++-- .../client/src/components/members/edit.tsx | 6 ++++-- .../client/src/components/members/index.tsx | 6 +++++- .../client/src/components/message/index.tsx | 7 +++++-- .../components/organization/delete/index.tsx | 5 ++++- .../src/components/organization/index.tsx | 1 + .../organization/public-switcher/index.tsx | 2 ++ .../organization/setting/base/index.tsx | 5 ++++- .../components/organization/setting/index.tsx | 9 ++++++--- .../organization/setting/members/index.tsx | 4 +++- .../organization/setting/more/index.tsx | 1 + .../organization/switcher/index.tsx | 4 +++- .../src/components/resizeable/resizeable.tsx | 3 ++- .../client/src/components/search/index.tsx | 5 ++++- .../client/src/components/size-setter.tsx | 3 ++- .../src/components/template/card/index.tsx | 5 ++++- .../src/components/template/editor/index.tsx | 7 +++++-- .../src/components/template/list/index.tsx | 4 +++- .../src/components/template/reader/index.tsx | 7 +++++-- .../client/src/components/theme/index.tsx | 4 +++- .../client/src/components/tooltip/index.tsx | 4 +++- .../client/src/components/upload/index.tsx | 4 +++- packages/client/src/components/user/index.tsx | 4 +++- .../components/user/reset-password/index.tsx | 4 +++- .../src/components/user/setting/index.tsx | 4 +++- .../src/components/wiki-creator/index.tsx | 4 +++- .../wiki-or-document-creator/index.tsx | 4 +++- .../client/src/components/wiki/card/index.tsx | 1 + .../src/components/wiki/create/index.tsx | 5 ++++- .../src/components/wiki/delete/index.tsx | 4 +++- .../components/wiki/documents-share/index.tsx | 5 ++++- .../src/components/wiki/pin-card/index.tsx | 2 ++ .../src/components/wiki/placeholder/index.tsx | 3 ++- .../components/wiki/setting/base/index.tsx | 5 ++++- .../components/wiki/setting/import/index.tsx | 5 ++++- .../components/wiki/setting/import/parser.tsx | 4 +++- .../src/components/wiki/setting/index.tsx | 5 ++++- .../components/wiki/setting/more/index.tsx | 1 + .../components/wiki/setting/privacy/index.tsx | 5 ++++- .../components/wiki/setting/users/index.tsx | 3 ++- .../client/src/components/wiki/star/index.tsx | 5 ++++- .../client/src/components/wiki/tocs/index.tsx | 8 ++++++-- .../components/wiki/tocs/manager/index.tsx | 4 +++- .../src/components/wiki/tocs/nav-item.tsx | 3 ++- .../src/components/wiki/tocs/public.tsx | 8 ++++++-- .../client/src/components/wiki/tocs/tree.tsx | 7 +++++-- packages/client/src/data/comment.ts | 4 +++- packages/client/src/data/document.ts | 8 +++++--- packages/client/src/data/message.ts | 4 +++- packages/client/src/data/organization.ts | 8 +++++--- packages/client/src/data/star.ts | 6 ++++-- packages/client/src/data/template.ts | 4 +++- packages/client/src/data/user.ts | 7 +++++-- packages/client/src/data/wiki.ts | 6 ++++-- packages/client/src/event/index.ts | 1 + packages/client/src/helpers/generate-html.ts | 3 ++- .../client/src/hooks/use-document-style.tsx | 3 ++- .../client/src/hooks/use-dragable-width.tsx | 5 +++-- .../src/layouts/app-double-column/index.tsx | 13 +++++++----- .../src/layouts/app-router-header/index.tsx | 4 +++- .../src/layouts/app-router-header/recent.tsx | 7 +++++-- .../src/layouts/app-router-header/wiki.tsx | 7 +++++-- .../src/layouts/app-single-column/index.tsx | 4 +++- .../src/layouts/double-column/index.tsx | 13 +++++++----- .../layouts/public-double-column/index.tsx | 6 ++++-- .../src/layouts/router-header/index.tsx | 4 +++- .../src/layouts/single-column/index.tsx | 4 +++- packages/client/src/pages/_app.tsx | 20 ++++++++++--------- packages/client/src/pages/admin/index.tsx | 4 +++- packages/client/src/pages/app/index.tsx | 5 ++++- .../pages/app/org/[organizationId]/index.tsx | 5 ++++- .../org/[organizationId]/setting/index.tsx | 5 ++++- .../app/org/[organizationId]/star/index.tsx | 5 ++++- .../[wikiId]/doc/[documentId]/edit/index.tsx | 4 +++- .../wiki/[wikiId]/doc/[documentId]/index.tsx | 4 +++- .../[organizationId]/wiki/[wikiId]/index.tsx | 5 ++++- .../wiki/[wikiId]/setting/index.tsx | 4 +++- .../app/org/[organizationId]/wiki/index.tsx | 5 ++++- .../client/src/pages/app/org/create/index.tsx | 5 ++++- .../client/src/pages/feature/csrf/index.tsx | 3 ++- .../client/src/pages/feature/editor/index.tsx | 6 ++++-- packages/client/src/pages/find/index.tsx | 5 ++++- .../client/src/pages/forgetPassword/index.tsx | 4 +++- packages/client/src/pages/index.tsx | 4 +++- packages/client/src/pages/login/index.tsx | 4 +++- packages/client/src/pages/register/index.tsx | 4 +++- .../share/document/[documentId]/index.tsx | 4 +++- .../[wikiId]/document/[documentId]/index.tsx | 4 +++- .../src/pages/share/wiki/[wikiId]/index.tsx | 4 +++- .../src/pages/template/[templateId]/index.tsx | 1 + packages/client/src/pages/template/index.tsx | 4 +++- packages/client/src/services/file.ts | 1 + packages/client/src/services/http-client.ts | 1 + .../client/src/services/server-prefetcher.ts | 3 ++- packages/client/src/services/user.ts | 1 + .../core/bubble-menu/bubble-menu-plugin.tsx | 1 + .../core/extensions/background-color.ts | 1 - .../src/tiptap/core/extensions/clipboard.ts | 5 +++-- .../src/tiptap/core/extensions/code-block.ts | 3 ++- .../client/src/tiptap/core/extensions/code.ts | 3 ++- .../cursor-plugin/index.ts | 7 ++++--- .../extensions/collaboration-cursor/index.ts | 1 + .../extensions/collaboration/collaboration.ts | 1 + .../collaboration/helpers/is-change-origin.ts | 3 ++- .../core/extensions/color-highlighter.ts | 3 ++- .../src/tiptap/core/extensions/columns.ts | 3 ++- .../core/extensions/document-reference.ts | 1 + .../src/tiptap/core/extensions/dragable.ts | 8 +++++--- .../src/tiptap/core/extensions/emoji.ts | 5 +++-- .../tiptap/core/extensions/event-emitter.ts | 3 ++- .../src/tiptap/core/extensions/excalidraw.ts | 1 + .../client/src/tiptap/core/extensions/flow.ts | 1 + .../src/tiptap/core/extensions/focus.ts | 1 + .../src/tiptap/core/extensions/font-family.ts | 1 - .../src/tiptap/core/extensions/font-size.ts | 1 - .../tiptap/core/extensions/horizontal-rule.ts | 1 + .../src/tiptap/core/extensions/iframe.ts | 1 + .../src/tiptap/core/extensions/indent.ts | 5 +++-- .../src/tiptap/core/extensions/katex.ts | 1 + .../src/tiptap/core/extensions/loading.ts | 3 ++- .../src/tiptap/core/extensions/mention.ts | 5 +++-- .../client/src/tiptap/core/extensions/mind.ts | 1 + .../src/tiptap/core/extensions/paste.ts | 9 +++++---- .../src/tiptap/core/extensions/placeholder.ts | 1 + .../core/extensions/scroll-to-cursor.ts | 3 ++- .../src/tiptap/core/extensions/search.ts | 3 ++- .../src/tiptap/core/extensions/selection.ts | 5 +++-- .../src/tiptap/core/extensions/slash.ts | 5 +++-- .../src/tiptap/core/extensions/status.ts | 1 + .../src/tiptap/core/extensions/table-cell.tsx | 9 ++++++--- .../tiptap/core/extensions/table-header.tsx | 9 ++++++--- .../src/tiptap/core/extensions/table.ts | 1 + .../src/tiptap/core/extensions/task-list.ts | 3 ++- .../src/tiptap/core/extensions/title.ts | 3 ++- .../tiptap/core/extensions/trailing-node.ts | 1 + .../src/tiptap/core/hooks/use-active.tsx | 6 ++++-- .../src/tiptap/core/hooks/use-attributes.tsx | 6 ++++-- packages/client/src/tiptap/core/index.tsx | 4 +++- .../client/src/tiptap/core/menus/_event.ts | 3 ++- .../src/tiptap/core/menus/align/index.tsx | 4 +++- .../tiptap/core/menus/attachment/bubble.tsx | 9 ++++++--- .../tiptap/core/menus/attachment/index.tsx | 1 + .../core/menus/background-color/index.tsx | 9 ++++++--- .../tiptap/core/menus/blockquote/index.tsx | 9 ++++++--- .../src/tiptap/core/menus/bold/index.tsx | 7 +++++-- .../tiptap/core/menus/bullet-list/index.tsx | 9 ++++++--- .../src/tiptap/core/menus/callout/bubble.tsx | 11 ++++++---- .../src/tiptap/core/menus/callout/index.tsx | 1 + .../core/menus/clear-node-and-marks/index.tsx | 7 +++++-- .../tiptap/core/menus/code-block/bubble.tsx | 9 ++++++--- .../tiptap/core/menus/code-block/index.tsx | 1 + .../src/tiptap/core/menus/code/index.tsx | 7 +++++-- .../src/tiptap/core/menus/columns/bubble.tsx | 11 ++++++---- .../src/tiptap/core/menus/columns/index.tsx | 1 + .../client/src/tiptap/core/menus/commands.tsx | 5 ++++- .../tiptap/core/menus/countdown/bubble.tsx | 9 ++++++--- .../src/tiptap/core/menus/countdown/index.tsx | 1 + .../src/tiptap/core/menus/countdown/modal.tsx | 7 +++++-- .../core/menus/document-children/bubble.tsx | 9 ++++++--- .../core/menus/document-children/index.tsx | 1 + .../core/menus/document-reference/bubble.tsx | 13 +++++++----- .../core/menus/document-reference/index.tsx | 1 + .../src/tiptap/core/menus/emoji/index.tsx | 7 +++++-- .../tiptap/core/menus/excalidraw/bubble.tsx | 13 +++++++----- .../tiptap/core/menus/excalidraw/index.tsx | 1 + .../tiptap/core/menus/excalidraw/modal.tsx | 7 +++++-- .../src/tiptap/core/menus/flow/bubble.tsx | 13 +++++++----- .../src/tiptap/core/menus/flow/index.tsx | 1 + .../src/tiptap/core/menus/flow/modal.tsx | 9 ++++++--- .../tiptap/core/menus/fontfamily/index.tsx | 4 +++- .../src/tiptap/core/menus/fontsize/index.tsx | 4 +++- .../src/tiptap/core/menus/heading/index.tsx | 4 +++- .../core/menus/horizontal-rule/index.tsx | 9 ++++++--- .../src/tiptap/core/menus/ident/index.tsx | 7 +++++-- .../src/tiptap/core/menus/iframe/bubble.tsx | 13 +++++++----- .../src/tiptap/core/menus/iframe/index.tsx | 1 + .../src/tiptap/core/menus/image/bubble.tsx | 11 ++++++---- .../src/tiptap/core/menus/image/index.tsx | 1 + .../src/tiptap/core/menus/insert/index.tsx | 11 ++++++---- .../src/tiptap/core/menus/italic/index.tsx | 7 +++++-- .../src/tiptap/core/menus/katex/bubble.tsx | 13 +++++++----- .../src/tiptap/core/menus/katex/index.tsx | 1 + .../tiptap/core/menus/lineheight/index.tsx | 7 +++++-- .../src/tiptap/core/menus/link/bubble.tsx | 9 ++++++--- .../src/tiptap/core/menus/link/index.tsx | 9 ++++++--- .../src/tiptap/core/menus/link/modal.tsx | 7 +++++-- .../src/tiptap/core/menus/mind/bubble.tsx | 13 +++++++----- .../src/tiptap/core/menus/mind/index.tsx | 1 + .../src/tiptap/core/menus/mind/modal.tsx | 12 +++++++---- .../core/menus/mind/toolbar/bgcolor.tsx | 1 + .../core/menus/mind/toolbar/font-color.tsx | 1 + .../tiptap/core/menus/mind/toolbar/image.tsx | 4 +++- .../tiptap/core/menus/mind/toolbar/index.tsx | 4 +++- .../tiptap/core/menus/mind/toolbar/link.tsx | 3 ++- .../core/menus/mind/toolbar/template.tsx | 2 ++ .../tiptap/core/menus/mind/toolbar/theme.tsx | 2 ++ .../tiptap/core/menus/ordered-list/index.tsx | 9 ++++++--- .../src/tiptap/core/menus/redo/index.tsx | 7 +++++-- .../src/tiptap/core/menus/search/index.tsx | 9 ++++++--- .../src/tiptap/core/menus/strike/index.tsx | 7 +++++-- .../src/tiptap/core/menus/subscript/index.tsx | 9 ++++++--- .../tiptap/core/menus/superscript/index.tsx | 9 ++++++--- .../src/tiptap/core/menus/table/bubble.tsx | 11 ++++++---- .../tiptap/core/menus/table/col-bubble.tsx | 9 ++++++--- .../src/tiptap/core/menus/table/index.tsx | 1 + .../tiptap/core/menus/table/row-bubble.tsx | 9 ++++++--- .../src/tiptap/core/menus/task-list/index.tsx | 9 ++++++--- .../tiptap/core/menus/text-color/index.tsx | 9 ++++++--- .../src/tiptap/core/menus/text/index.tsx | 4 +++- .../src/tiptap/core/menus/underline/index.tsx | 7 +++++-- .../src/tiptap/core/menus/undo/index.tsx | 7 +++++-- .../core/wrappers/attachment/file-icon.tsx | 4 +++- .../tiptap/core/wrappers/attachment/index.tsx | 11 +++++++--- .../core/wrappers/attachment/player/index.tsx | 10 +++++++--- .../tiptap/core/wrappers/callout/index.tsx | 4 +++- .../tiptap/core/wrappers/code-block/index.tsx | 5 ++++- .../tiptap/core/wrappers/countdown/index.tsx | 9 ++++++--- .../core/wrappers/document-children/index.tsx | 5 ++++- .../wrappers/document-reference/index.tsx | 4 +++- .../tiptap/core/wrappers/emoji-list/index.tsx | 3 ++- .../tiptap/core/wrappers/excalidraw/index.tsx | 13 +++++++----- .../src/tiptap/core/wrappers/flow/index.tsx | 13 +++++++----- .../src/tiptap/core/wrappers/iframe/index.tsx | 7 +++++-- .../src/tiptap/core/wrappers/image/index.tsx | 13 +++++++----- .../src/tiptap/core/wrappers/katex/index.tsx | 4 +++- .../src/tiptap/core/wrappers/loading.tsx | 1 + .../core/wrappers/mention-list/index.tsx | 6 ++++-- .../tiptap/core/wrappers/menu-list/index.tsx | 7 +++++-- .../src/tiptap/core/wrappers/mind/index.tsx | 11 ++++++---- .../src/tiptap/core/wrappers/status/index.tsx | 5 ++++- .../core/wrappers/table-of-contents/index.tsx | 6 ++++-- .../tiptap/core/wrappers/task-item/index.tsx | 1 + .../src/tiptap/core/wrappers/title/index.tsx | 14 ++++++++----- .../collaboration/collaboration/editor.tsx | 16 +++++++++------ .../collaboration/collaboration/index.tsx | 12 +++++++---- .../collaboration/collaboration/menubar.tsx | 7 +++++-- .../collaboration/collaboration/type.ts | 3 ++- .../src/tiptap/editor/collaboration/kit.ts | 4 +++- .../src/tiptap/editor/comment/menubar.tsx | 7 +++++-- .../client/src/tiptap/editor/reader/index.tsx | 8 ++++++-- .../client/src/tiptap/editor/tocs/index.tsx | 16 +++++++++------ .../markdown-to-html/markdownItContainer.ts | 3 ++- .../markdown/prosemirror-to-markdown/index.ts | 3 ++- .../client/src/tiptap/prose-utils/columns.ts | 5 +++-- .../src/tiptap/prose-utils/copy-node.ts | 1 + .../src/tiptap/prose-utils/lowlight-plugin.ts | 1 + .../client/src/tiptap/prose-utils/node.ts | 1 + .../client/src/tiptap/prose-utils/table.ts | 1 + .../client/src/tiptap/prose-utils/upload.ts | 3 ++- packages/server/.eslintrc.js | 7 ++++++- packages/server/src/app-cluster.service.ts | 1 + packages/server/src/app.module.ts | 14 +++++++------ .../server/src/controllers/auth.controller.ts | 1 + .../src/controllers/comment.controller.ts | 10 ++++++---- .../src/controllers/document.controller.ts | 16 ++++++++------- .../server/src/controllers/file.controller.ts | 8 +++++--- .../src/controllers/message.controller.ts | 6 ++++-- .../controllers/organization.controller.ts | 10 ++++++---- .../server/src/controllers/star.controller.ts | 8 +++++--- .../src/controllers/system.controller.ts | 4 +++- .../src/controllers/template.controller.ts | 8 +++++--- .../server/src/controllers/user.controller.ts | 12 ++++++----- .../src/controllers/verify.controller.ts | 4 +++- .../server/src/controllers/view.controller.ts | 1 + .../server/src/controllers/wiki.controller.ts | 16 ++++++++------- packages/server/src/dtos/auth.dto.ts | 1 + packages/server/src/dtos/share-wiki.dto.ts | 1 + packages/server/src/entities/auth.entity.ts | 1 + .../server/src/entities/document.entity.ts | 3 ++- packages/server/src/entities/user.entity.ts | 1 + packages/server/src/entities/wiki.entity.ts | 3 ++- .../server/src/guard/document-status.guard.ts | 4 +++- packages/server/src/guard/user.guard.ts | 1 + .../server/src/guard/wiki-status.guard.ts | 4 +++- .../src/helpers/file.helper/aliyun.client.ts | 1 + .../src/helpers/file.helper/local.client.ts | 1 + packages/server/src/helpers/redis.helper.ts | 3 ++- packages/server/src/main.ts | 5 +++-- packages/server/src/modules/auth.module.ts | 5 +++-- packages/server/src/modules/comment.module.ts | 5 +++-- .../server/src/modules/document.module.ts | 7 ++++--- packages/server/src/modules/file.module.ts | 3 ++- packages/server/src/modules/message.module.ts | 5 +++-- .../server/src/modules/organization.module.ts | 5 +++-- packages/server/src/modules/star.module.ts | 5 +++-- packages/server/src/modules/system.module.ts | 5 +++-- .../server/src/modules/template.module.ts | 5 +++-- packages/server/src/modules/user.module.ts | 14 +++++++------ packages/server/src/modules/verify.module.ts | 3 ++- packages/server/src/modules/view.module.ts | 3 ++- packages/server/src/modules/wiki.module.ts | 5 +++-- packages/server/src/pipes/validation.pipe.ts | 1 + packages/server/src/services/auth.service.ts | 8 +++++--- .../src/services/collaboration.service.ts | 8 +++++--- .../server/src/services/comment.service.ts | 8 +++++--- .../src/services/document-version.service.ts | 6 ++++-- .../server/src/services/document.service.ts | 12 ++++++----- packages/server/src/services/file.service.ts | 3 ++- .../server/src/services/message.service.ts | 10 ++++++---- .../src/services/organization.service.ts | 8 +++++--- packages/server/src/services/star.service.ts | 8 +++++--- .../server/src/services/system.service.ts | 3 ++- .../server/src/services/template.service.ts | 8 +++++--- packages/server/src/services/user.service.ts | 14 +++++++------ .../server/src/services/verify.service.ts | 3 ++- packages/server/src/services/view.service.ts | 6 ++++-- packages/server/src/services/wiki.service.ts | 17 ++++++++-------- .../src/transforms/http-response.transform.ts | 1 + packages/server/test/app.e2e-spec.ts | 1 + 352 files changed, 1292 insertions(+), 585 deletions(-) diff --git a/packages/client/.eslintrc.js b/packages/client/.eslintrc.js index 47ca066..1646ab3 100644 --- a/packages/client/.eslintrc.js +++ b/packages/client/.eslintrc.js @@ -54,7 +54,21 @@ module.exports = { 'react/react-in-jsx-scope': 'off', 'react/prop-types': 'off', '@typescript-eslint/explicit-function-return-type': 'off', - 'simple-import-sort/imports': 'error', + 'simple-import-sort/imports': [ + 'error', + { + groups: [ + ['react'], + ['@douyinfe(.*)$'], + ['(@)?think(.*)$'], + ['(@)?tiptap(.*)$'], + ['^@?\\w'], + ['@/(.*)'], + ['^[./]'], + ['(.*).module.scss'], + ], + }, + ], 'simple-import-sort/exports': 'error', }, ignorePatterns: ['dist/', 'node_modules', 'scripts', 'examples'], diff --git a/packages/client/src/components/admin/system-config/index.tsx b/packages/client/src/components/admin/system-config/index.tsx index c1b12c9..8cc4228 100644 --- a/packages/client/src/components/admin/system-config/index.tsx +++ b/packages/client/src/components/admin/system-config/index.tsx @@ -1,6 +1,7 @@ -import { TabPane, Tabs } from '@douyinfe/semi-ui'; import React from 'react'; +import { TabPane, Tabs } from '@douyinfe/semi-ui'; + import { Mail } from './mail'; import { System } from './system'; diff --git a/packages/client/src/components/admin/system-config/mail/index.tsx b/packages/client/src/components/admin/system-config/mail/index.tsx index 83b84ec..968dae5 100644 --- a/packages/client/src/components/admin/system-config/mail/index.tsx +++ b/packages/client/src/components/admin/system-config/mail/index.tsx @@ -1,8 +1,10 @@ +import React, { useCallback } from 'react'; + import { Banner, Button, Form, Toast } from '@douyinfe/semi-ui'; + import { DataRender } from 'components/data-render'; import { useSystemConfig } from 'data/user'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback } from 'react'; export const Mail = () => { const { data, loading, error, sendTestEmail, updateSystemConfig } = useSystemConfig(); diff --git a/packages/client/src/components/admin/system-config/system/index.tsx b/packages/client/src/components/admin/system-config/system/index.tsx index 0e66888..ea95047 100644 --- a/packages/client/src/components/admin/system-config/system/index.tsx +++ b/packages/client/src/components/admin/system-config/system/index.tsx @@ -1,9 +1,11 @@ +import React, { useCallback } from 'react'; + import { IconHelpCircle } from '@douyinfe/semi-icons'; import { Banner, Button, Form, Toast, Tooltip } from '@douyinfe/semi-ui'; + import { DataRender } from 'components/data-render'; import { useSystemConfig } from 'data/user'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback } from 'react'; export const System = () => { const { data, loading, error, updateSystemConfig } = useSystemConfig(); diff --git a/packages/client/src/components/banner/index.tsx b/packages/client/src/components/banner/index.tsx index bd56e8d..b5b1288 100644 --- a/packages/client/src/components/banner/index.tsx +++ b/packages/client/src/components/banner/index.tsx @@ -1,8 +1,10 @@ +import React, { useEffect, useRef } from 'react'; + import { IconClose } from '@douyinfe/semi-icons'; import { Banner as SemiBanner } from '@douyinfe/semi-ui'; import { BannerProps } from '@douyinfe/semi-ui/banner'; + import { useToggle } from 'hooks/use-toggle'; -import React, { useEffect, useRef } from 'react'; interface IProps extends BannerProps { duration?: number; diff --git a/packages/client/src/components/color-picker/index.tsx b/packages/client/src/components/color-picker/index.tsx index 0ea7ba6..e510e47 100644 --- a/packages/client/src/components/color-picker/index.tsx +++ b/packages/client/src/components/color-picker/index.tsx @@ -1,7 +1,9 @@ +import React, { useMemo } from 'react'; + import { Dropdown, SideSheet, Typography } from '@douyinfe/semi-ui'; + import { IsOnMobile } from 'hooks/use-on-mobile'; import { useToggle } from 'hooks/use-toggle'; -import React, { useMemo } from 'react'; import styles from './style.module.scss'; diff --git a/packages/client/src/components/data-render/constant.tsx b/packages/client/src/components/data-render/constant.tsx index a0a78b4..1e43698 100644 --- a/packages/client/src/components/data-render/constant.tsx +++ b/packages/client/src/components/data-render/constant.tsx @@ -1,7 +1,9 @@ -import { Spin, Typography } from '@douyinfe/semi-ui'; -import { Empty } from 'illustrations/empty'; import React, { useMemo } from 'react'; +import { Spin, Typography } from '@douyinfe/semi-ui'; + +import { Empty } from 'illustrations/empty'; + const { Text } = Typography; export const defaultLoading = ( diff --git a/packages/client/src/components/data-render/index.tsx b/packages/client/src/components/data-render/index.tsx index 2b05bea..9f1179a 100644 --- a/packages/client/src/components/data-render/index.tsx +++ b/packages/client/src/components/data-render/index.tsx @@ -1,6 +1,7 @@ -import deepEqual from 'deep-equal'; import React from 'react'; +import deepEqual from 'deep-equal'; + import { defaultEmpty, defaultLoading, defaultRenderError, Render } from './constant'; import { LoadingWrap } from './loading'; diff --git a/packages/client/src/components/data-render/loading.tsx b/packages/client/src/components/data-render/loading.tsx index d071d2d..c696342 100644 --- a/packages/client/src/components/data-render/loading.tsx +++ b/packages/client/src/components/data-render/loading.tsx @@ -1,6 +1,7 @@ -import { useToggle } from 'hooks/use-toggle'; import React, { useEffect, useRef } from 'react'; +import { useToggle } from 'hooks/use-toggle'; + import { Render } from './constant'; export const LoadingWrap = ({ loading, delay = 200, loadingContent, normalContent }) => { diff --git a/packages/client/src/components/document-creator/index.tsx b/packages/client/src/components/document-creator/index.tsx index 07933c0..fa1b073 100644 --- a/packages/client/src/components/document-creator/index.tsx +++ b/packages/client/src/components/document-creator/index.tsx @@ -1,8 +1,10 @@ +import React from 'react'; + import { Button } from '@douyinfe/semi-ui'; + import { DocumentCreator as DocumenCreatorForm } from 'components/document/create'; import { useRouterQuery } from 'hooks/use-router-query'; import { useToggle } from 'hooks/use-toggle'; -import React from 'react'; interface IProps { onCreateDocument?: () => void; diff --git a/packages/client/src/components/document/actions/index.tsx b/packages/client/src/components/document/actions/index.tsx index fb608db..1fd9130 100644 --- a/packages/client/src/components/document/actions/index.tsx +++ b/packages/client/src/components/document/actions/index.tsx @@ -1,7 +1,11 @@ +import React, { useCallback } from 'react'; + import { IconArticle, IconBranch, IconExport, IconHistory, IconMore, IconPlus, IconStar } from '@douyinfe/semi-icons'; import { Button, Dropdown, Space, Typography } from '@douyinfe/semi-ui'; import { ButtonProps } from '@douyinfe/semi-ui/button/Button'; + import { IDocument, IOrganization, IWiki } from '@think/domains'; + import cls from 'classnames'; import { DocumentCreator } from 'components/document/create'; import { DocumentDeletor } from 'components/document/delete'; @@ -12,7 +16,6 @@ import { DocumentStar } from 'components/document/star'; import { DocumentStyle } from 'components/document/style'; import { DocumentVersionTrigger } from 'components/document/version'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/document/card/index.tsx b/packages/client/src/components/document/card/index.tsx index 93c6144..93a9ebd 100644 --- a/packages/client/src/components/document/card/index.tsx +++ b/packages/client/src/components/document/card/index.tsx @@ -1,13 +1,16 @@ +import { useCallback } from 'react'; + import { IconEdit, IconUser } from '@douyinfe/semi-icons'; import { Avatar, Button, Skeleton, Space, Tooltip, Typography } from '@douyinfe/semi-ui'; + import type { IDocument } from '@think/domains'; + import { DocumentShare } from 'components/document/share'; import { DocumentStar } from 'components/document/star'; import { IconDocument } from 'components/icons/IconDocument'; import { LocaleTime } from 'components/locale-time'; import Link from 'next/link'; import Router from 'next/router'; -import { useCallback } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/document/collaboration/index.tsx b/packages/client/src/components/document/collaboration/index.tsx index bda5856..cce3fb0 100644 --- a/packages/client/src/components/document/collaboration/index.tsx +++ b/packages/client/src/components/document/collaboration/index.tsx @@ -1,12 +1,14 @@ +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; + import { IconUserAdd } from '@douyinfe/semi-icons'; import { Avatar, AvatarGroup, Button, Dropdown, Modal, Popover, Toast, Tooltip, Typography } from '@douyinfe/semi-ui'; + import { Members } from 'components/members'; import { useDoumentMembers } from 'data/document'; import { useUser } from 'data/user'; import { event, JOIN_USER } from 'event'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; interface IProps { wikiId: string; diff --git a/packages/client/src/components/document/comments/comments/index.tsx b/packages/client/src/components/document/comments/comments/index.tsx index 3738ecb..19abe1c 100644 --- a/packages/client/src/components/document/comments/comments/index.tsx +++ b/packages/client/src/components/document/comments/comments/index.tsx @@ -1,6 +1,7 @@ -import type { IComment } from '@think/domains'; import React from 'react'; +import type { IComment } from '@think/domains'; + import { CommentItem } from './item'; interface IProps { diff --git a/packages/client/src/components/document/comments/comments/item/index.tsx b/packages/client/src/components/document/comments/comments/item/index.tsx index 566f77a..2bbb07c 100644 --- a/packages/client/src/components/document/comments/comments/item/index.tsx +++ b/packages/client/src/components/document/comments/comments/item/index.tsx @@ -1,9 +1,12 @@ +import React from 'react'; + import { IconUser } from '@douyinfe/semi-icons'; import { Avatar, Popconfirm, Skeleton, Space, Typography } from '@douyinfe/semi-ui'; + import type { IComment, IUser } from '@think/domains'; + import { LocaleTime } from 'components/locale-time'; import { useUser } from 'data/user'; -import React from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/document/comments/index.tsx b/packages/client/src/components/document/comments/index.tsx index 5fcd67a..c50c55e 100644 --- a/packages/client/src/components/document/comments/index.tsx +++ b/packages/client/src/components/document/comments/index.tsx @@ -1,13 +1,17 @@ +import React, { useCallback, useRef, useState } from 'react'; + import { Avatar, Banner, Button, Pagination, Space, Spin, Typography } from '@douyinfe/semi-ui'; + +import { EditorContent, useEditor } from 'tiptap/core'; +import { CommentKit, CommentMenuBar } from 'tiptap/editor'; + import { DataRender } from 'components/data-render'; import { useComments } from 'data/comment'; import { useUser } from 'data/user'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useRef, useState } from 'react'; -import { EditorContent, useEditor } from 'tiptap/core'; -import { CommentKit, CommentMenuBar } from 'tiptap/editor'; import { Comments } from './comments'; + import styles from './index.module.scss'; interface IProps { diff --git a/packages/client/src/components/document/create/index.tsx b/packages/client/src/components/document/create/index.tsx index 2846499..d392158 100644 --- a/packages/client/src/components/document/create/index.tsx +++ b/packages/client/src/components/document/create/index.tsx @@ -1,12 +1,15 @@ +import { Dispatch, SetStateAction, useCallback, useEffect, useState } from 'react'; + import { Checkbox, Modal, TabPane, Tabs } from '@douyinfe/semi-ui'; + import { IDocument, IWiki } from '@think/domains'; + import { TemplateCardEmpty } from 'components/template/card'; import { TemplateList } from 'components/template/list'; import { useCreateDocument } from 'data/document'; import { useOwnTemplates, usePublicTemplates } from 'data/template'; import { useRouterQuery } from 'hooks/use-router-query'; import Router from 'next/router'; -import { Dispatch, SetStateAction, useCallback, useEffect, useState } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/document/delete/index.tsx b/packages/client/src/components/document/delete/index.tsx index edcf759..9f92329 100644 --- a/packages/client/src/components/document/delete/index.tsx +++ b/packages/client/src/components/document/delete/index.tsx @@ -1,9 +1,11 @@ +import React, { useCallback, useMemo } from 'react'; + import { IconDelete } from '@douyinfe/semi-icons'; import { Popconfirm, Space, Typography } from '@douyinfe/semi-ui'; + import { useDeleteDocument } from 'data/document'; import { useRouterQuery } from 'hooks/use-router-query'; import Router from 'next/router'; -import React, { useCallback, useMemo } from 'react'; interface IProps { wikiId: string; diff --git a/packages/client/src/components/document/editor/editor.tsx b/packages/client/src/components/document/editor/editor.tsx index 45dc0a9..fd1899c 100644 --- a/packages/client/src/components/document/editor/editor.tsx +++ b/packages/client/src/components/document/editor/editor.tsx @@ -1,9 +1,12 @@ +import React, { useEffect, useRef } from 'react'; + import { IAuthority, ILoginUser } from '@think/domains'; + +import { CollaborationEditor, ICollaborationRefProps } from 'tiptap/editor'; + import cls from 'classnames'; import { event, triggerChangeDocumentTitle, triggerJoinUser, USE_DOCUMENT_VERSION } from 'event'; import { useMount } from 'hooks/use-mount'; -import React, { useEffect, useRef } from 'react'; -import { CollaborationEditor, ICollaborationRefProps } from 'tiptap/editor'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/document/editor/index.tsx b/packages/client/src/components/document/editor/index.tsx index e08e1e4..642e04f 100644 --- a/packages/client/src/components/document/editor/index.tsx +++ b/packages/client/src/components/document/editor/index.tsx @@ -1,5 +1,8 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; + import { IconChevronLeft } from '@douyinfe/semi-icons'; import { Button, Nav, Skeleton, Space, Tooltip, Typography } from '@douyinfe/semi-ui'; + import { DataRender } from 'components/data-render'; import { Divider } from 'components/divider'; import { DocumentCollaboration } from 'components/document/collaboration'; @@ -16,10 +19,10 @@ import { IsOnMobile } from 'hooks/use-on-mobile'; import { useWindowSize } from 'hooks/use-window-size'; import { SecureDocumentIllustration } from 'illustrations/secure-document'; import Router from 'next/router'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { DocumentActions } from '../actions'; import { Editor } from './editor'; + import styles from './index.module.scss'; const { Text } = Typography; diff --git a/packages/client/src/components/document/export/index.tsx b/packages/client/src/components/document/export/index.tsx index 186391e..00f6577 100644 --- a/packages/client/src/components/document/export/index.tsx +++ b/packages/client/src/components/document/export/index.tsx @@ -1,18 +1,23 @@ +import React, { useCallback, useEffect, useMemo } from 'react'; + import { Badge, Button, Dropdown, Modal, Space, Typography } from '@douyinfe/semi-ui'; + import { IDocument } from '@think/domains'; + +import { createEditor } from 'tiptap/core'; +import { AllExtensions } from 'tiptap/core/all-kit'; +import { prosemirrorToMarkdown } from 'tiptap/markdown/prosemirror-to-markdown'; + import { IconJSON, IconMarkdown, IconPDF, IconWord } from 'components/icons'; import { useDocumentDetail } from 'data/document'; import FileSaver from 'file-saver'; import { safeJSONParse, safeJSONStringify } from 'helpers/json'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useEffect, useMemo } from 'react'; -import { createEditor } from 'tiptap/core'; -import { AllExtensions } from 'tiptap/core/all-kit'; -import { prosemirrorToMarkdown } from 'tiptap/markdown/prosemirror-to-markdown'; + +import { printEditorContent } from './pdf'; import styles from './index.module.scss'; -import { printEditorContent } from './pdf'; const { Text } = Typography; diff --git a/packages/client/src/components/document/fullscreen/index.tsx b/packages/client/src/components/document/fullscreen/index.tsx index d7361ae..34933d4 100644 --- a/packages/client/src/components/document/fullscreen/index.tsx +++ b/packages/client/src/components/document/fullscreen/index.tsx @@ -1,15 +1,18 @@ +import React, { useCallback, useEffect, useRef, useState } from 'react'; +import { FullScreen, useFullScreenHandle } from 'react-full-screen'; + import { IconShrinkScreenStroked } from '@douyinfe/semi-icons'; import { Button, Space, Tooltip, Typography } from '@douyinfe/semi-ui'; + import { EditorContent, useEditor } from '@tiptap/react'; +import { CollaborationKit, Document } from 'tiptap/editor'; + import cls from 'classnames'; import { IconFullscreen } from 'components/icons/IconFullscreen'; import { IconPencil } from 'components/icons/IconPencil'; import { safeJSONParse } from 'helpers/json'; import { useDrawingCursor } from 'hooks/use-cursor'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useEffect, useRef, useState } from 'react'; -import { FullScreen, useFullScreenHandle } from 'react-full-screen'; -import { CollaborationKit, Document } from 'tiptap/editor'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/document/link/index.tsx b/packages/client/src/components/document/link/index.tsx index 928e312..0cdc1fd 100644 --- a/packages/client/src/components/document/link/index.tsx +++ b/packages/client/src/components/document/link/index.tsx @@ -1,9 +1,12 @@ +import React, { useCallback } from 'react'; + import { IconLink } from '@douyinfe/semi-icons'; import { Space, Typography } from '@douyinfe/semi-ui'; + import { IDocument, IOrganization, IWiki } from '@think/domains'; + import { copy } from 'helpers/copy'; import { buildUrl } from 'helpers/url'; -import React, { useCallback } from 'react'; interface IProps { organizationId: IOrganization['id']; diff --git a/packages/client/src/components/document/reader/author.tsx b/packages/client/src/components/document/reader/author.tsx index ec44d29..575a568 100644 --- a/packages/client/src/components/document/reader/author.tsx +++ b/packages/client/src/components/document/reader/author.tsx @@ -1,8 +1,11 @@ +import React from 'react'; + import { IconUser } from '@douyinfe/semi-icons'; import { Avatar, Space } from '@douyinfe/semi-ui'; + import { IDocument } from '@think/domains'; + import { LocaleTime } from 'components/locale-time'; -import React from 'react'; interface IProps { document: IDocument; diff --git a/packages/client/src/components/document/reader/index.tsx b/packages/client/src/components/document/reader/index.tsx index 68ce6cf..f54e515 100644 --- a/packages/client/src/components/document/reader/index.tsx +++ b/packages/client/src/components/document/reader/index.tsx @@ -1,5 +1,11 @@ +import React, { useCallback, useMemo } from 'react'; +import { createPortal } from 'react-dom'; + import { IconEdit } from '@douyinfe/semi-icons'; import { Button, Layout, Nav, Skeleton, Space, Spin, Tooltip, Typography } from '@douyinfe/semi-ui'; + +import { CollaborationEditor } from 'tiptap/editor'; + import { DataRender } from 'components/data-render'; import { DocumentCollaboration } from 'components/document/collaboration'; import { DocumentStar } from 'components/document/star'; @@ -13,13 +19,11 @@ import { useMount } from 'hooks/use-mount'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { useWindowSize } from 'hooks/use-window-size'; import Router from 'next/router'; -import React, { useCallback, useMemo } from 'react'; -import { createPortal } from 'react-dom'; -import { CollaborationEditor } from 'tiptap/editor'; import { DocumentActions } from '../actions'; import { DocumentFullscreen } from '../fullscreen'; import { Author } from './author'; + import styles from './index.module.scss'; const { Header } = Layout; diff --git a/packages/client/src/components/document/share/index.tsx b/packages/client/src/components/document/share/index.tsx index 4c14510..e223024 100644 --- a/packages/client/src/components/document/share/index.tsx +++ b/packages/client/src/components/document/share/index.tsx @@ -1,12 +1,15 @@ +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; + import { IconLink } from '@douyinfe/semi-icons'; import { Button, Dropdown, Input, Modal, Space, Toast, Typography } from '@douyinfe/semi-ui'; + import { isPublicDocument } from '@think/domains'; + import { useDocumentDetail } from 'data/document'; import { getDocumentShareURL } from 'helpers/url'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { useToggle } from 'hooks/use-toggle'; import { ShareIllustration } from 'illustrations/share'; -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; interface IProps { documentId: string; diff --git a/packages/client/src/components/document/star/index.tsx b/packages/client/src/components/document/star/index.tsx index 0583ead..d21f1ff 100644 --- a/packages/client/src/components/document/star/index.tsx +++ b/packages/client/src/components/document/star/index.tsx @@ -1,11 +1,14 @@ -import { IconStar } from '@douyinfe/semi-icons'; -import { Button, Tooltip } from '@douyinfe/semi-ui'; -import { IDocument, IOrganization, IWiki } from '@think/domains'; -import { useDocumentStarToggle } from 'data/star'; -import { useToggle } from 'hooks/use-toggle'; import React, { useCallback } from 'react'; import VisibilitySensor from 'react-visibility-sensor'; +import { IconStar } from '@douyinfe/semi-icons'; +import { Button, Tooltip } from '@douyinfe/semi-ui'; + +import { IDocument, IOrganization, IWiki } from '@think/domains'; + +import { useDocumentStarToggle } from 'data/star'; +import { useToggle } from 'hooks/use-toggle'; + interface IProps { organizationId: IOrganization['id']; wikiId: IWiki['id']; diff --git a/packages/client/src/components/document/style/index.tsx b/packages/client/src/components/document/style/index.tsx index b1e753d..03e80cf 100644 --- a/packages/client/src/components/document/style/index.tsx +++ b/packages/client/src/components/document/style/index.tsx @@ -1,10 +1,12 @@ +import React, { useMemo } from 'react'; + import { IconArticle } from '@douyinfe/semi-icons'; import { Button, Dropdown, Radio, RadioGroup, Slider, Typography } from '@douyinfe/semi-ui'; + import { throttle } from 'helpers/throttle'; import { useDocumentStyle } from 'hooks/use-document-style'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { useToggle } from 'hooks/use-toggle'; -import React, { useMemo } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/document/version/index.tsx b/packages/client/src/components/document/version/index.tsx index 403c6b5..3c81597 100644 --- a/packages/client/src/components/document/version/index.tsx +++ b/packages/client/src/components/document/version/index.tsx @@ -1,6 +1,11 @@ +import React, { useCallback, useEffect, useState } from 'react'; + import { IconChevronLeft } from '@douyinfe/semi-icons'; import { Button, Modal, Select, Space, Tag, Typography } from '@douyinfe/semi-ui'; + import { EditorContent, useEditor } from '@tiptap/react'; +import { CollaborationKit } from 'tiptap/editor'; + import cls from 'classnames'; import { DataRender } from 'components/data-render'; import { LocaleTime } from 'components/locale-time'; @@ -9,8 +14,6 @@ import { generateDiffHtml } from 'helpers/generate-html'; import { safeJSONParse } from 'helpers/json'; import { DocumentVersionControl } from 'hooks/use-document-version'; import { IsOnMobile } from 'hooks/use-on-mobile'; -import React, { useCallback, useEffect, useState } from 'react'; -import { CollaborationKit } from 'tiptap/editor'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/emoji-picker/index.tsx b/packages/client/src/components/emoji-picker/index.tsx index 50c70c8..473be36 100644 --- a/packages/client/src/components/emoji-picker/index.tsx +++ b/packages/client/src/components/emoji-picker/index.tsx @@ -1,10 +1,13 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; + import { Button, Popover, SideSheet, TabPane, Tabs } from '@douyinfe/semi-ui'; + import { createKeysLocalStorageLRUCache } from 'helpers/lru-cache'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { ACTIVITIES, EXPRESSIONES, GESTURES, OBJECTS, SKY_WEATHER, SYMBOLS } from './constants'; + import styles from './index.module.scss'; const emojiLocalStorageLRUCache = createKeysLocalStorageLRUCache('EMOJI_PICKER', 20); diff --git a/packages/client/src/components/empty.tsx b/packages/client/src/components/empty.tsx index 9cb26a6..de3f0df 100644 --- a/packages/client/src/components/empty.tsx +++ b/packages/client/src/components/empty.tsx @@ -1,6 +1,7 @@ -import { Typography } from '@douyinfe/semi-ui'; import React from 'react'; +import { Typography } from '@douyinfe/semi-ui'; + interface IProps { illustration?: React.ReactNode; message: React.ReactNode; diff --git a/packages/client/src/components/grid-select/grid-select.tsx b/packages/client/src/components/grid-select/grid-select.tsx index 2a6517f..52105c2 100644 --- a/packages/client/src/components/grid-select/grid-select.tsx +++ b/packages/client/src/components/grid-select/grid-select.tsx @@ -1,6 +1,7 @@ -import { Typography } from '@douyinfe/semi-ui'; import React, { useCallback, useMemo, useState } from 'react'; +import { Typography } from '@douyinfe/semi-ui'; + import { GridCell } from './grid-cell'; const { Text } = Typography; diff --git a/packages/client/src/components/icons/IconDocument.tsx b/packages/client/src/components/icons/IconDocument.tsx index 9df647e..7a50f24 100644 --- a/packages/client/src/components/icons/IconDocument.tsx +++ b/packages/client/src/components/icons/IconDocument.tsx @@ -1,6 +1,7 @@ -import { Icon } from '@douyinfe/semi-ui'; import React from 'react'; +import { Icon } from '@douyinfe/semi-ui'; + export const IconDocument: React.FC<{ style?: React.CSSProperties }> = ({ style = {} }) => { return ( = ({ style = {} }) => { return ( = ({ style = {} }) => { return ( = ({ style = {} }) => { return ( = ({ style = {} }) => { return ( = ({ style = {} }) => { return ( = ({ style = {} }) => { return ( any; } diff --git a/packages/client/src/components/members/edit.tsx b/packages/client/src/components/members/edit.tsx index 777b1d3..34b702d 100644 --- a/packages/client/src/components/members/edit.tsx +++ b/packages/client/src/components/members/edit.tsx @@ -1,7 +1,9 @@ -import { Banner, Popconfirm, Select, Toast } from '@douyinfe/semi-ui'; -import { AuthEnum, AuthEnumArray, IAuth, IUser } from '@think/domains'; import React, { useCallback, useState } from 'react'; +import { Banner, Popconfirm, Select, Toast } from '@douyinfe/semi-ui'; + +import { AuthEnum, AuthEnumArray, IAuth, IUser } from '@think/domains'; + interface IProps { userWithAuth: { user: IUser; auth: IAuth }; updateUser: (arg) => any; diff --git a/packages/client/src/components/members/index.tsx b/packages/client/src/components/members/index.tsx index b34b6ad..0cefa7b 100644 --- a/packages/client/src/components/members/index.tsx +++ b/packages/client/src/components/members/index.tsx @@ -1,12 +1,16 @@ +import React from 'react'; + import { IconDelete, IconEdit } from '@douyinfe/semi-icons'; import { Banner, Button, Popconfirm, Table, Typography } from '@douyinfe/semi-ui'; + import { AuthEnumTextMap } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { LocaleTime } from 'components/locale-time'; -import React from 'react'; import { AddUser } from './add'; import { EditUser } from './edit'; + import styles from './index.module.scss'; interface IProps { diff --git a/packages/client/src/components/message/index.tsx b/packages/client/src/components/message/index.tsx index 7d425ea..50ebd5c 100644 --- a/packages/client/src/components/message/index.tsx +++ b/packages/client/src/components/message/index.tsx @@ -1,4 +1,7 @@ +import React, { useCallback, useMemo } from 'react'; + import { Badge, Button, Dropdown, Modal, Pagination, TabPane, Tabs, Typography } from '@douyinfe/semi-ui'; + import { DataRender } from 'components/data-render'; import { Empty } from 'components/empty'; import { IconMessage } from 'components/icons/IconMessage'; @@ -8,10 +11,10 @@ import { IsOnMobile } from 'hooks/use-on-mobile'; import { useToggle } from 'hooks/use-toggle'; import { EmptyBoxIllustration } from 'illustrations/empty-box'; import Link from 'next/link'; -import React, { useCallback, useMemo } from 'react'; + +import { Placeholder } from './placeholder'; import styles from './index.module.scss'; -import { Placeholder } from './placeholder'; const { Text } = Typography; const PAGE_SIZE = 6; diff --git a/packages/client/src/components/organization/delete/index.tsx b/packages/client/src/components/organization/delete/index.tsx index e971463..5234d8b 100644 --- a/packages/client/src/components/organization/delete/index.tsx +++ b/packages/client/src/components/organization/delete/index.tsx @@ -1,10 +1,13 @@ +import React, { useCallback } from 'react'; + import { IconDelete } from '@douyinfe/semi-icons'; import { Modal, Space, Typography } from '@douyinfe/semi-ui'; + import { IOrganization } from '@think/domains'; + import { useOrganizationDetail } from 'data/organization'; import { useRouterQuery } from 'hooks/use-router-query'; import Router from 'next/router'; -import React, { useCallback } from 'react'; interface IProps { organizationId: IOrganization['id']; diff --git a/packages/client/src/components/organization/index.tsx b/packages/client/src/components/organization/index.tsx index 9e65800..651bdbe 100644 --- a/packages/client/src/components/organization/index.tsx +++ b/packages/client/src/components/organization/index.tsx @@ -1,5 +1,6 @@ import { Typography } from '@douyinfe/semi-ui'; import { Avatar } from '@douyinfe/semi-ui'; + import { DataRender } from 'components/data-render'; import { useOrganizationDetail } from 'data/organization'; import { useRouterQuery } from 'hooks/use-router-query'; diff --git a/packages/client/src/components/organization/public-switcher/index.tsx b/packages/client/src/components/organization/public-switcher/index.tsx index f9362af..1cb4b6a 100644 --- a/packages/client/src/components/organization/public-switcher/index.tsx +++ b/packages/client/src/components/organization/public-switcher/index.tsx @@ -1,9 +1,11 @@ import { Space } from '@douyinfe/semi-ui'; + import { LogoImage, LogoText } from 'components/logo'; import { useUser } from 'data/user'; import { useWindowSize } from 'hooks/use-window-size'; import { UserOrganizationsSwitcher } from '../switcher'; + import styles from './index.module.scss'; export const OrganizationPublicSwitcher = () => { diff --git a/packages/client/src/components/organization/setting/base/index.tsx b/packages/client/src/components/organization/setting/base/index.tsx index 6e39487..874db1a 100644 --- a/packages/client/src/components/organization/setting/base/index.tsx +++ b/packages/client/src/components/organization/setting/base/index.tsx @@ -1,12 +1,15 @@ +import { useCallback, useEffect, useRef, useState } from 'react'; + import { Avatar, Button, Form, Toast } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; + import { ORGANIZATION_LOGOS } from '@think/constants'; import { IOrganization } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { ImageUploader } from 'components/image-uploader'; import { useOrganizationDetail } from 'data/organization'; import { useToggle } from 'hooks/use-toggle'; -import { useCallback, useEffect, useRef, useState } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/organization/setting/index.tsx b/packages/client/src/components/organization/setting/index.tsx index 0caf402..39b55b8 100644 --- a/packages/client/src/components/organization/setting/index.tsx +++ b/packages/client/src/components/organization/setting/index.tsx @@ -1,8 +1,11 @@ -import { TabPane, Tabs } from '@douyinfe/semi-ui'; -import { IOrganization } from '@think/domains'; -import { Seo } from 'components/seo'; import React from 'react'; +import { TabPane, Tabs } from '@douyinfe/semi-ui'; + +import { IOrganization } from '@think/domains'; + +import { Seo } from 'components/seo'; + import { Base } from './base'; import { OrganizationMembers } from './members'; import { More } from './more'; diff --git a/packages/client/src/components/organization/setting/members/index.tsx b/packages/client/src/components/organization/setting/members/index.tsx index e838107..121cabf 100644 --- a/packages/client/src/components/organization/setting/members/index.tsx +++ b/packages/client/src/components/organization/setting/members/index.tsx @@ -1,7 +1,9 @@ +import React from 'react'; + import { IOrganization } from '@think/domains'; + import { Members } from 'components/members'; import { useOrganizationMembers } from 'data/organization'; -import React from 'react'; interface IProps { organizationId: IOrganization['id']; diff --git a/packages/client/src/components/organization/setting/more/index.tsx b/packages/client/src/components/organization/setting/more/index.tsx index 086c012..339a515 100644 --- a/packages/client/src/components/organization/setting/more/index.tsx +++ b/packages/client/src/components/organization/setting/more/index.tsx @@ -1,4 +1,5 @@ import { Banner, Button, Typography } from '@douyinfe/semi-ui'; + import { OrganizationDeletor } from 'components/organization/delete'; const { Paragraph } = Typography; diff --git a/packages/client/src/components/organization/switcher/index.tsx b/packages/client/src/components/organization/switcher/index.tsx index e2ee8ec..7ce7e1c 100644 --- a/packages/client/src/components/organization/switcher/index.tsx +++ b/packages/client/src/components/organization/switcher/index.tsx @@ -1,11 +1,13 @@ +import { useMemo } from 'react'; + import { IconAppCenter, IconApps, IconSmallTriangleDown } from '@douyinfe/semi-icons'; import { Button, Dropdown, Space, Typography } from '@douyinfe/semi-ui'; import { Avatar } from '@douyinfe/semi-ui'; + import { DataRender } from 'components/data-render'; import { useOrganizationDetail, useUserOrganizations } from 'data/organization'; import { useRouterQuery } from 'hooks/use-router-query'; import Link from 'next/link'; -import { useMemo } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/resizeable/resizeable.tsx b/packages/client/src/components/resizeable/resizeable.tsx index d7a959d..71db4fe 100644 --- a/packages/client/src/components/resizeable/resizeable.tsx +++ b/packages/client/src/components/resizeable/resizeable.tsx @@ -1,7 +1,8 @@ +import React, { useEffect, useRef } from 'react'; + import cls from 'classnames'; import { useClickOutside } from 'hooks/use-click-outside'; import interact from 'interactjs'; -import React, { useEffect, useRef } from 'react'; import styles from './style.module.scss'; diff --git a/packages/client/src/components/search/index.tsx b/packages/client/src/components/search/index.tsx index 2b53418..30ec208 100644 --- a/packages/client/src/components/search/index.tsx +++ b/packages/client/src/components/search/index.tsx @@ -1,6 +1,10 @@ +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; + import { IconSearch as SemiIconSearch } from '@douyinfe/semi-icons'; import { Button, Dropdown, Input, Modal, Spin, Typography } from '@douyinfe/semi-ui'; + import { IDocument } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { DocumentStar } from 'components/document/star'; import { Empty } from 'components/empty'; @@ -14,7 +18,6 @@ import { useRouterQuery } from 'hooks/use-router-query'; import { useToggle } from 'hooks/use-toggle'; import Link from 'next/link'; import Router from 'next/router'; -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { HttpClient } from 'services/http-client'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/size-setter.tsx b/packages/client/src/components/size-setter.tsx index 1ecec19..5f31261 100644 --- a/packages/client/src/components/size-setter.tsx +++ b/packages/client/src/components/size-setter.tsx @@ -1,6 +1,7 @@ +import { useCallback, useRef } from 'react'; + import { Button, Dropdown, Form } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; -import { useCallback, useRef } from 'react'; type ISize = { width: number | string; height: number | string }; diff --git a/packages/client/src/components/template/card/index.tsx b/packages/client/src/components/template/card/index.tsx index d5fe8bd..e194aac 100644 --- a/packages/client/src/components/template/card/index.tsx +++ b/packages/client/src/components/template/card/index.tsx @@ -1,13 +1,16 @@ +import { useCallback } from 'react'; + import { IconEdit, IconPlus, IconUser } from '@douyinfe/semi-icons'; import { Avatar, Button, Modal, Skeleton, Space, Tooltip, Typography } from '@douyinfe/semi-ui'; + import type { ITemplate } from '@think/domains'; + import cls from 'classnames'; import { IconDocument } from 'components/icons/IconDocument'; import { TemplateReader } from 'components/template/reader'; import { useUser } from 'data/user'; import { useToggle } from 'hooks/use-toggle'; import Router from 'next/router'; -import { useCallback } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/template/editor/index.tsx b/packages/client/src/components/template/editor/index.tsx index c221a21..f0a6e13 100644 --- a/packages/client/src/components/template/editor/index.tsx +++ b/packages/client/src/components/template/editor/index.tsx @@ -1,5 +1,10 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; + import { IconChevronLeft } from '@douyinfe/semi-icons'; import { Button, Nav, Popconfirm, Space, Switch, Tooltip, Typography } from '@douyinfe/semi-ui'; + +import { CollaborationEditor } from 'tiptap/editor'; + import { DocumentStyle } from 'components/document/style'; import { Seo } from 'components/seo'; import { Theme } from 'components/theme'; @@ -10,8 +15,6 @@ import { useDocumentStyle } from 'hooks/use-document-style'; import { useMount } from 'hooks/use-mount'; import { useWindowSize } from 'hooks/use-window-size'; import Router from 'next/router'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { CollaborationEditor } from 'tiptap/editor'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/template/list/index.tsx b/packages/client/src/components/template/list/index.tsx index b74eedb..255d462 100644 --- a/packages/client/src/components/template/list/index.tsx +++ b/packages/client/src/components/template/list/index.tsx @@ -1,8 +1,10 @@ +import React, { useEffect, useMemo, useState } from 'react'; + import { List, Pagination } from '@douyinfe/semi-ui'; + import { DataRender } from 'components/data-render'; import { Empty } from 'components/empty'; import { IProps as ITemplateCardProps, TemplateCard, TemplateCardPlaceholder } from 'components/template/card'; -import React, { useEffect, useMemo, useState } from 'react'; const grid = { gutter: 16, diff --git a/packages/client/src/components/template/reader/index.tsx b/packages/client/src/components/template/reader/index.tsx index f33d79c..8266ff3 100644 --- a/packages/client/src/components/template/reader/index.tsx +++ b/packages/client/src/components/template/reader/index.tsx @@ -1,9 +1,12 @@ +import React from 'react'; + import { Spin } from '@douyinfe/semi-ui'; + +import { ReaderEditor } from 'tiptap/editor'; + import { DataRender } from 'components/data-render'; import { Seo } from 'components/seo'; import { useTemplate } from 'data/template'; -import React from 'react'; -import { ReaderEditor } from 'tiptap/editor'; interface IProps { templateId: string; diff --git a/packages/client/src/components/theme/index.tsx b/packages/client/src/components/theme/index.tsx index 35de542..0e568f9 100644 --- a/packages/client/src/components/theme/index.tsx +++ b/packages/client/src/components/theme/index.tsx @@ -1,7 +1,9 @@ +import React, { useCallback } from 'react'; + import { IconDesktop, IconMoon, IconSun } from '@douyinfe/semi-icons'; import { Button, Dropdown } from '@douyinfe/semi-ui'; + import { Theme as ThemeState, ThemeEnum } from 'hooks/use-theme'; -import React, { useCallback } from 'react'; export const Theme = () => { const { userPrefer, theme, toggle } = ThemeState.useHook(); diff --git a/packages/client/src/components/tooltip/index.tsx b/packages/client/src/components/tooltip/index.tsx index 7d4732f..2cc80eb 100644 --- a/packages/client/src/components/tooltip/index.tsx +++ b/packages/client/src/components/tooltip/index.tsx @@ -1,7 +1,9 @@ +import React from 'react'; + import { Tooltip as SemiTooltip } from '@douyinfe/semi-ui'; import { Position } from '@douyinfe/semi-ui/tooltip'; + import { useToggle } from 'hooks/use-toggle'; -import React from 'react'; interface IProps { content: React.ReactNode; diff --git a/packages/client/src/components/upload/index.tsx b/packages/client/src/components/upload/index.tsx index 5865309..98cbb07 100644 --- a/packages/client/src/components/upload/index.tsx +++ b/packages/client/src/components/upload/index.tsx @@ -1,7 +1,9 @@ +import React from 'react'; + import { IconUpload } from '@douyinfe/semi-icons'; import { Button, Toast, Upload as SemiUpload } from '@douyinfe/semi-ui'; + import { useAsyncLoading } from 'hooks/use-async-loading'; -import React from 'react'; import { uploadFile } from 'services/file'; interface IProps { diff --git a/packages/client/src/components/user/index.tsx b/packages/client/src/components/user/index.tsx index ec2d7d0..1c943e8 100644 --- a/packages/client/src/components/user/index.tsx +++ b/packages/client/src/components/user/index.tsx @@ -1,9 +1,11 @@ +import React, { useCallback } from 'react'; + import { IconSpin } from '@douyinfe/semi-icons'; import { Avatar, Button, Dropdown, Modal, Toast, Typography } from '@douyinfe/semi-ui'; + import { useUser } from 'data/user'; import { useToggle } from 'hooks/use-toggle'; import Router from 'next/router'; -import React, { useCallback } from 'react'; import { ResetPassword } from './reset-password'; import { UserSetting } from './setting'; diff --git a/packages/client/src/components/user/reset-password/index.tsx b/packages/client/src/components/user/reset-password/index.tsx index 9cde8cf..32af3a2 100644 --- a/packages/client/src/components/user/reset-password/index.tsx +++ b/packages/client/src/components/user/reset-password/index.tsx @@ -1,8 +1,10 @@ +import React, { useCallback, useState } from 'react'; + import { Button, Col, Form, Row, Toast } from '@douyinfe/semi-ui'; + import { useResetPassword, useSystemPublicConfig, useUser, useVerifyCode } from 'data/user'; import { useInterval } from 'hooks/use-interval'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useState } from 'react'; export const ResetPassword = ({ onSuccess }) => { const [email, setEmail] = useState(''); diff --git a/packages/client/src/components/user/setting/index.tsx b/packages/client/src/components/user/setting/index.tsx index 2e02996..17912b6 100644 --- a/packages/client/src/components/user/setting/index.tsx +++ b/packages/client/src/components/user/setting/index.tsx @@ -1,10 +1,12 @@ +import { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState } from 'react'; + import { Avatar, Button, Col, Form, Modal, Row, Space, Toast } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; + import { Upload } from 'components/upload'; import { useSystemPublicConfig, useUser, useVerifyCode } from 'data/user'; import { useInterval } from 'hooks/use-interval'; import { useToggle } from 'hooks/use-toggle'; -import { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState } from 'react'; interface IProps { visible: boolean; diff --git a/packages/client/src/components/wiki-creator/index.tsx b/packages/client/src/components/wiki-creator/index.tsx index 2936d04..b616458 100644 --- a/packages/client/src/components/wiki-creator/index.tsx +++ b/packages/client/src/components/wiki-creator/index.tsx @@ -1,7 +1,9 @@ +import React from 'react'; + import { Button } from '@douyinfe/semi-ui'; + import { WikiCreator as WikiCreatorForm } from 'components/wiki/create'; import { useToggle } from 'hooks/use-toggle'; -import React from 'react'; export const WikiCreator: React.FC = ({ children }) => { const [visible, toggleVisible] = useToggle(false); diff --git a/packages/client/src/components/wiki-or-document-creator/index.tsx b/packages/client/src/components/wiki-or-document-creator/index.tsx index 15da549..92d38af 100644 --- a/packages/client/src/components/wiki-or-document-creator/index.tsx +++ b/packages/client/src/components/wiki-or-document-creator/index.tsx @@ -1,10 +1,12 @@ +import React from 'react'; + import { IconPlus } from '@douyinfe/semi-icons'; import { Button, Dropdown } from '@douyinfe/semi-ui'; + import { DocumentCreator } from 'components/document/create'; import { WikiCreator } from 'components/wiki/create'; import { useRouterQuery } from 'hooks/use-router-query'; import { useToggle } from 'hooks/use-toggle'; -import React from 'react'; interface IProps { onCreateDocument?: () => void; diff --git a/packages/client/src/components/wiki/card/index.tsx b/packages/client/src/components/wiki/card/index.tsx index a818eeb..9b5ff66 100644 --- a/packages/client/src/components/wiki/card/index.tsx +++ b/packages/client/src/components/wiki/card/index.tsx @@ -1,5 +1,6 @@ import { IconUser } from '@douyinfe/semi-icons'; import { Avatar, Skeleton, Space, Typography } from '@douyinfe/semi-ui'; + import { IconDocument } from 'components/icons/IconDocument'; import { LocaleTime } from 'components/locale-time'; import { WikiStar } from 'components/wiki/star'; diff --git a/packages/client/src/components/wiki/create/index.tsx b/packages/client/src/components/wiki/create/index.tsx index d66d8a6..02d8d50 100644 --- a/packages/client/src/components/wiki/create/index.tsx +++ b/packages/client/src/components/wiki/create/index.tsx @@ -1,10 +1,13 @@ +import { Dispatch, SetStateAction, useRef } from 'react'; + import { Form, Modal } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; + import type { IWiki } from '@think/domains'; + import { ICreateWiki, useOwnWikis } from 'data/wiki'; import { useRouterQuery } from 'hooks/use-router-query'; import Router from 'next/router'; -import { Dispatch, SetStateAction, useRef } from 'react'; interface IProps { visible: boolean; diff --git a/packages/client/src/components/wiki/delete/index.tsx b/packages/client/src/components/wiki/delete/index.tsx index a1c189f..4ba29f8 100644 --- a/packages/client/src/components/wiki/delete/index.tsx +++ b/packages/client/src/components/wiki/delete/index.tsx @@ -1,9 +1,11 @@ +import React, { useCallback } from 'react'; + import { IconDelete } from '@douyinfe/semi-icons'; import { Modal, Space, Typography } from '@douyinfe/semi-ui'; + import { useOwnWikis } from 'data/wiki'; import { useRouterQuery } from 'hooks/use-router-query'; import Router from 'next/router'; -import React, { useCallback } from 'react'; interface IProps { wikiId: string; diff --git a/packages/client/src/components/wiki/documents-share/index.tsx b/packages/client/src/components/wiki/documents-share/index.tsx index 83e5516..388c3c5 100644 --- a/packages/client/src/components/wiki/documents-share/index.tsx +++ b/packages/client/src/components/wiki/documents-share/index.tsx @@ -1,9 +1,12 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; + import { IconClose } from '@douyinfe/semi-icons'; import { Banner, Button, Checkbox, Toast, Transfer, Typography } from '@douyinfe/semi-ui'; + import { isPublicDocument } from '@think/domains'; + import { flattenTree2Array } from 'components/wiki/tocs/utils'; import { useWikiDetail, useWikiTocs } from 'data/wiki'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/components/wiki/pin-card/index.tsx b/packages/client/src/components/wiki/pin-card/index.tsx index 588842f..6497466 100644 --- a/packages/client/src/components/wiki/pin-card/index.tsx +++ b/packages/client/src/components/wiki/pin-card/index.tsx @@ -1,5 +1,7 @@ import { Avatar, Skeleton, Space, Typography } from '@douyinfe/semi-ui'; + import { IWiki } from '@think/domains'; + import { IconDocument } from 'components/icons/IconDocument'; import { LocaleTime } from 'components/locale-time'; import { WikiStar } from 'components/wiki/star'; diff --git a/packages/client/src/components/wiki/placeholder/index.tsx b/packages/client/src/components/wiki/placeholder/index.tsx index d8211d0..4a107c3 100644 --- a/packages/client/src/components/wiki/placeholder/index.tsx +++ b/packages/client/src/components/wiki/placeholder/index.tsx @@ -1,6 +1,7 @@ -import { Skeleton } from '@douyinfe/semi-ui'; import React from 'react'; +import { Skeleton } from '@douyinfe/semi-ui'; + export const WorkspacePlaceholder = () => { const placeholder = (
{ const createDocument = useCallback( (e) => { diff --git a/packages/client/src/data/comment.ts b/packages/client/src/data/comment.ts index e6852fc..4db6621 100644 --- a/packages/client/src/data/comment.ts +++ b/packages/client/src/data/comment.ts @@ -1,6 +1,8 @@ -import { CommentApiDefinition, IComment } from '@think/domains'; import { useCallback, useState } from 'react'; import { useQuery } from 'react-query'; + +import { CommentApiDefinition, IComment } from '@think/domains'; + import { HttpClient } from 'services/http-client'; export type CreateCommentDto = Pick; diff --git a/packages/client/src/data/document.ts b/packages/client/src/data/document.ts index d2172c5..138a79a 100644 --- a/packages/client/src/data/document.ts +++ b/packages/client/src/data/document.ts @@ -1,8 +1,10 @@ -import { DocumentApiDefinition, IAuthority, IDocument, IUser, IWiki } from '@think/domains'; -import { triggerRefreshTocs } from 'event'; -import { useAsyncLoading } from 'hooks/use-async-loading'; import { useCallback, useState } from 'react'; import { QueriesOptions, useQuery, UseQueryOptions } from 'react-query'; + +import { DocumentApiDefinition, IAuthority, IDocument, IUser, IWiki } from '@think/domains'; + +import { triggerRefreshTocs } from 'event'; +import { useAsyncLoading } from 'hooks/use-async-loading'; import { HttpClient } from 'services/http-client'; type IDocumentWithVisitedAt = IDocument & { visitedAt: string }; diff --git a/packages/client/src/data/message.ts b/packages/client/src/data/message.ts index 173e80c..aa8eb1d 100644 --- a/packages/client/src/data/message.ts +++ b/packages/client/src/data/message.ts @@ -1,6 +1,8 @@ -import { IMessage, MessageApiDefinition } from '@think/domains'; import { useCallback, useState } from 'react'; import { useQuery } from 'react-query'; + +import { IMessage, MessageApiDefinition } from '@think/domains'; + import { HttpClient } from 'services/http-client'; const getMessagesApi = diff --git a/packages/client/src/data/organization.ts b/packages/client/src/data/organization.ts index 5b6edc5..a5f7b88 100644 --- a/packages/client/src/data/organization.ts +++ b/packages/client/src/data/organization.ts @@ -1,8 +1,10 @@ -import { IAuth, IOrganization, IUser, OrganizationApiDefinition } from '@think/domains'; -import { event, REFRESH_ORGANIZATIONS, triggerRefreshOrganizations } from 'event'; -import { useAsyncLoading } from 'hooks/use-async-loading'; import { useCallback, useEffect, useState } from 'react'; import { useQuery } from 'react-query'; + +import { IAuth, IOrganization, IUser, OrganizationApiDefinition } from '@think/domains'; + +import { event, REFRESH_ORGANIZATIONS, triggerRefreshOrganizations } from 'event'; +import { useAsyncLoading } from 'hooks/use-async-loading'; import { HttpClient } from 'services/http-client'; /** diff --git a/packages/client/src/data/star.ts b/packages/client/src/data/star.ts index 05e5cf2..0618568 100644 --- a/packages/client/src/data/star.ts +++ b/packages/client/src/data/star.ts @@ -1,7 +1,9 @@ -import { IDocument, IWiki, StarApiDefinition } from '@think/domains'; -import { event, TOGGLE_STAR_DOUCMENT, TOGGLE_STAR_WIKI, triggerToggleStarDocument, triggerToggleStarWiki } from 'event'; import { useCallback, useEffect } from 'react'; import { useQuery, UseQueryOptions } from 'react-query'; + +import { IDocument, IWiki, StarApiDefinition } from '@think/domains'; + +import { event, TOGGLE_STAR_DOUCMENT, TOGGLE_STAR_WIKI, triggerToggleStarDocument, triggerToggleStarWiki } from 'event'; import { HttpClient } from 'services/http-client'; export type IWikiWithIsMember = IWiki & { isMember?: boolean }; diff --git a/packages/client/src/data/template.ts b/packages/client/src/data/template.ts index 9e8d0ba..b638309 100644 --- a/packages/client/src/data/template.ts +++ b/packages/client/src/data/template.ts @@ -1,6 +1,8 @@ -import { ITemplate, TemplateApiDefinition } from '@think/domains'; import { useCallback, useState } from 'react'; import { useQuery } from 'react-query'; + +import { ITemplate, TemplateApiDefinition } from '@think/domains'; + import { HttpClient } from 'services/http-client'; export const getPublicTemplates = ( diff --git a/packages/client/src/data/user.ts b/packages/client/src/data/user.ts index b242016..4c46a87 100644 --- a/packages/client/src/data/user.ts +++ b/packages/client/src/data/user.ts @@ -1,10 +1,13 @@ +import { useCallback, useEffect } from 'react'; +import { useQuery } from 'react-query'; + import { Toast } from '@douyinfe/semi-ui'; + import { ILoginUser, ISystemConfig, IUser, SystemApiDefinition, UserApiDefinition } from '@think/domains'; + import { getStorage, setStorage } from 'helpers/storage'; import { useAsyncLoading } from 'hooks/use-async-loading'; import Router, { useRouter } from 'next/router'; -import { useCallback, useEffect } from 'react'; -import { useQuery } from 'react-query'; import { HttpClient } from 'services/http-client'; /** diff --git a/packages/client/src/data/wiki.ts b/packages/client/src/data/wiki.ts index 213a832..66c84b8 100644 --- a/packages/client/src/data/wiki.ts +++ b/packages/client/src/data/wiki.ts @@ -1,7 +1,9 @@ -import { IAuth, IDocument, IUser, IWiki, WikiApiDefinition } from '@think/domains'; -import { event, REFRESH_TOCS } from 'event'; import { useCallback, useEffect, useState } from 'react'; import { useQuery } from 'react-query'; + +import { IAuth, IDocument, IUser, IWiki, WikiApiDefinition } from '@think/domains'; + +import { event, REFRESH_TOCS } from 'event'; import { HttpClient } from 'services/http-client'; export type ICreateWiki = Pick; diff --git a/packages/client/src/event/index.ts b/packages/client/src/event/index.ts index ff385f7..067df42 100644 --- a/packages/client/src/event/index.ts +++ b/packages/client/src/event/index.ts @@ -1,4 +1,5 @@ import { IDocument, IUser, IWiki } from '@think/domains'; + import { EventEmitter } from 'helpers/event-emitter'; export const event = new EventEmitter(); diff --git a/packages/client/src/helpers/generate-html.ts b/packages/client/src/helpers/generate-html.ts index 7a5ede6..b932284 100644 --- a/packages/client/src/helpers/generate-html.ts +++ b/packages/client/src/helpers/generate-html.ts @@ -1,7 +1,8 @@ import { generateHTML } from '@tiptap/core'; -import HtmlDiff from 'htmldiff-js'; import { CollaborationKit } from 'tiptap/editor'; +import HtmlDiff from 'htmldiff-js'; + const json2html = (json) => generateHTML(json, CollaborationKit); export const generateDiffHtml = (selected, other) => { const selectedHtml = json2html(selected); diff --git a/packages/client/src/hooks/use-document-style.tsx b/packages/client/src/hooks/use-document-style.tsx index 826fcee..fecb506 100644 --- a/packages/client/src/hooks/use-document-style.tsx +++ b/packages/client/src/hooks/use-document-style.tsx @@ -1,7 +1,8 @@ -import { getStorage, setStorage } from 'helpers/storage'; import { useCallback, useEffect } from 'react'; import { useQuery } from 'react-query'; +import { getStorage, setStorage } from 'helpers/storage'; + export enum Width { 'standardWidth' = 'standardWidth', 'fullWidth' = 'fullWidth', diff --git a/packages/client/src/hooks/use-dragable-width.tsx b/packages/client/src/hooks/use-dragable-width.tsx index 5fc3ef8..8778aea 100644 --- a/packages/client/src/hooks/use-dragable-width.tsx +++ b/packages/client/src/hooks/use-dragable-width.tsx @@ -1,8 +1,9 @@ -import { clamp } from 'helpers/clamp'; -import { getStorage, setStorage } from 'helpers/storage'; import { useCallback, useMemo, useRef } from 'react'; import { useQuery } from 'react-query'; +import { clamp } from 'helpers/clamp'; +import { getStorage, setStorage } from 'helpers/storage'; + import { IsOnMobile } from './use-on-mobile'; const key = 'dragable-menu-width'; diff --git a/packages/client/src/layouts/app-double-column/index.tsx b/packages/client/src/layouts/app-double-column/index.tsx index 4788ed6..60a0ecd 100644 --- a/packages/client/src/layouts/app-double-column/index.tsx +++ b/packages/client/src/layouts/app-double-column/index.tsx @@ -1,12 +1,15 @@ -import { IconChevronLeft, IconChevronRight } from '@douyinfe/semi-icons'; -import { Button, Layout as SemiLayout } from '@douyinfe/semi-ui'; -import cls from 'classnames'; -import { throttle } from 'helpers/throttle'; -import { useDragableWidth } from 'hooks/use-dragable-width'; import React, { useMemo } from 'react'; import SplitPane from 'react-split-pane'; +import { IconChevronLeft, IconChevronRight } from '@douyinfe/semi-icons'; +import { Button, Layout as SemiLayout } from '@douyinfe/semi-ui'; + +import cls from 'classnames'; +import { throttle } from 'helpers/throttle'; +import { useDragableWidth } from 'hooks/use-dragable-width'; + import { AppRouterHeader } from '../app-router-header'; + import styles from './index.module.scss'; const { Sider, Content } = SemiLayout; diff --git a/packages/client/src/layouts/app-router-header/index.tsx b/packages/client/src/layouts/app-router-header/index.tsx index a6ead91..8ffa861 100644 --- a/packages/client/src/layouts/app-router-header/index.tsx +++ b/packages/client/src/layouts/app-router-header/index.tsx @@ -1,5 +1,8 @@ +import React, { useMemo } from 'react'; + import { IconMenu } from '@douyinfe/semi-icons'; import { Button, Dropdown, Layout as SemiLayout, Nav, Space } from '@douyinfe/semi-ui'; + import { Message } from 'components/message'; import { OrganizationSwitcher } from 'components/organization/switcher'; import { Search } from 'components/search'; @@ -10,7 +13,6 @@ import { IsOnMobile } from 'hooks/use-on-mobile'; import { useRouterQuery } from 'hooks/use-router-query'; import { useToggle } from 'hooks/use-toggle'; import Router, { useRouter } from 'next/router'; -import React, { useMemo } from 'react'; import { Recent, RecentModal } from './recent'; import { Wiki, WikiModal } from './wiki'; diff --git a/packages/client/src/layouts/app-router-header/recent.tsx b/packages/client/src/layouts/app-router-header/recent.tsx index a0ec2b1..85ceda0 100644 --- a/packages/client/src/layouts/app-router-header/recent.tsx +++ b/packages/client/src/layouts/app-router-header/recent.tsx @@ -1,5 +1,8 @@ +import React, { useCallback, useEffect } from 'react'; + import { IconChevronDown } from '@douyinfe/semi-icons'; import { Dropdown, Modal, Space, TabPane, Tabs, Typography } from '@douyinfe/semi-ui'; + import { DataRender } from 'components/data-render'; import { DocumentStar } from 'components/document/star'; import { Empty } from 'components/empty'; @@ -9,10 +12,10 @@ import { useRecentDocuments } from 'data/document'; import { useToggle } from 'hooks/use-toggle'; import Link from 'next/link'; import { useRouter } from 'next/router'; -import React, { useCallback, useEffect } from 'react'; + +import { Placeholder } from './placeholder'; import styles from './index.module.scss'; -import { Placeholder } from './placeholder'; const { Text } = Typography; diff --git a/packages/client/src/layouts/app-router-header/wiki.tsx b/packages/client/src/layouts/app-router-header/wiki.tsx index 2aed72d..c7cd4aa 100644 --- a/packages/client/src/layouts/app-router-header/wiki.tsx +++ b/packages/client/src/layouts/app-router-header/wiki.tsx @@ -1,5 +1,8 @@ +import React, { useCallback } from 'react'; + import { IconChevronDown } from '@douyinfe/semi-icons'; import { Avatar, Dropdown, Modal, Space, Typography } from '@douyinfe/semi-ui'; + import { DataRender } from 'components/data-render'; import { Empty } from 'components/empty'; import { WikiStar } from 'components/wiki/star'; @@ -7,10 +10,10 @@ import { useStarWikisInOrganization } from 'data/star'; import { useWikiDetail } from 'data/wiki'; import Link from 'next/link'; import { useRouter } from 'next/router'; -import React, { useCallback } from 'react'; + +import { Placeholder } from './placeholder'; import styles from './index.module.scss'; -import { Placeholder } from './placeholder'; const { Text } = Typography; diff --git a/packages/client/src/layouts/app-single-column/index.tsx b/packages/client/src/layouts/app-single-column/index.tsx index 702f6d2..f805817 100644 --- a/packages/client/src/layouts/app-single-column/index.tsx +++ b/packages/client/src/layouts/app-single-column/index.tsx @@ -1,7 +1,9 @@ -import { Layout as SemiLayout } from '@douyinfe/semi-ui'; import React from 'react'; +import { Layout as SemiLayout } from '@douyinfe/semi-ui'; + import { AppRouterHeader } from '../app-router-header'; + import styles from './index.module.scss'; const { Content } = SemiLayout; diff --git a/packages/client/src/layouts/double-column/index.tsx b/packages/client/src/layouts/double-column/index.tsx index 003a6a7..4a9bc7f 100644 --- a/packages/client/src/layouts/double-column/index.tsx +++ b/packages/client/src/layouts/double-column/index.tsx @@ -1,12 +1,15 @@ -import { IconChevronLeft, IconChevronRight } from '@douyinfe/semi-icons'; -import { Button, Layout as SemiLayout } from '@douyinfe/semi-ui'; -import cls from 'classnames'; -import { throttle } from 'helpers/throttle'; -import { useDragableWidth } from 'hooks/use-dragable-width'; import React, { useMemo } from 'react'; import SplitPane from 'react-split-pane'; +import { IconChevronLeft, IconChevronRight } from '@douyinfe/semi-icons'; +import { Button, Layout as SemiLayout } from '@douyinfe/semi-ui'; + +import cls from 'classnames'; +import { throttle } from 'helpers/throttle'; +import { useDragableWidth } from 'hooks/use-dragable-width'; + import { RouterHeader } from '../router-header'; + import styles from './index.module.scss'; const { Sider, Content } = SemiLayout; diff --git a/packages/client/src/layouts/public-double-column/index.tsx b/packages/client/src/layouts/public-double-column/index.tsx index 6af27f2..79c85b9 100644 --- a/packages/client/src/layouts/public-double-column/index.tsx +++ b/packages/client/src/layouts/public-double-column/index.tsx @@ -1,10 +1,12 @@ +import React, { useMemo } from 'react'; +import SplitPane from 'react-split-pane'; + import { IconChevronLeft, IconChevronRight } from '@douyinfe/semi-icons'; import { Button, Layout as SemiLayout } from '@douyinfe/semi-ui'; + import cls from 'classnames'; import { throttle } from 'helpers/throttle'; import { useDragableWidth } from 'hooks/use-dragable-width'; -import React, { useMemo } from 'react'; -import SplitPane from 'react-split-pane'; import styles from './index.module.scss'; diff --git a/packages/client/src/layouts/router-header/index.tsx b/packages/client/src/layouts/router-header/index.tsx index f5efde8..4294758 100644 --- a/packages/client/src/layouts/router-header/index.tsx +++ b/packages/client/src/layouts/router-header/index.tsx @@ -1,4 +1,7 @@ +import React, { useCallback } from 'react'; + import { Button, Layout as SemiLayout, Nav, Space } from '@douyinfe/semi-ui'; + import { Message } from 'components/message'; import { OrganizationPublicSwitcher } from 'components/organization/public-switcher'; import { Theme } from 'components/theme'; @@ -6,7 +9,6 @@ import { User } from 'components/user'; import { useUser } from 'data/user'; import { IsOnMobile } from 'hooks/use-on-mobile'; import Router, { useRouter } from 'next/router'; -import React, { useCallback } from 'react'; const { Header: SemiHeader } = SemiLayout; diff --git a/packages/client/src/layouts/single-column/index.tsx b/packages/client/src/layouts/single-column/index.tsx index c6d13ec..4ec319e 100644 --- a/packages/client/src/layouts/single-column/index.tsx +++ b/packages/client/src/layouts/single-column/index.tsx @@ -1,7 +1,9 @@ -import { Layout as SemiLayout } from '@douyinfe/semi-ui'; import React from 'react'; +import { Layout as SemiLayout } from '@douyinfe/semi-ui'; + import { RouterHeader } from '../router-header'; + import styles from './index.module.scss'; const { Content } = SemiLayout; diff --git a/packages/client/src/pages/_app.tsx b/packages/client/src/pages/_app.tsx index 440fa1b..b3ff830 100644 --- a/packages/client/src/pages/_app.tsx +++ b/packages/client/src/pages/_app.tsx @@ -1,21 +1,23 @@ -import 'tiptap/fix-match-nodes'; -import 'viewerjs/dist/viewer.css'; -import 'styles/globals.scss'; -import 'tiptap/core/styles/index.scss'; import '@react-pdf-viewer/core/lib/styles/index.css'; import '@react-pdf-viewer/default-layout/lib/styles/index.css'; -import 'thirtypart/array-prototype-at'; - import { Worker } from '@react-pdf-viewer/core'; +import React from 'react'; +import { Hydrate, QueryClient, QueryClientProvider } from 'react-query'; + +import 'tiptap/fix-match-nodes'; +import 'tiptap/core/styles/index.scss'; +import { preloadTiptapResources } from 'tiptap/preload'; + import { isMobile } from 'helpers/env'; import { DocumentVersionControl } from 'hooks/use-document-version'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { Theme } from 'hooks/use-theme'; import App from 'next/app'; import Head from 'next/head'; -import React from 'react'; -import { Hydrate, QueryClient, QueryClientProvider } from 'react-query'; -import { preloadTiptapResources } from 'tiptap/preload'; + +import 'viewerjs/dist/viewer.css'; +import 'styles/globals.scss'; +import 'thirtypart/array-prototype-at'; class MyApp extends App<{ isMobile: boolean }> { state = { diff --git a/packages/client/src/pages/admin/index.tsx b/packages/client/src/pages/admin/index.tsx index 15b4bac..da72ebf 100644 --- a/packages/client/src/pages/admin/index.tsx +++ b/packages/client/src/pages/admin/index.tsx @@ -1,4 +1,7 @@ +import React, { useCallback } from 'react'; + import { Banner, Typography } from '@douyinfe/semi-ui'; + import { SystemConfig } from 'components/admin/system-config'; import { Seo } from 'components/seo'; import { useUser } from 'data/user'; @@ -6,7 +9,6 @@ import { Forbidden } from 'illustrations/forbidden'; import { SingleColumnLayout } from 'layouts/single-column'; import type { NextPage } from 'next'; import Router, { useRouter } from 'next/router'; -import React, { useCallback } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/pages/app/index.tsx b/packages/client/src/pages/app/index.tsx index d1e032e..fd4f5ea 100644 --- a/packages/client/src/pages/app/index.tsx +++ b/packages/client/src/pages/app/index.tsx @@ -1,5 +1,9 @@ +import { useCallback, useEffect } from 'react'; + import { Avatar, Button, Table, Typography } from '@douyinfe/semi-ui'; + import { IOrganization } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { LocaleTime } from 'components/locale-time'; import { Seo } from 'components/seo'; @@ -7,7 +11,6 @@ import { usePeronalOrganization, useUserOrganizations } from 'data/organization' import { SingleColumnLayout } from 'layouts/single-column'; import Link from 'next/link'; import Router from 'next/router'; -import { useCallback, useEffect } from 'react'; const { Title, Paragraph } = Typography; const { Column } = Table; diff --git a/packages/client/src/pages/app/org/[organizationId]/index.tsx b/packages/client/src/pages/app/org/[organizationId]/index.tsx index 2e1739d..b047ceb 100644 --- a/packages/client/src/pages/app/org/[organizationId]/index.tsx +++ b/packages/client/src/pages/app/org/[organizationId]/index.tsx @@ -1,5 +1,9 @@ +import React, { useEffect, useMemo } from 'react'; + import { Avatar, Button, List, Table, Typography } from '@douyinfe/semi-ui'; + import { DocumentApiDefinition, IDocument, IOrganization, StarApiDefinition } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { DocumentActions } from 'components/document/actions'; import { Empty } from 'components/empty'; @@ -14,7 +18,6 @@ import { useToggle } from 'hooks/use-toggle'; import { AppSingleColumnLayout } from 'layouts/app-single-column'; import type { NextPage } from 'next'; import Link from 'next/link'; -import React, { useEffect, useMemo } from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; import styles from './index.module.scss'; diff --git a/packages/client/src/pages/app/org/[organizationId]/setting/index.tsx b/packages/client/src/pages/app/org/[organizationId]/setting/index.tsx index 160b723..29813dd 100644 --- a/packages/client/src/pages/app/org/[organizationId]/setting/index.tsx +++ b/packages/client/src/pages/app/org/[organizationId]/setting/index.tsx @@ -1,10 +1,13 @@ +import React, { useCallback } from 'react'; + import { Typography } from '@douyinfe/semi-ui'; + import { IOrganization } from '@think/domains'; + import { OrganizationSetting } from 'components/organization/setting'; import { AppSingleColumnLayout } from 'layouts/app-single-column'; import { NextPage } from 'next'; import Router, { useRouter } from 'next/router'; -import React, { useCallback } from 'react'; interface IProps { organizationId: IOrganization['id']; diff --git a/packages/client/src/pages/app/org/[organizationId]/star/index.tsx b/packages/client/src/pages/app/org/[organizationId]/star/index.tsx index a6586cc..ab4df03 100644 --- a/packages/client/src/pages/app/org/[organizationId]/star/index.tsx +++ b/packages/client/src/pages/app/org/[organizationId]/star/index.tsx @@ -1,5 +1,9 @@ +import React from 'react'; + import { List, Typography } from '@douyinfe/semi-ui'; + import { StarApiDefinition } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { DocumentCard, DocumentCardPlaceholder } from 'components/document/card'; import { Empty } from 'components/empty'; @@ -14,7 +18,6 @@ import { import { useRouterQuery } from 'hooks/use-router-query'; import { AppSingleColumnLayout } from 'layouts/app-single-column'; import type { NextPage } from 'next'; -import React from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; import styles from './index.module.scss'; diff --git a/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/doc/[documentId]/edit/index.tsx b/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/doc/[documentId]/edit/index.tsx index 318c634..846159c 100644 --- a/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/doc/[documentId]/edit/index.tsx +++ b/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/doc/[documentId]/edit/index.tsx @@ -1,8 +1,10 @@ +import React from 'react'; + import { DocumentApiDefinition, IDocument } from '@think/domains'; + import { DocumentEditor } from 'components/document/editor'; import { getDocumentDetail } from 'data/document'; import { NextPage } from 'next'; -import React from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; interface IProps { diff --git a/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/doc/[documentId]/index.tsx b/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/doc/[documentId]/index.tsx index be539a5..083746b 100644 --- a/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/doc/[documentId]/index.tsx +++ b/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/doc/[documentId]/index.tsx @@ -1,11 +1,13 @@ +import React from 'react'; + import { DocumentApiDefinition, IDocument, IWiki, WikiApiDefinition } from '@think/domains'; + import { DocumentReader } from 'components/document/reader'; import { WikiTocs } from 'components/wiki/tocs'; import { getDocumentDetail } from 'data/document'; import { getWikiTocs } from 'data/wiki'; import { AppDoubleColumnLayout } from 'layouts/app-double-column'; import { NextPage } from 'next'; -import React from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; interface IProps { diff --git a/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/index.tsx b/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/index.tsx index 623260e..a89b129 100644 --- a/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/index.tsx +++ b/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/index.tsx @@ -1,12 +1,15 @@ +import React from 'react'; + import { Spin } from '@douyinfe/semi-ui'; + import { IWiki, WikiApiDefinition } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { DocumentReader } from 'components/document/reader'; import { WikiTocs } from 'components/wiki/tocs'; import { getWikiDetail, getWikiTocs, useWikiDetail } from 'data/wiki'; import { AppDoubleColumnLayout } from 'layouts/app-double-column'; import { NextPage } from 'next'; -import React from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; interface IProps { diff --git a/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/setting/index.tsx b/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/setting/index.tsx index d1055fa..f7da019 100644 --- a/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/setting/index.tsx +++ b/packages/client/src/pages/app/org/[organizationId]/wiki/[wikiId]/setting/index.tsx @@ -1,11 +1,13 @@ +import React, { useCallback } from 'react'; + import { IWiki, WikiApiDefinition } from '@think/domains'; + import { WikiSetting } from 'components/wiki/setting'; import { WikiTocs } from 'components/wiki/tocs'; import { getWikiMembers, getWikiTocs } from 'data/wiki'; import { AppDoubleColumnLayout } from 'layouts/app-double-column'; import { NextPage } from 'next'; import Router, { useRouter } from 'next/router'; -import React, { useCallback } from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; interface IProps { diff --git a/packages/client/src/pages/app/org/[organizationId]/wiki/index.tsx b/packages/client/src/pages/app/org/[organizationId]/wiki/index.tsx index a831ab6..88fb217 100644 --- a/packages/client/src/pages/app/org/[organizationId]/wiki/index.tsx +++ b/packages/client/src/pages/app/org/[organizationId]/wiki/index.tsx @@ -1,5 +1,9 @@ +import React from 'react'; + import { List, TabPane, Tabs, Typography } from '@douyinfe/semi-ui'; + import { WikiApiDefinition } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { Empty } from 'components/empty'; import { Seo } from 'components/seo'; @@ -10,7 +14,6 @@ import { useRouterQuery } from 'hooks/use-router-query'; import { CreateWikiIllustration } from 'illustrations/create-wiki'; import { AppSingleColumnLayout } from 'layouts/app-single-column'; import type { NextPage } from 'next'; -import React from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; const grid = { diff --git a/packages/client/src/pages/app/org/create/index.tsx b/packages/client/src/pages/app/org/create/index.tsx index acb5d7d..9cd66b7 100644 --- a/packages/client/src/pages/app/org/create/index.tsx +++ b/packages/client/src/pages/app/org/create/index.tsx @@ -1,13 +1,16 @@ +import { useCallback, useRef, useState } from 'react'; + import { Avatar, Button, Form, Typography } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; + import { ORGANIZATION_LOGOS } from '@think/constants'; + import { ImageUploader } from 'components/image-uploader'; import { Seo } from 'components/seo'; import { useCreateOrganization } from 'data/organization'; import { useToggle } from 'hooks/use-toggle'; import { SingleColumnLayout } from 'layouts/single-column'; import Router from 'next/router'; -import { useCallback, useRef, useState } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/pages/feature/csrf/index.tsx b/packages/client/src/pages/feature/csrf/index.tsx index da2b09d..d6b4edf 100644 --- a/packages/client/src/pages/feature/csrf/index.tsx +++ b/packages/client/src/pages/feature/csrf/index.tsx @@ -1,6 +1,7 @@ +import React, { useRef, useState } from 'react'; + import { SingleColumnLayout } from 'layouts/single-column'; import { useRouter } from 'next/router'; -import React, { useRef, useState } from 'react'; const Page = () => { const $container = useRef(); diff --git a/packages/client/src/pages/feature/editor/index.tsx b/packages/client/src/pages/feature/editor/index.tsx index 783cbd4..ff135fe 100644 --- a/packages/client/src/pages/feature/editor/index.tsx +++ b/packages/client/src/pages/feature/editor/index.tsx @@ -1,8 +1,10 @@ +import React, { useRef } from 'react'; + +import { CollaborationEditor, ICollaborationEditorProps, ICollaborationRefProps } from 'tiptap/editor'; + import { useUser } from 'data/user'; import { SingleColumnLayout } from 'layouts/single-column'; import { useRouter } from 'next/router'; -import React, { useRef } from 'react'; -import { CollaborationEditor, ICollaborationEditorProps, ICollaborationRefProps } from 'tiptap/editor'; const Page = () => { const $container = useRef(); diff --git a/packages/client/src/pages/find/index.tsx b/packages/client/src/pages/find/index.tsx index 14d21cc..7a0f59b 100644 --- a/packages/client/src/pages/find/index.tsx +++ b/packages/client/src/pages/find/index.tsx @@ -1,5 +1,9 @@ +import React from 'react'; + import { List, Pagination, Typography } from '@douyinfe/semi-ui'; + import { WikiApiDefinition } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { Empty } from 'components/empty'; import { Seo } from 'components/seo'; @@ -7,7 +11,6 @@ import { WikiCard, WikiCardPlaceholder } from 'components/wiki/card'; import { getAllPublicWikis, useAllPublicWikis } from 'data/wiki'; import { SingleColumnLayout } from 'layouts/single-column'; import type { NextPage } from 'next'; -import React from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; const grid = { diff --git a/packages/client/src/pages/forgetPassword/index.tsx b/packages/client/src/pages/forgetPassword/index.tsx index 1c258d0..7bbad66 100644 --- a/packages/client/src/pages/forgetPassword/index.tsx +++ b/packages/client/src/pages/forgetPassword/index.tsx @@ -1,4 +1,7 @@ +import React, { useCallback } from 'react'; + import { Layout, Modal, Space, Typography } from '@douyinfe/semi-ui'; + import { Author } from 'components/author'; import { LogoImage, LogoText } from 'components/logo'; import { Seo } from 'components/seo'; @@ -6,7 +9,6 @@ import { ResetPassword } from 'components/user/reset-password'; import { useRouterQuery } from 'hooks/use-router-query'; import Link from 'next/link'; import Router from 'next/router'; -import React, { useCallback } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/pages/index.tsx b/packages/client/src/pages/index.tsx index e894fc0..2c9fdb8 100644 --- a/packages/client/src/pages/index.tsx +++ b/packages/client/src/pages/index.tsx @@ -1,11 +1,13 @@ +import React, { useCallback } from 'react'; + import { Button, Typography } from '@douyinfe/semi-ui'; + import { Seo } from 'components/seo'; import { toLogin, useUser } from 'data/user'; import { TeamWorkIllustration } from 'illustrations/team-work'; import { SingleColumnLayout } from 'layouts/single-column'; import type { NextPage } from 'next'; import Router from 'next/router'; -import React, { useCallback } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/pages/login/index.tsx b/packages/client/src/pages/login/index.tsx index 0559b23..ce7e971 100644 --- a/packages/client/src/pages/login/index.tsx +++ b/packages/client/src/pages/login/index.tsx @@ -1,4 +1,7 @@ +import React, { useCallback } from 'react'; + import { Button, Form, Layout, Space, Typography } from '@douyinfe/semi-ui'; + import { Author } from 'components/author'; import { LogoImage, LogoText } from 'components/logo'; import { Seo } from 'components/seo'; @@ -6,7 +9,6 @@ import { useUser } from 'data/user'; import { useRouterQuery } from 'hooks/use-router-query'; import { useToggle } from 'hooks/use-toggle'; import Link from 'next/link'; -import React, { useCallback } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/pages/register/index.tsx b/packages/client/src/pages/register/index.tsx index 2129f4d..452433c 100644 --- a/packages/client/src/pages/register/index.tsx +++ b/packages/client/src/pages/register/index.tsx @@ -1,4 +1,7 @@ +import React, { useCallback, useState } from 'react'; + import { Button, Col, Form, Layout, Modal, Row, Space, Toast, Typography } from '@douyinfe/semi-ui'; + import { Author } from 'components/author'; import { LogoImage, LogoText } from 'components/logo'; import { Seo } from 'components/seo'; @@ -9,7 +12,6 @@ import { useRouterQuery } from 'hooks/use-router-query'; import { useToggle } from 'hooks/use-toggle'; import Link from 'next/link'; import Router from 'next/router'; -import React, { useCallback, useState } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/pages/share/document/[documentId]/index.tsx b/packages/client/src/pages/share/document/[documentId]/index.tsx index ad022cb..09738ae 100644 --- a/packages/client/src/pages/share/document/[documentId]/index.tsx +++ b/packages/client/src/pages/share/document/[documentId]/index.tsx @@ -1,8 +1,10 @@ +import React from 'react'; + import { DocumentApiDefinition, IDocument } from '@think/domains'; + import { DocumentPublicReader } from 'components/document/reader/public'; import { getPublicDocumentDetail } from 'data/document'; import { NextPage } from 'next'; -import React from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; interface IProps { diff --git a/packages/client/src/pages/share/wiki/[wikiId]/document/[documentId]/index.tsx b/packages/client/src/pages/share/wiki/[wikiId]/document/[documentId]/index.tsx index 544976e..38648bd 100644 --- a/packages/client/src/pages/share/wiki/[wikiId]/document/[documentId]/index.tsx +++ b/packages/client/src/pages/share/wiki/[wikiId]/document/[documentId]/index.tsx @@ -1,11 +1,13 @@ +import React from 'react'; + import { DocumentApiDefinition, IDocument, IWiki, WikiApiDefinition } from '@think/domains'; + import { DocumentPublicReader } from 'components/document/reader/public'; import { WikiPublicTocs } from 'components/wiki/tocs/public'; import { getPublicDocumentDetail } from 'data/document'; import { getPublicWikiTocs } from 'data/wiki'; import { PublicDoubleColumnLayout } from 'layouts/public-double-column'; import { NextPage } from 'next'; -import React from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; interface IProps { diff --git a/packages/client/src/pages/share/wiki/[wikiId]/index.tsx b/packages/client/src/pages/share/wiki/[wikiId]/index.tsx index 40d6cb9..dc2634e 100644 --- a/packages/client/src/pages/share/wiki/[wikiId]/index.tsx +++ b/packages/client/src/pages/share/wiki/[wikiId]/index.tsx @@ -1,11 +1,13 @@ +import React from 'react'; + import { IWiki, WikiApiDefinition } from '@think/domains'; + import { DataRender } from 'components/data-render'; import { DocumentPublicReader } from 'components/document/reader/public'; import { WikiPublicTocs } from 'components/wiki/tocs/public'; import { getPublicWikiDetail, getPublicWikiHomeDocument, getPublicWikiTocs, usePublicWikiHomeDoc } from 'data/wiki'; import { PublicDoubleColumnLayout } from 'layouts/public-double-column'; import { NextPage } from 'next'; -import React from 'react'; import { serverPrefetcher } from 'services/server-prefetcher'; interface IProps { diff --git a/packages/client/src/pages/template/[templateId]/index.tsx b/packages/client/src/pages/template/[templateId]/index.tsx index 1a0097c..332208f 100644 --- a/packages/client/src/pages/template/[templateId]/index.tsx +++ b/packages/client/src/pages/template/[templateId]/index.tsx @@ -1,4 +1,5 @@ import { ITemplate, TemplateApiDefinition } from '@think/domains'; + import { TemplateEditor } from 'components/template/editor'; import { getTemplateDetail } from 'data/template'; import { NextPage } from 'next'; diff --git a/packages/client/src/pages/template/index.tsx b/packages/client/src/pages/template/index.tsx index c8d1853..81dc26f 100644 --- a/packages/client/src/pages/template/index.tsx +++ b/packages/client/src/pages/template/index.tsx @@ -1,11 +1,13 @@ +import React, { useCallback } from 'react'; + import { Button, TabPane, Tabs, Typography } from '@douyinfe/semi-ui'; + import { Seo } from 'components/seo'; import { TemplateList } from 'components/template/list'; import { useOwnTemplates, usePublicTemplates } from 'data/template'; import { SingleColumnLayout } from 'layouts/single-column'; import type { NextPage } from 'next'; import Router, { useRouter } from 'next/router'; -import React, { useCallback } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/services/file.ts b/packages/client/src/services/file.ts index 5ff3c23..457b152 100644 --- a/packages/client/src/services/file.ts +++ b/packages/client/src/services/file.ts @@ -1,4 +1,5 @@ import { FILE_CHUNK_SIZE, FileApiDefinition } from '@think/domains'; + import { string } from 'lib0'; import SparkMD5 from 'spark-md5'; diff --git a/packages/client/src/services/http-client.ts b/packages/client/src/services/http-client.ts index 4c57462..4516fec 100644 --- a/packages/client/src/services/http-client.ts +++ b/packages/client/src/services/http-client.ts @@ -1,4 +1,5 @@ import { Toast } from '@douyinfe/semi-ui'; + import axios, { Axios, AxiosRequestConfig, AxiosResponse } from 'axios'; import { toLogin } from 'data/user'; diff --git a/packages/client/src/services/server-prefetcher.ts b/packages/client/src/services/server-prefetcher.ts index 62448b7..3162966 100644 --- a/packages/client/src/services/server-prefetcher.ts +++ b/packages/client/src/services/server-prefetcher.ts @@ -1,6 +1,7 @@ -import { NextPageContext } from 'next'; import { dehydrate, QueryClient } from 'react-query'; +import { NextPageContext } from 'next'; + type PrefetchActions = Array<{ url: string | (string | number)[]; action: (cookie: string) => void; diff --git a/packages/client/src/services/user.ts b/packages/client/src/services/user.ts index 42a5bb4..85efe0b 100644 --- a/packages/client/src/services/user.ts +++ b/packages/client/src/services/user.ts @@ -1,4 +1,5 @@ import { IAuth, IUser, OrganizationApiDefinition } from '@think/domains'; + import Router from 'next/router'; import { HttpClient } from './http-client'; diff --git a/packages/client/src/tiptap/core/bubble-menu/bubble-menu-plugin.tsx b/packages/client/src/tiptap/core/bubble-menu/bubble-menu-plugin.tsx index 71c7027..61965e4 100644 --- a/packages/client/src/tiptap/core/bubble-menu/bubble-menu-plugin.tsx +++ b/packages/client/src/tiptap/core/bubble-menu/bubble-menu-plugin.tsx @@ -1,4 +1,5 @@ import { Editor, isNodeSelection, isTextSelection, posToDOMRect } from '@tiptap/core'; + import { EditorState, Plugin, PluginKey } from 'prosemirror-state'; import { EditorView } from 'prosemirror-view'; import tippy, { Instance, Props, sticky } from 'tippy.js'; diff --git a/packages/client/src/tiptap/core/extensions/background-color.ts b/packages/client/src/tiptap/core/extensions/background-color.ts index ad8280a..68b836b 100644 --- a/packages/client/src/tiptap/core/extensions/background-color.ts +++ b/packages/client/src/tiptap/core/extensions/background-color.ts @@ -1,5 +1,4 @@ import '@tiptap/extension-text-style'; - import { Extension } from '@tiptap/core'; export type ColorOptions = { diff --git a/packages/client/src/tiptap/core/extensions/clipboard.ts b/packages/client/src/tiptap/core/extensions/clipboard.ts index 158d845..98267e1 100644 --- a/packages/client/src/tiptap/core/extensions/clipboard.ts +++ b/packages/client/src/tiptap/core/extensions/clipboard.ts @@ -1,9 +1,10 @@ import { Extension } from '@tiptap/core'; -import { Fragment } from 'prosemirror-model'; -import { Plugin, PluginKey } from 'prosemirror-state'; import { EXTENSION_PRIORITY_HIGHEST } from 'tiptap/core/constants'; import { copyNode } from 'tiptap/prose-utils'; +import { Fragment } from 'prosemirror-model'; +import { Plugin, PluginKey } from 'prosemirror-state'; + const isPureText = (content): boolean => { if (!content) return false; diff --git a/packages/client/src/tiptap/core/extensions/code-block.ts b/packages/client/src/tiptap/core/extensions/code-block.ts index 649f7d0..c2211f9 100644 --- a/packages/client/src/tiptap/core/extensions/code-block.ts +++ b/packages/client/src/tiptap/core/extensions/code-block.ts @@ -1,11 +1,12 @@ import { findChildren } from '@tiptap/core'; import BuiltInCodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'; import { ReactNodeViewRenderer } from '@tiptap/react'; +import { CodeBlockWrapper } from 'tiptap/core/wrappers/code-block'; + import { lowlight } from 'lowlight/lib/all'; import { Node as ProsemirrorNode } from 'prosemirror-model'; import { Plugin, PluginKey } from 'prosemirror-state'; import { Decoration, DecorationSet } from 'prosemirror-view'; -import { CodeBlockWrapper } from 'tiptap/core/wrappers/code-block'; function parseNodes(nodes: any[], className: string[] = []): { text: string; classes: string[] }[] { return nodes diff --git a/packages/client/src/tiptap/core/extensions/code.ts b/packages/client/src/tiptap/core/extensions/code.ts index 808a869..45bb448 100644 --- a/packages/client/src/tiptap/core/extensions/code.ts +++ b/packages/client/src/tiptap/core/extensions/code.ts @@ -1,8 +1,9 @@ import { Extension } from '@tiptap/core'; import BuiltInCode from '@tiptap/extension-code'; -import codemark from 'prosemirror-codemark'; import { EXTENSION_PRIORITY_LOWER } from 'tiptap/core/constants'; +import codemark from 'prosemirror-codemark'; + export const Code = BuiltInCode.extend({ excludes: null, /** diff --git a/packages/client/src/tiptap/core/extensions/collaboration-cursor/cursor-plugin/index.ts b/packages/client/src/tiptap/core/extensions/collaboration-cursor/cursor-plugin/index.ts index 75cd9a9..d7e7bb3 100644 --- a/packages/client/src/tiptap/core/extensions/collaboration-cursor/cursor-plugin/index.ts +++ b/packages/client/src/tiptap/core/extensions/collaboration-cursor/cursor-plugin/index.ts @@ -1,6 +1,3 @@ -import * as math from 'lib0/math'; -import { Plugin } from 'prosemirror-state'; // eslint-disable-line -import { Decoration, DecorationSet } from 'prosemirror-view'; // eslint-disable-line import { absolutePositionToRelativePosition, relativePositionToAbsolutePosition, @@ -8,6 +5,10 @@ import { yCursorPluginKey, ySyncPluginKey, } from 'tiptap/core/thritypart/y-prosemirror/y-prosemirror'; + +import * as math from 'lib0/math'; +import { Plugin } from 'prosemirror-state'; // eslint-disable-line +import { Decoration, DecorationSet } from 'prosemirror-view'; // eslint-disable-line import * as Y from 'yjs'; /** diff --git a/packages/client/src/tiptap/core/extensions/collaboration-cursor/index.ts b/packages/client/src/tiptap/core/extensions/collaboration-cursor/index.ts index 6bdd8f0..4e21c09 100644 --- a/packages/client/src/tiptap/core/extensions/collaboration-cursor/index.ts +++ b/packages/client/src/tiptap/core/extensions/collaboration-cursor/index.ts @@ -1,4 +1,5 @@ import { Extension } from '@tiptap/core'; + import { EditorState } from 'prosemirror-state'; import { yCursorPlugin } from './cursor-plugin'; diff --git a/packages/client/src/tiptap/core/extensions/collaboration/collaboration.ts b/packages/client/src/tiptap/core/extensions/collaboration/collaboration.ts index 33c8797..d096c28 100644 --- a/packages/client/src/tiptap/core/extensions/collaboration/collaboration.ts +++ b/packages/client/src/tiptap/core/extensions/collaboration/collaboration.ts @@ -6,6 +6,7 @@ import { yUndoPlugin, yUndoPluginKey, } from 'tiptap/core/thritypart/y-prosemirror/y-prosemirror'; + import { UndoManager } from 'yjs'; declare module '@tiptap/core' { diff --git a/packages/client/src/tiptap/core/extensions/collaboration/helpers/is-change-origin.ts b/packages/client/src/tiptap/core/extensions/collaboration/helpers/is-change-origin.ts index 73a5c8e..d5321bd 100644 --- a/packages/client/src/tiptap/core/extensions/collaboration/helpers/is-change-origin.ts +++ b/packages/client/src/tiptap/core/extensions/collaboration/helpers/is-change-origin.ts @@ -1,6 +1,7 @@ -import { Transaction } from 'prosemirror-state'; import { ySyncPluginKey } from 'tiptap/core/thritypart/y-prosemirror/y-prosemirror'; +import { Transaction } from 'prosemirror-state'; + export function isChangeOrigin(transaction: Transaction): boolean { return !!transaction.getMeta(ySyncPluginKey); } diff --git a/packages/client/src/tiptap/core/extensions/color-highlighter.ts b/packages/client/src/tiptap/core/extensions/color-highlighter.ts index 00a178f..e45de0f 100644 --- a/packages/client/src/tiptap/core/extensions/color-highlighter.ts +++ b/packages/client/src/tiptap/core/extensions/color-highlighter.ts @@ -1,7 +1,8 @@ import { Extension } from '@tiptap/core'; -import { Plugin } from 'prosemirror-state'; import { findColors } from 'tiptap/prose-utils'; +import { Plugin } from 'prosemirror-state'; + export const ColorHighlighter = Extension.create({ name: 'colorHighlighter', diff --git a/packages/client/src/tiptap/core/extensions/columns.ts b/packages/client/src/tiptap/core/extensions/columns.ts index 16e8c4f..f11dc01 100644 --- a/packages/client/src/tiptap/core/extensions/columns.ts +++ b/packages/client/src/tiptap/core/extensions/columns.ts @@ -1,7 +1,8 @@ import { mergeAttributes, Node } from '@tiptap/core'; -import { TextSelection } from 'prosemirror-state'; import { addOrDeleteCol, createColumns, gotoCol } from 'tiptap/prose-utils'; +import { TextSelection } from 'prosemirror-state'; + import { EXTENSION_PRIORITY_HIGHEST } from '../constants'; declare module '@tiptap/core' { diff --git a/packages/client/src/tiptap/core/extensions/document-reference.ts b/packages/client/src/tiptap/core/extensions/document-reference.ts index aec8320..1a430fe 100644 --- a/packages/client/src/tiptap/core/extensions/document-reference.ts +++ b/packages/client/src/tiptap/core/extensions/document-reference.ts @@ -1,4 +1,5 @@ import { IUser } from '@think/domains'; + import { mergeAttributes, Node } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; import { DocumentReferenceWrapper } from 'tiptap/core/wrappers/document-reference'; diff --git a/packages/client/src/tiptap/core/extensions/dragable.ts b/packages/client/src/tiptap/core/extensions/dragable.ts index e7f69be..a1dd3e4 100644 --- a/packages/client/src/tiptap/core/extensions/dragable.ts +++ b/packages/client/src/tiptap/core/extensions/dragable.ts @@ -1,4 +1,9 @@ +import ReactDOM from 'react-dom'; + import { Extension } from '@tiptap/core'; +import { safePos } from 'tiptap/prose-utils'; +import { ActiveNode, removePossibleTable, selectAncestorNodeByDom } from 'tiptap/prose-utils'; + import { NodeSelection, Plugin as PMPlugin, @@ -8,9 +13,6 @@ import { } from 'prosemirror-state'; import { findParentNodeClosestToPos } from 'prosemirror-utils'; import { __serializeForClipboard, Decoration, DecorationSet, EditorView } from 'prosemirror-view'; -import ReactDOM from 'react-dom'; -import { safePos } from 'tiptap/prose-utils'; -import { ActiveNode, removePossibleTable, selectAncestorNodeByDom } from 'tiptap/prose-utils'; const DragablePluginKey = new PMPluginKey('dragable'); diff --git a/packages/client/src/tiptap/core/extensions/emoji.ts b/packages/client/src/tiptap/core/extensions/emoji.ts index f0eb7a4..ff1d5e0 100644 --- a/packages/client/src/tiptap/core/extensions/emoji.ts +++ b/packages/client/src/tiptap/core/extensions/emoji.ts @@ -1,12 +1,13 @@ import { Node } from '@tiptap/core'; import { ReactRenderer } from '@tiptap/react'; import Suggestion from '@tiptap/suggestion'; -import { Plugin, PluginKey } from 'prosemirror-state'; -import tippy from 'tippy.js'; import { EXTENSION_PRIORITY_HIGHEST } from 'tiptap/core/constants'; import { EmojiList } from 'tiptap/core/wrappers/emoji-list'; import { emojiSearch, emojisToName } from 'tiptap/core/wrappers/emoji-list/emojis'; +import { Plugin, PluginKey } from 'prosemirror-state'; +import tippy from 'tippy.js'; + declare module '@tiptap/core' { interface Commands { emoji: { diff --git a/packages/client/src/tiptap/core/extensions/event-emitter.ts b/packages/client/src/tiptap/core/extensions/event-emitter.ts index 5e24f13..59b1cdf 100644 --- a/packages/client/src/tiptap/core/extensions/event-emitter.ts +++ b/packages/client/src/tiptap/core/extensions/event-emitter.ts @@ -1,7 +1,8 @@ import { Extension } from '@tiptap/core'; -import { EventEmitter as Em } from 'helpers/event-emitter'; import { EXTENSION_PRIORITY_HIGHEST } from 'tiptap/core/constants'; +import { EventEmitter as Em } from 'helpers/event-emitter'; + const event = new Em(); /** diff --git a/packages/client/src/tiptap/core/extensions/excalidraw.ts b/packages/client/src/tiptap/core/extensions/excalidraw.ts index d36da5c..0ba1767 100644 --- a/packages/client/src/tiptap/core/extensions/excalidraw.ts +++ b/packages/client/src/tiptap/core/extensions/excalidraw.ts @@ -1,4 +1,5 @@ import { IUser } from '@think/domains'; + import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; import { ExcalidrawWrapper } from 'tiptap/core/wrappers/excalidraw'; diff --git a/packages/client/src/tiptap/core/extensions/flow.ts b/packages/client/src/tiptap/core/extensions/flow.ts index 8c795cc..2abe350 100644 --- a/packages/client/src/tiptap/core/extensions/flow.ts +++ b/packages/client/src/tiptap/core/extensions/flow.ts @@ -1,4 +1,5 @@ import { IUser } from '@think/domains'; + import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; import { FlowWrapper } from 'tiptap/core/wrappers/flow'; diff --git a/packages/client/src/tiptap/core/extensions/focus.ts b/packages/client/src/tiptap/core/extensions/focus.ts index 59fbe52..0746df4 100644 --- a/packages/client/src/tiptap/core/extensions/focus.ts +++ b/packages/client/src/tiptap/core/extensions/focus.ts @@ -1,4 +1,5 @@ import { Extension } from '@tiptap/core'; + import { Plugin, PluginKey } from 'prosemirror-state'; import { Decoration, DecorationSet } from 'prosemirror-view'; diff --git a/packages/client/src/tiptap/core/extensions/font-family.ts b/packages/client/src/tiptap/core/extensions/font-family.ts index 848f3ae..dfa388b 100644 --- a/packages/client/src/tiptap/core/extensions/font-family.ts +++ b/packages/client/src/tiptap/core/extensions/font-family.ts @@ -1,5 +1,4 @@ import '@tiptap/extension-text-style'; - import { Extension } from '@tiptap/core'; declare module '@tiptap/core' { diff --git a/packages/client/src/tiptap/core/extensions/font-size.ts b/packages/client/src/tiptap/core/extensions/font-size.ts index f7df8b7..c96c5ab 100644 --- a/packages/client/src/tiptap/core/extensions/font-size.ts +++ b/packages/client/src/tiptap/core/extensions/font-size.ts @@ -1,5 +1,4 @@ import '@tiptap/extension-text-style'; - import { Extension } from '@tiptap/core'; type FontSizeOptions = { diff --git a/packages/client/src/tiptap/core/extensions/horizontal-rule.ts b/packages/client/src/tiptap/core/extensions/horizontal-rule.ts index 6955be0..afbe85b 100644 --- a/packages/client/src/tiptap/core/extensions/horizontal-rule.ts +++ b/packages/client/src/tiptap/core/extensions/horizontal-rule.ts @@ -1,4 +1,5 @@ import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core'; + import { TextSelection } from 'prosemirror-state'; export interface HorizontalRuleOptions { diff --git a/packages/client/src/tiptap/core/extensions/iframe.ts b/packages/client/src/tiptap/core/extensions/iframe.ts index 5b34c0c..e1787e7 100644 --- a/packages/client/src/tiptap/core/extensions/iframe.ts +++ b/packages/client/src/tiptap/core/extensions/iframe.ts @@ -1,4 +1,5 @@ import { IUser } from '@think/domains'; + import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; import { IframeWrapper } from 'tiptap/core/wrappers/iframe'; diff --git a/packages/client/src/tiptap/core/extensions/indent.ts b/packages/client/src/tiptap/core/extensions/indent.ts index 44350cb..4c57041 100644 --- a/packages/client/src/tiptap/core/extensions/indent.ts +++ b/packages/client/src/tiptap/core/extensions/indent.ts @@ -1,7 +1,8 @@ -import { Command, Extension } from '@tiptap/core'; +import { Extension } from '@tiptap/core'; +import { clamp, getNodeType, isListActive, isListNode } from 'tiptap/prose-utils'; + import { liftListItem, sinkListItem } from 'prosemirror-schema-list'; import { AllSelection, TextSelection, Transaction } from 'prosemirror-state'; -import { clamp, getNodeType, isListActive, isListNode } from 'tiptap/prose-utils'; declare module '@tiptap/core' { interface Commands { diff --git a/packages/client/src/tiptap/core/extensions/katex.ts b/packages/client/src/tiptap/core/extensions/katex.ts index 7e655d9..c92d4b8 100644 --- a/packages/client/src/tiptap/core/extensions/katex.ts +++ b/packages/client/src/tiptap/core/extensions/katex.ts @@ -1,4 +1,5 @@ import { IUser } from '@think/domains'; + import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; import { KatexWrapper } from 'tiptap/core/wrappers/katex'; diff --git a/packages/client/src/tiptap/core/extensions/loading.ts b/packages/client/src/tiptap/core/extensions/loading.ts index b442c7d..afa90f6 100644 --- a/packages/client/src/tiptap/core/extensions/loading.ts +++ b/packages/client/src/tiptap/core/extensions/loading.ts @@ -1,8 +1,9 @@ import { Editor, Node } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; -import { Node as PMNode } from 'prosemirror-state'; import { LoadingWrapper } from 'tiptap/core/wrappers/loading'; +import { Node as PMNode } from 'prosemirror-state'; + export function findLoadingById(editor: Editor, id: string): null | { node: PMNode; pos: number } { let target: PMNode | null = null; let pos = -1; diff --git a/packages/client/src/tiptap/core/extensions/mention.ts b/packages/client/src/tiptap/core/extensions/mention.ts index f8e15c9..2291841 100644 --- a/packages/client/src/tiptap/core/extensions/mention.ts +++ b/packages/client/src/tiptap/core/extensions/mention.ts @@ -1,10 +1,11 @@ import BulitInMention from '@tiptap/extension-mention'; import { ReactRenderer } from '@tiptap/react'; -import { getMentionUser } from 'services/user'; -import tippy from 'tippy.js'; import { MentionList } from 'tiptap/core/wrappers/mention-list'; import { getDatasetAttribute } from 'tiptap/prose-utils'; +import { getMentionUser } from 'services/user'; +import tippy from 'tippy.js'; + const suggestion = { items: async ({ query }) => { const res = await getMentionUser(); diff --git a/packages/client/src/tiptap/core/extensions/mind.ts b/packages/client/src/tiptap/core/extensions/mind.ts index fcf3e57..bbbb198 100644 --- a/packages/client/src/tiptap/core/extensions/mind.ts +++ b/packages/client/src/tiptap/core/extensions/mind.ts @@ -1,4 +1,5 @@ import { IUser } from '@think/domains'; + import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; import { MindWrapper } from 'tiptap/core/wrappers/mind'; diff --git a/packages/client/src/tiptap/core/extensions/paste.ts b/packages/client/src/tiptap/core/extensions/paste.ts index 424c73d..4f69f79 100644 --- a/packages/client/src/tiptap/core/extensions/paste.ts +++ b/packages/client/src/tiptap/core/extensions/paste.ts @@ -1,9 +1,5 @@ import { Editor as CoreEditor, Extension, getSchema } from '@tiptap/core'; import { Document } from '@tiptap/extension-document'; -import { safeJSONParse } from 'helpers/json'; -import { toggleMark } from 'prosemirror-commands'; -import { DOMParser as PMDOMParser, Fragment, Node, Schema } from 'prosemirror-model'; -import { EditorState, Plugin, PluginKey, TextSelection } from 'prosemirror-state'; import { EXTENSION_PRIORITY_HIGHEST } from 'tiptap/core/constants'; import { debug, @@ -17,6 +13,11 @@ import { safePos, } from 'tiptap/prose-utils'; +import { safeJSONParse } from 'helpers/json'; +import { toggleMark } from 'prosemirror-commands'; +import { DOMParser as PMDOMParser, Fragment, Node, Schema } from 'prosemirror-model'; +import { EditorState, Plugin, PluginKey, TextSelection } from 'prosemirror-state'; + const htmlToProsemirror = (editor: CoreEditor, html, isPasteMarkdown = false) => { const firstNode = editor.view.state.doc.content.firstChild; const shouldInsertTitleText = !!(firstNode?.textContent?.length <= 0 ?? true); diff --git a/packages/client/src/tiptap/core/extensions/placeholder.ts b/packages/client/src/tiptap/core/extensions/placeholder.ts index 2e78899..978ed6e 100644 --- a/packages/client/src/tiptap/core/extensions/placeholder.ts +++ b/packages/client/src/tiptap/core/extensions/placeholder.ts @@ -1,4 +1,5 @@ import { Editor, Extension } from '@tiptap/core'; + import { Node as ProsemirrorNode } from 'prosemirror-model'; import { Plugin } from 'prosemirror-state'; import { Decoration, DecorationSet } from 'prosemirror-view'; diff --git a/packages/client/src/tiptap/core/extensions/scroll-to-cursor.ts b/packages/client/src/tiptap/core/extensions/scroll-to-cursor.ts index 9eaa7cb..56d9ccb 100644 --- a/packages/client/src/tiptap/core/extensions/scroll-to-cursor.ts +++ b/packages/client/src/tiptap/core/extensions/scroll-to-cursor.ts @@ -1,7 +1,8 @@ import { Extension } from '@tiptap/core'; -import { Plugin } from 'prosemirror-state'; import { ImagesLoaded } from 'tiptap/image-load'; +import { Plugin } from 'prosemirror-state'; + /** * Options for customizing Scroll2Cursor plugin */ diff --git a/packages/client/src/tiptap/core/extensions/search.ts b/packages/client/src/tiptap/core/extensions/search.ts index ad8712b..61481e2 100644 --- a/packages/client/src/tiptap/core/extensions/search.ts +++ b/packages/client/src/tiptap/core/extensions/search.ts @@ -1,9 +1,10 @@ import { Extension } from '@tiptap/core'; +import { Editor } from 'tiptap/core'; + import { Node as ProsemirrorNode } from 'prosemirror-model'; import { EditorState, Plugin, PluginKey } from 'prosemirror-state'; import { Decoration, DecorationSet } from 'prosemirror-view'; import scrollIntoView from 'scroll-into-view-if-needed'; -import { Editor } from 'tiptap/core'; declare module '@tiptap/core' { interface Commands { diff --git a/packages/client/src/tiptap/core/extensions/selection.ts b/packages/client/src/tiptap/core/extensions/selection.ts index b1a244d..8c48a49 100644 --- a/packages/client/src/tiptap/core/extensions/selection.ts +++ b/packages/client/src/tiptap/core/extensions/selection.ts @@ -1,9 +1,10 @@ import { Extension } from '@tiptap/core'; -import { AllSelection, NodeSelection, Plugin, PluginKey, Selection, TextSelection } from 'prosemirror-state'; -import { Decoration, DecorationSet } from 'prosemirror-view'; import { EXTENSION_PRIORITY_HIGHEST } from 'tiptap/core/constants'; import { getCurrentNode, getNodeAtPos, isInCallout, isInCodeBlock, isTodoListNode } from 'tiptap/prose-utils'; +import { AllSelection, NodeSelection, Plugin, PluginKey, Selection, TextSelection } from 'prosemirror-state'; +import { Decoration, DecorationSet } from 'prosemirror-view'; + export const selectionPluginKey = new PluginKey('selection'); export const getTopLevelNodesFromSelection = (selection: Selection, doc) => { diff --git a/packages/client/src/tiptap/core/extensions/slash.ts b/packages/client/src/tiptap/core/extensions/slash.ts index f380d9a..eb27484 100644 --- a/packages/client/src/tiptap/core/extensions/slash.ts +++ b/packages/client/src/tiptap/core/extensions/slash.ts @@ -1,12 +1,13 @@ import { Node } from '@tiptap/core'; import { ReactRenderer } from '@tiptap/react'; import Suggestion from '@tiptap/suggestion'; -import { Plugin, PluginKey } from 'prosemirror-state'; -import tippy from 'tippy.js'; import { EXTENSION_PRIORITY_HIGHEST } from 'tiptap/core/constants'; import { insertMenuLRUCache, QUICK_INSERT_COMMANDS, transformToCommands } from 'tiptap/core/menus/commands'; import { MenuList } from 'tiptap/core/wrappers/menu-list'; +import { Plugin, PluginKey } from 'prosemirror-state'; +import tippy from 'tippy.js'; + const createSlashExtension = (char: string) => { const extensionName = `quickInsert-${char}`; const extensionPluginKey = new PluginKey('quickInsert'); diff --git a/packages/client/src/tiptap/core/extensions/status.ts b/packages/client/src/tiptap/core/extensions/status.ts index 43f655a..0512423 100644 --- a/packages/client/src/tiptap/core/extensions/status.ts +++ b/packages/client/src/tiptap/core/extensions/status.ts @@ -1,4 +1,5 @@ import { IUser } from '@think/domains'; + import { mergeAttributes, Node } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; import { STATUS_COLORS, StatusWrapper } from 'tiptap/core/wrappers/status'; diff --git a/packages/client/src/tiptap/core/extensions/table-cell.tsx b/packages/client/src/tiptap/core/extensions/table-cell.tsx index 963bf6c..793c955 100644 --- a/packages/client/src/tiptap/core/extensions/table-cell.tsx +++ b/packages/client/src/tiptap/core/extensions/table-cell.tsx @@ -1,12 +1,15 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; + import { IconPlus } from '@douyinfe/semi-icons'; + import { mergeAttributes, Node } from '@tiptap/core'; +import { getCellsInColumn, isRowSelected, isTableSelected, selectRow, selectTable } from 'tiptap/prose-utils'; + import { Tooltip } from 'components/tooltip'; import { Plugin, PluginKey } from 'prosemirror-state'; import { addRowAfter } from 'prosemirror-tables'; import { Decoration, DecorationSet } from 'prosemirror-view'; -import React from 'react'; -import ReactDOM from 'react-dom'; -import { getCellsInColumn, isRowSelected, isTableSelected, selectRow, selectTable } from 'tiptap/prose-utils'; export interface TableCellOptions { HTMLAttributes: Record; diff --git a/packages/client/src/tiptap/core/extensions/table-header.tsx b/packages/client/src/tiptap/core/extensions/table-header.tsx index 4c44e14..b6b5211 100644 --- a/packages/client/src/tiptap/core/extensions/table-header.tsx +++ b/packages/client/src/tiptap/core/extensions/table-header.tsx @@ -1,12 +1,15 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; + import { IconPlus } from '@douyinfe/semi-icons'; + import { mergeAttributes, Node } from '@tiptap/core'; +import { getCellsInRow, isColumnSelected, selectColumn } from 'tiptap/prose-utils'; + import { Tooltip } from 'components/tooltip'; import { Plugin, PluginKey } from 'prosemirror-state'; import { addColumnAfter } from 'prosemirror-tables'; import { Decoration, DecorationSet } from 'prosemirror-view'; -import React from 'react'; -import ReactDOM from 'react-dom'; -import { getCellsInRow, isColumnSelected, selectColumn } from 'tiptap/prose-utils'; export interface TableHeaderOptions { HTMLAttributes: Record; diff --git a/packages/client/src/tiptap/core/extensions/table.ts b/packages/client/src/tiptap/core/extensions/table.ts index 4d5711e..b580d15 100644 --- a/packages/client/src/tiptap/core/extensions/table.ts +++ b/packages/client/src/tiptap/core/extensions/table.ts @@ -1,4 +1,5 @@ import BuiltInTable from '@tiptap/extension-table'; + import { Node as ProseMirrorNode } from 'prosemirror-model'; import { Plugin, PluginKey } from 'prosemirror-state'; import { tableNodeTypes } from 'prosemirror-tables'; diff --git a/packages/client/src/tiptap/core/extensions/task-list.ts b/packages/client/src/tiptap/core/extensions/task-list.ts index 0cb76be..66ae7a9 100644 --- a/packages/client/src/tiptap/core/extensions/task-list.ts +++ b/packages/client/src/tiptap/core/extensions/task-list.ts @@ -1,8 +1,9 @@ import { getNodeType } from '@tiptap/core'; import { TaskList as BuiltInTaskList } from '@tiptap/extension-task-list'; +import { PARSE_HTML_PRIORITY_HIGHEST } from 'tiptap/core/constants'; + import { liftListItem } from 'prosemirror-schema-list'; import { findParentNodeClosestToPos } from 'prosemirror-utils'; -import { PARSE_HTML_PRIORITY_HIGHEST } from 'tiptap/core/constants'; export const TaskList = BuiltInTaskList.extend({ parseHTML() { diff --git a/packages/client/src/tiptap/core/extensions/title.ts b/packages/client/src/tiptap/core/extensions/title.ts index 9b02bfb..d57f8e8 100644 --- a/packages/client/src/tiptap/core/extensions/title.ts +++ b/packages/client/src/tiptap/core/extensions/title.ts @@ -1,8 +1,9 @@ import { mergeAttributes, Node } from '@tiptap/core'; import { ReactNodeViewRenderer } from '@tiptap/react'; +import { getDatasetAttribute, getNodeAtPos, isInTitle, nodeAttrsToDataset } from 'tiptap/prose-utils'; + import { Plugin, PluginKey, TextSelection } from 'prosemirror-state'; import { Decoration, DecorationSet } from 'prosemirror-view'; -import { getDatasetAttribute, getNodeAtPos, isInTitle, nodeAttrsToDataset } from 'tiptap/prose-utils'; import { TitleWrapper } from '../wrappers/title'; diff --git a/packages/client/src/tiptap/core/extensions/trailing-node.ts b/packages/client/src/tiptap/core/extensions/trailing-node.ts index 57d26b0..e6dfb04 100644 --- a/packages/client/src/tiptap/core/extensions/trailing-node.ts +++ b/packages/client/src/tiptap/core/extensions/trailing-node.ts @@ -1,4 +1,5 @@ import { Extension } from '@tiptap/core'; + import { Plugin, PluginKey } from 'prosemirror-state'; /** diff --git a/packages/client/src/tiptap/core/hooks/use-active.tsx b/packages/client/src/tiptap/core/hooks/use-active.tsx index 65c7fb2..4841502 100644 --- a/packages/client/src/tiptap/core/hooks/use-active.tsx +++ b/packages/client/src/tiptap/core/hooks/use-active.tsx @@ -1,7 +1,9 @@ -import { Editor } from '@tiptap/core'; -import { useToggle } from 'hooks/use-toggle'; import React, { useEffect } from 'react'; +import { Editor } from '@tiptap/core'; + +import { useToggle } from 'hooks/use-toggle'; + export const useActive = (editor: Editor, ...args) => { const [active, toggleActive] = useToggle(false); diff --git a/packages/client/src/tiptap/core/hooks/use-attributes.tsx b/packages/client/src/tiptap/core/hooks/use-attributes.tsx index 95191dd..3f27f31 100644 --- a/packages/client/src/tiptap/core/hooks/use-attributes.tsx +++ b/packages/client/src/tiptap/core/hooks/use-attributes.tsx @@ -1,7 +1,9 @@ -import { Editor } from '@tiptap/core'; -import deepEqual from 'deep-equal'; import React, { useEffect, useRef, useState } from 'react'; +import { Editor } from '@tiptap/core'; + +import deepEqual from 'deep-equal'; + type MapFn = (arg: T) => R; function mapSelf(d: T): T { diff --git a/packages/client/src/tiptap/core/index.tsx b/packages/client/src/tiptap/core/index.tsx index 9d8ee88..e901190 100644 --- a/packages/client/src/tiptap/core/index.tsx +++ b/packages/client/src/tiptap/core/index.tsx @@ -1,9 +1,11 @@ +import { DependencyList, useEffect, useState } from 'react'; + import { EditorOptions } from '@tiptap/core'; import { Editor as BuiltInEditor } from '@tiptap/react'; import { EditorContent, NodeViewContent, NodeViewWrapper } from '@tiptap/react'; + import { EventEmitter } from 'helpers/event-emitter'; import { throttle } from 'helpers/throttle'; -import { DependencyList, useEffect, useState } from 'react'; function useForceUpdate() { const [, setValue] = useState(0); diff --git a/packages/client/src/tiptap/core/menus/_event.ts b/packages/client/src/tiptap/core/menus/_event.ts index e0f3ec8..cf06fa7 100644 --- a/packages/client/src/tiptap/core/menus/_event.ts +++ b/packages/client/src/tiptap/core/menus/_event.ts @@ -1,6 +1,7 @@ -import { EventEmitter } from 'helpers/event-emitter'; import { Editor } from 'tiptap/core'; +import { EventEmitter } from 'helpers/event-emitter'; + const getEventEmitter = (editor: Editor): EventEmitter => { try { const event = editor.eventEmitter; diff --git a/packages/client/src/tiptap/core/menus/align/index.tsx b/packages/client/src/tiptap/core/menus/align/index.tsx index 9960797..bfd5979 100644 --- a/packages/client/src/tiptap/core/menus/align/index.tsx +++ b/packages/client/src/tiptap/core/menus/align/index.tsx @@ -1,6 +1,8 @@ +import React, { useCallback, useMemo } from 'react'; + import { IconAlignCenter, IconAlignJustify, IconAlignLeft, IconAlignRight } from '@douyinfe/semi-icons'; import { Button, Dropdown, Tooltip } from '@douyinfe/semi-ui'; -import React, { useCallback, useMemo } from 'react'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; diff --git a/packages/client/src/tiptap/core/menus/attachment/bubble.tsx b/packages/client/src/tiptap/core/menus/attachment/bubble.tsx index d246ae9..a78aab6 100644 --- a/packages/client/src/tiptap/core/menus/attachment/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/attachment/bubble.tsx @@ -1,12 +1,15 @@ +import { useCallback } from 'react'; + import { IconCopy, IconDelete } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { Tooltip } from 'components/tooltip'; -import { useCallback } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Attachment } from 'tiptap/core/extensions/attachment'; import { copyNode, deleteNode } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { Tooltip } from 'components/tooltip'; + export const AttachmentBubbleMenu = ({ editor }) => { const copyMe = useCallback(() => copyNode(Attachment.name, editor), [editor]); const deleteMe = useCallback(() => deleteNode(Attachment.name, editor), [editor]); diff --git a/packages/client/src/tiptap/core/menus/attachment/index.tsx b/packages/client/src/tiptap/core/menus/attachment/index.tsx index b8cbff7..f2f6150 100644 --- a/packages/client/src/tiptap/core/menus/attachment/index.tsx +++ b/packages/client/src/tiptap/core/menus/attachment/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { AttachmentBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/background-color/index.tsx b/packages/client/src/tiptap/core/menus/background-color/index.tsx index 3315b91..3347874 100644 --- a/packages/client/src/tiptap/core/menus/background-color/index.tsx +++ b/packages/client/src/tiptap/core/menus/background-color/index.tsx @@ -1,13 +1,16 @@ +import React, { useCallback } from 'react'; + import { IconMark } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { ColorPicker } from 'components/color-picker'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; +import { ColorPicker } from 'components/color-picker'; +import { Tooltip } from 'components/tooltip'; + const FlexStyle: React.CSSProperties = { display: 'inline-flex', flexDirection: 'column', diff --git a/packages/client/src/tiptap/core/menus/blockquote/index.tsx b/packages/client/src/tiptap/core/menus/blockquote/index.tsx index 65ecc44..18adffc 100644 --- a/packages/client/src/tiptap/core/menus/blockquote/index.tsx +++ b/packages/client/src/tiptap/core/menus/blockquote/index.tsx @@ -1,12 +1,15 @@ -import { Button } from '@douyinfe/semi-ui'; -import { IconQuote } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { Blockquote as BlockquoteExtension } from 'tiptap/core/extensions/blockquote'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { IconQuote } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const Blockquote: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isBlockquoteActive = useActive(editor, BlockquoteExtension.name); diff --git a/packages/client/src/tiptap/core/menus/bold/index.tsx b/packages/client/src/tiptap/core/menus/bold/index.tsx index aa3517b..170b582 100644 --- a/packages/client/src/tiptap/core/menus/bold/index.tsx +++ b/packages/client/src/tiptap/core/menus/bold/index.tsx @@ -1,12 +1,15 @@ +import React, { useCallback } from 'react'; + import { IconBold } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; import { Bold as BoldExtension } from 'tiptap/core/extensions/bold'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { Tooltip } from 'components/tooltip'; + export const Bold: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isBoldActive = useActive(editor, BoldExtension.name); diff --git a/packages/client/src/tiptap/core/menus/bullet-list/index.tsx b/packages/client/src/tiptap/core/menus/bullet-list/index.tsx index b7463d0..9457a48 100644 --- a/packages/client/src/tiptap/core/menus/bullet-list/index.tsx +++ b/packages/client/src/tiptap/core/menus/bullet-list/index.tsx @@ -1,12 +1,15 @@ -import { Button } from '@douyinfe/semi-ui'; -import { IconList } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { BulletList as BulletListExtension } from 'tiptap/core/extensions/bullet-list'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { IconList } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const BulletList: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isBulletListActive = useActive(editor, BulletListExtension.name); diff --git a/packages/client/src/tiptap/core/menus/callout/bubble.tsx b/packages/client/src/tiptap/core/menus/callout/bubble.tsx index 00a21f9..5ef4b50 100644 --- a/packages/client/src/tiptap/core/menus/callout/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/callout/bubble.tsx @@ -1,14 +1,17 @@ +import { useCallback } from 'react'; + import { IconCopy, IconDelete } from '@douyinfe/semi-icons'; import { Button, Popover, Space, Typography } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { IconDrawBoard } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; -import { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Callout } from 'tiptap/core/extensions/callout'; import { copyNode, deleteNode } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { IconDrawBoard } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + import styles from './bubble.module.scss'; const { Text } = Typography; diff --git a/packages/client/src/tiptap/core/menus/callout/index.tsx b/packages/client/src/tiptap/core/menus/callout/index.tsx index ec5e7b7..28854f5 100644 --- a/packages/client/src/tiptap/core/menus/callout/index.tsx +++ b/packages/client/src/tiptap/core/menus/callout/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { CalloutBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/clear-node-and-marks/index.tsx b/packages/client/src/tiptap/core/menus/clear-node-and-marks/index.tsx index 4ce3d56..e2ce4d4 100644 --- a/packages/client/src/tiptap/core/menus/clear-node-and-marks/index.tsx +++ b/packages/client/src/tiptap/core/menus/clear-node-and-marks/index.tsx @@ -1,8 +1,11 @@ +import React, { useCallback } from 'react'; + import { Button } from '@douyinfe/semi-ui'; + +import { Editor } from 'tiptap/core'; + import { IconClear } from 'components/icons'; import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; -import { Editor } from 'tiptap/core'; export const CleadrNodeAndMarks: React.FC<{ editor: Editor }> = ({ editor }) => { const clear = useCallback(() => { diff --git a/packages/client/src/tiptap/core/menus/code-block/bubble.tsx b/packages/client/src/tiptap/core/menus/code-block/bubble.tsx index cf5ad25..0e792b6 100644 --- a/packages/client/src/tiptap/core/menus/code-block/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/code-block/bubble.tsx @@ -1,12 +1,15 @@ +import React, { useCallback } from 'react'; + import { IconCopy, IconDelete } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { CodeBlock } from 'tiptap/core/extensions/code-block'; import { copyNode, deleteNode } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { Tooltip } from 'components/tooltip'; + export const CodeBlockBubbleMenu = ({ editor }) => { const shouldShow = useCallback(() => editor.isActive(CodeBlock.name), [editor]); const getRenderContainer = useCallback((node) => { diff --git a/packages/client/src/tiptap/core/menus/code-block/index.tsx b/packages/client/src/tiptap/core/menus/code-block/index.tsx index 1795b2d..3da75fd 100644 --- a/packages/client/src/tiptap/core/menus/code-block/index.tsx +++ b/packages/client/src/tiptap/core/menus/code-block/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { CodeBlockBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/code/index.tsx b/packages/client/src/tiptap/core/menus/code/index.tsx index 5a44bea..73d1927 100644 --- a/packages/client/src/tiptap/core/menus/code/index.tsx +++ b/packages/client/src/tiptap/core/menus/code/index.tsx @@ -1,12 +1,15 @@ +import React, { useCallback } from 'react'; + import { IconCode } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; import { Code as InlineCode } from 'tiptap/core/extensions/code'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { Tooltip } from 'components/tooltip'; + export const Code: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isCodeActive = useActive(editor, InlineCode.name); diff --git a/packages/client/src/tiptap/core/menus/columns/bubble.tsx b/packages/client/src/tiptap/core/menus/columns/bubble.tsx index c362980..8073db1 100644 --- a/packages/client/src/tiptap/core/menus/columns/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/columns/bubble.tsx @@ -1,13 +1,16 @@ +import { useCallback } from 'react'; + import { IconCopy, IconDelete } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { IconAddColAfter, IconAddColBefore, IconDeleteCol } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; -import { useCallback } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Columns } from 'tiptap/core/extensions/columns'; import { copyNode, deleteNode } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { IconAddColAfter, IconAddColBefore, IconDeleteCol } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const ColumnsBubbleMenu = ({ editor }) => { const getRenderContainer = useCallback((node) => { let container = node; diff --git a/packages/client/src/tiptap/core/menus/columns/index.tsx b/packages/client/src/tiptap/core/menus/columns/index.tsx index 0cbac47..3ad3476 100644 --- a/packages/client/src/tiptap/core/menus/columns/index.tsx +++ b/packages/client/src/tiptap/core/menus/columns/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { ColumnsBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/commands.tsx b/packages/client/src/tiptap/core/menus/commands.tsx index b37218c..e35b443 100644 --- a/packages/client/src/tiptap/core/menus/commands.tsx +++ b/packages/client/src/tiptap/core/menus/commands.tsx @@ -1,5 +1,9 @@ import { Dropdown, Popover } from '@douyinfe/semi-ui'; + import { IUser } from '@think/domains'; + +import { Editor } from 'tiptap/core'; + import { GridSelect } from 'components/grid-select'; import { IconAttachment, @@ -18,7 +22,6 @@ import { IconTableOfContents, } from 'components/icons'; import { createKeysLocalStorageLRUCache } from 'helpers/lru-cache'; -import { Editor } from 'tiptap/core'; import { createCountdown } from './countdown/service'; diff --git a/packages/client/src/tiptap/core/menus/countdown/bubble.tsx b/packages/client/src/tiptap/core/menus/countdown/bubble.tsx index d7dcfa4..4be3de4 100644 --- a/packages/client/src/tiptap/core/menus/countdown/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/countdown/bubble.tsx @@ -1,13 +1,16 @@ +import { useCallback } from 'react'; + import { IconCopy, IconDelete, IconEdit } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { Tooltip } from 'components/tooltip'; -import { useCallback } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Countdown } from 'tiptap/core/extensions/countdown'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; import { copyNode, deleteNode } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { Tooltip } from 'components/tooltip'; + import { triggerOpenCountSettingModal } from '../_event'; export const CountdownBubbleMenu = ({ editor }) => { diff --git a/packages/client/src/tiptap/core/menus/countdown/index.tsx b/packages/client/src/tiptap/core/menus/countdown/index.tsx index b07c7bf..f0700ce 100644 --- a/packages/client/src/tiptap/core/menus/countdown/index.tsx +++ b/packages/client/src/tiptap/core/menus/countdown/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { CountdownBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/countdown/modal.tsx b/packages/client/src/tiptap/core/menus/countdown/modal.tsx index d91b017..b63ab7c 100644 --- a/packages/client/src/tiptap/core/menus/countdown/modal.tsx +++ b/packages/client/src/tiptap/core/menus/countdown/modal.tsx @@ -1,9 +1,12 @@ +import { useCallback, useEffect, useRef, useState } from 'react'; + import { Form, Modal } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; -import { useToggle } from 'hooks/use-toggle'; -import { useCallback, useEffect, useRef, useState } from 'react'; + import { Editor } from 'tiptap/core'; +import { useToggle } from 'hooks/use-toggle'; + import { cancelSubject, OPEN_COUNT_SETTING_MODAL, subject } from '../_event'; type IProps = { editor: Editor }; diff --git a/packages/client/src/tiptap/core/menus/document-children/bubble.tsx b/packages/client/src/tiptap/core/menus/document-children/bubble.tsx index 2ce45ce..858fc4c 100644 --- a/packages/client/src/tiptap/core/menus/document-children/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/document-children/bubble.tsx @@ -1,12 +1,15 @@ +import React, { useCallback } from 'react'; + import { IconCopy, IconDelete } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { DocumentChildren } from 'tiptap/core/extensions/document-children'; import { copyNode, deleteNode } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { Tooltip } from 'components/tooltip'; + export const DocumentChildrenBubbleMenu = ({ editor }) => { const shouldShow = useCallback(() => editor.isActive(DocumentChildren.name), [editor]); const copyMe = useCallback(() => copyNode(DocumentChildren.name, editor), [editor]); diff --git a/packages/client/src/tiptap/core/menus/document-children/index.tsx b/packages/client/src/tiptap/core/menus/document-children/index.tsx index 44c763a..1be1a53 100644 --- a/packages/client/src/tiptap/core/menus/document-children/index.tsx +++ b/packages/client/src/tiptap/core/menus/document-children/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { DocumentChildrenBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/document-reference/bubble.tsx b/packages/client/src/tiptap/core/menus/document-reference/bubble.tsx index e89fe3d..90eb403 100644 --- a/packages/client/src/tiptap/core/menus/document-reference/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/document-reference/bubble.tsx @@ -1,5 +1,13 @@ +import { useCallback, useEffect } from 'react'; + import { IconCopy, IconDelete, IconEdit } from '@douyinfe/semi-icons'; import { Button, List, Popover, Space, Typography } from '@douyinfe/semi-ui'; + +import { BubbleMenu } from 'tiptap/core/bubble-menu'; +import { DocumentReference, IDocumentReferenceAttrs } from 'tiptap/core/extensions/document-reference'; +import { useAttributes } from 'tiptap/core/hooks/use-attributes'; +import { copyNode, deleteNode } from 'tiptap/prose-utils'; + import { DataRender } from 'components/data-render'; import { Divider } from 'components/divider'; import { IconDocument } from 'components/icons'; @@ -8,11 +16,6 @@ import { useUser } from 'data/user'; import { useWikiTocs } from 'data/wiki'; import { useToggle } from 'hooks/use-toggle'; import { useRouter } from 'next/router'; -import { useCallback, useEffect } from 'react'; -import { BubbleMenu } from 'tiptap/core/bubble-menu'; -import { DocumentReference, IDocumentReferenceAttrs } from 'tiptap/core/extensions/document-reference'; -import { useAttributes } from 'tiptap/core/hooks/use-attributes'; -import { copyNode, deleteNode } from 'tiptap/prose-utils'; const { Text } = Typography; diff --git a/packages/client/src/tiptap/core/menus/document-reference/index.tsx b/packages/client/src/tiptap/core/menus/document-reference/index.tsx index 76fc832..d493162 100644 --- a/packages/client/src/tiptap/core/menus/document-reference/index.tsx +++ b/packages/client/src/tiptap/core/menus/document-reference/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { DocumentReferenceBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/emoji/index.tsx b/packages/client/src/tiptap/core/menus/emoji/index.tsx index 1d253bf..90b314d 100644 --- a/packages/client/src/tiptap/core/menus/emoji/index.tsx +++ b/packages/client/src/tiptap/core/menus/emoji/index.tsx @@ -1,9 +1,12 @@ +import React, { useCallback } from 'react'; + import { Button } from '@douyinfe/semi-ui'; + +import { Editor } from 'tiptap/core'; + import { EmojiPicker } from 'components/emoji-picker'; import { IconEmoji } from 'components/icons'; import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; -import { Editor } from 'tiptap/core'; export const Emoji: React.FC<{ editor: Editor }> = ({ editor }) => { const setEmoji = useCallback( diff --git a/packages/client/src/tiptap/core/menus/excalidraw/bubble.tsx b/packages/client/src/tiptap/core/menus/excalidraw/bubble.tsx index 62459b1..74d3474 100644 --- a/packages/client/src/tiptap/core/menus/excalidraw/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/excalidraw/bubble.tsx @@ -1,15 +1,18 @@ +import { useCallback, useEffect } from 'react'; + import { IconCopy, IconDelete, IconEdit, IconLineHeight } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { SizeSetter } from 'components/size-setter'; -import { Tooltip } from 'components/tooltip'; -import { useUser } from 'data/user'; -import { useCallback, useEffect } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Excalidraw, IExcalidrawAttrs } from 'tiptap/core/extensions/excalidraw'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; import { copyNode, deleteNode, getEditorContainerDOMSize } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { SizeSetter } from 'components/size-setter'; +import { Tooltip } from 'components/tooltip'; +import { useUser } from 'data/user'; + import { triggerOpenExcalidrawSettingModal } from '../_event'; export const ExcalidrawBubbleMenu = ({ editor }) => { diff --git a/packages/client/src/tiptap/core/menus/excalidraw/index.tsx b/packages/client/src/tiptap/core/menus/excalidraw/index.tsx index 3c786fd..c0e9750 100644 --- a/packages/client/src/tiptap/core/menus/excalidraw/index.tsx +++ b/packages/client/src/tiptap/core/menus/excalidraw/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { ExcalidrawBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/excalidraw/modal.tsx b/packages/client/src/tiptap/core/menus/excalidraw/modal.tsx index 8f11c87..e5a7d64 100644 --- a/packages/client/src/tiptap/core/menus/excalidraw/modal.tsx +++ b/packages/client/src/tiptap/core/menus/excalidraw/modal.tsx @@ -1,8 +1,11 @@ -import { Modal, Spin, Typography } from '@douyinfe/semi-ui'; -import { useToggle } from 'hooks/use-toggle'; import { useCallback, useEffect, useState } from 'react'; + +import { Modal, Spin, Typography } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; +import { useToggle } from 'hooks/use-toggle'; + import { cancelSubject, OPEN_EXCALIDRAW_SETTING_MODAL, subject } from '../_event'; type IProps = { editor: Editor }; diff --git a/packages/client/src/tiptap/core/menus/flow/bubble.tsx b/packages/client/src/tiptap/core/menus/flow/bubble.tsx index 98001d8..c36c899 100644 --- a/packages/client/src/tiptap/core/menus/flow/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/flow/bubble.tsx @@ -1,15 +1,18 @@ +import { useCallback, useEffect } from 'react'; + import { IconCopy, IconDelete, IconEdit, IconLineHeight } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { SizeSetter } from 'components/size-setter'; -import { Tooltip } from 'components/tooltip'; -import { useUser } from 'data/user'; -import { useCallback, useEffect } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Flow, IFlowAttrs } from 'tiptap/core/extensions/flow'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; import { copyNode, deleteNode, getEditorContainerDOMSize } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { SizeSetter } from 'components/size-setter'; +import { Tooltip } from 'components/tooltip'; +import { useUser } from 'data/user'; + import { triggerOpenFlowSettingModal } from '../_event'; export const FlowBubbleMenu = ({ editor }) => { diff --git a/packages/client/src/tiptap/core/menus/flow/index.tsx b/packages/client/src/tiptap/core/menus/flow/index.tsx index bb99012..1c1b89c 100644 --- a/packages/client/src/tiptap/core/menus/flow/index.tsx +++ b/packages/client/src/tiptap/core/menus/flow/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { FlowBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/flow/modal.tsx b/packages/client/src/tiptap/core/menus/flow/modal.tsx index 89988ed..611519c 100644 --- a/packages/client/src/tiptap/core/menus/flow/modal.tsx +++ b/packages/client/src/tiptap/core/menus/flow/modal.tsx @@ -1,9 +1,12 @@ -import { Modal, Spin, Typography } from '@douyinfe/semi-ui'; -import { useToggle } from 'hooks/use-toggle'; import { useCallback, useEffect, useRef, useState } from 'react'; -import { createEditor, load } from 'thirtypart/diagram'; + +import { Modal, Spin, Typography } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; +import { useToggle } from 'hooks/use-toggle'; +import { createEditor, load } from 'thirtypart/diagram'; + import { cancelSubject, OPEN_FLOW_SETTING_MODAL, subject } from '../_event'; type IProps = { editor: Editor }; diff --git a/packages/client/src/tiptap/core/menus/fontfamily/index.tsx b/packages/client/src/tiptap/core/menus/fontfamily/index.tsx index 1d84302..438738d 100644 --- a/packages/client/src/tiptap/core/menus/fontfamily/index.tsx +++ b/packages/client/src/tiptap/core/menus/fontfamily/index.tsx @@ -1,5 +1,7 @@ -import { Select } from '@douyinfe/semi-ui'; import React, { useCallback } from 'react'; + +import { Select } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; diff --git a/packages/client/src/tiptap/core/menus/fontsize/index.tsx b/packages/client/src/tiptap/core/menus/fontsize/index.tsx index 7fbba35..eddf40e 100644 --- a/packages/client/src/tiptap/core/menus/fontsize/index.tsx +++ b/packages/client/src/tiptap/core/menus/fontsize/index.tsx @@ -1,5 +1,7 @@ -import { Select } from '@douyinfe/semi-ui'; import React, { useCallback } from 'react'; + +import { Select } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; diff --git a/packages/client/src/tiptap/core/menus/heading/index.tsx b/packages/client/src/tiptap/core/menus/heading/index.tsx index cfb31a6..cc4a24f 100644 --- a/packages/client/src/tiptap/core/menus/heading/index.tsx +++ b/packages/client/src/tiptap/core/menus/heading/index.tsx @@ -1,5 +1,7 @@ -import { Select } from '@douyinfe/semi-ui'; import React, { useCallback, useMemo } from 'react'; + +import { Select } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; diff --git a/packages/client/src/tiptap/core/menus/horizontal-rule/index.tsx b/packages/client/src/tiptap/core/menus/horizontal-rule/index.tsx index c467785..180ca18 100644 --- a/packages/client/src/tiptap/core/menus/horizontal-rule/index.tsx +++ b/packages/client/src/tiptap/core/menus/horizontal-rule/index.tsx @@ -1,11 +1,14 @@ -import { Button } from '@douyinfe/semi-ui'; -import { IconHorizontalRule } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { IconHorizontalRule } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const HorizontalRule: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); diff --git a/packages/client/src/tiptap/core/menus/ident/index.tsx b/packages/client/src/tiptap/core/menus/ident/index.tsx index 4fb0745..4690eab 100644 --- a/packages/client/src/tiptap/core/menus/ident/index.tsx +++ b/packages/client/src/tiptap/core/menus/ident/index.tsx @@ -1,11 +1,14 @@ +import React, { useCallback } from 'react'; + import { IconIndentLeft, IconIndentRight } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { Tooltip } from 'components/tooltip'; + export const Ident: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); diff --git a/packages/client/src/tiptap/core/menus/iframe/bubble.tsx b/packages/client/src/tiptap/core/menus/iframe/bubble.tsx index db60f8f..cae992a 100644 --- a/packages/client/src/tiptap/core/menus/iframe/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/iframe/bubble.tsx @@ -1,16 +1,19 @@ +import { useCallback, useEffect, useRef } from 'react'; + import { IconCopy, IconDelete, IconEdit, IconExternalOpen, IconLineHeight } from '@douyinfe/semi-icons'; import { Button, Form, Modal, Space, Typography } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; + +import { BubbleMenu } from 'tiptap/core/bubble-menu'; +import { Iframe, IIframeAttrs } from 'tiptap/core/extensions/iframe'; +import { useAttributes } from 'tiptap/core/hooks/use-attributes'; +import { copyNode, deleteNode } from 'tiptap/prose-utils'; + import { Divider } from 'components/divider'; import { SizeSetter } from 'components/size-setter'; import { Tooltip } from 'components/tooltip'; import { useUser } from 'data/user'; import { useToggle } from 'hooks/use-toggle'; -import { useCallback, useEffect, useRef } from 'react'; -import { BubbleMenu } from 'tiptap/core/bubble-menu'; -import { Iframe, IIframeAttrs } from 'tiptap/core/extensions/iframe'; -import { useAttributes } from 'tiptap/core/hooks/use-attributes'; -import { copyNode, deleteNode } from 'tiptap/prose-utils'; const { Text } = Typography; diff --git a/packages/client/src/tiptap/core/menus/iframe/index.tsx b/packages/client/src/tiptap/core/menus/iframe/index.tsx index 7ef4f61..b9b369d 100644 --- a/packages/client/src/tiptap/core/menus/iframe/index.tsx +++ b/packages/client/src/tiptap/core/menus/iframe/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { IframeBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/image/bubble.tsx b/packages/client/src/tiptap/core/menus/image/bubble.tsx index 710670a..01f5f31 100644 --- a/packages/client/src/tiptap/core/menus/image/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/image/bubble.tsx @@ -1,3 +1,5 @@ +import React, { useCallback, useEffect, useState } from 'react'; + import { IconAlignCenter, IconAlignLeft, @@ -7,15 +9,16 @@ import { IconLineHeight, } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { SizeSetter } from 'components/size-setter'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback, useEffect, useState } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Image } from 'tiptap/core/extensions/image'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; import { copyNode, deleteNode, getEditorContainerDOMSize } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { SizeSetter } from 'components/size-setter'; +import { Tooltip } from 'components/tooltip'; + export const ImageBubbleMenu = ({ editor }) => { const { width: maxWidth } = getEditorContainerDOMSize(editor); const { width: currentWidth, height: currentHeight } = useAttributes(editor, Image.name, { width: 0, height: 0 }); diff --git a/packages/client/src/tiptap/core/menus/image/index.tsx b/packages/client/src/tiptap/core/menus/image/index.tsx index 230d785..90aff5f 100644 --- a/packages/client/src/tiptap/core/menus/image/index.tsx +++ b/packages/client/src/tiptap/core/menus/image/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { ImageBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/insert/index.tsx b/packages/client/src/tiptap/core/menus/insert/index.tsx index 7460d07..ba106a0 100644 --- a/packages/client/src/tiptap/core/menus/insert/index.tsx +++ b/packages/client/src/tiptap/core/menus/insert/index.tsx @@ -1,13 +1,16 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; + import { IconPlus } from '@douyinfe/semi-icons'; import { Button, Dropdown } from '@douyinfe/semi-ui'; -import { Tooltip } from 'components/tooltip'; -import { useUser } from 'data/user'; -import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { Tooltip } from 'components/tooltip'; +import { useUser } from 'data/user'; +import { useToggle } from 'hooks/use-toggle'; + import { COMMANDS, insertMenuLRUCache, transformToCommands } from '../commands'; const _CommandRender = ({ commands, editor, runCommand }) => { diff --git a/packages/client/src/tiptap/core/menus/italic/index.tsx b/packages/client/src/tiptap/core/menus/italic/index.tsx index 58ffd49..d422759 100644 --- a/packages/client/src/tiptap/core/menus/italic/index.tsx +++ b/packages/client/src/tiptap/core/menus/italic/index.tsx @@ -1,12 +1,15 @@ +import React, { useCallback } from 'react'; + import { IconItalic } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; import { Italic as ItalicExtension } from 'tiptap/core/extensions/italic'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { Tooltip } from 'components/tooltip'; + export const Italic: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isItalicActive = useActive(editor, ItalicExtension.name); diff --git a/packages/client/src/tiptap/core/menus/katex/bubble.tsx b/packages/client/src/tiptap/core/menus/katex/bubble.tsx index 6d888b4..373bc57 100644 --- a/packages/client/src/tiptap/core/menus/katex/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/katex/bubble.tsx @@ -1,16 +1,19 @@ +import { useCallback, useEffect, useRef } from 'react'; + import { IconCopy, IconDelete, IconEdit, IconHelpCircle } from '@douyinfe/semi-icons'; import { Button, Popover, Space, TextArea, Typography } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { Tooltip } from 'components/tooltip'; -import { useUser } from 'data/user'; -import { useToggle } from 'hooks/use-toggle'; -import { useCallback, useEffect, useRef } from 'react'; + import { Editor } from 'tiptap/core'; import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { IKatexAttrs, Katex } from 'tiptap/core/extensions/katex'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; import { copyNode, deleteNode } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { Tooltip } from 'components/tooltip'; +import { useUser } from 'data/user'; +import { useToggle } from 'hooks/use-toggle'; + const { Text } = Typography; export const KatexBubbleMenu: React.FC<{ editor: Editor }> = ({ editor }) => { diff --git a/packages/client/src/tiptap/core/menus/katex/index.tsx b/packages/client/src/tiptap/core/menus/katex/index.tsx index ee5e9cc..97f4569 100644 --- a/packages/client/src/tiptap/core/menus/katex/index.tsx +++ b/packages/client/src/tiptap/core/menus/katex/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { KatexBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/lineheight/index.tsx b/packages/client/src/tiptap/core/menus/lineheight/index.tsx index 68f1fb5..b33947d 100644 --- a/packages/client/src/tiptap/core/menus/lineheight/index.tsx +++ b/packages/client/src/tiptap/core/menus/lineheight/index.tsx @@ -1,11 +1,14 @@ -import { Button, Dropdown, Tooltip } from '@douyinfe/semi-ui'; -import { IconLineHeight } from 'components/icons'; import React, { useCallback } from 'react'; + +import { Button, Dropdown, Tooltip } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; +import { IconLineHeight } from 'components/icons'; + export const LINE_HEIGHT = [null, 1, 1.15, 1.5, 2, 2.5, 3]; export const LineHeight: React.FC<{ editor: Editor }> = ({ editor }) => { diff --git a/packages/client/src/tiptap/core/menus/link/bubble.tsx b/packages/client/src/tiptap/core/menus/link/bubble.tsx index 8fd9312..5e58e23 100644 --- a/packages/client/src/tiptap/core/menus/link/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/link/bubble.tsx @@ -1,13 +1,16 @@ +import { useCallback, useEffect, useState } from 'react'; + import { IconEdit, IconExternalOpen, IconUnlink } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { Tooltip } from 'components/tooltip'; -import { useCallback, useEffect, useState } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Link } from 'tiptap/core/extensions/link'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; import { findMarkPosition, isMarkActive } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { Tooltip } from 'components/tooltip'; + import { triggerOpenLinkSettingModal } from '../_event'; export const LinkBubbleMenu = ({ editor }) => { diff --git a/packages/client/src/tiptap/core/menus/link/index.tsx b/packages/client/src/tiptap/core/menus/link/index.tsx index b463cb9..f35b250 100644 --- a/packages/client/src/tiptap/core/menus/link/index.tsx +++ b/packages/client/src/tiptap/core/menus/link/index.tsx @@ -1,12 +1,15 @@ -import { Button } from '@douyinfe/semi-ui'; -import { IconLink } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { Link as LinkExtension } from 'tiptap/core/extensions/link'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { IconLink } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + import { LinkBubbleMenu } from './bubble'; import { LinkSettingModal } from './modal'; import { createOrToggleLink } from './service'; diff --git a/packages/client/src/tiptap/core/menus/link/modal.tsx b/packages/client/src/tiptap/core/menus/link/modal.tsx index bb4ad78..d148ecf 100644 --- a/packages/client/src/tiptap/core/menus/link/modal.tsx +++ b/packages/client/src/tiptap/core/menus/link/modal.tsx @@ -1,10 +1,13 @@ +import { useCallback, useEffect, useRef, useState } from 'react'; + import { Form, Modal } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; -import { useToggle } from 'hooks/use-toggle'; -import { useCallback, useEffect, useRef, useState } from 'react'; + import { Editor } from 'tiptap/core'; import { isValidURL } from 'tiptap/prose-utils'; +import { useToggle } from 'hooks/use-toggle'; + import { cancelSubject, OPEN_LINK_SETTING_MODAL, subject } from '../_event'; type IProps = { editor: Editor }; diff --git a/packages/client/src/tiptap/core/menus/mind/bubble.tsx b/packages/client/src/tiptap/core/menus/mind/bubble.tsx index d8afd25..354357b 100644 --- a/packages/client/src/tiptap/core/menus/mind/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/mind/bubble.tsx @@ -1,15 +1,18 @@ +import { useCallback, useEffect } from 'react'; + import { IconCopy, IconDelete, IconEdit, IconLineHeight } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; -import { SizeSetter } from 'components/size-setter'; -import { Tooltip } from 'components/tooltip'; -import { useUser } from 'data/user'; -import { useCallback, useEffect } from 'react'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { IMindAttrs, Mind } from 'tiptap/core/extensions/mind'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; import { copyNode, deleteNode, getEditorContainerDOMSize } from 'tiptap/prose-utils'; +import { Divider } from 'components/divider'; +import { SizeSetter } from 'components/size-setter'; +import { Tooltip } from 'components/tooltip'; +import { useUser } from 'data/user'; + import { triggerOpenMindSettingModal } from '../_event'; export const MindBubbleMenu = ({ editor }) => { diff --git a/packages/client/src/tiptap/core/menus/mind/index.tsx b/packages/client/src/tiptap/core/menus/mind/index.tsx index 2e71ded..f4e25e3 100644 --- a/packages/client/src/tiptap/core/menus/mind/index.tsx +++ b/packages/client/src/tiptap/core/menus/mind/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { MindBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/mind/modal.tsx b/packages/client/src/tiptap/core/menus/mind/modal.tsx index 63cc322..8cbf0c3 100644 --- a/packages/client/src/tiptap/core/menus/mind/modal.tsx +++ b/packages/client/src/tiptap/core/menus/mind/modal.tsx @@ -1,13 +1,17 @@ -import { Modal, Spin, Typography } from '@douyinfe/semi-ui'; -import { useToggle } from 'hooks/use-toggle'; import { useCallback, useEffect, useState } from 'react'; -import { load, renderMind } from 'thirtypart/kityminder'; + +import { Modal, Spin, Typography } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; +import { useToggle } from 'hooks/use-toggle'; +import { load, renderMind } from 'thirtypart/kityminder'; + import { cancelSubject, OPEN_MIND_SETTING_MODAL, subject } from '../_event'; -import styles from './style.module.scss'; import { Toolbar } from './toolbar'; +import styles from './style.module.scss'; + type IProps = { editor: Editor }; const { Text } = Typography; diff --git a/packages/client/src/tiptap/core/menus/mind/toolbar/bgcolor.tsx b/packages/client/src/tiptap/core/menus/mind/toolbar/bgcolor.tsx index e6409fc..1f95f3c 100644 --- a/packages/client/src/tiptap/core/menus/mind/toolbar/bgcolor.tsx +++ b/packages/client/src/tiptap/core/menus/mind/toolbar/bgcolor.tsx @@ -1,5 +1,6 @@ import { IconMark } from '@douyinfe/semi-icons'; import { Button, Tooltip } from '@douyinfe/semi-ui'; + import { ColorPicker } from 'components/color-picker'; export const BgColor = ({ bgColor, selectedNode, setBackgroundColor }) => { diff --git a/packages/client/src/tiptap/core/menus/mind/toolbar/font-color.tsx b/packages/client/src/tiptap/core/menus/mind/toolbar/font-color.tsx index f3b3894..1ac94d7 100644 --- a/packages/client/src/tiptap/core/menus/mind/toolbar/font-color.tsx +++ b/packages/client/src/tiptap/core/menus/mind/toolbar/font-color.tsx @@ -1,5 +1,6 @@ import { IconFont } from '@douyinfe/semi-icons'; import { Button, Tooltip } from '@douyinfe/semi-ui'; + import { ColorPicker } from 'components/color-picker'; export const FontColor = ({ selectedNode, setFontColor, textColor }) => { diff --git a/packages/client/src/tiptap/core/menus/mind/toolbar/image.tsx b/packages/client/src/tiptap/core/menus/mind/toolbar/image.tsx index 4eeb84b..d7837d6 100644 --- a/packages/client/src/tiptap/core/menus/mind/toolbar/image.tsx +++ b/packages/client/src/tiptap/core/menus/mind/toolbar/image.tsx @@ -1,8 +1,10 @@ +import { useCallback, useEffect, useRef, useState } from 'react'; + import { IconImage } from '@douyinfe/semi-icons'; import { Button, Dropdown, Form, Tooltip } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; + import { Upload } from 'components/upload'; -import { useCallback, useEffect, useRef, useState } from 'react'; export const Image = ({ disabled, image, setImage }) => { const $form = useRef(); diff --git a/packages/client/src/tiptap/core/menus/mind/toolbar/index.tsx b/packages/client/src/tiptap/core/menus/mind/toolbar/index.tsx index 4d694b7..ae3edbb 100644 --- a/packages/client/src/tiptap/core/menus/mind/toolbar/index.tsx +++ b/packages/client/src/tiptap/core/menus/mind/toolbar/index.tsx @@ -1,10 +1,12 @@ +import { useCallback, useEffect, useState } from 'react'; + import { IconBold, IconRedo, IconUndo } from '@douyinfe/semi-icons'; import { Button, Space, Tooltip } from '@douyinfe/semi-ui'; + import { Divider } from 'components/divider'; import { IconMindCenter } from 'components/icons'; import { IconZoomIn, IconZoomOut } from 'components/icons'; import { useToggle } from 'hooks/use-toggle'; -import { useCallback, useEffect, useState } from 'react'; import { BgColor } from './bgcolor'; import { FontColor } from './font-color'; diff --git a/packages/client/src/tiptap/core/menus/mind/toolbar/link.tsx b/packages/client/src/tiptap/core/menus/mind/toolbar/link.tsx index c80572d..009f030 100644 --- a/packages/client/src/tiptap/core/menus/mind/toolbar/link.tsx +++ b/packages/client/src/tiptap/core/menus/mind/toolbar/link.tsx @@ -1,7 +1,8 @@ +import { useCallback, useEffect, useRef, useState } from 'react'; + import { IconLink } from '@douyinfe/semi-icons'; import { Button, Dropdown, Form, Tooltip } from '@douyinfe/semi-ui'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; -import { useCallback, useEffect, useRef, useState } from 'react'; export const Link = ({ disabled, link, setLink }) => { const $form = useRef(); diff --git a/packages/client/src/tiptap/core/menus/mind/toolbar/template.tsx b/packages/client/src/tiptap/core/menus/mind/toolbar/template.tsx index f4f0bfc..56ccede 100644 --- a/packages/client/src/tiptap/core/menus/mind/toolbar/template.tsx +++ b/packages/client/src/tiptap/core/menus/mind/toolbar/template.tsx @@ -1,8 +1,10 @@ import { Button, Popover, Typography } from '@douyinfe/semi-ui'; + import cls from 'classnames'; import { IconStructure } from 'components/icons'; import { TEMPLATES } from '../constant'; + import styles from './index.module.scss'; const { Text } = Typography; diff --git a/packages/client/src/tiptap/core/menus/mind/toolbar/theme.tsx b/packages/client/src/tiptap/core/menus/mind/toolbar/theme.tsx index 6c577e6..191d47d 100644 --- a/packages/client/src/tiptap/core/menus/mind/toolbar/theme.tsx +++ b/packages/client/src/tiptap/core/menus/mind/toolbar/theme.tsx @@ -1,8 +1,10 @@ import { Button, Popover, Typography } from '@douyinfe/semi-ui'; + import cls from 'classnames'; import { IconDrawBoard } from 'components/icons'; import { THEMES } from '../constant'; + import styles from './index.module.scss'; const { Text } = Typography; diff --git a/packages/client/src/tiptap/core/menus/ordered-list/index.tsx b/packages/client/src/tiptap/core/menus/ordered-list/index.tsx index b8b7ae4..9c661ab 100644 --- a/packages/client/src/tiptap/core/menus/ordered-list/index.tsx +++ b/packages/client/src/tiptap/core/menus/ordered-list/index.tsx @@ -1,12 +1,15 @@ -import { Button } from '@douyinfe/semi-ui'; -import { IconOrderedList } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { OrderedList as OrderedListExtension } from 'tiptap/core/extensions/ordered-list'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { IconOrderedList } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const OrderedList: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isOrderedListActive = useActive(editor, OrderedListExtension.name); diff --git a/packages/client/src/tiptap/core/menus/redo/index.tsx b/packages/client/src/tiptap/core/menus/redo/index.tsx index 35d73ff..96b1675 100644 --- a/packages/client/src/tiptap/core/menus/redo/index.tsx +++ b/packages/client/src/tiptap/core/menus/redo/index.tsx @@ -1,9 +1,12 @@ +import React, { useCallback } from 'react'; + import { IconRedo } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; +import { Tooltip } from 'components/tooltip'; + export const Redo: React.FC<{ editor: Editor }> = ({ editor }) => { const redo = useCallback(() => editor.chain().focus().redo().run(), [editor]); diff --git a/packages/client/src/tiptap/core/menus/search/index.tsx b/packages/client/src/tiptap/core/menus/search/index.tsx index e72c46f..34c92a2 100644 --- a/packages/client/src/tiptap/core/menus/search/index.tsx +++ b/packages/client/src/tiptap/core/menus/search/index.tsx @@ -1,12 +1,15 @@ +import React, { useCallback, useEffect, useState } from 'react'; + import { Button, Input, Popover, SideSheet, Space, Typography } from '@douyinfe/semi-ui'; + +import { Editor } from 'tiptap/core'; +import { ON_SEARCH_RESULTS, SearchNReplace } from 'tiptap/core/extensions/search'; + import { IconSearchReplace } from 'components/icons'; import { Tooltip } from 'components/tooltip'; import deepEqual from 'deep-equal'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useEffect, useState } from 'react'; -import { Editor } from 'tiptap/core'; -import { ON_SEARCH_RESULTS, SearchNReplace } from 'tiptap/core/extensions/search'; const { Text } = Typography; diff --git a/packages/client/src/tiptap/core/menus/strike/index.tsx b/packages/client/src/tiptap/core/menus/strike/index.tsx index 989d295..2a2f28a 100644 --- a/packages/client/src/tiptap/core/menus/strike/index.tsx +++ b/packages/client/src/tiptap/core/menus/strike/index.tsx @@ -1,12 +1,15 @@ +import React, { useCallback } from 'react'; + import { IconStrikeThrough } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; import { Strike as StrikeExtension } from 'tiptap/core/extensions/strike'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { Tooltip } from 'components/tooltip'; + export const Strike: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isStrikeActive = useActive(editor, StrikeExtension.name); diff --git a/packages/client/src/tiptap/core/menus/subscript/index.tsx b/packages/client/src/tiptap/core/menus/subscript/index.tsx index ae67da2..ff208e0 100644 --- a/packages/client/src/tiptap/core/menus/subscript/index.tsx +++ b/packages/client/src/tiptap/core/menus/subscript/index.tsx @@ -1,11 +1,14 @@ -import { Button } from '@douyinfe/semi-ui'; -import { IconSub } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button } from '@douyinfe/semi-ui'; + import { Subscript as SubscriptExtension } from 'tiptap/core/extensions/subscript'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { IconSub } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const Subscript: React.FC<{ editor: any }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isSubscriptActive = useActive(editor, SubscriptExtension.name); diff --git a/packages/client/src/tiptap/core/menus/superscript/index.tsx b/packages/client/src/tiptap/core/menus/superscript/index.tsx index 50ea09a..41d963d 100644 --- a/packages/client/src/tiptap/core/menus/superscript/index.tsx +++ b/packages/client/src/tiptap/core/menus/superscript/index.tsx @@ -1,11 +1,14 @@ -import { Button } from '@douyinfe/semi-ui'; -import { IconSup } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button } from '@douyinfe/semi-ui'; + import { Superscript as SuperscriptExtension } from 'tiptap/core/extensions/superscript'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { IconSup } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const Superscript: React.FC<{ editor: any }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isSuperscriptActive = useActive(editor, SuperscriptExtension.name); diff --git a/packages/client/src/tiptap/core/menus/table/bubble.tsx b/packages/client/src/tiptap/core/menus/table/bubble.tsx index 1f387dd..5fa41a2 100644 --- a/packages/client/src/tiptap/core/menus/table/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/table/bubble.tsx @@ -1,5 +1,12 @@ +import React, { useCallback } from 'react'; + import { IconCopy } from '@douyinfe/semi-icons'; import { Button, Space } from '@douyinfe/semi-ui'; + +import { BubbleMenu } from 'tiptap/core/bubble-menu'; +import { Table } from 'tiptap/core/extensions/table'; +import { copyNode, deleteNode } from 'tiptap/prose-utils'; + import { Divider } from 'components/divider'; import { IconAddColumnAfter, @@ -16,10 +23,6 @@ import { IconTableHeaderRow, } from 'components/icons'; import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; -import { BubbleMenu } from 'tiptap/core/bubble-menu'; -import { Table } from 'tiptap/core/extensions/table'; -import { copyNode, deleteNode } from 'tiptap/prose-utils'; export const TableBubbleMenu = ({ editor }) => { const shouldShow = useCallback(() => { diff --git a/packages/client/src/tiptap/core/menus/table/col-bubble.tsx b/packages/client/src/tiptap/core/menus/table/col-bubble.tsx index 6599bd0..e63f5a9 100644 --- a/packages/client/src/tiptap/core/menus/table/col-bubble.tsx +++ b/packages/client/src/tiptap/core/menus/table/col-bubble.tsx @@ -1,11 +1,14 @@ -import { Button, Space } from '@douyinfe/semi-ui'; -import { IconAddColumnAfter, IconAddColumnBefore, IconDeleteColumn } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button, Space } from '@douyinfe/semi-ui'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Table } from 'tiptap/core/extensions/table'; import { isTableSelected } from 'tiptap/prose-utils'; +import { IconAddColumnAfter, IconAddColumnBefore, IconDeleteColumn } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const TableColBubbleMenu = ({ editor }) => { const shouldShow = useCallback( ({ node, state }) => { diff --git a/packages/client/src/tiptap/core/menus/table/index.tsx b/packages/client/src/tiptap/core/menus/table/index.tsx index a3a55ca..3499098 100644 --- a/packages/client/src/tiptap/core/menus/table/index.tsx +++ b/packages/client/src/tiptap/core/menus/table/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Editor } from 'tiptap/core'; import { TableBubbleMenu } from './bubble'; diff --git a/packages/client/src/tiptap/core/menus/table/row-bubble.tsx b/packages/client/src/tiptap/core/menus/table/row-bubble.tsx index ba2de11..2099c62 100644 --- a/packages/client/src/tiptap/core/menus/table/row-bubble.tsx +++ b/packages/client/src/tiptap/core/menus/table/row-bubble.tsx @@ -1,11 +1,14 @@ -import { Button, Space } from '@douyinfe/semi-ui'; -import { IconAddRowAfter, IconAddRowBefore, IconDeleteRow } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button, Space } from '@douyinfe/semi-ui'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Table } from 'tiptap/core/extensions/table'; import { isTableSelected } from 'tiptap/prose-utils'; +import { IconAddRowAfter, IconAddRowBefore, IconDeleteRow } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const TableRowBubbleMenu = ({ editor }) => { const shouldShow = useCallback( ({ node, state }) => { diff --git a/packages/client/src/tiptap/core/menus/task-list/index.tsx b/packages/client/src/tiptap/core/menus/task-list/index.tsx index 5b72cca..8aabcfb 100644 --- a/packages/client/src/tiptap/core/menus/task-list/index.tsx +++ b/packages/client/src/tiptap/core/menus/task-list/index.tsx @@ -1,12 +1,15 @@ -import { Button } from '@douyinfe/semi-ui'; -import { IconTask } from 'components/icons'; -import { Tooltip } from 'components/tooltip'; import React, { useCallback } from 'react'; + +import { Button } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { TaskList as TaskListExtension } from 'tiptap/core/extensions/task-list'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { IconTask } from 'components/icons'; +import { Tooltip } from 'components/tooltip'; + export const TaskList: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isTaskListActive = useActive(editor, TaskListExtension.name); diff --git a/packages/client/src/tiptap/core/menus/text-color/index.tsx b/packages/client/src/tiptap/core/menus/text-color/index.tsx index e9b3362..116d79c 100644 --- a/packages/client/src/tiptap/core/menus/text-color/index.tsx +++ b/packages/client/src/tiptap/core/menus/text-color/index.tsx @@ -1,14 +1,17 @@ +import React, { useCallback } from 'react'; + import { IconFont } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { ColorPicker } from 'components/color-picker'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; import { TextStyle } from 'tiptap/core/extensions/text-style'; import { Title } from 'tiptap/core/extensions/title'; import { useActive } from 'tiptap/core/hooks/use-active'; import { useAttributes } from 'tiptap/core/hooks/use-attributes'; +import { ColorPicker } from 'components/color-picker'; +import { Tooltip } from 'components/tooltip'; + type Color = { color: string }; const FlexStyle = { diff --git a/packages/client/src/tiptap/core/menus/text/index.tsx b/packages/client/src/tiptap/core/menus/text/index.tsx index bc4fd16..367adb6 100644 --- a/packages/client/src/tiptap/core/menus/text/index.tsx +++ b/packages/client/src/tiptap/core/menus/text/index.tsx @@ -1,5 +1,7 @@ -import { Space } from '@douyinfe/semi-ui'; import React, { useCallback } from 'react'; + +import { Space } from '@douyinfe/semi-ui'; + import { BubbleMenu } from 'tiptap/core/bubble-menu'; import { Attachment } from 'tiptap/core/extensions/attachment'; import { Callout } from 'tiptap/core/extensions/callout'; diff --git a/packages/client/src/tiptap/core/menus/underline/index.tsx b/packages/client/src/tiptap/core/menus/underline/index.tsx index 5887ebb..2d4edf8 100644 --- a/packages/client/src/tiptap/core/menus/underline/index.tsx +++ b/packages/client/src/tiptap/core/menus/underline/index.tsx @@ -1,12 +1,15 @@ +import React, { useCallback } from 'react'; + import { IconUnderline } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; import { Title } from 'tiptap/core/extensions/title'; import { Underline as UnderlineExtension } from 'tiptap/core/extensions/underline'; import { useActive } from 'tiptap/core/hooks/use-active'; +import { Tooltip } from 'components/tooltip'; + export const Underline: React.FC<{ editor: Editor }> = ({ editor }) => { const isTitleActive = useActive(editor, Title.name); const isUnderlineActive = useActive(editor, UnderlineExtension.name); diff --git a/packages/client/src/tiptap/core/menus/undo/index.tsx b/packages/client/src/tiptap/core/menus/undo/index.tsx index b6e8fe7..74d959e 100644 --- a/packages/client/src/tiptap/core/menus/undo/index.tsx +++ b/packages/client/src/tiptap/core/menus/undo/index.tsx @@ -1,9 +1,12 @@ +import React, { useCallback } from 'react'; + import { IconUndo } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; -import { Tooltip } from 'components/tooltip'; -import React, { useCallback } from 'react'; + import { Editor } from 'tiptap/core'; +import { Tooltip } from 'components/tooltip'; + export const Undo: React.FC<{ editor: Editor }> = ({ editor }) => { const undo = useCallback(() => editor.chain().focus().undo().run(), [editor]); diff --git a/packages/client/src/tiptap/core/wrappers/attachment/file-icon.tsx b/packages/client/src/tiptap/core/wrappers/attachment/file-icon.tsx index 10878e5..4086cd2 100644 --- a/packages/client/src/tiptap/core/wrappers/attachment/file-icon.tsx +++ b/packages/client/src/tiptap/core/wrappers/attachment/file-icon.tsx @@ -1,7 +1,9 @@ import { IconFile, IconImage, IconSong, IconVideo } from '@douyinfe/semi-icons'; -import { IconFilePDF, IconFilePPT, IconFileSheet, IconFileWord } from 'components/icons'; + import { normalizeFileType } from 'tiptap/prose-utils'; +import { IconFilePDF, IconFilePPT, IconFileSheet, IconFileWord } from 'components/icons'; + export const getFileTypeIcon = (fileType: string) => { const type = normalizeFileType(fileType); diff --git a/packages/client/src/tiptap/core/wrappers/attachment/index.tsx b/packages/client/src/tiptap/core/wrappers/attachment/index.tsx index 49fad80..c89b01a 100644 --- a/packages/client/src/tiptap/core/wrappers/attachment/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/attachment/index.tsx @@ -1,18 +1,23 @@ +import { useCallback, useEffect, useRef, useState } from 'react'; + import { IconClose, IconDownload, IconPlayCircle } from '@douyinfe/semi-icons'; import { Button, Collapsible, Progress, Space, Spin, Toast, Typography } from '@douyinfe/semi-ui'; + import { FILE_CHUNK_SIZE } from '@think/domains'; + import { NodeViewWrapper } from '@tiptap/react'; +import { download, extractFileExtension, extractFilename, normalizeFileSize } from 'tiptap/prose-utils'; + import cls from 'classnames'; import { Tooltip } from 'components/tooltip'; import { useToggle } from 'hooks/use-toggle'; -import { useCallback, useEffect, useRef, useState } from 'react'; import { uploadFile } from 'services/file'; -import { download, extractFileExtension, extractFilename, normalizeFileSize } from 'tiptap/prose-utils'; import { getFileTypeIcon } from './file-icon'; -import styles from './index.module.scss'; import { Player } from './player'; +import styles from './index.module.scss'; + const { Text } = Typography; export const AttachmentWrapper = ({ editor, node, updateAttributes }) => { diff --git a/packages/client/src/tiptap/core/wrappers/attachment/player/index.tsx b/packages/client/src/tiptap/core/wrappers/attachment/player/index.tsx index 90d8727..ab0b71b 100644 --- a/packages/client/src/tiptap/core/wrappers/attachment/player/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/attachment/player/index.tsx @@ -1,6 +1,7 @@ -import { Typography } from '@douyinfe/semi-ui'; -import { ImageViewer } from 'components/image-viewer'; import React, { useMemo, useRef } from 'react'; + +import { Typography } from '@douyinfe/semi-ui'; + import { extractFileExtension, extractFilename, @@ -9,9 +10,12 @@ import { normalizeFileType, } from 'tiptap/prose-utils'; -import styles from './index.module.scss'; +import { ImageViewer } from 'components/image-viewer'; + import { PDFPlayer } from './pdf-player'; +import styles from './index.module.scss'; + interface IProps { url: string; fileType: string; diff --git a/packages/client/src/tiptap/core/wrappers/callout/index.tsx b/packages/client/src/tiptap/core/wrappers/callout/index.tsx index 684fc36..19d71d6 100644 --- a/packages/client/src/tiptap/core/wrappers/callout/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/callout/index.tsx @@ -1,9 +1,11 @@ +import { useCallback, useMemo } from 'react'; + import { NodeViewContent, NodeViewWrapper } from '@tiptap/react'; + import cls from 'classnames'; import { EmojiPicker } from 'components/emoji-picker'; import { convertColorToRGBA } from 'helpers/color'; import { Theme, ThemeEnum } from 'hooks/use-theme'; -import { useCallback, useMemo } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/code-block/index.tsx b/packages/client/src/tiptap/core/wrappers/code-block/index.tsx index 79afa59..e7ffb16 100644 --- a/packages/client/src/tiptap/core/wrappers/code-block/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/code-block/index.tsx @@ -1,9 +1,12 @@ +import React, { useRef } from 'react'; + import { IconCopy } from '@douyinfe/semi-icons'; import { Button, Select, Tooltip } from '@douyinfe/semi-ui'; + import { NodeViewContent, NodeViewWrapper } from '@tiptap/react'; + import cls from 'classnames'; import { copy } from 'helpers/copy'; -import React, { useRef } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/countdown/index.tsx b/packages/client/src/tiptap/core/wrappers/countdown/index.tsx index 2d8eeb4..87cbbd5 100644 --- a/packages/client/src/tiptap/core/wrappers/countdown/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/countdown/index.tsx @@ -1,8 +1,11 @@ -import { Space, Typography } from '@douyinfe/semi-ui'; -import { NodeViewWrapper } from '@tiptap/react'; -import cls from 'classnames'; import ReactCountdown from 'react-countdown'; +import { Space, Typography } from '@douyinfe/semi-ui'; + +import { NodeViewWrapper } from '@tiptap/react'; + +import cls from 'classnames'; + import styles from './index.module.scss'; const { Text, Title } = Typography; diff --git a/packages/client/src/tiptap/core/wrappers/document-children/index.tsx b/packages/client/src/tiptap/core/wrappers/document-children/index.tsx index a2bf1a7..17b0f52 100644 --- a/packages/client/src/tiptap/core/wrappers/document-children/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/document-children/index.tsx @@ -1,5 +1,9 @@ +import { useEffect } from 'react'; + import { Typography } from '@douyinfe/semi-ui'; + import { NodeViewWrapper } from '@tiptap/react'; + import cls from 'classnames'; import { DataRender } from 'components/data-render'; import { Empty } from 'components/empty'; @@ -7,7 +11,6 @@ import { IconDocument } from 'components/icons'; import { useChildrenDocument } from 'data/document'; import Link from 'next/link'; import { useRouter } from 'next/router'; -import { useEffect } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/document-reference/index.tsx b/packages/client/src/tiptap/core/wrappers/document-reference/index.tsx index 5127181..e3c1c3a 100644 --- a/packages/client/src/tiptap/core/wrappers/document-reference/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/document-reference/index.tsx @@ -1,9 +1,11 @@ +import { useMemo } from 'react'; + import { NodeViewWrapper } from '@tiptap/react'; + import cls from 'classnames'; import { IconDocument } from 'components/icons'; import Link from 'next/link'; import { useRouter } from 'next/router'; -import { useMemo } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/emoji-list/index.tsx b/packages/client/src/tiptap/core/wrappers/emoji-list/index.tsx index 20192a7..634f70a 100644 --- a/packages/client/src/tiptap/core/wrappers/emoji-list/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/emoji-list/index.tsx @@ -1,5 +1,6 @@ -import cls from 'classnames'; import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'; + +import cls from 'classnames'; import scrollIntoView from 'scroll-into-view-if-needed'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/excalidraw/index.tsx b/packages/client/src/tiptap/core/wrappers/excalidraw/index.tsx index 96e8088..83bffeb 100644 --- a/packages/client/src/tiptap/core/wrappers/excalidraw/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/excalidraw/index.tsx @@ -1,15 +1,18 @@ +import React from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; +import VisibilitySensor from 'react-visibility-sensor'; + import { Space, Spin, Typography } from '@douyinfe/semi-ui'; + import { NodeViewWrapper } from '@tiptap/react'; +import { Excalidraw } from 'tiptap/core/extensions/excalidraw'; +import { getEditorContainerDOMSize } from 'tiptap/prose-utils'; + import cls from 'classnames'; import { IconMind } from 'components/icons'; import { Resizeable } from 'components/resizeable'; import deepEqual from 'deep-equal'; import { useToggle } from 'hooks/use-toggle'; -import React from 'react'; -import { useCallback, useEffect, useRef, useState } from 'react'; -import VisibilitySensor from 'react-visibility-sensor'; -import { Excalidraw } from 'tiptap/core/extensions/excalidraw'; -import { getEditorContainerDOMSize } from 'tiptap/prose-utils'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/flow/index.tsx b/packages/client/src/tiptap/core/wrappers/flow/index.tsx index b24f763..58739e4 100644 --- a/packages/client/src/tiptap/core/wrappers/flow/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/flow/index.tsx @@ -1,16 +1,19 @@ +import React from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; +import VisibilitySensor from 'react-visibility-sensor'; + import { Button, Space, Spin, Typography } from '@douyinfe/semi-ui'; + import { NodeViewWrapper } from '@tiptap/react'; +import { Flow } from 'tiptap/core/extensions/flow'; +import { getEditorContainerDOMSize } from 'tiptap/prose-utils'; + import cls from 'classnames'; import { IconFlow, IconMindCenter, IconZoomIn, IconZoomOut } from 'components/icons'; import { Resizeable } from 'components/resizeable'; import deepEqual from 'deep-equal'; import { useToggle } from 'hooks/use-toggle'; -import React from 'react'; -import { useCallback, useEffect, useRef, useState } from 'react'; -import VisibilitySensor from 'react-visibility-sensor'; import { load, renderXml } from 'thirtypart/diagram'; -import { Flow } from 'tiptap/core/extensions/flow'; -import { getEditorContainerDOMSize } from 'tiptap/prose-utils'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/iframe/index.tsx b/packages/client/src/tiptap/core/wrappers/iframe/index.tsx index 7a03f71..2b7f2e3 100644 --- a/packages/client/src/tiptap/core/wrappers/iframe/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/iframe/index.tsx @@ -1,9 +1,12 @@ +import { useCallback } from 'react'; + import { Typography } from '@douyinfe/semi-ui'; + import { NodeViewWrapper } from '@tiptap/react'; +import { getEditorContainerDOMSize } from 'tiptap/prose-utils'; + import cls from 'classnames'; import { Resizeable } from 'components/resizeable'; -import { useCallback } from 'react'; -import { getEditorContainerDOMSize } from 'tiptap/prose-utils'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/image/index.tsx b/packages/client/src/tiptap/core/wrappers/image/index.tsx index 0ebde69..b7cfb05 100644 --- a/packages/client/src/tiptap/core/wrappers/image/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/image/index.tsx @@ -1,10 +1,9 @@ -import { Spin, Typography } from '@douyinfe/semi-ui'; -import { NodeViewWrapper } from '@tiptap/react'; -import { Resizeable } from 'components/resizeable'; -import { useToggle } from 'hooks/use-toggle'; import { useCallback, useEffect, useRef } from 'react'; import { LazyLoadImage } from 'react-lazy-load-image-component'; -import { uploadFile } from 'services/file'; + +import { Spin, Typography } from '@douyinfe/semi-ui'; + +import { NodeViewWrapper } from '@tiptap/react'; import { extractFileExtension, extractFilename, @@ -12,6 +11,10 @@ import { getImageWidthHeight, } from 'tiptap/prose-utils'; +import { Resizeable } from 'components/resizeable'; +import { useToggle } from 'hooks/use-toggle'; +import { uploadFile } from 'services/file'; + import styles from './index.module.scss'; const { Text } = Typography; diff --git a/packages/client/src/tiptap/core/wrappers/katex/index.tsx b/packages/client/src/tiptap/core/wrappers/katex/index.tsx index 6efa2e0..9dd782e 100644 --- a/packages/client/src/tiptap/core/wrappers/katex/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/katex/index.tsx @@ -1,8 +1,10 @@ +import { useMemo } from 'react'; + import { NodeViewWrapper } from '@tiptap/react'; + import { convertColorToRGBA } from 'helpers/color'; import { Theme, ThemeEnum } from 'hooks/use-theme'; import katex from 'katex'; -import { useMemo } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/loading.tsx b/packages/client/src/tiptap/core/wrappers/loading.tsx index dc4fb0f..22428d7 100644 --- a/packages/client/src/tiptap/core/wrappers/loading.tsx +++ b/packages/client/src/tiptap/core/wrappers/loading.tsx @@ -1,4 +1,5 @@ import { Spin } from '@douyinfe/semi-ui'; + import { NodeViewWrapper } from '@tiptap/react'; export const LoadingWrapper = ({ editor, node }) => { diff --git a/packages/client/src/tiptap/core/wrappers/mention-list/index.tsx b/packages/client/src/tiptap/core/wrappers/mention-list/index.tsx index ac9a840..4e156b7 100644 --- a/packages/client/src/tiptap/core/wrappers/mention-list/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/mention-list/index.tsx @@ -1,6 +1,8 @@ -import { Editor } from '@tiptap/core'; -import cls from 'classnames'; import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'; + +import { Editor } from '@tiptap/core'; + +import cls from 'classnames'; import scrollIntoView from 'scroll-into-view-if-needed'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/menu-list/index.tsx b/packages/client/src/tiptap/core/wrappers/menu-list/index.tsx index ca47237..9b2f3b7 100644 --- a/packages/client/src/tiptap/core/wrappers/menu-list/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/menu-list/index.tsx @@ -1,10 +1,13 @@ +import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'; + import { Space } from '@douyinfe/semi-ui'; + import { Editor } from '@tiptap/core'; +import { ILabelRenderCommand } from 'tiptap/core/menus/commands'; + import cls from 'classnames'; import { useUser } from 'data/user'; -import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'; import scrollIntoView from 'scroll-into-view-if-needed'; -import { ILabelRenderCommand } from 'tiptap/core/menus/commands'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/mind/index.tsx b/packages/client/src/tiptap/core/wrappers/mind/index.tsx index e606303..641ff5e 100644 --- a/packages/client/src/tiptap/core/wrappers/mind/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/mind/index.tsx @@ -1,16 +1,19 @@ +import React, { useCallback, useEffect, useRef, useState } from 'react'; +import VisibilitySensor from 'react-visibility-sensor'; + import { Button, Space, Spin, Typography } from '@douyinfe/semi-ui'; + import { NodeViewWrapper } from '@tiptap/react'; +import { MAX_ZOOM, MIN_ZOOM, ZOOM_STEP } from 'tiptap/core/menus/mind/constant'; +import { clamp, getEditorContainerDOMSize } from 'tiptap/prose-utils'; + import cls from 'classnames'; import { IconMind, IconMindCenter, IconZoomIn, IconZoomOut } from 'components/icons'; import { Resizeable } from 'components/resizeable'; import { Tooltip } from 'components/tooltip'; import deepEqual from 'deep-equal'; import { useToggle } from 'hooks/use-toggle'; -import React, { useCallback, useEffect, useRef, useState } from 'react'; -import VisibilitySensor from 'react-visibility-sensor'; import { load, renderMind } from 'thirtypart/kityminder'; -import { MAX_ZOOM, MIN_ZOOM, ZOOM_STEP } from 'tiptap/core/menus/mind/constant'; -import { clamp, getEditorContainerDOMSize } from 'tiptap/prose-utils'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/status/index.tsx b/packages/client/src/tiptap/core/wrappers/status/index.tsx index bcb6d63..f0978a5 100644 --- a/packages/client/src/tiptap/core/wrappers/status/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/status/index.tsx @@ -1,10 +1,13 @@ +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; + import { IconTick } from '@douyinfe/semi-icons'; import { Input, Popover, Space, Tag } from '@douyinfe/semi-ui'; + import { NodeViewWrapper } from '@tiptap/react'; + import cls from 'classnames'; import { useUser } from 'data/user'; import { useToggle } from 'hooks/use-toggle'; -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/table-of-contents/index.tsx b/packages/client/src/tiptap/core/wrappers/table-of-contents/index.tsx index e1c6b0e..be2f63d 100644 --- a/packages/client/src/tiptap/core/wrappers/table-of-contents/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/table-of-contents/index.tsx @@ -1,7 +1,9 @@ -import { NodeViewWrapper } from '@tiptap/react'; -import cls from 'classnames'; import { useCallback, useEffect, useState } from 'react'; +import { NodeViewWrapper } from '@tiptap/react'; + +import cls from 'classnames'; + import styles from './index.module.scss'; const arrToTree = (tocs) => { diff --git a/packages/client/src/tiptap/core/wrappers/task-item/index.tsx b/packages/client/src/tiptap/core/wrappers/task-item/index.tsx index ae2dc69..512147b 100644 --- a/packages/client/src/tiptap/core/wrappers/task-item/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/task-item/index.tsx @@ -1,4 +1,5 @@ import { Checkbox } from '@douyinfe/semi-ui'; + import { NodeViewContent, NodeViewWrapper } from '@tiptap/react'; import styles from './index.module.scss'; diff --git a/packages/client/src/tiptap/core/wrappers/title/index.tsx b/packages/client/src/tiptap/core/wrappers/title/index.tsx index c750b86..d19eb3e 100644 --- a/packages/client/src/tiptap/core/wrappers/title/index.tsx +++ b/packages/client/src/tiptap/core/wrappers/title/index.tsx @@ -1,11 +1,15 @@ -import { Button } from '@douyinfe/semi-ui'; -import { DOCUMENT_COVERS } from '@think/constants'; -import { NodeViewContent, NodeViewWrapper } from '@tiptap/react'; -import cls from 'classnames'; -import { ImageUploader } from 'components/image-uploader'; import { useCallback, useEffect, useRef } from 'react'; import { createPortal } from 'react-dom'; +import { Button } from '@douyinfe/semi-ui'; + +import { DOCUMENT_COVERS } from '@think/constants'; + +import { NodeViewContent, NodeViewWrapper } from '@tiptap/react'; + +import cls from 'classnames'; +import { ImageUploader } from 'components/image-uploader'; + import styles from './index.module.scss'; const images = [ diff --git a/packages/client/src/tiptap/editor/collaboration/collaboration/editor.tsx b/packages/client/src/tiptap/editor/collaboration/collaboration/editor.tsx index 1188ec3..2b4a30f 100644 --- a/packages/client/src/tiptap/editor/collaboration/collaboration/editor.tsx +++ b/packages/client/src/tiptap/editor/collaboration/collaboration/editor.tsx @@ -1,4 +1,12 @@ +import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'; + import { BackTop, Toast } from '@douyinfe/semi-ui'; + +import { EditorContent, useEditor } from 'tiptap/core'; +import { Collaboration } from 'tiptap/core/extensions/collaboration'; +import { CollaborationCursor } from 'tiptap/core/extensions/collaboration-cursor'; +import { Tocs } from 'tiptap/editor/tocs'; + import { HocuspocusProvider } from '@hocuspocus/provider'; import cls from 'classnames'; import { Banner } from 'components/banner'; @@ -11,17 +19,13 @@ import { useDocumentStyle } from 'hooks/use-document-style'; import { useNetwork } from 'hooks/use-network'; import { IsOnMobile } from 'hooks/use-on-mobile'; import { useToggle } from 'hooks/use-toggle'; -import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'; -import { EditorContent, useEditor } from 'tiptap/core'; -import { Collaboration } from 'tiptap/core/extensions/collaboration'; -import { CollaborationCursor } from 'tiptap/core/extensions/collaboration-cursor'; -import { Tocs } from 'tiptap/editor/tocs'; import { CollaborationKit } from '../kit'; -import styles from './index.module.scss'; import { MenuBar } from './menubar'; import { ICollaborationEditorProps, ProviderStatus } from './type'; +import styles from './index.module.scss'; + type IProps = Pick< ICollaborationEditorProps, 'editable' | 'user' | 'onTitleUpdate' | 'menubar' | 'renderInEditorPortal' | 'hideComment' diff --git a/packages/client/src/tiptap/editor/collaboration/collaboration/index.tsx b/packages/client/src/tiptap/editor/collaboration/collaboration/index.tsx index 09d60d2..5f0b404 100644 --- a/packages/client/src/tiptap/editor/collaboration/collaboration/index.tsx +++ b/packages/client/src/tiptap/editor/collaboration/collaboration/index.tsx @@ -1,17 +1,21 @@ +import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'; + import { Spin, Typography } from '@douyinfe/semi-ui'; + +import { Editor } from 'tiptap/core'; +import { IndexeddbPersistence } from 'tiptap/core/thritypart/y-indexeddb'; + import { HocuspocusProvider } from '@hocuspocus/provider'; import { DataRender } from 'components/data-render'; import deepEqual from 'deep-equal'; import { useToggle } from 'hooks/use-toggle'; import { SecureDocumentIllustration } from 'illustrations/secure-document'; -import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'; -import { Editor } from 'tiptap/core'; -import { IndexeddbPersistence } from 'tiptap/core/thritypart/y-indexeddb'; import { EditorInstance } from './editor'; -import styles from './index.module.scss'; import { ICollaborationEditorProps, ProviderStatus } from './type'; +import styles from './index.module.scss'; + const { Text } = Typography; export type ICollaborationRefProps = { diff --git a/packages/client/src/tiptap/editor/collaboration/collaboration/menubar.tsx b/packages/client/src/tiptap/editor/collaboration/collaboration/menubar.tsx index 08c41f4..7844e56 100644 --- a/packages/client/src/tiptap/editor/collaboration/collaboration/menubar.tsx +++ b/packages/client/src/tiptap/editor/collaboration/collaboration/menubar.tsx @@ -1,6 +1,7 @@ -import { Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; import React, { useMemo } from 'react'; + +import { Space } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { Align } from 'tiptap/core/menus/align'; import { Attachment } from 'tiptap/core/menus/attachment'; @@ -45,6 +46,8 @@ import { TextColor } from 'tiptap/core/menus/text-color'; import { Underline } from 'tiptap/core/menus/underline'; import { Undo } from 'tiptap/core/menus/undo'; +import { Divider } from 'components/divider'; + const _MenuBar: React.FC<{ editor: Editor }> = ({ editor }) => { const isEditable = useMemo(() => editor && editor.isEditable, [editor]); diff --git a/packages/client/src/tiptap/editor/collaboration/collaboration/type.ts b/packages/client/src/tiptap/editor/collaboration/collaboration/type.ts index 148bda7..3bbebc9 100644 --- a/packages/client/src/tiptap/editor/collaboration/collaboration/type.ts +++ b/packages/client/src/tiptap/editor/collaboration/collaboration/type.ts @@ -1,6 +1,7 @@ -import { ILoginUser, IUser } from '@think/domains'; import React from 'react'; +import { ILoginUser, IUser } from '@think/domains'; + export interface ICollaborationEditorProps { /** * 文档 id diff --git a/packages/client/src/tiptap/editor/collaboration/kit.ts b/packages/client/src/tiptap/editor/collaboration/kit.ts index f91cc3c..10628a0 100644 --- a/packages/client/src/tiptap/editor/collaboration/kit.ts +++ b/packages/client/src/tiptap/editor/collaboration/kit.ts @@ -1,5 +1,5 @@ import { Toast } from '@douyinfe/semi-ui'; -import { safeJSONParse } from 'helpers/json'; + // 自定义节点扩展 import { Attachment } from 'tiptap/core/extensions/attachment'; import { BackgroundColor } from 'tiptap/core/extensions/background-color'; @@ -73,6 +73,8 @@ import { htmlToProsemirror } from 'tiptap/markdown/html-to-prosemirror'; import { markdownToHTML, markdownToProsemirror } from 'tiptap/markdown/markdown-to-prosemirror'; import { prosemirrorToMarkdown } from 'tiptap/markdown/prosemirror-to-markdown'; +import { safeJSONParse } from 'helpers/json'; + const DocumentWithTitle = Document.extend({ content: 'title{1} block+', }); diff --git a/packages/client/src/tiptap/editor/comment/menubar.tsx b/packages/client/src/tiptap/editor/comment/menubar.tsx index ff4e0ca..d9315d0 100644 --- a/packages/client/src/tiptap/editor/comment/menubar.tsx +++ b/packages/client/src/tiptap/editor/comment/menubar.tsx @@ -1,6 +1,7 @@ -import { Space } from '@douyinfe/semi-ui'; -import { Divider } from 'components/divider'; import React from 'react'; + +import { Space } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { BackgroundColor } from 'tiptap/core/menus/background-color'; import { Bold } from 'tiptap/core/menus/bold'; @@ -16,6 +17,8 @@ import { TextColor } from 'tiptap/core/menus/text-color'; import { Underline } from 'tiptap/core/menus/underline'; import { Undo } from 'tiptap/core/menus/undo'; +import { Divider } from 'components/divider'; + const _CommentMenuBar: React.FC<{ editor: Editor }> = ({ editor }) => { return ( <> diff --git a/packages/client/src/tiptap/editor/reader/index.tsx b/packages/client/src/tiptap/editor/reader/index.tsx index b3a359d..a5e5b4f 100644 --- a/packages/client/src/tiptap/editor/reader/index.tsx +++ b/packages/client/src/tiptap/editor/reader/index.tsx @@ -1,12 +1,16 @@ +import React, { useCallback, useMemo, useRef } from 'react'; + import { BackTop } from '@douyinfe/semi-ui'; + +import { EditorContent, useEditor } from 'tiptap/core'; + import { ImageViewer } from 'components/image-viewer'; import { isMobile } from 'helpers/env'; import { safeJSONParse } from 'helpers/json'; -import React, { useCallback, useMemo, useRef } from 'react'; -import { EditorContent, useEditor } from 'tiptap/core'; import { CollaborationKit } from '../collaboration/kit'; import { Tocs } from '../tocs'; + import styles from './index.module.scss'; interface IProps { diff --git a/packages/client/src/tiptap/editor/tocs/index.tsx b/packages/client/src/tiptap/editor/tocs/index.tsx index d4ac079..43ff7c1 100644 --- a/packages/client/src/tiptap/editor/tocs/index.tsx +++ b/packages/client/src/tiptap/editor/tocs/index.tsx @@ -1,16 +1,20 @@ -import { Anchor, Tooltip } from '@douyinfe/semi-ui'; -import cls from 'classnames'; -import { throttle } from 'helpers/throttle'; -import { useToggle } from 'hooks/use-toggle'; import React, { useCallback, useEffect, useRef, useState } from 'react'; -import scrollIntoView from 'scroll-into-view-if-needed'; + +import { Anchor, Tooltip } from '@douyinfe/semi-ui'; + import { Editor } from 'tiptap/core'; import { TableOfContents } from 'tiptap/core/extensions/table-of-contents'; import { findNode } from 'tiptap/prose-utils'; -import styles from './index.module.scss'; +import cls from 'classnames'; +import { throttle } from 'helpers/throttle'; +import { useToggle } from 'hooks/use-toggle'; +import scrollIntoView from 'scroll-into-view-if-needed'; + import { parseHeadingsToTocs } from './util'; +import styles from './index.module.scss'; + interface IHeading { level: number; id: string; diff --git a/packages/client/src/tiptap/markdown/markdown-to-prosemirror/markdown-to-html/markdownItContainer.ts b/packages/client/src/tiptap/markdown/markdown-to-prosemirror/markdown-to-html/markdownItContainer.ts index ea5f1f5..974c1bc 100644 --- a/packages/client/src/tiptap/markdown/markdown-to-prosemirror/markdown-to-html/markdownItContainer.ts +++ b/packages/client/src/tiptap/markdown/markdown-to-prosemirror/markdown-to-html/markdownItContainer.ts @@ -1,6 +1,7 @@ -import container from 'markdown-it-container'; import { jsonToDOMDataset, strToJSON } from 'tiptap/prose-utils'; +import container from 'markdown-it-container'; + export const createMarkdownContainer = (types: string | Array) => (md) => { if (!Array.isArray(types)) { types = [types]; diff --git a/packages/client/src/tiptap/markdown/prosemirror-to-markdown/index.ts b/packages/client/src/tiptap/markdown/prosemirror-to-markdown/index.ts index b275cec..fc24bee 100644 --- a/packages/client/src/tiptap/markdown/prosemirror-to-markdown/index.ts +++ b/packages/client/src/tiptap/markdown/prosemirror-to-markdown/index.ts @@ -1,4 +1,3 @@ -import { defaultMarkdownSerializer, MarkdownSerializer as ProseMirrorMarkdownSerializer } from 'prosemirror-markdown'; import { Attachment } from 'tiptap/core/extensions/attachment'; import { Blockquote } from 'tiptap/core/extensions/blockquote'; import { Bold } from 'tiptap/core/extensions/bold'; @@ -40,6 +39,8 @@ import { Text } from 'tiptap/core/extensions/text'; import { TextStyle } from 'tiptap/core/extensions/text-style'; import { Title } from 'tiptap/core/extensions/title'; +import { defaultMarkdownSerializer, MarkdownSerializer as ProseMirrorMarkdownSerializer } from 'prosemirror-markdown'; + import { closeTag, isPlainURL, diff --git a/packages/client/src/tiptap/prose-utils/columns.ts b/packages/client/src/tiptap/prose-utils/columns.ts index 0fea7ba..f146af6 100644 --- a/packages/client/src/tiptap/prose-utils/columns.ts +++ b/packages/client/src/tiptap/prose-utils/columns.ts @@ -1,8 +1,9 @@ +import { Column } from 'tiptap/core/extensions/column'; +import { Columns } from 'tiptap/core/extensions/columns'; + import { Node as PMNode } from 'prosemirror-model'; import { EditorState, TextSelection } from 'prosemirror-state'; import { findParentNode } from 'prosemirror-utils'; -import { Column } from 'tiptap/core/extensions/column'; -import { Columns } from 'tiptap/core/extensions/columns'; export function createColumn(colType, index, colContent = null) { if (colContent) { diff --git a/packages/client/src/tiptap/prose-utils/copy-node.ts b/packages/client/src/tiptap/prose-utils/copy-node.ts index 1e5e645..083bd2c 100644 --- a/packages/client/src/tiptap/prose-utils/copy-node.ts +++ b/packages/client/src/tiptap/prose-utils/copy-node.ts @@ -1,4 +1,5 @@ import { Editor } from '@tiptap/core'; + import { copy } from 'helpers/copy'; import { safeJSONStringify } from 'helpers/json'; import { Fragment, Node } from 'prosemirror-model'; diff --git a/packages/client/src/tiptap/prose-utils/lowlight-plugin.ts b/packages/client/src/tiptap/prose-utils/lowlight-plugin.ts index dcca182..fb55552 100644 --- a/packages/client/src/tiptap/prose-utils/lowlight-plugin.ts +++ b/packages/client/src/tiptap/prose-utils/lowlight-plugin.ts @@ -1,4 +1,5 @@ import { findChildren } from '@tiptap/core'; + import { Node as ProsemirrorNode } from 'prosemirror-model'; import { Plugin, PluginKey } from 'prosemirror-state'; import { Decoration, DecorationSet } from 'prosemirror-view'; diff --git a/packages/client/src/tiptap/prose-utils/node.ts b/packages/client/src/tiptap/prose-utils/node.ts index 6dc8e97..8ae2521 100644 --- a/packages/client/src/tiptap/prose-utils/node.ts +++ b/packages/client/src/tiptap/prose-utils/node.ts @@ -1,4 +1,5 @@ import { Editor } from '@tiptap/core'; + import { Node, ResolvedPos } from 'prosemirror-model'; import { EditorState } from 'prosemirror-state'; diff --git a/packages/client/src/tiptap/prose-utils/table.ts b/packages/client/src/tiptap/prose-utils/table.ts index 4ea04e7..55e25c3 100644 --- a/packages/client/src/tiptap/prose-utils/table.ts +++ b/packages/client/src/tiptap/prose-utils/table.ts @@ -1,4 +1,5 @@ import { findParentNode } from '@tiptap/core'; + import { Node, ResolvedPos } from 'prosemirror-model'; import { Selection, Transaction } from 'prosemirror-state'; import { CellSelection, TableMap } from 'prosemirror-tables'; diff --git a/packages/client/src/tiptap/prose-utils/upload.ts b/packages/client/src/tiptap/prose-utils/upload.ts index 2808a45..d0249ea 100644 --- a/packages/client/src/tiptap/prose-utils/upload.ts +++ b/packages/client/src/tiptap/prose-utils/upload.ts @@ -1,9 +1,10 @@ import { Editor } from '@tiptap/core'; -import { uploadFile } from 'services/file'; import { Attachment } from 'tiptap/core/extensions/attachment'; import { Image } from 'tiptap/core/extensions/image'; import { findLoadingById, Loading } from 'tiptap/core/extensions/loading'; +import { uploadFile } from 'services/file'; + import { extractFileExtension, extractFilename } from './file'; export const acceptedMimes = { diff --git a/packages/server/.eslintrc.js b/packages/server/.eslintrc.js index 179df16..56b0408 100644 --- a/packages/server/.eslintrc.js +++ b/packages/server/.eslintrc.js @@ -29,7 +29,12 @@ module.exports = { '@typescript-eslint/interface-name-prefix': 'off', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/no-explicit-any': 'off', - 'simple-import-sort/imports': 'error', + 'simple-import-sort/imports': [ + 'error', + { + groups: [['(@)?nestjs(.*)$'], ['(@)?think(.*)$'], ['^@?\\w'], ['@/(.*)'], ['^[./]']], + }, + ], 'simple-import-sort/exports': 'error', }, }; diff --git a/packages/server/src/app-cluster.service.ts b/packages/server/src/app-cluster.service.ts index 380c849..4f1c2e1 100644 --- a/packages/server/src/app-cluster.service.ts +++ b/packages/server/src/app-cluster.service.ts @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ import { Injectable } from '@nestjs/common'; + import * as cluster from 'cluster'; import * as os from 'os'; diff --git a/packages/server/src/app.module.ts b/packages/server/src/app.module.ts index 05d214e..05f96ec 100644 --- a/packages/server/src/app.module.ts +++ b/packages/server/src/app.module.ts @@ -1,3 +1,11 @@ +import { forwardRef, Inject, Module } from '@nestjs/common'; +import { ConfigModule, ConfigService } from '@nestjs/config'; +import { Cron, ScheduleModule } from '@nestjs/schedule'; +import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm'; +import { LoggerModule } from 'nestjs-pino'; + +import { getConfig } from '@think/config'; + import { AuthEntity } from '@entities/auth.entity'; import { CommentEntity } from '@entities/comment.entity'; import { DocumentEntity } from '@entities/document.entity'; @@ -23,13 +31,7 @@ import { UserModule } from '@modules/user.module'; import { VerifyModule } from '@modules/verify.module'; import { ViewModule } from '@modules/view.module'; import { WikiModule } from '@modules/wiki.module'; -import { forwardRef, Inject, Module } from '@nestjs/common'; -import { ConfigModule, ConfigService } from '@nestjs/config'; -import { Cron, ScheduleModule } from '@nestjs/schedule'; -import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm'; -import { getConfig } from '@think/config'; import * as fs from 'fs-extra'; -import { LoggerModule } from 'nestjs-pino'; import * as path from 'path'; import pino from 'pino'; diff --git a/packages/server/src/controllers/auth.controller.ts b/packages/server/src/controllers/auth.controller.ts index 18b7495..15f111a 100644 --- a/packages/server/src/controllers/auth.controller.ts +++ b/packages/server/src/controllers/auth.controller.ts @@ -1,4 +1,5 @@ import { Controller } from '@nestjs/common'; + import { AuthService } from '@services/auth.service'; @Controller('auth') diff --git a/packages/server/src/controllers/comment.controller.ts b/packages/server/src/controllers/comment.controller.ts index 5150c25..32de018 100644 --- a/packages/server/src/controllers/comment.controller.ts +++ b/packages/server/src/controllers/comment.controller.ts @@ -1,6 +1,3 @@ -import { CommentDto, UpdateCommentDto } from '@dtos/comment.dto'; -import { JwtGuard } from '@guard/jwt.guard'; -import { UserGuard } from '@guard/user.guard'; import { Body, ClassSerializerInterceptor, @@ -17,9 +14,14 @@ import { UseGuards, UseInterceptors, } from '@nestjs/common'; -import { CommentService } from '@services/comment.service'; + import { CommentApiDefinition } from '@think/domains'; +import { CommentDto, UpdateCommentDto } from '@dtos/comment.dto'; +import { JwtGuard } from '@guard/jwt.guard'; +import { UserGuard } from '@guard/user.guard'; +import { CommentService } from '@services/comment.service'; + @Controller('comment') export class CommentController { constructor(private readonly commentService: CommentService) {} diff --git a/packages/server/src/controllers/document.controller.ts b/packages/server/src/controllers/document.controller.ts index b72494a..aa4d945 100644 --- a/packages/server/src/controllers/document.controller.ts +++ b/packages/server/src/controllers/document.controller.ts @@ -1,9 +1,3 @@ -import { OperateUserAuthDto } from '@dtos/auth.dto'; -import { CreateDocumentDto } from '@dtos/create-document.dto'; -import { ShareDocumentDto } from '@dtos/share-document.dto'; -import { UpdateDocumentDto } from '@dtos/update-document.dto'; -import { CheckDocumentStatus, DocumentStatusGuard } from '@guard/document-status.guard'; -import { JwtGuard } from '@guard/jwt.guard'; import { Body, ClassSerializerInterceptor, @@ -20,9 +14,17 @@ import { UseGuards, UseInterceptors, } from '@nestjs/common'; -import { DocumentService } from '@services/document.service'; + import { DocumentApiDefinition, DocumentStatus, IPagination } from '@think/domains'; +import { OperateUserAuthDto } from '@dtos/auth.dto'; +import { CreateDocumentDto } from '@dtos/create-document.dto'; +import { ShareDocumentDto } from '@dtos/share-document.dto'; +import { UpdateDocumentDto } from '@dtos/update-document.dto'; +import { CheckDocumentStatus, DocumentStatusGuard } from '@guard/document-status.guard'; +import { JwtGuard } from '@guard/jwt.guard'; +import { DocumentService } from '@services/document.service'; + @Controller('document') @UseGuards(DocumentStatusGuard) export class DocumentController { diff --git a/packages/server/src/controllers/file.controller.ts b/packages/server/src/controllers/file.controller.ts index 9b3332f..c9067ac 100644 --- a/packages/server/src/controllers/file.controller.ts +++ b/packages/server/src/controllers/file.controller.ts @@ -1,10 +1,12 @@ -import { JwtGuard } from '@guard/jwt.guard'; -import { FileQuery } from '@helpers/file.helper/oss.client'; import { Controller, Post, Query, UploadedFile, UseGuards, UseInterceptors } from '@nestjs/common'; import { FileInterceptor } from '@nestjs/platform-express'; -import { FileService } from '@services/file.service'; + import { FILE_CHUNK_SIZE, FileApiDefinition } from '@think/domains'; +import { JwtGuard } from '@guard/jwt.guard'; +import { FileQuery } from '@helpers/file.helper/oss.client'; +import { FileService } from '@services/file.service'; + @Controller('file') export class FileController { constructor(private readonly fileService: FileService) {} diff --git a/packages/server/src/controllers/message.controller.ts b/packages/server/src/controllers/message.controller.ts index be5b4ff..7b907b8 100644 --- a/packages/server/src/controllers/message.controller.ts +++ b/packages/server/src/controllers/message.controller.ts @@ -1,4 +1,3 @@ -import { JwtGuard } from '@guard/jwt.guard'; import { ClassSerializerInterceptor, Controller, @@ -12,9 +11,12 @@ import { UseGuards, UseInterceptors, } from '@nestjs/common'; -import { MessageService } from '@services/message.service'; + import { MessageApiDefinition } from '@think/domains'; +import { JwtGuard } from '@guard/jwt.guard'; +import { MessageService } from '@services/message.service'; + @Controller('message') export class MessageController { constructor(private readonly messageService: MessageService) {} diff --git a/packages/server/src/controllers/organization.controller.ts b/packages/server/src/controllers/organization.controller.ts index 3df4617..9750668 100644 --- a/packages/server/src/controllers/organization.controller.ts +++ b/packages/server/src/controllers/organization.controller.ts @@ -1,6 +1,3 @@ -import { OperateUserAuthDto } from '@dtos/auth.dto'; -import { CreateOrganizationDto } from '@dtos/organization.dto'; -import { JwtGuard } from '@guard/jwt.guard'; import { Body, ClassSerializerInterceptor, @@ -17,9 +14,14 @@ import { UseGuards, UseInterceptors, } from '@nestjs/common'; -import { OrganizationService } from '@services/organization.service'; + import { IPagination, OrganizationApiDefinition } from '@think/domains'; +import { OperateUserAuthDto } from '@dtos/auth.dto'; +import { CreateOrganizationDto } from '@dtos/organization.dto'; +import { JwtGuard } from '@guard/jwt.guard'; +import { OrganizationService } from '@services/organization.service'; + @Controller('organization') export class OrganizationController { constructor(private readonly organizationService: OrganizationService) {} diff --git a/packages/server/src/controllers/star.controller.ts b/packages/server/src/controllers/star.controller.ts index c19ee19..f4082f6 100644 --- a/packages/server/src/controllers/star.controller.ts +++ b/packages/server/src/controllers/star.controller.ts @@ -1,5 +1,3 @@ -import { StarDto } from '@dtos/star.dto'; -import { JwtGuard } from '@guard/jwt.guard'; import { Body, ClassSerializerInterceptor, @@ -14,9 +12,13 @@ import { UseGuards, UseInterceptors, } from '@nestjs/common'; -import { StarService } from '@services/star.service'; + import { StarApiDefinition } from '@think/domains'; +import { StarDto } from '@dtos/star.dto'; +import { JwtGuard } from '@guard/jwt.guard'; +import { StarService } from '@services/star.service'; + @Controller('star') export class StarController { constructor(private readonly starService: StarService) {} diff --git a/packages/server/src/controllers/system.controller.ts b/packages/server/src/controllers/system.controller.ts index 6f0f2d5..909b6f1 100644 --- a/packages/server/src/controllers/system.controller.ts +++ b/packages/server/src/controllers/system.controller.ts @@ -1,7 +1,9 @@ import { ClassSerializerInterceptor, Controller, Get, HttpCode, HttpStatus, UseInterceptors } from '@nestjs/common'; -import { SystemService } from '@services/system.service'; + import { SystemApiDefinition } from '@think/domains'; +import { SystemService } from '@services/system.service'; + @Controller('system') export class SystemController { constructor(private readonly systemService: SystemService) {} diff --git a/packages/server/src/controllers/template.controller.ts b/packages/server/src/controllers/template.controller.ts index 748bac4..a5925ba 100644 --- a/packages/server/src/controllers/template.controller.ts +++ b/packages/server/src/controllers/template.controller.ts @@ -1,5 +1,3 @@ -import { TemplateDto } from '@dtos/template.dto'; -import { JwtGuard } from '@guard/jwt.guard'; import { Body, ClassSerializerInterceptor, @@ -16,9 +14,13 @@ import { UseGuards, UseInterceptors, } from '@nestjs/common'; -import { TemplateService } from '@services/template.service'; + import { TemplateApiDefinition } from '@think/domains'; +import { TemplateDto } from '@dtos/template.dto'; +import { JwtGuard } from '@guard/jwt.guard'; +import { TemplateService } from '@services/template.service'; + @Controller('template') export class TemplateController { constructor(private readonly templateService: TemplateService) {} diff --git a/packages/server/src/controllers/user.controller.ts b/packages/server/src/controllers/user.controller.ts index c697e2b..a219526 100644 --- a/packages/server/src/controllers/user.controller.ts +++ b/packages/server/src/controllers/user.controller.ts @@ -1,7 +1,3 @@ -import { RegisterUserDto, ResetPasswordDto } from '@dtos/create-user.dto'; -import { LoginUserDto } from '@dtos/login-user.dto'; -import { UpdateUserDto } from '@dtos/update-user.dto'; -import { JwtGuard } from '@guard/jwt.guard'; import { Body, ClassSerializerInterceptor, @@ -17,8 +13,14 @@ import { UseGuards, UseInterceptors, } from '@nestjs/common'; -import { UserService } from '@services/user.service'; + import { UserApiDefinition } from '@think/domains'; + +import { RegisterUserDto, ResetPasswordDto } from '@dtos/create-user.dto'; +import { LoginUserDto } from '@dtos/login-user.dto'; +import { UpdateUserDto } from '@dtos/update-user.dto'; +import { JwtGuard } from '@guard/jwt.guard'; +import { UserService } from '@services/user.service'; import { Response as ExpressResponse } from 'express'; @Controller('user') diff --git a/packages/server/src/controllers/verify.controller.ts b/packages/server/src/controllers/verify.controller.ts index 7d76b72..9c9b489 100644 --- a/packages/server/src/controllers/verify.controller.ts +++ b/packages/server/src/controllers/verify.controller.ts @@ -7,9 +7,11 @@ import { Query, UseInterceptors, } from '@nestjs/common'; -import { VerifyService } from '@services/verify.service'; + import { UserApiDefinition } from '@think/domains'; +import { VerifyService } from '@services/verify.service'; + @Controller('verify') export class VerifyController { constructor(private readonly verifyService: VerifyService) {} diff --git a/packages/server/src/controllers/view.controller.ts b/packages/server/src/controllers/view.controller.ts index 443ea37..6e40103 100644 --- a/packages/server/src/controllers/view.controller.ts +++ b/packages/server/src/controllers/view.controller.ts @@ -1,4 +1,5 @@ import { Controller } from '@nestjs/common'; + import { ViewService } from '@services/view.service'; @Controller('view') diff --git a/packages/server/src/controllers/wiki.controller.ts b/packages/server/src/controllers/wiki.controller.ts index a40abcd..1fd5fec 100644 --- a/packages/server/src/controllers/wiki.controller.ts +++ b/packages/server/src/controllers/wiki.controller.ts @@ -1,9 +1,3 @@ -import { OperateUserAuthDto } from '@dtos/auth.dto'; -import { CreateWikiDto } from '@dtos/create-wiki.dto'; -import { ShareWikiDto } from '@dtos/share-wiki.dto'; -import { UpdateWikiDto } from '@dtos/update-wiki.dto'; -import { JwtGuard } from '@guard/jwt.guard'; -import { CheckWikiStatus, WikiStatusGuard } from '@guard/wiki-status.guard'; import { Body, ClassSerializerInterceptor, @@ -20,9 +14,17 @@ import { UseGuards, UseInterceptors, } from '@nestjs/common'; -import { WikiService } from '@services/wiki.service'; + import { IPagination, WikiApiDefinition, WikiStatus } from '@think/domains'; +import { OperateUserAuthDto } from '@dtos/auth.dto'; +import { CreateWikiDto } from '@dtos/create-wiki.dto'; +import { ShareWikiDto } from '@dtos/share-wiki.dto'; +import { UpdateWikiDto } from '@dtos/update-wiki.dto'; +import { JwtGuard } from '@guard/jwt.guard'; +import { CheckWikiStatus, WikiStatusGuard } from '@guard/wiki-status.guard'; +import { WikiService } from '@services/wiki.service'; + @Controller('wiki') export class WikiController { constructor(private readonly wikiService: WikiService) {} diff --git a/packages/server/src/dtos/auth.dto.ts b/packages/server/src/dtos/auth.dto.ts index c85c7d7..8fa9b14 100644 --- a/packages/server/src/dtos/auth.dto.ts +++ b/packages/server/src/dtos/auth.dto.ts @@ -1,4 +1,5 @@ import { AuthEnum } from '@think/domains'; + import { IsNotEmpty, IsOptional, IsString } from 'class-validator'; export class AuthDto { diff --git a/packages/server/src/dtos/share-wiki.dto.ts b/packages/server/src/dtos/share-wiki.dto.ts index 8439fbe..01df566 100644 --- a/packages/server/src/dtos/share-wiki.dto.ts +++ b/packages/server/src/dtos/share-wiki.dto.ts @@ -1,4 +1,5 @@ import { WikiStatus } from '@think/domains'; + import { IsOptional } from 'class-validator'; export class ShareWikiDto { diff --git a/packages/server/src/entities/auth.entity.ts b/packages/server/src/entities/auth.entity.ts index 304fb9a..84d2437 100644 --- a/packages/server/src/entities/auth.entity.ts +++ b/packages/server/src/entities/auth.entity.ts @@ -1,4 +1,5 @@ import { AuthEnum } from '@think/domains'; + import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'; @Entity('auth') diff --git a/packages/server/src/entities/document.entity.ts b/packages/server/src/entities/document.entity.ts index a4c1718..1ce1285 100644 --- a/packages/server/src/entities/document.entity.ts +++ b/packages/server/src/entities/document.entity.ts @@ -1,5 +1,6 @@ -import { getShortId } from '@helpers/shortid.herlper'; import { DocumentStatus } from '@think/domains'; + +import { getShortId } from '@helpers/shortid.herlper'; import { Exclude } from 'class-transformer'; import { BeforeInsert, Column, CreateDateColumn, Entity, PrimaryColumn, UpdateDateColumn } from 'typeorm'; diff --git a/packages/server/src/entities/user.entity.ts b/packages/server/src/entities/user.entity.ts index 904eb43..e1365ca 100644 --- a/packages/server/src/entities/user.entity.ts +++ b/packages/server/src/entities/user.entity.ts @@ -1,4 +1,5 @@ import { UserStatus } from '@think/domains'; + import * as bcrypt from 'bcryptjs'; import { Exclude } from 'class-transformer'; import { BeforeInsert, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'; diff --git a/packages/server/src/entities/wiki.entity.ts b/packages/server/src/entities/wiki.entity.ts index 8679c37..2faf881 100644 --- a/packages/server/src/entities/wiki.entity.ts +++ b/packages/server/src/entities/wiki.entity.ts @@ -1,6 +1,7 @@ -import { getShortId } from '@helpers/shortid.herlper'; import { DEFAULT_WIKI_AVATAR } from '@think/constants'; import { WikiStatus } from '@think/domains'; + +import { getShortId } from '@helpers/shortid.herlper'; import { BeforeInsert, Column, CreateDateColumn, Entity, PrimaryColumn, UpdateDateColumn } from 'typeorm'; @Entity('wiki') diff --git a/packages/server/src/guard/document-status.guard.ts b/packages/server/src/guard/document-status.guard.ts index 619944a..d90cabf 100644 --- a/packages/server/src/guard/document-status.guard.ts +++ b/packages/server/src/guard/document-status.guard.ts @@ -1,8 +1,10 @@ import { CanActivate, ExecutionContext, HttpException, HttpStatus, Injectable, SetMetadata } from '@nestjs/common'; import { Reflector } from '@nestjs/core'; -import { DocumentService } from '@services/document.service'; + import { DocumentStatus } from '@think/domains'; +import { DocumentService } from '@services/document.service'; + const KEY = 'DocumentStatus'; export const CheckDocumentStatus = (status: DocumentStatus) => SetMetadata(KEY, status); diff --git a/packages/server/src/guard/user.guard.ts b/packages/server/src/guard/user.guard.ts index 974a08b..6363ad8 100644 --- a/packages/server/src/guard/user.guard.ts +++ b/packages/server/src/guard/user.guard.ts @@ -1,5 +1,6 @@ import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; + import { IUser } from '@think/domains'; @Injectable() diff --git a/packages/server/src/guard/wiki-status.guard.ts b/packages/server/src/guard/wiki-status.guard.ts index c25d886..6544c51 100644 --- a/packages/server/src/guard/wiki-status.guard.ts +++ b/packages/server/src/guard/wiki-status.guard.ts @@ -1,8 +1,10 @@ import { CanActivate, ExecutionContext, HttpException, HttpStatus, Injectable, SetMetadata } from '@nestjs/common'; import { Reflector } from '@nestjs/core'; -import { WikiService } from '@services/wiki.service'; + import { WikiStatus } from '@think/domains'; +import { WikiService } from '@services/wiki.service'; + const KEY = 'WikiStatus'; export const CheckWikiStatus = (status: WikiStatus) => SetMetadata(KEY, status); diff --git a/packages/server/src/helpers/file.helper/aliyun.client.ts b/packages/server/src/helpers/file.helper/aliyun.client.ts index aad1e49..5c4c426 100644 --- a/packages/server/src/helpers/file.helper/aliyun.client.ts +++ b/packages/server/src/helpers/file.helper/aliyun.client.ts @@ -1,4 +1,5 @@ import { FILE_CHUNK_SIZE } from '@think/domains'; + import * as AliyunOSS from 'ali-oss'; import * as fs from 'fs-extra'; import * as os from 'os'; diff --git a/packages/server/src/helpers/file.helper/local.client.ts b/packages/server/src/helpers/file.helper/local.client.ts index d7a864f..ee0085f 100644 --- a/packages/server/src/helpers/file.helper/local.client.ts +++ b/packages/server/src/helpers/file.helper/local.client.ts @@ -1,4 +1,5 @@ import { FILE_CHUNK_SIZE } from '@think/domains'; + import * as fs from 'fs-extra'; import * as path from 'path'; diff --git a/packages/server/src/helpers/redis.helper.ts b/packages/server/src/helpers/redis.helper.ts index c057723..6e661fb 100644 --- a/packages/server/src/helpers/redis.helper.ts +++ b/packages/server/src/helpers/redis.helper.ts @@ -1,5 +1,6 @@ -import { RedisDBEnum } from '@constants/*'; import { getConfig } from '@think/config'; + +import { RedisDBEnum } from '@constants/*'; import Redis from 'ioredis'; import * as lodash from 'lodash'; diff --git a/packages/server/src/main.ts b/packages/server/src/main.ts index 7496622..a0bba98 100644 --- a/packages/server/src/main.ts +++ b/packages/server/src/main.ts @@ -1,7 +1,8 @@ -import { HttpResponseExceptionFilter } from '@exceptions/http-response.exception'; -import { FILE_DEST, FILE_ROOT_PATH } from '@helpers/file.helper/local.client'; import { ConfigService } from '@nestjs/config'; import { NestFactory } from '@nestjs/core'; + +import { HttpResponseExceptionFilter } from '@exceptions/http-response.exception'; +import { FILE_DEST, FILE_ROOT_PATH } from '@helpers/file.helper/local.client'; import { ValidationPipe } from '@pipes/validation.pipe'; import { HttpResponseTransformInterceptor } from '@transforms/http-response.transform'; import * as bodyParser from 'body-parser'; diff --git a/packages/server/src/modules/auth.module.ts b/packages/server/src/modules/auth.module.ts index e31b753..b113f8a 100644 --- a/packages/server/src/modules/auth.module.ts +++ b/packages/server/src/modules/auth.module.ts @@ -1,7 +1,8 @@ -import { AuthController } from '@controllers/auth.controller'; -import { AuthEntity } from '@entities/auth.entity'; import { forwardRef, Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; + +import { AuthController } from '@controllers/auth.controller'; +import { AuthEntity } from '@entities/auth.entity'; import { AuthService } from '@services/auth.service'; import { UserModule } from './user.module'; diff --git a/packages/server/src/modules/comment.module.ts b/packages/server/src/modules/comment.module.ts index 74a6803..19ac958 100644 --- a/packages/server/src/modules/comment.module.ts +++ b/packages/server/src/modules/comment.module.ts @@ -1,3 +1,6 @@ +import { forwardRef, Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; + import { CommentController } from '@controllers/comment.controller'; import { CommentEntity } from '@entities/comment.entity'; import { AuthModule } from '@modules/auth.module'; @@ -5,8 +8,6 @@ import { DocumentModule } from '@modules/document.module'; import { MessageModule } from '@modules/message.module'; import { UserModule } from '@modules/user.module'; import { WikiModule } from '@modules/wiki.module'; -import { forwardRef, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { CommentService } from '@services/comment.service'; @Module({ diff --git a/packages/server/src/modules/document.module.ts b/packages/server/src/modules/document.module.ts index 3586fee..c59534e 100644 --- a/packages/server/src/modules/document.module.ts +++ b/packages/server/src/modules/document.module.ts @@ -1,3 +1,7 @@ +import { forwardRef, Module } from '@nestjs/common'; +import { ConfigModule } from '@nestjs/config'; +import { TypeOrmModule } from '@nestjs/typeorm'; + import { DocumentController } from '@controllers/document.controller'; import { DocumentEntity } from '@entities/document.entity'; import { AuthModule } from '@modules/auth.module'; @@ -7,9 +11,6 @@ import { TemplateModule } from '@modules/template.module'; import { UserModule } from '@modules/user.module'; import { ViewModule } from '@modules/view.module'; import { WikiModule } from '@modules/wiki.module'; -import { forwardRef, Module } from '@nestjs/common'; -import { ConfigModule } from '@nestjs/config'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { DocumentService } from '@services/document.service'; @Module({ diff --git a/packages/server/src/modules/file.module.ts b/packages/server/src/modules/file.module.ts index 251b16e..c0138cd 100644 --- a/packages/server/src/modules/file.module.ts +++ b/packages/server/src/modules/file.module.ts @@ -1,6 +1,7 @@ -import { FileController } from '@controllers/file.controller'; import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; + +import { FileController } from '@controllers/file.controller'; import { FileService } from '@services/file.service'; @Module({ diff --git a/packages/server/src/modules/message.module.ts b/packages/server/src/modules/message.module.ts index 5173018..590bc3a 100644 --- a/packages/server/src/modules/message.module.ts +++ b/packages/server/src/modules/message.module.ts @@ -1,8 +1,9 @@ +import { forwardRef, Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; + import { MessageController } from '@controllers/message.controller'; import { MessageEntity } from '@entities/message.entity'; import { UserModule } from '@modules/user.module'; -import { forwardRef, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { MessageService } from '@services/message.service'; @Module({ diff --git a/packages/server/src/modules/organization.module.ts b/packages/server/src/modules/organization.module.ts index 14f14fd..b3225ff 100644 --- a/packages/server/src/modules/organization.module.ts +++ b/packages/server/src/modules/organization.module.ts @@ -1,11 +1,12 @@ +import { forwardRef, Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; + import { OrganizationController } from '@controllers/organization.controller'; import { OrganizationEntity } from '@entities/organization.entity'; import { AuthModule } from '@modules/auth.module'; import { MessageModule } from '@modules/message.module'; import { UserModule } from '@modules/user.module'; import { WikiModule } from '@modules/wiki.module'; -import { forwardRef, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { OrganizationService } from '@services/organization.service'; @Module({ diff --git a/packages/server/src/modules/star.module.ts b/packages/server/src/modules/star.module.ts index e0cc9c8..8d88ab0 100644 --- a/packages/server/src/modules/star.module.ts +++ b/packages/server/src/modules/star.module.ts @@ -1,3 +1,6 @@ +import { forwardRef, Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; + import { StarController } from '@controllers/star.controller'; import { StarEntity } from '@entities/star.entity'; import { AuthModule } from '@modules/auth.module'; @@ -5,8 +8,6 @@ import { DocumentModule } from '@modules/document.module'; import { OrganizationModule } from '@modules/organization.module'; import { UserModule } from '@modules/user.module'; import { WikiModule } from '@modules/wiki.module'; -import { forwardRef, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { StarService } from '@services/star.service'; @Module({ diff --git a/packages/server/src/modules/system.module.ts b/packages/server/src/modules/system.module.ts index c4d4f9c..1fc02e2 100644 --- a/packages/server/src/modules/system.module.ts +++ b/packages/server/src/modules/system.module.ts @@ -1,7 +1,8 @@ -import { SystemController } from '@controllers/system.controller'; -import { SystemEntity } from '@entities/system.entity'; import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; + +import { SystemController } from '@controllers/system.controller'; +import { SystemEntity } from '@entities/system.entity'; import { SystemService } from '@services/system.service'; @Module({ diff --git a/packages/server/src/modules/template.module.ts b/packages/server/src/modules/template.module.ts index 2c26c35..92e495e 100644 --- a/packages/server/src/modules/template.module.ts +++ b/packages/server/src/modules/template.module.ts @@ -1,11 +1,12 @@ +import { forwardRef, Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; + import { TemplateController } from '@controllers/template.controller'; import { TemplateEntity } from '@entities/template.entity'; import { DocumentModule } from '@modules/document.module'; import { MessageModule } from '@modules/message.module'; import { UserModule } from '@modules/user.module'; import { WikiModule } from '@modules/wiki.module'; -import { forwardRef, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { TemplateService } from '@services/template.service'; @Module({ diff --git a/packages/server/src/modules/user.module.ts b/packages/server/src/modules/user.module.ts index 62ea9b1..539501b 100644 --- a/packages/server/src/modules/user.module.ts +++ b/packages/server/src/modules/user.module.ts @@ -1,3 +1,11 @@ +import { forwardRef, Inject, Injectable, Module, UnauthorizedException } from '@nestjs/common'; +import { ConfigModule } from '@nestjs/config'; +import { JwtModule } from '@nestjs/jwt'; +import { PassportModule, PassportStrategy } from '@nestjs/passport'; +import { TypeOrmModule } from '@nestjs/typeorm'; + +import { getConfig } from '@think/config'; + import { UserController } from '@controllers/user.controller'; import { UserEntity } from '@entities/user.entity'; import { MessageModule } from '@modules/message.module'; @@ -6,13 +14,7 @@ import { StarModule } from '@modules/star.module'; import { SystemModule } from '@modules/system.module'; import { VerifyModule } from '@modules/verify.module'; import { WikiModule } from '@modules/wiki.module'; -import { forwardRef, Inject, Injectable, Module, UnauthorizedException } from '@nestjs/common'; -import { ConfigModule } from '@nestjs/config'; -import { JwtModule } from '@nestjs/jwt'; -import { PassportModule, PassportStrategy } from '@nestjs/passport'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { UserService } from '@services/user.service'; -import { getConfig } from '@think/config'; import { Request as RequestType } from 'express'; import { ExtractJwt, Strategy } from 'passport-jwt'; diff --git a/packages/server/src/modules/verify.module.ts b/packages/server/src/modules/verify.module.ts index f7cd023..1a873e9 100644 --- a/packages/server/src/modules/verify.module.ts +++ b/packages/server/src/modules/verify.module.ts @@ -1,6 +1,7 @@ +import { forwardRef, Module } from '@nestjs/common'; + import { VerifyController } from '@controllers/verify.controller'; import { SystemModule } from '@modules/system.module'; -import { forwardRef, Module } from '@nestjs/common'; import { VerifyService } from '@services/verify.service'; @Module({ diff --git a/packages/server/src/modules/view.module.ts b/packages/server/src/modules/view.module.ts index 8c45a47..b693602 100644 --- a/packages/server/src/modules/view.module.ts +++ b/packages/server/src/modules/view.module.ts @@ -1,5 +1,6 @@ -import { ViewController } from '@controllers/view.controller'; import { Module } from '@nestjs/common'; + +import { ViewController } from '@controllers/view.controller'; import { ViewService } from '@services/view.service'; @Module({ diff --git a/packages/server/src/modules/wiki.module.ts b/packages/server/src/modules/wiki.module.ts index 7ba0f8d..9f9df9a 100644 --- a/packages/server/src/modules/wiki.module.ts +++ b/packages/server/src/modules/wiki.module.ts @@ -1,3 +1,6 @@ +import { forwardRef, Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; + import { WikiController } from '@controllers/wiki.controller'; import { WikiEntity } from '@entities/wiki.entity'; import { AuthModule } from '@modules/auth.module'; @@ -7,8 +10,6 @@ import { OrganizationModule } from '@modules/organization.module'; import { StarModule } from '@modules/star.module'; import { UserModule } from '@modules/user.module'; import { ViewModule } from '@modules/view.module'; -import { forwardRef, Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; import { WikiService } from '@services/wiki.service'; @Module({ diff --git a/packages/server/src/pipes/validation.pipe.ts b/packages/server/src/pipes/validation.pipe.ts index 82d0291..7ff8016 100644 --- a/packages/server/src/pipes/validation.pipe.ts +++ b/packages/server/src/pipes/validation.pipe.ts @@ -1,4 +1,5 @@ import { ArgumentMetadata, BadRequestException, Injectable, PipeTransform } from '@nestjs/common'; + import { plainToClass } from 'class-transformer'; import { validate } from 'class-validator'; diff --git a/packages/server/src/services/auth.service.ts b/packages/server/src/services/auth.service.ts index 2bebcb1..66cee2d 100644 --- a/packages/server/src/services/auth.service.ts +++ b/packages/server/src/services/auth.service.ts @@ -1,9 +1,11 @@ -import { AuthDto } from '@dtos/auth.dto'; -import { AuthEntity } from '@entities/auth.entity'; import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { UserService } from '@services/user.service'; + import { AuthEnum, IDocument, IOrganization, IPagination, IUser, IWiki } from '@think/domains'; + +import { AuthDto } from '@dtos/auth.dto'; +import { AuthEntity } from '@entities/auth.entity'; +import { UserService } from '@services/user.service'; import * as lodash from 'lodash'; import { Repository } from 'typeorm'; diff --git a/packages/server/src/services/collaboration.service.ts b/packages/server/src/services/collaboration.service.ts index 2ce9ebc..c90536f 100644 --- a/packages/server/src/services/collaboration.service.ts +++ b/packages/server/src/services/collaboration.service.ts @@ -1,12 +1,14 @@ -import { onAuthenticatePayload, onChangePayload, onLoadDocumentPayload, Server } from '@hocuspocus/server'; -import { TiptapTransformer } from '@hocuspocus/transformer'; import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; + +import { DocumentStatus, IUser } from '@think/domains'; + +import { onAuthenticatePayload, onChangePayload, onLoadDocumentPayload, Server } from '@hocuspocus/server'; +import { TiptapTransformer } from '@hocuspocus/transformer'; import { DocumentService } from '@services/document.service'; import { DocumentVersionService } from '@services/document-version.service'; import { TemplateService } from '@services/template.service'; import { UserService } from '@services/user.service'; -import { DocumentStatus, IUser } from '@think/domains'; import * as lodash from 'lodash'; import * as Y from 'yjs'; diff --git a/packages/server/src/services/comment.service.ts b/packages/server/src/services/comment.service.ts index 9a40cbf..0039b7b 100644 --- a/packages/server/src/services/comment.service.ts +++ b/packages/server/src/services/comment.service.ts @@ -1,13 +1,15 @@ +import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; + +import { AuthEnum, buildMessageURL, DocumentStatus, IUser } from '@think/domains'; + import { CommentDto, UpdateCommentDto } from '@dtos/comment.dto'; import { CommentEntity } from '@entities/comment.entity'; import { parseUserAgent } from '@helpers/ua.helper'; -import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; import { AuthService } from '@services/auth.service'; import { DocumentService } from '@services/document.service'; import { MessageService } from '@services/message.service'; import { UserService } from '@services/user.service'; -import { AuthEnum, buildMessageURL, DocumentStatus, IUser } from '@think/domains'; import { Repository } from 'typeorm'; @Injectable() diff --git a/packages/server/src/services/document-version.service.ts b/packages/server/src/services/document-version.service.ts index 29bf9e8..5b4a712 100644 --- a/packages/server/src/services/document-version.service.ts +++ b/packages/server/src/services/document-version.service.ts @@ -1,8 +1,10 @@ -import { RedisDBEnum } from '@constants/*'; -import { buildRedis } from '@helpers/redis.helper'; import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; + import { getConfig } from '@think/config'; import { IDocument, IUser } from '@think/domains'; + +import { RedisDBEnum } from '@constants/*'; +import { buildRedis } from '@helpers/redis.helper'; import Redis from 'ioredis'; import * as lodash from 'lodash'; diff --git a/packages/server/src/services/document.service.ts b/packages/server/src/services/document.service.ts index 9e5f5ab..93d4b05 100644 --- a/packages/server/src/services/document.service.ts +++ b/packages/server/src/services/document.service.ts @@ -1,11 +1,15 @@ +import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import { InjectRepository } from '@nestjs/typeorm'; + +import { EMPTY_DOCUMNENT } from '@think/constants'; +import { AuthEnum, buildMessageURL, DocumentStatus, IUser } from '@think/domains'; + import { OperateUserAuthDto } from '@dtos/auth.dto'; import { CreateDocumentDto } from '@dtos/create-document.dto'; import { ShareDocumentDto } from '@dtos/share-document.dto'; import { UpdateDocumentDto } from '@dtos/update-document.dto'; import { DocumentEntity } from '@entities/document.entity'; -import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; -import { ConfigService } from '@nestjs/config'; -import { InjectRepository } from '@nestjs/typeorm'; import { AuthService } from '@services/auth.service'; import { CollaborationService } from '@services/collaboration.service'; import { DocumentVersionService } from '@services/document-version.service'; @@ -14,8 +18,6 @@ import { TemplateService } from '@services/template.service'; import { UserService } from '@services/user.service'; import { ViewService } from '@services/view.service'; import { WikiService } from '@services/wiki.service'; -import { EMPTY_DOCUMNENT } from '@think/constants'; -import { AuthEnum, buildMessageURL, DocumentStatus, IUser } from '@think/domains'; import { instanceToPlain } from 'class-transformer'; import * as HTMLtoDOCX from 'html-to-docx'; import * as lodash from 'lodash'; diff --git a/packages/server/src/services/file.service.ts b/packages/server/src/services/file.service.ts index 5694acd..612ecd4 100644 --- a/packages/server/src/services/file.service.ts +++ b/packages/server/src/services/file.service.ts @@ -1,7 +1,8 @@ -import { getOssClient, OssClient } from '@helpers/file.helper'; import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; +import { getOssClient, OssClient } from '@helpers/file.helper'; + @Injectable() export class FileService { private ossClient: OssClient; diff --git a/packages/server/src/services/message.service.ts b/packages/server/src/services/message.service.ts index ab2acdd..1950b32 100644 --- a/packages/server/src/services/message.service.ts +++ b/packages/server/src/services/message.service.ts @@ -1,12 +1,14 @@ -import { MessageEntity } from '@entities/message.entity'; import { HttpException, HttpStatus, Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; + import { IUser } from '@think/domains'; -import { Repository } from 'typeorm'; -import Redis from 'ioredis'; -import { buildRedis } from '@helpers/redis.helper'; + import { RedisDBEnum } from '@constants/*'; +import { MessageEntity } from '@entities/message.entity'; +import { buildRedis } from '@helpers/redis.helper'; +import Redis from 'ioredis'; import { uniqueId } from 'lodash'; +import { Repository } from 'typeorm'; @Injectable() export class MessageService { diff --git a/packages/server/src/services/organization.service.ts b/packages/server/src/services/organization.service.ts index 8d2f282..2a6c504 100644 --- a/packages/server/src/services/organization.service.ts +++ b/packages/server/src/services/organization.service.ts @@ -1,14 +1,16 @@ +import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; + +import { AuthEnum, buildMessageURL, IOrganization, IUser } from '@think/domains'; + import { OperateUserAuthDto } from '@dtos/auth.dto'; import { CreateOrganizationDto } from '@dtos/organization.dto'; import { OrganizationEntity } from '@entities/organization.entity'; import { UserEntity } from '@entities/user.entity'; -import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; import { AuthService } from '@services/auth.service'; import { MessageService } from '@services/message.service'; import { UserService } from '@services/user.service'; import { WikiService } from '@services/wiki.service'; -import { AuthEnum, buildMessageURL, IOrganization, IUser } from '@think/domains'; import { Repository } from 'typeorm'; @Injectable() diff --git a/packages/server/src/services/star.service.ts b/packages/server/src/services/star.service.ts index d4e4b0b..2ce2dc6 100644 --- a/packages/server/src/services/star.service.ts +++ b/packages/server/src/services/star.service.ts @@ -1,13 +1,15 @@ -import { StarDto } from '@dtos/star.dto'; -import { StarEntity } from '@entities/star.entity'; import { forwardRef, Inject, Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; + +import { IDocument, IUser } from '@think/domains'; + +import { StarDto } from '@dtos/star.dto'; +import { StarEntity } from '@entities/star.entity'; import { AuthService } from '@services/auth.service'; import { DocumentService } from '@services/document.service'; import { OrganizationService } from '@services/organization.service'; import { UserService } from '@services/user.service'; import { WikiService } from '@services/wiki.service'; -import { IDocument, IUser } from '@think/domains'; import * as lodash from 'lodash'; import { Repository } from 'typeorm'; diff --git a/packages/server/src/services/system.service.ts b/packages/server/src/services/system.service.ts index 562cbcb..6c80848 100644 --- a/packages/server/src/services/system.service.ts +++ b/packages/server/src/services/system.service.ts @@ -1,7 +1,8 @@ -import { SystemEntity } from '@entities/system.entity'; import { HttpException, HttpStatus, Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { InjectRepository } from '@nestjs/typeorm'; + +import { SystemEntity } from '@entities/system.entity'; import * as nodemailer from 'nodemailer'; import { Repository } from 'typeorm'; diff --git a/packages/server/src/services/template.service.ts b/packages/server/src/services/template.service.ts index 972e986..0b75e36 100644 --- a/packages/server/src/services/template.service.ts +++ b/packages/server/src/services/template.service.ts @@ -1,9 +1,11 @@ -import { TemplateDto } from '@dtos/template.dto'; -import { TemplateEntity } from '@entities/template.entity'; import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { UserService } from '@services/user.service'; + import { IUser } from '@think/domains'; + +import { TemplateDto } from '@dtos/template.dto'; +import { TemplateEntity } from '@entities/template.entity'; +import { UserService } from '@services/user.service'; import { instanceToPlain } from 'class-transformer'; import * as lodash from 'lodash'; import { Repository } from 'typeorm'; diff --git a/packages/server/src/services/user.service.ts b/packages/server/src/services/user.service.ts index 0e60252..391bf15 100644 --- a/packages/server/src/services/user.service.ts +++ b/packages/server/src/services/user.service.ts @@ -1,20 +1,22 @@ +import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import { JwtService } from '@nestjs/jwt'; +import { InjectRepository } from '@nestjs/typeorm'; + +import { ORGANIZATION_LOGOS } from '@think/constants'; +import { IUser, UserStatus } from '@think/domains'; + import { RegisterUserDto, ResetPasswordDto } from '@dtos/create-user.dto'; import { LoginUserDto } from '@dtos/login-user.dto'; import { UpdateUserDto } from '@dtos/update-user.dto'; import { SystemEntity } from '@entities/system.entity'; import { UserEntity } from '@entities/user.entity'; -import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; -import { ConfigService } from '@nestjs/config'; -import { JwtService } from '@nestjs/jwt'; -import { InjectRepository } from '@nestjs/typeorm'; import { MessageService } from '@services/message.service'; import { OrganizationService } from '@services/organization.service'; import { StarService } from '@services/star.service'; import { SystemService } from '@services/system.service'; import { VerifyService } from '@services/verify.service'; import { WikiService } from '@services/wiki.service'; -import { ORGANIZATION_LOGOS } from '@think/constants'; -import { IUser, UserStatus } from '@think/domains'; import { instanceToPlain } from 'class-transformer'; import { Repository } from 'typeorm'; diff --git a/packages/server/src/services/verify.service.ts b/packages/server/src/services/verify.service.ts index c4a9c9a..d99af18 100644 --- a/packages/server/src/services/verify.service.ts +++ b/packages/server/src/services/verify.service.ts @@ -1,6 +1,7 @@ +import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; + import { RedisDBEnum } from '@constants/*'; import { buildRedis } from '@helpers/redis.helper'; -import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; import { SystemService } from '@services/system.service'; import Redis from 'ioredis'; import { randomInt } from 'node:crypto'; diff --git a/packages/server/src/services/view.service.ts b/packages/server/src/services/view.service.ts index 6363dd1..5f876d3 100644 --- a/packages/server/src/services/view.service.ts +++ b/packages/server/src/services/view.service.ts @@ -1,8 +1,10 @@ +import { Injectable } from '@nestjs/common'; + +import { IDocument, IOrganization, IUser } from '@think/domains'; + import { RedisDBEnum } from '@constants/*'; import { DocumentEntity } from '@entities/document.entity'; import { buildRedis } from '@helpers/redis.helper'; -import { Injectable } from '@nestjs/common'; -import { IDocument, IOrganization, IUser } from '@think/domains'; import Redis from 'ioredis'; import * as lodash from 'lodash'; diff --git a/packages/server/src/services/wiki.service.ts b/packages/server/src/services/wiki.service.ts index 76c06a2..f5f0ef6 100644 --- a/packages/server/src/services/wiki.service.ts +++ b/packages/server/src/services/wiki.service.ts @@ -1,18 +1,20 @@ +import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; + +import { AuthEnum, buildMessageURL, DocumentStatus, IPagination, IUser, WikiStatus } from '@think/domains'; + import { OperateUserAuthDto } from '@dtos/auth.dto'; import { CreateWikiDto } from '@dtos/create-wiki.dto'; import { ShareWikiDto } from '@dtos/share-wiki.dto'; import { UpdateWikiDto } from '@dtos/update-wiki.dto'; import { WikiEntity } from '@entities/wiki.entity'; import { array2tree } from '@helpers/tree.helper'; -import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; import { AuthService } from '@services/auth.service'; import { DocumentService } from '@services/document.service'; import { MessageService } from '@services/message.service'; import { StarService } from '@services/star.service'; import { UserService } from '@services/user.service'; import { ViewService } from '@services/view.service'; -import { AuthEnum, buildMessageURL, DocumentStatus, IPagination, IUser, WikiStatus } from '@think/domains'; import { instanceToPlain } from 'class-transformer'; import * as lodash from 'lodash'; import { Repository } from 'typeorm'; @@ -326,14 +328,13 @@ export class WikiService { * @param pagination * @returns */ - async getAllWikis(user: IUser, organizationId, pagination: IPagination) { + async getAllWikis(user: IUser, organizationId) { await this.authService.canView(user.id, { organizationId, wikiId: null, documentId: null, }); - const { page = 1, pageSize = 12 } = pagination; const { data: userWikiAuths, total } = await this.authService.getUserCanViewWikisInOrganization( user.id, organizationId @@ -357,14 +358,13 @@ export class WikiService { * @param pagination * @returns */ - async getOwnWikis(user: IUser, organizationId, pagination: IPagination) { + async getOwnWikis(user: IUser, organizationId) { await this.authService.canView(user.id, { organizationId, wikiId: null, documentId: null, }); - const { page = 1, pageSize = 12 } = pagination; const { data: userWikiAuths, total } = await this.authService.getUserCreateWikisInOrganization( user.id, organizationId @@ -387,14 +387,13 @@ export class WikiService { * @param pagination * @returns */ - async getJoinWikis(user: IUser, organizationId, pagination: IPagination) { + async getJoinWikis(user: IUser, organizationId) { await this.authService.canView(user.id, { organizationId, wikiId: null, documentId: null, }); - const { page = 1, pageSize = 12 } = pagination; const { data: userWikiAuths, total } = await this.authService.getUserJoinWikisInOrganization( user.id, organizationId diff --git a/packages/server/src/transforms/http-response.transform.ts b/packages/server/src/transforms/http-response.transform.ts index bb55292..a1935d1 100644 --- a/packages/server/src/transforms/http-response.transform.ts +++ b/packages/server/src/transforms/http-response.transform.ts @@ -1,4 +1,5 @@ import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common'; + import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; diff --git a/packages/server/test/app.e2e-spec.ts b/packages/server/test/app.e2e-spec.ts index f4dd23f..3f7f478 100644 --- a/packages/server/test/app.e2e-spec.ts +++ b/packages/server/test/app.e2e-spec.ts @@ -1,5 +1,6 @@ import { INestApplication } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; + import * as request from 'supertest'; import { AppModule } from './../src/app.module';