Skip to content

Instantly share code, notes, and snippets.

@sverweij
Last active March 19, 2025 18:34
Show Gist options
  • Select an option

  • Save sverweij/188bfd227f1a2e0e1694c676d7bc192b to your computer and use it in GitHub Desktop.

Select an option

Save sverweij/188bfd227f1a2e0e1694c676d7bc192b to your computer and use it in GitHub Desktop.

Revisions

  1. sverweij revised this gist Mar 19, 2025. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions SCRATCH.html
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,5 @@
    }   
    </script>
    </head>
    <body contenteditable style="font: 1rem/1 monospace; line-height: 1.4rem; max-width: 60rem; margin: 0 auto; padding: 4rem; color: darkblue; background-color: lightyellow">
    </body>
    <body contenteditable style="font: 1rem/1 monospace; line-height: 1.4rem; max-width: 60rem; margin: 0 auto; padding: 4rem; color: darkblue; background-color: lightyellow"></body>
    </html>
  2. sverweij created this gist Mar 19, 2025.
    19 changes: 19 additions & 0 deletions SCRATCH.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    <!DOCTYPE html>
    <html>
    <head>   
    <title>SCRATCH</title>   
    <script>
    window.onload = () => {
    const content = document.querySelector('[contenteditable]');
    if (localStorage.getItem('scratch.savedContent')) {
    content.innerHTML = localStorage.getItem('scratch.savedContent');
    }
    content.addEventListener('input', () => {
    localStorage.setItem('scratch.savedContent', content.innerHTML);
    });
    }   
    </script>
    </head>
    <body contenteditable style="font: 1rem/1 monospace; line-height: 1.4rem; max-width: 60rem; margin: 0 auto; padding: 4rem; color: darkblue; background-color: lightyellow">
    </body>
    </html>