mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 16:31:13 +00:00
style: move wiki external operations to side panel
This commit is contained in:
@@ -38,7 +38,6 @@ class Wiki extends Component {
|
|||||||
seadoc_access_token: '',
|
seadoc_access_token: '',
|
||||||
assets_url: '',
|
assets_url: '',
|
||||||
};
|
};
|
||||||
this.addNewPageRef = React.createRef();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
UNSAFE_componentWillMount() {
|
||||||
@@ -202,7 +201,6 @@ class Wiki extends Component {
|
|||||||
setCurrentPage={this.setCurrentPage}
|
setCurrentPage={this.setCurrentPage}
|
||||||
currentPageId={this.state.currentPageId}
|
currentPageId={this.state.currentPageId}
|
||||||
onUpdatePage={this.onUpdatePage}
|
onUpdatePage={this.onUpdatePage}
|
||||||
addNewPageRef={this.addNewPageRef}
|
|
||||||
/>
|
/>
|
||||||
<MainPanel
|
<MainPanel
|
||||||
path={this.state.path}
|
path={this.state.path}
|
||||||
@@ -216,7 +214,6 @@ class Wiki extends Component {
|
|||||||
seadoc_access_token={this.state.seadoc_access_token}
|
seadoc_access_token={this.state.seadoc_access_token}
|
||||||
assets_url={this.state.assets_url}
|
assets_url={this.state.assets_url}
|
||||||
onUpdatePage={this.onUpdatePage}
|
onUpdatePage={this.onUpdatePage}
|
||||||
onAddWikiPage={this.addNewPageRef.current}
|
|
||||||
/>
|
/>
|
||||||
<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>
|
||||||
|
@@ -22,7 +22,6 @@ const propTypes = {
|
|||||||
config: PropTypes.object,
|
config: PropTypes.object,
|
||||||
currentPageId: PropTypes.string,
|
currentPageId: PropTypes.string,
|
||||||
onUpdatePage: PropTypes.func,
|
onUpdatePage: PropTypes.func,
|
||||||
onAddWikiPage: PropTypes.func,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MainPanel extends Component {
|
class MainPanel extends Component {
|
||||||
@@ -67,7 +66,7 @@ class MainPanel extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { permission, pathExist, isDataLoading, isViewFile, config, onAddWikiPage } = this.props;
|
const { permission, pathExist, isDataLoading, isViewFile, config } = this.props;
|
||||||
const { currentPageConfig = {}, } = this.state;
|
const { currentPageConfig = {}, } = this.state;
|
||||||
const isViewingFile = pathExist && !isDataLoading && isViewFile;
|
const isViewingFile = pathExist && !isDataLoading && isViewFile;
|
||||||
const isReadOnly = !(permission === 'rw');
|
const isReadOnly = !(permission === 'rw');
|
||||||
@@ -97,7 +96,6 @@ class MainPanel extends Component {
|
|||||||
isWikiReadOnly={isReadOnly}
|
isWikiReadOnly={isReadOnly}
|
||||||
topSlot={<Input className='sf-wiki-title' onCompositionEnd={this.handleRenameDocument} bsSize="lg" onChange={this.handleRenameDocument} defaultValue={currentPageConfig.name} />}
|
topSlot={<Input className='sf-wiki-title' onCompositionEnd={this.handleRenameDocument} bsSize="lg" onChange={this.handleRenameDocument} defaultValue={currentPageConfig.name} />}
|
||||||
/>
|
/>
|
||||||
<WikiExternalOperations onAddWikiPage={onAddWikiPage} />
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -16,6 +16,7 @@ import Page from './models/page';
|
|||||||
import wikiAPI from '../../utils/wiki-api';
|
import wikiAPI from '../../utils/wiki-api';
|
||||||
import { FOLDER } from './constant';
|
import { FOLDER } from './constant';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
|
import WikiExternalOperations from './wiki-external-operations';
|
||||||
|
|
||||||
import './side-panel.css';
|
import './side-panel.css';
|
||||||
|
|
||||||
@@ -29,7 +30,6 @@ const propTypes = {
|
|||||||
setCurrentPage: PropTypes.func.isRequired,
|
setCurrentPage: PropTypes.func.isRequired,
|
||||||
currentPageId: PropTypes.string,
|
currentPageId: PropTypes.string,
|
||||||
onUpdatePage: PropTypes.func.isRequired,
|
onUpdatePage: PropTypes.func.isRequired,
|
||||||
addNewPageRef: PropTypes.object.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SidePanel extends Component {
|
class SidePanel extends Component {
|
||||||
@@ -40,7 +40,6 @@ class SidePanel extends Component {
|
|||||||
isShowNewFolderDialog: false,
|
isShowNewFolderDialog: false,
|
||||||
isShowAddNewPageDialog: false,
|
isShowAddNewPageDialog: false,
|
||||||
};
|
};
|
||||||
this.props.addNewPageRef.current = this.handleAddNewPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmDeletePage = (pageId) => {
|
confirmDeletePage = (pageId) => {
|
||||||
@@ -381,6 +380,7 @@ class SidePanel extends Component {
|
|||||||
<div className="wiki2-side-nav">
|
<div className="wiki2-side-nav">
|
||||||
{isLoading ? <Loading /> : (isObjectNotEmpty(config) ? this.renderFolderView() : this.renderNoFolder())}
|
{isLoading ? <Loading /> : (isObjectNotEmpty(config) ? this.renderFolderView() : this.renderNoFolder())}
|
||||||
</div>
|
</div>
|
||||||
|
<WikiExternalOperations onAddWikiPage={this.handleAddNewPage.bind(false)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user