mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-07 01:41:39 +00:00
Change page title (#6350)
* 01 change component name * 02 change wiki title
This commit is contained in:
@@ -198,6 +198,7 @@ class Wiki extends Component {
|
|||||||
callback && callback();
|
callback && callback();
|
||||||
});
|
});
|
||||||
this.cacheHistoryFiles(docUuid, name, id);
|
this.cacheHistoryFiles(docUuid, name, id);
|
||||||
|
this.updateDocumentTitle(name);
|
||||||
};
|
};
|
||||||
|
|
||||||
onUpdatePage = (pageId, newPage) => {
|
onUpdatePage = (pageId, newPage) => {
|
||||||
@@ -205,6 +206,9 @@ class Wiki extends Component {
|
|||||||
toaster.danger(gettext('Page name cannot be empty'));
|
toaster.danger(gettext('Page name cannot be empty'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.state.currentPageId === pageId) {
|
||||||
|
this.updateDocumentTitle(newPage.name);
|
||||||
|
}
|
||||||
const { config } = this.state;
|
const { config } = this.state;
|
||||||
let pages = config.pages;
|
let pages = config.pages;
|
||||||
let newPages = pages.map(page => {
|
let newPages = pages.map(page => {
|
||||||
@@ -217,6 +221,10 @@ class Wiki extends Component {
|
|||||||
this.saveWikiConfig(newConfig);
|
this.saveWikiConfig(newConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
updateDocumentTitle = (newTitle) => {
|
||||||
|
document.title = newTitle;
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div id="main" className="wiki-main">
|
<div id="main" className="wiki-main">
|
||||||
|
@@ -4,7 +4,7 @@ import classnames from 'classnames';
|
|||||||
import { Input } from 'reactstrap';
|
import { Input } from 'reactstrap';
|
||||||
import { gettext } from '../../../utils/constants';
|
import { gettext } from '../../../utils/constants';
|
||||||
import { WIKI_COVER_LIST } from '../constant';
|
import { WIKI_COVER_LIST } from '../constant';
|
||||||
import HeaderIcon from './page-icon';
|
import PageIcon from './page-icon';
|
||||||
import { generateARandomEmoji, generateEmojiIcon } from '../utils/emoji-utils';
|
import { generateARandomEmoji, generateEmojiIcon } from '../utils/emoji-utils';
|
||||||
|
|
||||||
import './page-title.css';
|
import './page-title.css';
|
||||||
@@ -63,7 +63,7 @@ const PageTitle = ({ currentPageConfig, onUpdatePage }) => {
|
|||||||
return (
|
return (
|
||||||
<div id="wiki-page-title" className='wiki-page-title-wrapper' onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
|
<div id="wiki-page-title" className='wiki-page-title-wrapper' onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
|
||||||
{currentPageConfig.icon && (
|
{currentPageConfig.icon && (
|
||||||
<HeaderIcon currentPageConfig={currentPageConfig} onUpdatePage={onUpdatePage} />
|
<PageIcon currentPageConfig={currentPageConfig} onUpdatePage={onUpdatePage} />
|
||||||
)}
|
)}
|
||||||
<div className={classnames('wiki-page-controller', {'show': isShowController})}>
|
<div className={classnames('wiki-page-controller', {'show': isShowController})}>
|
||||||
{!currentPageConfig.icon && (
|
{!currentPageConfig.icon && (
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
{% render_bundle 'wiki2' 'css' %}
|
{% render_bundle 'wiki2' 'css' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block wiki_title %} {{h1_head_content}} - {{repo_name}}{% endblock %}
|
{% block wiki_title %}{{repo_name}}{% endblock %}
|
||||||
|
|
||||||
{% block extra_script %}
|
{% block extra_script %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
Reference in New Issue
Block a user