Merge pull request #1063 from hgiesel/edithtmlfix

Fix bug with initially enabled toolbar in browser
This commit is contained in:
Damien Elmes 2021-03-11 10:02:41 +10:00 committed by GitHub
commit 763800ad9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,7 @@
import { caretToEnd } from "./helpers"; import { caretToEnd } from "./helpers";
import { saveField } from "./changeTimer"; import { saveField } from "./changeTimer";
import { filterHTML } from "./htmlFilter"; import { filterHTML } from "./htmlFilter";
import { updateButtonState } from "./toolbar"; import { updateButtonState, disableButtons } from "./toolbar";
import { EditorField } from "./editorField"; import { EditorField } from "./editorField";
import { LabelContainer } from "./labelContainer"; import { LabelContainer } from "./labelContainer";
@ -113,6 +113,11 @@ export function setFields(fields: [string, string][]): void {
forEditorField(fields, (field, [name, fieldContent]) => forEditorField(fields, (field, [name, fieldContent]) =>
field.initialize(name, color, 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 { export function setBackgrounds(cols: ("dupe" | "")[]): void {