From 1ddf1b8c54fcda9fe89e6c4531739f76d7652f52 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 22 Sep 2024 11:19:38 +0800 Subject: refactor: rename data attribute for editor data-layout -> data-mode This prevents confusing with data-layout in dumbymap --- src/editor.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/editor.mjs') diff --git a/src/editor.mjs b/src/editor.mjs index 6d13816..897a0d1 100644 --- a/src/editor.mjs +++ b/src/editor.mjs @@ -10,10 +10,10 @@ const HtmlContainer = document.querySelector(".DumbyMap") const textArea = document.querySelector(".editor textarea") const toggleEditing = () => { - if (document.body.getAttribute("data-layout") === "editing") { - document.body.removeAttribute("data-layout") + if (document.body.getAttribute("data-mode") === "editing") { + document.body.removeAttribute("data-mode") } else { - document.body.setAttribute("data-layout", "editing") + document.body.setAttribute("data-mode", "editing") } HtmlContainer.setAttribute("data-layout", "normal") } @@ -560,7 +560,7 @@ document.onkeydown = (e) => { const layoutObserver = new MutationObserver(() => { const layout = HtmlContainer.getAttribute('data-layout') if (layout !== 'normal') { - document.body.removeAttribute('data-layout') + document.body.removeAttribute('data-mode') } }) -- cgit v1.2.3-70-g09d2