aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-09-22 11:19:38 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-09-22 11:27:09 +0800
commit1ddf1b8c54fcda9fe89e6c4531739f76d7652f52 (patch)
treec866f57ceb0f7a7e4689a841ad5942394a528990 /src
parent25a2a077f7b436c752834f01fbedbbd8fe285512 (diff)
refactor: rename data attribute for editor
data-layout -> data-mode This prevents confusing with data-layout in dumbymap
Diffstat (limited to 'src')
-rw-r--r--src/css/index.css2
-rw-r--r--src/editor.mjs8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/css/index.css b/src/css/index.css
index 3b8a51f..dc4c2e8 100644
--- a/src/css/index.css
+++ b/src/css/index.css
@@ -11,7 +11,7 @@ body {
11 width: 100%; 11 width: 100%;
12 height: 100vh; 12 height: 100vh;
13 13
14 &[data-layout="editing"] { 14 &[data-mode="editing"] {
15 display: flex; 15 display: flex;
16 align-items: stretch; 16 align-items: stretch;
17 gap: 0.5em; 17 gap: 0.5em;
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")
10const textArea = document.querySelector(".editor textarea") 10const textArea = document.querySelector(".editor textarea")
11 11
12const toggleEditing = () => { 12const toggleEditing = () => {
13 if (document.body.getAttribute("data-layout") === "editing") { 13 if (document.body.getAttribute("data-mode") === "editing") {
14 document.body.removeAttribute("data-layout") 14 document.body.removeAttribute("data-mode")
15 } else { 15 } else {
16 document.body.setAttribute("data-layout", "editing") 16 document.body.setAttribute("data-mode", "editing")
17 } 17 }
18 HtmlContainer.setAttribute("data-layout", "normal") 18 HtmlContainer.setAttribute("data-layout", "normal")
19} 19}
@@ -560,7 +560,7 @@ document.onkeydown = (e) => {
560const layoutObserver = new MutationObserver(() => { 560const layoutObserver = new MutationObserver(() => {
561 const layout = HtmlContainer.getAttribute('data-layout') 561 const layout = HtmlContainer.getAttribute('data-layout')
562 if (layout !== 'normal') { 562 if (layout !== 'normal') {
563 document.body.removeAttribute('data-layout') 563 document.body.removeAttribute('data-mode')
564 } 564 }
565}) 565})
566 566