Skip to content

Commit 87fe392

Browse files
committed
fix(quicktools): hideQuickTools issue of EditorFile tabs on init
1 parent 6c6e92a commit 87fe392

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

src/handlers/quickTools.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,13 @@ function toggle() {
361361

362362
function setHeight(height = 1, save = true) {
363363
const { $footer, $row1, $row2 } = quickTools;
364-
const { editor } = editorManager;
364+
const { editor, activeFile } = editorManager;
365+
366+
// If active file has hideQuickTools, force height to 0 and don't save
367+
if (activeFile?.hideQuickTools) {
368+
height = 0;
369+
save = false;
370+
}
365371

366372
setFooterHeight(height);
367373
if (save) {

src/lib/editorFile.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import tile from "components/tile";
44
import confirm from "dialogs/confirm";
55
import DOMPurify from "dompurify";
66
import startDrag from "handlers/editorFileTab";
7+
import actions from "handlers/quickTools";
78
import tag from "html-tag-js";
89
import mimeTypes from "mime-types";
910
import helpers from "utils/helpers";
@@ -815,6 +816,19 @@ export default class EditorFile {
815816
this.#loadText();
816817
}
817818

819+
// Handle quicktools visibility based on hideQuickTools property
820+
if (this.hideQuickTools) {
821+
root.classList.add("hide-floating-button");
822+
actions("set-height", { height: 0, save: false });
823+
} else {
824+
root.classList.remove("hide-floating-button");
825+
const quickToolsHeight =
826+
appSettings.value.quickTools !== undefined
827+
? appSettings.value.quickTools
828+
: 1;
829+
actions("set-height", { height: quickToolsHeight, save: false });
830+
}
831+
818832
editorManager.header.subText = this.#getTitle();
819833

820834
this.#emit("focus", createFileEvent(this));

src/lib/editorManager.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import quickTools from "components/quickTools";
77
import ScrollBar from "components/scrollbar";
88
import SideButton, { sideButtonContainer } from "components/sideButton";
99
import keyboardHandler, { keydownState } from "handlers/keyboard";
10-
import actions from "handlers/quickTools";
1110
import EditorFile from "./editorFile";
1211
import appSettings from "./settings";
1312
import {
@@ -672,18 +671,6 @@ async function EditorManager($header, $body) {
672671
file.tab.classList.add("active");
673672
file.tab.scrollIntoView();
674673

675-
if (file?.hideQuickTools) {
676-
root.classList.add("hide-floating-button");
677-
actions("set-height", { height: 0, save: false });
678-
} else {
679-
root.classList.remove("hide-floating-button");
680-
const quickToolsHeight =
681-
appSettings.value.quickTools !== undefined
682-
? appSettings.value.quickTools
683-
: 1;
684-
actions("set-height", { height: quickToolsHeight, save: true });
685-
}
686-
687674
$header.text = file.filename;
688675
$header.subText = file.headerSubtitle || "";
689676
manager.onupdate("switch-file");

0 commit comments

Comments
 (0)