From 76102db2a92b4b972aa48fcbb6b7f4253298c89c Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Wed, 10 Mar 2021 19:28:08 +0100 Subject: [PATCH] Fix bug with initially enabled toolbar in browser --- ts/editor/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ts/editor/index.ts b/ts/editor/index.ts index 3e02ffa43..0f0c87f2e 100644 --- a/ts/editor/index.ts +++ b/ts/editor/index.ts @@ -4,7 +4,7 @@ import { caretToEnd } from "./helpers"; import { saveField } from "./changeTimer"; import { filterHTML } from "./htmlFilter"; -import { updateButtonState } from "./toolbar"; +import { updateButtonState, disableButtons } from "./toolbar"; import { EditorField } from "./editorField"; import { LabelContainer } from "./labelContainer"; @@ -113,6 +113,11 @@ export function setFields(fields: [string, string][]): void { forEditorField(fields, (field, [name, fieldContent]) => field.initialize(name, color, fieldContent) ); + + if (!getCurrentField()) { + // when initial focus of the window is not on editor (e.g. browser) + disableButtons(); + } } export function setBackgrounds(cols: ("dupe" | "")[]): void {