orioltf
1/31/2013 - 12:44 PM

#BOOKMARK: Convert browser into a Plain Text Editor with save button

#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>