mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-30 19:52:28 +08:00
fix(mindmap): pane resizer not always working
This commit is contained in:
parent
ab4e9db864
commit
ccb98d69fa
@ -165,8 +165,7 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup(): void {
|
cleanup(): void {
|
||||||
this.splitInstance?.destroy();
|
this.#destroyResizer();
|
||||||
this.splitInstance = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async doRefresh(note: FNote | null | undefined) {
|
async doRefresh(note: FNote | null | undefined) {
|
||||||
@ -189,18 +188,20 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
|
|||||||
|
|
||||||
// Vertical vs horizontal layout
|
// Vertical vs horizontal layout
|
||||||
const layoutOrientation = (!utils.isMobile() ? options.get("splitEditorOrientation") ?? "horizontal" : "vertical");
|
const layoutOrientation = (!utils.isMobile() ? options.get("splitEditorOrientation") ?? "horizontal" : "vertical");
|
||||||
if (this.layoutOrientation === layoutOrientation && this.isReadOnly === isReadOnly) {
|
if (this.layoutOrientation !== layoutOrientation || this.isReadOnly !== isReadOnly) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$widget
|
this.$widget
|
||||||
.toggleClass("split-horizontal", !isReadOnly && layoutOrientation === "horizontal")
|
.toggleClass("split-horizontal", !isReadOnly && layoutOrientation === "horizontal")
|
||||||
.toggleClass("split-vertical", !isReadOnly && layoutOrientation === "vertical")
|
.toggleClass("split-vertical", !isReadOnly && layoutOrientation === "vertical")
|
||||||
.toggleClass("split-read-only", isReadOnly);
|
.toggleClass("split-read-only", isReadOnly);
|
||||||
this.layoutOrientation = layoutOrientation as ("horizontal" | "vertical");
|
this.layoutOrientation = layoutOrientation as ("horizontal" | "vertical");
|
||||||
this.isReadOnly = isReadOnly;
|
this.isReadOnly = isReadOnly;
|
||||||
|
this.#destroyResizer();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.splitInstance) {
|
||||||
this.#setupResizer();
|
this.#setupResizer();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#setupResizer() {
|
#setupResizer() {
|
||||||
if (!utils.isDesktop()) {
|
if (!utils.isDesktop()) {
|
||||||
@ -226,6 +227,11 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#destroyResizer() {
|
||||||
|
this.splitInstance?.destroy();
|
||||||
|
this.splitInstance = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called upon when the split between the preview and content pane is initialized. Can be used to add additional listeners if needed.
|
* Called upon when the split between the preview and content pane is initialized. Can be used to add additional listeners if needed.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user