Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/handlers/quickTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ export default function actions(action, value) {
return true;

case "set-height":
setHeight(value);
if (typeof value === "object") {
setHeight(value.height, value.save);
} else {
setHeight(value);
}
return true;

case "search-prev":
Expand Down Expand Up @@ -275,12 +279,14 @@ function toggle() {
focusEditor();
}

function setHeight(height = 1) {
function setHeight(height = 1, save = true) {
const { $footer, $row1, $row2 } = quickTools;
const { editor } = editorManager;

setFooterHeight(height);
appSettings.update({ quickTools: height }, false);
if (save) {
appSettings.update({ quickTools: height }, false);
}
editor.resize(true);

if (!height) {
Expand Down
7 changes: 7 additions & 0 deletions src/lib/editorFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export default class EditorFile {
* @type {HTMLElement}
*/
#content = null;
/**
* Whether to hide quicktools for this tab
* @type {boolean}
*/
hideQuickTools = false;

/**
* Custom stylesheets for tab
Expand Down Expand Up @@ -186,6 +191,8 @@ export default class EditorFile {
const { addFile, getFile } = editorManager;
let doesExists = null;

this.hideQuickTools = options?.hideQuickTools || false;

// if options are passed
if (options) {
// if options doesn't contains id, and provide a new id
Expand Down
9 changes: 9 additions & 0 deletions src/lib/editorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ScrollBar from "components/scrollbar";
import SideButton, { sideButtonContainer } from "components/sideButton";
import keyboardHandler from "handlers/keyboard";
import { keydownState } from "handlers/keyboard";
import actions from "handlers/quickTools";
import sidebarApps from "sidebarApps";
import EditorFile from "./editorFile";
import appSettings from "./settings";
Expand Down Expand Up @@ -645,6 +646,14 @@ async function EditorManager($header, $body) {

manager.activeFile = file;

if (file.hideQuickTools) {
root.classList.add("hide-floating-button");
actions("set-height", { height: 0, save: false });
} else {
root.classList.remove("hide-floating-button");
actions("set-height", appSettings.value.quickTools);
}

if (file.type === "editor") {
editor.setSession(file.session);
editor.setReadOnly(!file.editable || !!file.loading);
Expand Down
1 change: 1 addition & 0 deletions src/lib/loadPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const THEME_IDENTIFIERS = new Set([
"sweet",
"moonlight",
"bluloco",
"acode.plugin.extra_syntax_highlights",
]);

export default async function loadPlugins(loadOnlyTheme = false) {
Expand Down
11 changes: 9 additions & 2 deletions src/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,15 @@ async function loadApp() {
function onEditorUpdate(mode, saveState = true) {
const { activeFile } = editorManager;

if (!$editMenuToggler.isConnected) {
$header.insertBefore($editMenuToggler, $header.lastChild);
// if (!$editMenuToggler.isConnected) {
// $header.insertBefore($editMenuToggler, $header.lastChild);
// }
if (activeFile?.type === "page") {
$editMenuToggler.remove();
} else {
if (!$editMenuToggler.isConnected) {
$header.insertBefore($editMenuToggler, $header.lastChild);
}
}

if (mode === "switch-file") {
Expand Down