Skip to content

Commit

Permalink
delete page file
Browse files Browse the repository at this point in the history
  • Loading branch information
JoinTyang committed May 14, 2024
1 parent 15b63d5 commit eae10e8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/src/pages/wiki2/side-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ViewStructureFooter from './view-structure/view-structure-footer';
import { generateUniqueId, getIconURL, isObjectNotEmpty } from './utils';
import Folder from './models/folder';
import Page from './models/page';
import { seafileAPI } from '../../utils/seafile-api';

export const FOLDER = 'folder';
export const PAGE = 'page';
Expand Down Expand Up @@ -98,9 +99,13 @@ class SidePanel extends Component {
const config = deepCopy(this.props.config);
const { pages, navigation } = config;
const index = PageUtils.getPageIndexById(pageId, pages);
const pageIndex = pages.findIndex(item => item.id === pageId);
let path = pages[pageIndex].path

config.pages.splice(index, 1);
PageUtils.deletePage(navigation, pageId);
this.props.saveWikiConfig(config);
seafileAPI.deleteFile(repoID, path);
if (config.pages.length > 0) {
this.props.setCurrentPage(config.pages[0].id);
} else {
Expand Down

0 comments on commit eae10e8

Please sign in to comment.