mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-10 18:23:21 +08:00
fix(tutorial-tips): Recompute pos when theme changes
This commit is contained in:
parent
0af15efae4
commit
6729ade1cc
1 changed files with 8 additions and 3 deletions
|
@ -125,6 +125,11 @@ export default function HasTutorialTip(ComposedComponent, TipConfig) {
|
||||||
this._workspaceTimer = setTimeout(this._onTooltipStateChanged, 0);
|
this._workspaceTimer = setTimeout(this._onTooltipStateChanged, 0);
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
this._disposables = [
|
||||||
|
NylasEnv.themes.onDidChangeActiveThemes(() => {
|
||||||
|
this._themesTimer = setTimeout(this._onRecomputeTooltipPosition, 0);
|
||||||
|
}),
|
||||||
|
]
|
||||||
window.addEventListener('resize', this._onRecomputeTooltipPosition);
|
window.addEventListener('resize', this._onRecomputeTooltipPosition);
|
||||||
|
|
||||||
// unfortunately, we can't render() a container around ComposedComponent
|
// unfortunately, we can't render() a container around ComposedComponent
|
||||||
|
@ -150,13 +155,13 @@ export default function HasTutorialTip(ComposedComponent, TipConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
for (const unlisten of this._unlisteners) {
|
this._unlisteners.forEach((unlisten) => unlisten())
|
||||||
unlisten();
|
this._disposables.forEach((disposable) => disposable.dispose())
|
||||||
}
|
|
||||||
|
|
||||||
window.removeEventListener('resize', this._onRecomputeTooltipPosition);
|
window.removeEventListener('resize', this._onRecomputeTooltipPosition);
|
||||||
this.tipNode.parentNode.removeChild(this.tipNode);
|
this.tipNode.parentNode.removeChild(this.tipNode);
|
||||||
clearTimeout(this._workspaceTimer);
|
clearTimeout(this._workspaceTimer);
|
||||||
|
clearTimeout(this._themesTimer);
|
||||||
|
|
||||||
TipsStore.unmountedTip(TipKey);
|
TipsStore.unmountedTip(TipKey);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue