From dbd257caa64be25b8c4cb479952be57dbe948012 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Tue, 29 Mar 2022 22:23:41 +0800 Subject: [PATCH] feat: document version --- README.md | 7 ++ .../src/components/document/editor/index.tsx | 2 + .../src/components/document/version/index.tsx | 82 +++++++++++++++++++ packages/client/src/data/document.ts | 14 ++++ packages/config/yaml/dev.yaml | 5 ++ packages/server/package.json | 1 + .../src/controllers/document.controller.ts | 8 ++ .../src/services/collaboration.service.ts | 28 +++++-- .../src/services/document-version.service.ts | 52 ++++++++++++ .../server/src/services/document.service.ts | 36 +++++++- pnpm-lock.yaml | 60 +++++++++++++- 11 files changed, 282 insertions(+), 13 deletions(-) create mode 100644 packages/client/src/components/document/version/index.tsx create mode 100644 packages/server/src/services/document-version.service.ts diff --git a/README.md b/README.md index a2e6bee..f06510f 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,13 @@ mysql -u root -p; CREATE DATABASE `think` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ``` +#### 可选:Redis + +``` +docker pull redis:latest +docker run --name think-redis -p 6379:6379 -d redis --appendonly yes --requirepass "root" +``` + ### 本地运行 首先,clone 项目。 diff --git a/packages/client/src/components/document/editor/index.tsx b/packages/client/src/components/document/editor/index.tsx index d824f95..da1c6c5 100644 --- a/packages/client/src/components/document/editor/index.tsx +++ b/packages/client/src/components/document/editor/index.tsx @@ -12,6 +12,7 @@ import { DocumentShare } from 'components/document/share'; import { DocumentStar } from 'components/document/star'; import { DocumentCollaboration } from 'components/document/collaboration'; import { DocumentStyle } from 'components/document/style'; +import { DocumentVersion } from 'components/document/version'; import { useDocumentStyle } from 'hooks/use-document-style'; import { EventEmitter } from 'helpers/event-emitter'; import { Editor } from './editor'; @@ -89,6 +90,7 @@ export const DocumentEditor: React.FC = ({ documentId }) => { )} + }> + toggleVisible(false)} + onCancel={() => toggleVisible(false)} + > + + +