chore: fix error, improve ui

This commit is contained in:
fantasticit 2022-09-15 23:30:34 +08:00
parent bb060b2729
commit 48f7b5f168
4 changed files with 9 additions and 8 deletions

View File

@ -62,7 +62,7 @@ export const DocumentEditor: React.FC<IProps> = ({ documentId }) => {
{document && ( {document && (
<DocumentActions organizationId={document.organizationId} wikiId={document.wikiId} documentId={documentId} /> <DocumentActions organizationId={document.organizationId} wikiId={document.wikiId} documentId={documentId} />
)} )}
<DocumentVersion documentId={documentId} onSelect={triggerUseDocumentVersion} /> <DocumentVersion key={'edit'} documentId={documentId} onSelect={triggerUseDocumentVersion} />
</Space> </Space>
), ),
[documentId, document, authority] [documentId, document, authority]

View File

@ -25,7 +25,6 @@
main { main {
padding: 24px; padding: 24px;
overflow: auto; overflow: auto;
background-color: var(--semi-color-bg-0);
flex: 1; flex: 1;
&.isMobile { &.isMobile {

View File

@ -126,8 +126,8 @@ export const DocumentVersion: React.FC<Partial<IProps>> = ({ documentId, onSelec
</Select> </Select>
<div style={{ paddingLeft: '8px' }}></div> <div style={{ paddingLeft: '8px' }}></div>
<Space style={{ marginLeft: 12 }}> <Space style={{ marginLeft: 12 }}>
<Tag style={{ backgroundColor: '#e9ffe9' }}></Tag> <Tag style={{ backgroundColor: '#e9ffe9', color: '#333' }}></Tag>
<Tag style={{ backgroundColor: '#ffeaea' }}></Tag> <Tag style={{ backgroundColor: '#ffeaea', color: '#333' }}></Tag>
</Space> </Space>
</div> </div>
)} )}
@ -156,8 +156,8 @@ export const DocumentVersion: React.FC<Partial<IProps>> = ({ documentId, onSelec
empty={!loading && !data.length} empty={!loading && !data.length}
normalContent={() => ( normalContent={() => (
<div className={styles.contentWrap}> <div className={styles.contentWrap}>
<main className={cls('container', isMobile && styles.isMobile)}> <main className={cls(isMobile && styles.isMobile)}>
<div> <div className="container">
{diffVersion ? ( {diffVersion ? (
<div id="diff-visual" className="ProseMirror"></div> <div id="diff-visual" className="ProseMirror"></div>
) : ( ) : (

View File

@ -26,7 +26,9 @@ export const useEditor = (options: Partial<EditorOptions> = {}, deps: Dependency
options.editorProps = options.editorProps || {}; options.editorProps = options.editorProps || {};
if (options.editable) { if (options.editable) {
options.editorProps.attributes = options.editorProps.attributes || {}; options.editorProps.attributes = options.editorProps.attributes || {
spellcheck: 'false',
};
// @ts-ignore // @ts-ignore
options.editorProps.attributes.class = options.editorProps.attributes.class || ''; options.editorProps.attributes.class = options.editorProps.attributes.class || '';
// @ts-ignore // @ts-ignore
@ -41,7 +43,7 @@ export const useEditor = (options: Partial<EditorOptions> = {}, deps: Dependency
instance.on( instance.on(
'update', 'update',
throttle(() => { throttle(() => {
instance.chain().focus().scrollIntoView().run(); // instance.chain().focus().scrollIntoView().run();
}, 200) }, 200)
); );
} }