Quick In-Browser Text Editor - Edit and Save Text - Now with Formatting Removed for easier edits!

Understatement
By Andrew Davidson
on Nov. 29, 2023

Before
After

As I rant and raved exactly one year ago, I love my text/code editor applications on my laptop and use them almost daily, and went so far to write a bookmarklet that turns any browser tab into a quick editor:

data:text/html, <html contenteditable autofocus 
style=margin:2em;font-size:36px>

Well a year on, and I found myself avoiding using it for a simple reason: it didn't remove much of the formatting, including line heights, HTML elements, styling, and font choices. You end up having to remove the copied formatting and styling before the text is useful. See the screencaps to the left for examples of pasted command line output to see the formatting. I ran across Phuoc Nguyen's paste as plain text javascript snippet from March of 2020, and managed to stuff it into my one liner above, for cleaned text pastes. The new (longer) one-liner is below, and I use my URL shorting service to host the javascript:

data:text/html, <html contenteditable autofocus 
id=edit style=margin:2em;font-size:36px><head> 
<script src=http://w.undr.us/df.js></script>

The df.js stands for 'dump formatting', and uses Phuoc's code almost exactly, with only a change of the name of the ID we're looking for, which I had to include in our one-liner ('id=edit'). Many thanks to him for the clean code! I'm still looking for the possibility of storing the written/pasted contents as a cookie, so you don't need to 'save' the file ever, as it'll live in the browsers cache - but that'll be a 2024 release at this rate! Check back to this site or subscribe to our RSS as we'll announce updates!