diff --git a/frontend/src/pages/wiki2/index.js b/frontend/src/pages/wiki2/index.js index 1618c7822d..4568ac8429 100644 --- a/frontend/src/pages/wiki2/index.js +++ b/frontend/src/pages/wiki2/index.js @@ -39,17 +39,21 @@ class Wiki extends Component { assets_url: '', }; } + UNSAFE_componentWillMount() { if (!Utils.isDesktop()) { this.setState({ closeSideBar: true }); } } + componentDidMount() { this.getWikiConfig(); } + handlePath = () => { return isWiki2 ? 'wikis/' : 'published/'; }; + getWikiConfig = () => { wikiAPI.getWiki2Config(wikiId).then(res => { const { wiki_config, repo_id } = res.data.wiki; @@ -85,6 +89,7 @@ class Wiki extends Component { onError && onError(); }); }; + getFirstPageId = (config) => { if (!config || !Array.isArray(config.navigation)) return ''; for (let i = 0; i < config.navigation.length; i++) { @@ -97,6 +102,7 @@ class Wiki extends Component { } } }; + getSdocFileContent = (docUuid, accessToken) => { const config = { docUuid, @@ -114,9 +120,11 @@ class Wiki extends Component { toaster.danger(errorMsg); }); }; + onCloseSide = () => { this.setState({ closeSideBar: !this.state.closeSideBar }); }; + showPage = (pageId, filePath) => { this.setState({ isDataLoading: true, @@ -142,6 +150,7 @@ class Wiki extends Component { const fileUrl = `${siteRoot}${this.handlePath()}${wikiId}/?${params.toString()}`; window.history.pushState({ url: fileUrl, path: filePath }, filePath, fileUrl); }; + setCurrentPage = (pageId, callback) => { const { currentPageId, config } = this.state; if (pageId === currentPageId) { @@ -162,6 +171,7 @@ class Wiki extends Component { callback && callback(); }); }; + onUpdatePage = (pageId, newPage) => { if (newPage.name === '') { toaster.danger(gettext('Page name cannot be empty')); diff --git a/frontend/src/pages/wiki2/top-nav/index.jsx b/frontend/src/pages/wiki2/top-nav/index.jsx index 5c68db5e2a..ba7256827c 100644 --- a/frontend/src/pages/wiki2/top-nav/index.jsx +++ b/frontend/src/pages/wiki2/top-nav/index.jsx @@ -36,7 +36,6 @@ function getPaths(navigation, currentPageId, pages) { } function WikiTopNav({ config, currentPageId }) { - console.log('config in wiki top nav',config) const { navigation, pages } = config; const paths = getPaths(navigation, currentPageId, pages); return ( diff --git a/frontend/src/pages/wiki2/utils/index.js b/frontend/src/pages/wiki2/utils/index.js index b9f8204adf..1d7c975369 100644 --- a/frontend/src/pages/wiki2/utils/index.js +++ b/frontend/src/pages/wiki2/utils/index.js @@ -47,4 +47,4 @@ const getCurrentPageConfig = (pages,pageId) => { return pages.filter(page => page.id === pageId)[0] } -export { generatorBase64Code, generateUniqueId, isObjectNotEmpty, getIconURL,getCurrentPageConfig }; +export { generatorBase64Code, generateUniqueId, isObjectNotEmpty, getIconURL, getCurrentPageConfig };