Backport 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 Damien Elmes
parent 7e14f72121
commit 6cdaa48cdc

View file

@ -5,7 +5,7 @@ import { nodeIsInline, caretToEnd } from "./helpers";
import { bridgeCommand } from "./lib"; import { bridgeCommand } from "./lib";
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 { onInput, onKey, onKeyUp } from "./inputHandlers"; import { onInput, onKey, onKeyUp } from "./inputHandlers";
import { onFocus, onBlur } from "./focusHandlers"; import { onFocus, onBlur } from "./focusHandlers";
@ -302,6 +302,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" | "")[]) { export function setBackgrounds(cols: ("dupe" | "")[]) {