1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 04:48:03 +00:00
* [sdoc file view] added file view, history/trash file view for 'sdoc'

* [sdoc file view] sdoc-editor: upgraded it to the latest version(0.1.5)

- sdoc file view: enable 'auto save'
- sdoc shared/history/trash file view: use the read-only sdoc viewer

* [sdoc file view] fixup
This commit is contained in:
llj
2023-04-17 15:32:52 +08:00
committed by GitHub
parent 101c5e85fb
commit 7ab352db18
16 changed files with 702 additions and 79 deletions

View File

@@ -0,0 +1,20 @@
import React from 'react';
import { SDocViewer } from '@seafile/sdoc-editor';
import { defaultContentForSDoc } from '../../utils/constants';
import '../../css/sdoc-file-view.css';
const { fileContent } = window.app.pageOptions;
class FileContent extends React.Component {
render() {
return (
<div className="file-view-content flex-1 o-auto sdoc-file-view p-0 d-flex flex-column">
<SDocViewer document={fileContent ? JSON.parse(fileContent) : defaultContentForSDoc} config={{}} />
</div>
);
}
}
export default FileContent;

View File

@@ -23,6 +23,7 @@ const propTypes = {
const {
canLockUnlockFile,
repoID, repoName, repoEncrypted, parentDir, filePerm, filePath,
fileType,
fileName,
canEditFile, err,
fileEnc, // for 'edit', not undefined only for some kinds of files (e.g. text file)
@@ -140,7 +141,7 @@ class FileToolbar extends React.Component {
/>
)}
{(canEditFile && !err) &&
{(canEditFile && fileType != 'SDoc' && !err) &&
( this.props.isSaving ?
<button type={'button'} aria-label={gettext('Saving...')} className={'btn btn-icon btn-secondary btn-active'}>
<i className={'fa fa-spin fa-spinner'}/></button> :
@@ -204,7 +205,7 @@ class FileToolbar extends React.Component {
<Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle} className="d-block d-md-none">
<ButtonGroup >
{(canEditFile && !err) &&
{(canEditFile && fileType != 'SDoc' && !err) &&
(this.props.isSaving ?
<button type={'button'} aria-label={gettext('Saving...')} className={'btn btn-icon btn-secondary btn-active'}>
<i className={'fa fa-spin fa-spinner'}/></button> :