Skip to content

Commit 783f851

Browse files
committed
feat: Adds hideQuickTools property to EditorFile
Adds `hideQuickTools` boolean property to EditorFile (defaults to false) to control visibility of quicktools for editortabs as in many cases that quicktools toggler button hides some content of tab which is annoying
1 parent 6e76030 commit 783f851

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

src/handlers/quickTools.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ export default function actions(action, value) {
161161
return true;
162162

163163
case "set-height":
164-
setHeight(value);
164+
if (typeof value === "object") {
165+
setHeight(value.height, value.save);
166+
} else {
167+
setHeight(value);
168+
}
165169
return true;
166170

167171
case "search-prev":
@@ -275,12 +279,14 @@ function toggle() {
275279
focusEditor();
276280
}
277281

278-
function setHeight(height = 1) {
282+
function setHeight(height = 1, save = true) {
279283
const { $footer, $row1, $row2 } = quickTools;
280284
const { editor } = editorManager;
281285

282286
setFooterHeight(height);
283-
appSettings.update({ quickTools: height }, false);
287+
if (save) {
288+
appSettings.update({ quickTools: height }, false);
289+
}
284290
editor.resize(true);
285291

286292
if (!height) {

src/lib/editorFile.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ export default class EditorFile {
4949
* @type {HTMLElement}
5050
*/
5151
#content = null;
52+
/**
53+
* Whether to hide quicktools for this tab
54+
* @type {boolean}
55+
*/
56+
hideQuickTools = false;
5257

5358
/**
5459
* Custom stylesheets for tab
@@ -186,6 +191,8 @@ export default class EditorFile {
186191
const { addFile, getFile } = editorManager;
187192
let doesExists = null;
188193

194+
this.hideQuickTools = options?.hideQuickTools || false;
195+
189196
// if options are passed
190197
if (options) {
191198
// if options doesn't contains id, and provide a new id

src/lib/editorManager.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ScrollBar from "components/scrollbar";
99
import SideButton, { sideButtonContainer } from "components/sideButton";
1010
import keyboardHandler from "handlers/keyboard";
1111
import { keydownState } from "handlers/keyboard";
12+
import actions from "handlers/quickTools";
1213
import sidebarApps from "sidebarApps";
1314
import EditorFile from "./editorFile";
1415
import appSettings from "./settings";
@@ -645,6 +646,14 @@ async function EditorManager($header, $body) {
645646

646647
manager.activeFile = file;
647648

649+
if (file.hideQuickTools) {
650+
root.classList.add("hide-floating-button");
651+
actions("set-height", { height: 0, save: false });
652+
} else {
653+
root.classList.remove("hide-floating-button");
654+
actions("set-height", appSettings.value.quickTools);
655+
}
656+
648657
if (file.type === "editor") {
649658
editor.setSession(file.session);
650659
editor.setReadOnly(!file.editable || !!file.loading);

0 commit comments

Comments
 (0)