set browser tab title (#220)
* Update the browser tab title The tab title will be set to the same title as the "NavigationBar" with "- Tachidesk" as the suffix * Set the manga title and chapter name as browser tab title in the reader While the reader is still loading the "mangaId" and the "chapterIndex" will be set as the title.
This commit is contained in:
@@ -14,7 +14,7 @@ type ContextType = {
|
||||
|
||||
// AppBar title
|
||||
title: string
|
||||
setTitle: React.Dispatch<React.SetStateAction<string>>
|
||||
setTitle: (title: string) => void
|
||||
|
||||
// AppBar action buttons
|
||||
action: any
|
||||
|
||||
@@ -21,11 +21,16 @@ export default function NavBarProvider({ children }:IProps) {
|
||||
value: <div />,
|
||||
});
|
||||
|
||||
const updateTitle = (newTitle: string) => {
|
||||
document.title = `${newTitle} - Tachidesk`;
|
||||
setTitle(newTitle);
|
||||
};
|
||||
|
||||
const value = {
|
||||
defaultBackTo,
|
||||
setDefaultBackTo,
|
||||
title,
|
||||
setTitle,
|
||||
setTitle: updateTitle,
|
||||
action,
|
||||
setAction,
|
||||
override,
|
||||
|
||||
Reference in New Issue
Block a user