mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-11 11:51:27 +00:00
update-favicon
This commit is contained in:
@@ -15,9 +15,7 @@ export default class SdocEditor extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { docName } = window.seafile;
|
||||
const fileIcon = Utils.getFileIconUrl(docName, 192);
|
||||
document.getElementById('favicon').href = fileIcon;
|
||||
this.onSetFavicon();
|
||||
}
|
||||
|
||||
toggleStar = (isStarred) => {
|
||||
@@ -28,6 +26,19 @@ export default class SdocEditor extends React.Component {
|
||||
this.setState({isDraft: false});
|
||||
};
|
||||
|
||||
onSetFavicon = (suffix) => {
|
||||
let { docName } = window.seafile;
|
||||
if (suffix) {
|
||||
docName = docName + suffix;
|
||||
}
|
||||
const fileIcon = Utils.getFileIconUrl(docName, 192);
|
||||
document.getElementById('favicon').href = fileIcon;
|
||||
};
|
||||
|
||||
onNewNotification = () => {
|
||||
this.onSetFavicon('_notification');
|
||||
};
|
||||
|
||||
render() {
|
||||
const { repoID, docPath, docName, docPerm } = window.seafile;
|
||||
const { isStarred, isDraft } = this.state;
|
||||
@@ -42,6 +53,7 @@ export default class SdocEditor extends React.Component {
|
||||
isStarred={isStarred}
|
||||
toggleStar={this.toggleStar}
|
||||
unmarkDraft={this.unmarkDraft}
|
||||
onNewNotification={this.onNewNotification}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
|
Reference in New Issue
Block a user