mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-11 20:01:10 +00:00
feat: wiki editor
This commit is contained in:
@@ -49,6 +49,7 @@ class Wiki extends Component {
|
||||
can_edit_file: false,
|
||||
seadoc_access_token: '',
|
||||
docUuid: '',
|
||||
assets_url: '',
|
||||
};
|
||||
|
||||
window.onpopstate = this.onpopstate;
|
||||
@@ -217,6 +218,7 @@ class Wiki extends Component {
|
||||
this.removePythonWrapper();
|
||||
wikiAPI.getWiki2FileContent(wikiId, filePath).then(res => {
|
||||
let data = res.data;
|
||||
|
||||
this.setState({
|
||||
isDataLoading: false,
|
||||
content: data.content,
|
||||
@@ -225,6 +227,7 @@ class Wiki extends Component {
|
||||
latestContributor: data.latest_contributor,
|
||||
can_edit_file: data.can_edit_file,
|
||||
seadoc_access_token: data.seadoc_access_token,
|
||||
assets_url: data.assets_url,
|
||||
});
|
||||
}).catch(error => {
|
||||
let errorMsg = Utils.getErrorMsg(error);
|
||||
@@ -603,7 +606,7 @@ class Wiki extends Component {
|
||||
setCurrentPage={this.setCurrentPage}
|
||||
currentPageId={this.state.currentPageId}
|
||||
/>
|
||||
{<MainPanel
|
||||
<MainPanel
|
||||
path={this.state.path}
|
||||
pathExist={this.state.pathExist}
|
||||
isViewFile={this.state.isViewFile}
|
||||
@@ -618,7 +621,8 @@ class Wiki extends Component {
|
||||
onMainNavBarClick={this.onMainNavBarClick}
|
||||
can_edit_file={this.state.can_edit_file}
|
||||
seadoc_access_token={this.state.seadoc_access_token}
|
||||
/>}
|
||||
assets_url={this.state.assets_url}
|
||||
/>
|
||||
<MediaQuery query="(max-width: 767.8px)">
|
||||
<Modal isOpen={!this.state.closeSideBar} toggle={this.onCloseSide} contentClassName="d-none"></Modal>
|
||||
</MediaQuery>
|
||||
|
@@ -25,6 +25,7 @@ const propTypes = {
|
||||
onLinkClick: PropTypes.func.isRequired,
|
||||
can_edit_file: PropTypes.bool,
|
||||
seadoc_access_token: PropTypes.string,
|
||||
assets_url: PropTypes.string,
|
||||
};
|
||||
|
||||
class MainPanel extends Component {
|
||||
@@ -94,10 +95,11 @@ class MainPanel extends Component {
|
||||
...config,
|
||||
...pageOptions,
|
||||
sdocServer,
|
||||
assetsUrl,
|
||||
assetsUrl: assetsUrl || props.assets_url,
|
||||
can_edit_file,
|
||||
accessToken: seadoc_access_token,
|
||||
serviceUrl: config.serviceURL,
|
||||
assets_url: config.assetsUrl,
|
||||
};
|
||||
return { ...props, docUuid: window.seafile.docUuid };
|
||||
}
|
||||
@@ -147,7 +149,7 @@ class MainPanel extends Component {
|
||||
<div className={`cur-view-content ${isViewingFile ? 'o-hidden' : ''}`}>
|
||||
{!this.props.pathExist && errMessage}
|
||||
{this.props.pathExist && this.props.isDataLoading && <Loading />}
|
||||
{isViewingFile && Utils.isMarkdownFile(this.props.path) && (
|
||||
{/* {isViewingFile && Utils.isMarkdownFile(this.props.path) && (
|
||||
<SeafileMarkdownViewer
|
||||
isWiki={true}
|
||||
path={this.props.path}
|
||||
@@ -158,8 +160,8 @@ class MainPanel extends Component {
|
||||
latestContributor={this.props.latestContributor}
|
||||
onLinkClick={this.props.onLinkClick}
|
||||
/>
|
||||
)}
|
||||
{this.props.seadoc_access_token && this.state.docUuid && isViewingFile && Utils.isSdocFile(this.props.path) && (
|
||||
)} */}
|
||||
{isViewingFile && Utils.isSdocFile(this.props.path) && (
|
||||
<WikiViewer
|
||||
document={editorContent}
|
||||
showOutline={false}
|
||||
|
Reference in New Issue
Block a user