fix: fix comment editor

pull/8/head
fantasticit 2022-03-22 12:42:12 +08:00
parent 1edcdd5513
commit 4c9838e29e
3 changed files with 35 additions and 7 deletions

View File

@ -32,6 +32,7 @@
"@tiptap/extension-hard-break": "^2.0.0-beta.30",
"@tiptap/extension-heading": "^2.0.0-beta.26",
"@tiptap/extension-highlight": "^2.0.0-beta.33",
"@tiptap/extension-history": "^2.0.0-beta.21",
"@tiptap/extension-image": "^2.0.0-beta.25",
"@tiptap/extension-italic": "^2.0.0-beta.25",
"@tiptap/extension-link": "^2.0.0-beta.36",

View File

@ -2,7 +2,7 @@ import React, { useRef, useState } from 'react';
import { useEditor, EditorContent } from '@tiptap/react';
import { Avatar, Button, Space, Typography, Banner, Pagination } from '@douyinfe/semi-ui';
import { useToggle } from 'hooks/useToggle';
import { DEFAULT_EXTENSION, Document, CommentMenuBar } from 'components/tiptap';
import { DEFAULT_EXTENSION, Document, History, CommentMenuBar } from 'components/tiptap';
import { DataRender } from 'components/data-render';
import { useUser } from 'data/user';
import { useComments } from 'data/comment';
@ -34,7 +34,7 @@ export const CommentEditor: React.FC<IProps> = ({ documentId }) => {
const editor = useEditor({
editable: true,
extensions: [...DEFAULT_EXTENSION, Document],
extensions: [...DEFAULT_EXTENSION, Document, History],
});
const openEditor = () => {
@ -113,11 +113,7 @@ export const CommentEditor: React.FC<IProps> = ({ documentId }) => {
deleteComment={deleteComment}
/>
<div className={styles.paginationWrap}>
<Pagination
total={commentsData.total}
showTotal
onPageChange={setPage}
></Pagination>
<Pagination total={commentsData.total} showTotal onPageChange={setPage}></Pagination>
</div>
</div>
)}

View File

@ -66,6 +66,7 @@ importers:
'@tiptap/extension-hard-break': ^2.0.0-beta.30
'@tiptap/extension-heading': ^2.0.0-beta.26
'@tiptap/extension-highlight': ^2.0.0-beta.33
'@tiptap/extension-history': ^2.0.0-beta.21
'@tiptap/extension-image': ^2.0.0-beta.25
'@tiptap/extension-italic': ^2.0.0-beta.25
'@tiptap/extension-link': ^2.0.0-beta.36
@ -144,6 +145,7 @@ importers:
'@tiptap/extension-hard-break': 2.0.0-beta.30_@tiptap+core@2.0.0-beta.171
'@tiptap/extension-heading': 2.0.0-beta.26_@tiptap+core@2.0.0-beta.171
'@tiptap/extension-highlight': 2.0.0-beta.33_@tiptap+core@2.0.0-beta.171
'@tiptap/extension-history': 2.0.0-beta.21_@tiptap+core@2.0.0-beta.171
'@tiptap/extension-image': 2.0.0-beta.25_@tiptap+core@2.0.0-beta.171
'@tiptap/extension-italic': 2.0.0-beta.25_@tiptap+core@2.0.0-beta.171
'@tiptap/extension-link': 2.0.0-beta.36_@tiptap+core@2.0.0-beta.171
@ -1759,6 +1761,16 @@ packages:
'@tiptap/core': 2.0.0-beta.171
dev: false
/@tiptap/extension-history/2.0.0-beta.21_@tiptap+core@2.0.0-beta.171:
resolution: {integrity: sha512-0v8Cl30V4dsabdpspLdk+f+lMoIvLFlJN5WRxtc7RRZ5gfJVxPHwooIKdvC51brfh/oJtWFCNMRjhoz0fRaF9A==}
peerDependencies:
'@tiptap/core': ^2.0.0-beta.1
dependencies:
'@tiptap/core': 2.0.0-beta.171
'@types/prosemirror-history': 1.0.3
prosemirror-history: 1.2.0
dev: false
/@tiptap/extension-image/2.0.0-beta.25_@tiptap+core@2.0.0-beta.171:
resolution: {integrity: sha512-RgW5jFVS2QNDvFhBOz7H1hY6LjYcbVAa/mE4F4c3RPg3o7GJZXNoL9s+k0QkEM2GXAvY6fX+OICMBn8TSENXKA==}
peerDependencies:
@ -2146,6 +2158,13 @@ packages:
'@types/prosemirror-state': 1.2.8
dev: false
/@types/prosemirror-history/1.0.3:
resolution: {integrity: sha512-5TloMDRavgLjOAKXp1Li8u0xcsspzbT1Cm9F2pwHOkgvQOz1jWQb2VIXO7RVNsFjLBZdIXlyfSLivro3DuMWXg==}
dependencies:
'@types/prosemirror-model': 1.16.0
'@types/prosemirror-state': 1.2.8
dev: false
/@types/prosemirror-keymap/1.0.4:
resolution: {integrity: sha512-ycevwkqUh+jEQtPwqO7sWGcm+Sybmhu8MpBsM8DlO3+YTKnXbKA6SDz/+q14q1wK3UA8lHJyfR+v+GPxfUSemg==}
dependencies:
@ -6792,6 +6811,14 @@ packages:
prosemirror-view: 1.23.6
dev: false
/prosemirror-history/1.2.0:
resolution: {integrity: sha512-B9v9xtf4fYbKxQwIr+3wtTDNLDZcmMMmGiI3TAPShnUzvo+Rmv1GiUrsQChY1meetHl7rhML2cppF3FTs7f7UQ==}
dependencies:
prosemirror-state: 1.3.4
prosemirror-transform: 1.3.3
rope-sequence: 1.3.2
dev: false
/prosemirror-keymap/1.1.5:
resolution: {integrity: sha512-8SZgPH3K+GLsHL2wKuwBD9rxhsbnVBTwpHCO4VUO5GmqUQlxd/2GtBVWTsyLq4Dp3N9nGgPd3+lZFKUDuVp+Vw==}
dependencies:
@ -7209,6 +7236,10 @@ packages:
dependencies:
glob: 7.2.0
/rope-sequence/1.3.2:
resolution: {integrity: sha512-ku6MFrwEVSVmXLvy3dYph3LAMNS0890K7fabn+0YIRQ2T96T9F4gkFf0vf0WW0JUraNWwGRtInEpH7yO4tbQZg==}
dev: false
/run-async/2.4.1:
resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==}
engines: {node: '>=0.12.0'}