mirror of
https://github.com/mattermost/focalboard.git
synced 2024-11-27 08:31:20 +02:00
Respect the mattermost icon when focalboard is used as a plugin (#1185)
This commit is contained in:
parent
6ad11e072b
commit
fae2ac150e
@ -66,7 +66,6 @@ type Props = {
|
||||
}
|
||||
|
||||
const MainApp = (props: Props) => {
|
||||
const [faviconStored, setFaviconStored] = useState(false)
|
||||
wsClient.initPlugin(manifest.id, props.webSocketClient)
|
||||
|
||||
useEffect(() => {
|
||||
@ -84,24 +83,11 @@ const MainApp = (props: Props) => {
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const oldLinks = document.querySelectorAll("link[rel*='icon']") as NodeListOf<HTMLLinkElement>
|
||||
if (!oldLinks) {
|
||||
return () => null
|
||||
}
|
||||
setFaviconStored(true)
|
||||
|
||||
return () => {
|
||||
document.querySelectorAll("link[rel*='icon']").forEach((n) => n.remove())
|
||||
oldLinks.forEach((link) => document.getElementsByTagName('head')[0].appendChild(link))
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<ReduxProvider store={store}>
|
||||
<div id='focalboard-app'>
|
||||
{faviconStored && <App/>}
|
||||
<App/>
|
||||
</div>
|
||||
<div id='focalboard-root-portal'/>
|
||||
</ReduxProvider>
|
||||
|
@ -247,6 +247,11 @@ class Utils {
|
||||
// favicon
|
||||
|
||||
static setFavicon(icon?: string): void {
|
||||
if (Utils.isFocalboardPlugin()) {
|
||||
// Do not change the icon from focalboard plugin
|
||||
return
|
||||
}
|
||||
|
||||
if (!icon) {
|
||||
document.querySelector("link[rel*='icon']")?.remove()
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user