From a87f81f00bd711fe59aa4ffcfe7048851d6fb145 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Thu, 17 Jun 2021 20:57:20 +0200 Subject: [PATCH] Only toggle the current field, not all --- ts/editor/TemplateButtons.svelte | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ts/editor/TemplateButtons.svelte b/ts/editor/TemplateButtons.svelte index 328fd0817..2fd298f56 100644 --- a/ts/editor/TemplateButtons.svelte +++ b/ts/editor/TemplateButtons.svelte @@ -18,7 +18,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { wrap } from "./wrap"; import { appendInParentheses } from "./helpers"; - import { forEditorField, getEditorField } from "."; + import { getCurrentField } from "."; import { paperclipIcon, micIcon, functionIcon, xmlIcon } from "./icons"; export let api = {}; @@ -32,13 +32,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } function checkHtmlEdit() { - return getEditorField(0)!.editingArea.codable.active; + const currentField = getCurrentField(); + return currentField ? currentField.codable.active : false; } function onHtmlEdit() { - forEditorField([], (field) => { - field.editingArea.toggleHtmlEdit(); - }); + const currentField = getCurrentField(); + if (currentField) { + currentField.toggleHtmlEdit(); + } } @@ -187,7 +189,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html updateState(event); }} on:mount={createShortcut} - disables={false} > {@html xmlIcon}