Skip to content

Instantly share code, notes, and snippets.

@orioltf
Created January 31, 2013 12:44
Show Gist options
  • Save orioltf/4682605 to your computer and use it in GitHub Desktop.
Save orioltf/4682605 to your computer and use it in GitHub Desktop.
#BOOKMARK: Convert browser into a Plain Text Editor with save button
data:text/html;charset=utf-8,
<html>
<head>
<title>Plain Text Editor</title>
<style>
html{background-color: #f2f2f2;}
body{background-color: #fff; margin:1.5rem auto; max-width: 80rem;}
body, textarea {font-size: 1rem; line-height: 1.4;}
textarea {border: none; height: 90%; width: 100%;}
</style>
</head>
<body contenteditable>
<textarea id="txtBody" autofocus></textarea>
<button onClick="SaveTextArea()">Save</button>
<script>
function SaveTextArea() {
window.location = "data:application/octet-stream," + escape(txtBody.value);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment