Skip to content

Commit

Permalink
change wiki page no name (#6795)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael18811380328 authored Sep 19, 2024
1 parent 26cdff0 commit fff51af
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion frontend/src/pages/wiki2/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ const WIKI_COVER_LIST = [
'wiki-cover-9.jpg',
];

export { FOLDER, PAGE, WIKI_COVER_LIST };
const DEFAULT_PAGE_NAME = 'Untitled';

export { FOLDER, PAGE, WIKI_COVER_LIST, DEFAULT_PAGE_NAME };
6 changes: 3 additions & 3 deletions frontend/src/pages/wiki2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import { Modal } from 'reactstrap';
import { Utils } from '../../utils/utils';
import wikiAPI from '../../utils/wiki-api';
import SDocServerApi from '../../utils/sdoc-server-api';
import { wikiId, siteRoot, lang, isWiki2, seadocServerUrl, gettext, wikiPermission } from '../../utils/constants';
import { wikiId, siteRoot, lang, isWiki2, seadocServerUrl, wikiPermission } from '../../utils/constants';
import WikiConfig from './models/wiki-config';
import toaster from '../../components/toast';
import SidePanel from './side-panel';
import MainPanel from './main-panel';
import PageUtils from './wiki-nav/page-utils';
import LocalStorage from '../../utils/local-storage-utils';
import { DEFAULT_PAGE_NAME } from './constant';

import '../../css/layout.css';
import '../../css/side-panel.css';
Expand Down Expand Up @@ -225,8 +226,7 @@ class Wiki extends Component {

onUpdatePage = (pageId, newPage, isUpdateBySide) => {
if (newPage.name === '') {
toaster.danger(gettext('Page name cannot be empty'));
return;
newPage.name = DEFAULT_PAGE_NAME;
}
if (this.state.currentPageId === pageId) {
this.updateDocumentTitle(newPage.name);
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/wiki2/side-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import wikiAPI from '../../utils/wiki-api';
import { Utils } from '../../utils/utils';
import WikiExternalOperations from './wiki-external-operations';
import WikiTrashDialog from './wiki-trash-dialog';
import { DEFAULT_PAGE_NAME } from './constant';

import './side-panel.css';

Expand Down Expand Up @@ -131,7 +132,7 @@ class SidePanel extends Component {
};

// default page name
handleAddNewPage = (jumpToNewPage = true, pageName = 'Untitled') => {
handleAddNewPage = (jumpToNewPage = true, pageName = DEFAULT_PAGE_NAME) => {
if (this.isAddingPage === true) return;
this.isAddingPage = true;
wikiAPI.createWiki2Page(wikiId, pageName).then(res => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/wiki2/wiki-nav/wiki-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class WikiNav extends Component {
})}
{wikiPermission !== 'public' &&
<div className='wiki2-trash' onClick={this.props.toggelTrashDialog}>
<span className="sf3-font-recycle1 sf3-font mr-2"></span>
<span className="sf3-font-trash sf3-font mr-2"></span>
<span>{gettext('Trash')}</span>
</div>
}
Expand Down

0 comments on commit fff51af

Please sign in to comment.