mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 03:43:45 +08:00
FIX: keeps panel size when changing content (#21698)
Before this commit the following actions would have shown the issue: - visit a thread - changes the width of the side panel - open threads list - the size has reverted to previous state This was caused by the width change to not correctly be tracked.
This commit is contained in:
parent
c543a3207d
commit
bce56d843c
|
@ -9,7 +9,7 @@
|
||||||
}}
|
}}
|
||||||
style={{if
|
style={{if
|
||||||
(and this.site.desktopView this.chatStateManager.isFullPageActive)
|
(and this.site.desktopView this.chatStateManager.isFullPageActive)
|
||||||
this.width
|
this.widthStyle
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{{yield}}
|
{{yield}}
|
||||||
|
|
|
@ -12,25 +12,13 @@ export default class ChatSidePanel extends Component {
|
||||||
@service site;
|
@service site;
|
||||||
|
|
||||||
@tracked sidePanel;
|
@tracked sidePanel;
|
||||||
|
@tracked widthStyle;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
setSidePanel(element) {
|
setSidePanel(element) {
|
||||||
this.sidePanel = element;
|
this.sidePanel = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
get width() {
|
|
||||||
if (!this.sidePanel) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const maxWidth = Math.min(
|
|
||||||
this.#maxWidth(this.sidePanel),
|
|
||||||
this.chatSidePanelSize.width
|
|
||||||
);
|
|
||||||
|
|
||||||
return htmlSafe(`width:${maxWidth}px`);
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
didResize(element, size) {
|
didResize(element, size) {
|
||||||
if (this.isDestroying || this.isDestroyed) {
|
if (this.isDestroying || this.isDestroyed) {
|
||||||
|
@ -43,6 +31,7 @@ export default class ChatSidePanel extends Component {
|
||||||
if (mainPanelWidth > MIN_CHAT_CHANNEL_WIDTH) {
|
if (mainPanelWidth > MIN_CHAT_CHANNEL_WIDTH) {
|
||||||
this.chatSidePanelSize.width = size.width;
|
this.chatSidePanelSize.width = size.width;
|
||||||
element.style.width = size.width + "px";
|
element.style.width = size.width + "px";
|
||||||
|
this.widthStyle = htmlSafe(`width:${size.width}px`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user