mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-15 23:00:57 +00:00
feat: wiki editor title seperation
This commit is contained in:
@@ -172,7 +172,25 @@ class Wiki extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
onUpdatePage = (pageId, newPage) => {
|
||||
if (newPage.name === '') {
|
||||
toaster.danger(gettext('Page name cannot be empty'));
|
||||
return;
|
||||
}
|
||||
const { config } = this.state
|
||||
let pages = config.pages;
|
||||
let newPages = pages.map(page => {
|
||||
if (page.id === pageId) {
|
||||
return { ...page, ...newPage };
|
||||
}
|
||||
return page;
|
||||
});
|
||||
const newConfig = { ...config, pages: newPages };
|
||||
this.saveWikiConfig(newConfig);
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
return (
|
||||
<div id="main" className="wiki-main">
|
||||
<SidePanel
|
||||
|
@@ -69,13 +69,14 @@ class MainPanel extends Component {
|
||||
}
|
||||
{this.props.pathExist && this.props.isDataLoading && <Loading />}
|
||||
{isViewingFile && Utils.isSdocFile(this.props.path) && (
|
||||
<SdocWikiViewer
|
||||
document={this.props.editorContent}
|
||||
showOutline={false}
|
||||
showToolbar={false}
|
||||
docUuid={this.state.docUuid}
|
||||
isWikiReadOnly={isReadOnly}
|
||||
/>
|
||||
<div>
|
||||
<SdocWikiViewer
|
||||
document={this.props.editorContent}
|
||||
docUuid={this.state.docUuid}
|
||||
isWikiReadOnly={isReadOnly}
|
||||
topSlot={<Input className='sf-wiki-title' bsSize="lg" onChange={this.handleRenameDocument} defaultValue={currentPageConfig.name} />}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -43,4 +43,8 @@ const getIconURL = (repoId, fileName) => {
|
||||
return serviceURL + '/lib/' + repoId + '/file/_Internal/Wiki/Icon/' + fileName + '?raw=1';
|
||||
};
|
||||
|
||||
export { generatorBase64Code, generateUniqueId, isObjectNotEmpty, getIconURL };
|
||||
const getCurrentPageConfig = (pages,pageId) => {
|
||||
return pages.filter(page => page.id === pageId)[0]
|
||||
}
|
||||
|
||||
export { generatorBase64Code, generateUniqueId, isObjectNotEmpty, getIconURL, getCurrentPageConfig };
|
||||
|
Reference in New Issue
Block a user