1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 08:28:11 +00:00

style: move wiki external operations to side panel

This commit is contained in:
liuhongbo
2024-06-14 10:15:58 +08:00
parent e14311ccf1
commit d9803dbcfb
3 changed files with 3 additions and 8 deletions

View File

@@ -38,7 +38,6 @@ class Wiki extends Component {
seadoc_access_token: '',
assets_url: '',
};
this.addNewPageRef = React.createRef();
}
UNSAFE_componentWillMount() {
@@ -202,7 +201,6 @@ class Wiki extends Component {
setCurrentPage={this.setCurrentPage}
currentPageId={this.state.currentPageId}
onUpdatePage={this.onUpdatePage}
addNewPageRef={this.addNewPageRef}
/>
<MainPanel
path={this.state.path}
@@ -216,7 +214,6 @@ class Wiki extends Component {
seadoc_access_token={this.state.seadoc_access_token}
assets_url={this.state.assets_url}
onUpdatePage={this.onUpdatePage}
onAddWikiPage={this.addNewPageRef.current}
/>
<MediaQuery query="(max-width: 767.8px)">
<Modal isOpen={!this.state.closeSideBar} toggle={this.onCloseSide} contentClassName="d-none"></Modal>

View File

@@ -22,7 +22,6 @@ const propTypes = {
config: PropTypes.object,
currentPageId: PropTypes.string,
onUpdatePage: PropTypes.func,
onAddWikiPage: PropTypes.func,
};
class MainPanel extends Component {
@@ -67,7 +66,7 @@ class MainPanel extends Component {
};
render() {
const { permission, pathExist, isDataLoading, isViewFile, config, onAddWikiPage } = this.props;
const { permission, pathExist, isDataLoading, isViewFile, config } = this.props;
const { currentPageConfig = {}, } = this.state;
const isViewingFile = pathExist && !isDataLoading && isViewFile;
const isReadOnly = !(permission === 'rw');
@@ -97,7 +96,6 @@ class MainPanel extends Component {
isWikiReadOnly={isReadOnly}
topSlot={<Input className='sf-wiki-title' onCompositionEnd={this.handleRenameDocument} bsSize="lg" onChange={this.handleRenameDocument} defaultValue={currentPageConfig.name} />}
/>
<WikiExternalOperations onAddWikiPage={onAddWikiPage} />
</>
)}
</div>

View File

@@ -16,6 +16,7 @@ import Page from './models/page';
import wikiAPI from '../../utils/wiki-api';
import { FOLDER } from './constant';
import { Utils } from '../../utils/utils';
import WikiExternalOperations from './wiki-external-operations';
import './side-panel.css';
@@ -29,7 +30,6 @@ const propTypes = {
setCurrentPage: PropTypes.func.isRequired,
currentPageId: PropTypes.string,
onUpdatePage: PropTypes.func.isRequired,
addNewPageRef: PropTypes.object.isRequired,
};
class SidePanel extends Component {
@@ -40,7 +40,6 @@ class SidePanel extends Component {
isShowNewFolderDialog: false,
isShowAddNewPageDialog: false,
};
this.props.addNewPageRef.current = this.handleAddNewPage;
}
confirmDeletePage = (pageId) => {
@@ -381,6 +380,7 @@ class SidePanel extends Component {
<div className="wiki2-side-nav">
{isLoading ? <Loading /> : (isObjectNotEmpty(config) ? this.renderFolderView() : this.renderNoFolder())}
</div>
<WikiExternalOperations onAddWikiPage={this.handleAddNewPage.bind(false)} />
</div>
);
}