Last active
August 29, 2015 14:01
-
-
Save addyosmani/671e76df47c2eff3ad7a to your computer and use it in GitHub Desktop.
Tweet-friendly offline text editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var d=document,l=localStorage,k='c',q = d.body;q.contentEditable=true;q.innerHTML=l[k];q.onkeyup=function(){l[k]=q.innerHTML;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.write('<body contenteditable style="font: 2rem/1.5 monospace;max-width:60rem;margin:0 auto;padding:4rem;">');var k = 'c'; var q = document.querySelector('body');q.innerHTML=localStorage[k];q.onkeyup=function(){localStorage[k]=q.innerHTML;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bookmarklet: