Skip to content

Instantly share code, notes, and snippets.

@s4y
Last active April 14, 2018 10:45
Show Gist options
  • Select an option

  • Save s4y/3dfbac8b856ead48c885c31c57ddf499 to your computer and use it in GitHub Desktop.

Select an option

Save s4y/3dfbac8b856ead48c885c31c57ddf499 to your computer and use it in GitHub Desktop.
A tiny little text editor that you can type as a URL

Simplest

data:text/html,<body contenteditable>

Monospace font, spell checking off

data:text/html,<body spellcheck=false style="font: 16px monospace" contenteditable>

URL updates as you type

…a lifesaver in case you accidentally close the tab.

data:text/html,<!--#--><body spellcheck=false style="font: 16px monospace" oninput="location.hash = '-->'+document.body.outerHTML" contenteditable>

Tab key inserts a tab

data:text/html,<!--#--><body spellcheck=false style="font: 16px monospace" onkeydown="if(event.keyCode==9){document.execCommand('insertText', false, '\t'); return false; }" oninput="location.hash = '-->'+document.body.outerHTML" contenteditable>

Tab key inserts four spaces

data:text/html,<!--#--><body spellcheck=false style="font: 16px monospace" onkeydown="if(event.keyCode==9){document.execCommand('insertText', false, '    '); return false; }" oninput="location.hash = '-->'+document.body.outerHTML" contenteditable>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment