1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 18:03:48 +00:00

Change page title (#6350)

* 01 change component name

* 02 change wiki title
This commit is contained in:
Michael An
2024-07-16 10:26:57 +08:00
committed by GitHub
parent 7c6866503f
commit 5f3c79d2a8
3 changed files with 11 additions and 3 deletions

View File

@@ -198,6 +198,7 @@ class Wiki extends Component {
callback && callback();
});
this.cacheHistoryFiles(docUuid, name, id);
this.updateDocumentTitle(name);
};
onUpdatePage = (pageId, newPage) => {
@@ -205,6 +206,9 @@ class Wiki extends Component {
toaster.danger(gettext('Page name cannot be empty'));
return;
}
if (this.state.currentPageId === pageId) {
this.updateDocumentTitle(newPage.name);
}
const { config } = this.state;
let pages = config.pages;
let newPages = pages.map(page => {
@@ -217,6 +221,10 @@ class Wiki extends Component {
this.saveWikiConfig(newConfig);
};
updateDocumentTitle = (newTitle) => {
document.title = newTitle;
};
render() {
return (
<div id="main" className="wiki-main">

View File

@@ -4,7 +4,7 @@ import classnames from 'classnames';
import { Input } from 'reactstrap';
import { gettext } from '../../../utils/constants';
import { WIKI_COVER_LIST } from '../constant';
import HeaderIcon from './page-icon';
import PageIcon from './page-icon';
import { generateARandomEmoji, generateEmojiIcon } from '../utils/emoji-utils';
import './page-title.css';
@@ -63,7 +63,7 @@ const PageTitle = ({ currentPageConfig, onUpdatePage }) => {
return (
<div id="wiki-page-title" className='wiki-page-title-wrapper' onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
{currentPageConfig.icon && (
<HeaderIcon currentPageConfig={currentPageConfig} onUpdatePage={onUpdatePage} />
<PageIcon currentPageConfig={currentPageConfig} onUpdatePage={onUpdatePage} />
)}
<div className={classnames('wiki-page-controller', {'show': isShowController})}>
{!currentPageConfig.icon && (

View File

@@ -16,7 +16,7 @@
{% render_bundle 'wiki2' 'css' %}
{% endblock %}
{% block wiki_title %} {{h1_head_content}} - {{repo_name}}{% endblock %}
{% block wiki_title %}{{repo_name}}{% endblock %}
{% block extra_script %}
<script type="text/javascript">