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