1
0
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:
liuhongbo
2024-06-11 18:14:14 +08:00
parent db47d9cae9
commit fa5315bae8
5 changed files with 39 additions and 16 deletions

View File

@@ -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

View File

@@ -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>

View File

@@ -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 };