mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:23:46 +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
|
||||
(and this.site.desktopView this.chatStateManager.isFullPageActive)
|
||||
this.width
|
||||
this.widthStyle
|
||||
}}
|
||||
>
|
||||
{{yield}}
|
||||
|
|
|
@ -12,25 +12,13 @@ export default class ChatSidePanel extends Component {
|
|||
@service site;
|
||||
|
||||
@tracked sidePanel;
|
||||
@tracked widthStyle;
|
||||
|
||||
@action
|
||||
setSidePanel(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
|
||||
didResize(element, size) {
|
||||
if (this.isDestroying || this.isDestroyed) {
|
||||
|
@ -43,6 +31,7 @@ export default class ChatSidePanel extends Component {
|
|||
if (mainPanelWidth > MIN_CHAT_CHANNEL_WIDTH) {
|
||||
this.chatSidePanelSize.width = size.width;
|
||||
element.style.width = size.width + "px";
|
||||
this.widthStyle = htmlSafe(`width:${size.width}px`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user