Skip to content

Commit 2586af2

Browse files
committed
Localstorage
Save document in localstorage, retrieve on load, just in case
1 parent 6e7acd8 commit 2586af2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

index.html

+10
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,17 @@
112112
theme: "khidark"
113113
});
114114
result.setSize("100%", "100%");
115+
116+
editor.on("change", (e) => {
117+
let value = e.getValue();
118+
localStorage.setItem("content", value);
119+
});
120+
121+
let content = localStorage.getItem("content");
122+
editor.setValue(content);
123+
115124
});
125+
116126
</script>
117127
<style>
118128
body {

0 commit comments

Comments
 (0)