Skip to content

Commit

Permalink
text boxes
Browse files Browse the repository at this point in the history
gschare committed Jan 15, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 39e4ce8 commit 771a4ba
Showing 6 changed files with 47 additions and 39 deletions.
1 change: 1 addition & 0 deletions content/css/new.css
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ h2 {
background: none;
color: inherit;
font-family: inherit;
font-size: 16px;
}

@media screen and (min-width: 800px) {
1 change: 1 addition & 0 deletions content/lab/box.html
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
background: none;
color: inherit;
font-family: inherit;
font-size: 16px;
}

.editor:focus {
38 changes: 20 additions & 18 deletions content/new.html
Original file line number Diff line number Diff line change
@@ -112,28 +112,30 @@ <h2>weather</h2>
source: https://blog.jverkamp.com/2018/09/26/simple-localstorage-notepad/
-->
<div class="flex">
<textarea id="editor" contenteditable="true" placeholder="Type..."></textarea>
<script>
(function() {
var editorKey = 'html5-notepad';
var editor = document.getElementById('editor');
var cache = localStorage.getItem(editorKey);
<div>
<p>Not enough space? Need to focus? <a href="/lab/box.html">Put it in the box!</a></p>
<textarea id="editor" contenteditable="true" placeholder="Type..."></textarea>
<script>
(function() {
var editorKey = 'html5-notepad';
var editor = document.getElementById('editor');
var cache = localStorage.getItem(editorKey);

if (cache) {
editor.value = cache;
}
if (cache) {
editor.value = cache;
}

function autosave() {
var newValue = editor.value;
if (cache != newValue) {
cache = newValue;
localStorage.setItem(editorKey, cache);
function autosave() {
var newValue = editor.value;
if (cache != newValue) {
cache = newValue;
localStorage.setItem(editorKey, cache);
}
}
}

editor.addEventListener('input', autosave);
})();
</script>
editor.addEventListener('input', autosave);
})();
</script>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions docs/css/new.css
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ h2 {
background: none;
color: inherit;
font-family: inherit;
font-size: 16px;
}

@media screen and (min-width: 800px) {
1 change: 1 addition & 0 deletions docs/lab/box.html
Original file line number Diff line number Diff line change
@@ -78,6 +78,7 @@
background: none;
color: inherit;
font-family: inherit;
font-size: 16px;
}

.editor:focus {
44 changes: 23 additions & 21 deletions docs/new.html
Original file line number Diff line number Diff line change
@@ -160,30 +160,32 @@ <h2>weather</h2>
source: https://blog.jverkamp.com/2018/09/26/simple-localstorage-notepad/
-->
<div class="flex">
<textarea id="editor" contenteditable="true" placeholder="Type..."></textarea>
<script>
(function() {
var editorKey = 'html5-notepad';
var editor = document.getElementById('editor');
var cache = localStorage.getItem(editorKey);

if (cache) {
editor.value = cache;
}

function autosave() {
var newValue = editor.value;
if (cache != newValue) {
cache = newValue;
localStorage.setItem(editorKey, cache);
<div>
<p>Not enough space? Need to focus? <a href="/lab/box.html">Put it in the box!</a></p>
<textarea id="editor" contenteditable="true" placeholder="Type..."></textarea>
<script>
(function() {
var editorKey = 'html5-notepad';
var editor = document.getElementById('editor');
var cache = localStorage.getItem(editorKey);

if (cache) {
editor.value = cache;
}

function autosave() {
var newValue = editor.value;
if (cache != newValue) {
cache = newValue;
localStorage.setItem(editorKey, cache);
}
}
}

editor.addEventListener('input', autosave);
})();
</script>
editor.addEventListener('input', autosave);
})();
</script>
</div>
</div>
</div>

</div>
</main></body></html>

0 comments on commit 771a4ba

Please sign in to comment.