1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

Sdoc draft (#5556)

* [dir view] redesigned the sdoc draft identifier

* [dir view] added option 'Mark as draft' to 'New File' dialog; added big button '+ SeaDoc' for empty library

* [sdoc draft] fixed API typos

* [sdoc file view] displayed draft identifier & added 'unmark as draft' for drafts

* [media/sdoc-editor] updated i18n/l10n strings for sdoc-editor

* [dir view] 'New' dropdown menu: added '(beta)' for 'New SeaDoc File'
This commit is contained in:
llj
2023-07-22 15:54:25 +08:00
committed by GitHub
parent f02f40ee3a
commit 68ed3e5773
20 changed files with 148 additions and 99 deletions

View File

@@ -1,6 +1,6 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { gettext } from '../../utils/constants';
import { enableSeadoc, gettext } from '../../utils/constants';
import Loading from '../loading';
import ModalPortal from '../modal-portal';
import CreateFile from '../../components/dialog/create-file-dialog';
@@ -10,7 +10,7 @@ import '../../css/tip-for-new-file.css';
const propTypes = {
path: PropTypes.string.isRequired,
isDirentListLoading: PropTypes.bool.isRequired,
onAddFile: PropTypes.func.isRequired,
onAddFile: PropTypes.func.isRequired
};
class DirentNodeView extends React.Component {
@@ -41,11 +41,6 @@ class DirentNodeView extends React.Component {
return false; // current repo is null, and unnecessary to check duplicated name
}
onAddFile = (filePath, isDraft) => {
this.setState({isCreateFileDialogShow: false});
this.props.onAddFile(filePath, isDraft);
}
render() {
if (this.props.isDirentListLoading) {
return (<Loading />);
@@ -53,9 +48,9 @@ class DirentNodeView extends React.Component {
return (
<Fragment>
<div className="tip-for-new-file text-center">
<p className="text-secondary">{gettext('This folder has no content at this time.')}</p>
<p className="text-secondary">{gettext('You can create files quickly')}{' +'}</p>
<div className="tip-for-new-file">
<p className="text-secondary text-center">{gettext('This folder has no content at this time.')}</p>
<p className="text-secondary text-center">{gettext('You can create files quickly')}{' +'}</p>
<button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.md')}>
{'+ Markdown'}</button>
<button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.pptx')}>
@@ -65,14 +60,17 @@ class DirentNodeView extends React.Component {
{'+ Word'}</button>
<button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.xlsx')}>
{'+ Excel'}</button>
<br />
{enableSeadoc && <button className="big-new-file-button" onClick={this.onCreateNewFile.bind(this, '.sdoc')}>
{'+ SeaDoc'}</button>}
</div>
{this.state.isCreateFileDialogShow && (
<ModalPortal>
<CreateFile
parentPath={this.props.path}
fileType={this.state.fileType}
onAddFile={this.onAddFile}
addFileCancel={this.onCreateFileToggle}
onAddFile={this.props.onAddFile}
toggleDialog={this.onCreateFileToggle}
checkDuplicatedName={this.checkDuplicatedName}
/>
</ModalPortal>