Skip to content

Commit 807cb60

Browse files
feat(quicktools): hide quicktools on media files, enable toggler by default, and add search button
1 parent c152f54 commit 807cb60

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/lib/applySettings.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export default {
3131
afterRender() {
3232
const { value: settings } = appSettings;
3333
const { $toggler } = quickTools;
34-
if (settings.floatingButton) {
34+
const activeFile = editorManager.activeFile;
35+
if (settings.floatingButton && !activeFile?.hideQuickTools) {
3536
clearTimeout($toggler._hideTimeout);
3637
$toggler._hideTimeout = null;
3738
$toggler.classList.remove("hide");
@@ -47,7 +48,11 @@ export default {
4748
}, 300);
4849
}
4950

50-
actions("set-height", settings.quickTools);
51+
if (activeFile?.hideQuickTools) {
52+
actions("set-height", { height: 0, save: false });
53+
} else {
54+
actions("set-height", settings.quickTools);
55+
}
5156
fonts.setAppFont(settings.appFont);
5257
fonts.setEditorFont(settings.editorFont);
5358
if (!themes.applied) {

src/lib/openFile.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ export default async function openFile(file, options = {}) {
180180
tabIcon: "file file_type_video",
181181
content: videoContainer,
182182
render: true,
183+
hideQuickTools: true,
183184
});
184185
return;
185186
}
@@ -347,6 +348,7 @@ export default async function openFile(file, options = {}) {
347348
tabIcon: "file file_type_image",
348349
content: imageContainer,
349350
render: true,
351+
hideQuickTools: true,
350352
});
351353
return;
352354
}
@@ -374,6 +376,7 @@ export default async function openFile(file, options = {}) {
374376
tabIcon: "file file_type_audio",
375377
content: audioPlayer.container,
376378
render: true,
379+
hideQuickTools: true,
377380
});
378381
audioTab.onclose = () => {
379382
audioPlayer.cleanup();

src/lib/settings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ class Settings {
142142
fadeFoldWidgets: false,
143143
autoCorrect: true,
144144
openFileListPos: this.OPEN_FILE_LIST_POS_HEADER,
145-
quickTools: 2,
145+
quickTools: 1,
146146
quickToolsTriggerMode: this.QUICKTOOLS_TRIGGER_MODE_TOUCH,
147147
appFont: "",
148148
editorFont: "Roboto Mono",
149149
vibrateOnTap: true,
150150
fullscreen: false,
151-
floatingButton: false,
151+
floatingButton: true,
152152
liveAutoCompletion: true,
153153
localWordCompletion: true,
154154
languageCompletion: true,
@@ -190,7 +190,7 @@ class Settings {
190190
useTextareaForIME: false,
191191
touchMoveThreshold: Math.round((1 / devicePixelRatio) * 10) / 20,
192192
quicktoolsItems: [
193-
2, 1, 34, 3, 4, 18, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 33, 21, 20,
193+
2, 1, 5, 3, 4, 18, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 33, 21, 20,
194194
16, 19, 17, 23, 24, 25, 26, 27, 28, 29, 30, 31,
195195
],
196196
excludeFolders: this.#excludeFolders,

src/settings/appSettings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ export default function otherSettings() {
443443
break;
444444

445445
case "floatingButton":
446-
if (value) {
446+
if (value && !editorManager.activeFile?.hideQuickTools) {
447447
clearTimeout(quickTools.$toggler._hideTimeout);
448448
quickTools.$toggler._hideTimeout = null;
449449
quickTools.$toggler.classList.remove("hide");

0 commit comments

Comments
 (0)