1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-10 19:29:56 +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

@@ -14,7 +14,7 @@
"@gatsbyjs/reach-router": "1.3.9",
"@seafile/react-image-lightbox": "2.0.2",
"@seafile/resumablejs": "1.1.16",
"@seafile/sdoc-editor": "0.5.69",
"@seafile/sdoc-editor": "0.5.70",
"@seafile/seafile-calendar": "0.0.12",
"@seafile/seafile-editor": "1.0.99",
"@uiw/codemirror-extensions-langs": "^4.19.4",
@@ -4617,9 +4617,9 @@
"integrity": "sha512-8rBbmAEuuwOAGHYGCtEzpx+bxAcGS+V30otMmhRe7bPAdh4E57RWgCa8x7pkzHGFlY1t5d+ILz1gojvPVMYQig=="
},
"node_modules/@seafile/sdoc-editor": {
"version": "0.5.69",
"resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-0.5.69.tgz",
"integrity": "sha512-9MFvdCuvFGPulhWHFR94AJlxpTl2OwxNewr/BazaJJK2tpdSCZLtY18zpLJotNWjyrALmpJwej7jVbauFhPP1w==",
"version": "0.5.70",
"resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-0.5.70.tgz",
"integrity": "sha512-V7QecojmGV/6D1F/eOGHSCeOpvJVMee6E3FArWDnf+IRYUs2rvvSKZ/STM2eutIHdjEH5SijkUCs9WySmdDDdA==",
"dependencies": {
"@seafile/print-js": "1.6.5",
"@seafile/react-image-lightbox": "2.0.4",
@@ -31292,9 +31292,9 @@
"integrity": "sha512-8rBbmAEuuwOAGHYGCtEzpx+bxAcGS+V30otMmhRe7bPAdh4E57RWgCa8x7pkzHGFlY1t5d+ILz1gojvPVMYQig=="
},
"@seafile/sdoc-editor": {
"version": "0.5.69",
"resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-0.5.69.tgz",
"integrity": "sha512-9MFvdCuvFGPulhWHFR94AJlxpTl2OwxNewr/BazaJJK2tpdSCZLtY18zpLJotNWjyrALmpJwej7jVbauFhPP1w==",
"version": "0.5.70",
"resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-0.5.70.tgz",
"integrity": "sha512-V7QecojmGV/6D1F/eOGHSCeOpvJVMee6E3FArWDnf+IRYUs2rvvSKZ/STM2eutIHdjEH5SijkUCs9WySmdDDdA==",
"requires": {
"@seafile/print-js": "1.6.5",
"@seafile/react-image-lightbox": "2.0.4",

View File

@@ -9,7 +9,7 @@
"@gatsbyjs/reach-router": "1.3.9",
"@seafile/react-image-lightbox": "2.0.2",
"@seafile/resumablejs": "1.1.16",
"@seafile/sdoc-editor": "0.5.69",
"@seafile/sdoc-editor": "0.5.70",
"@seafile/seafile-calendar": "0.0.12",
"@seafile/seafile-editor": "1.0.99",
"@uiw/codemirror-extensions-langs": "^4.19.4",

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