diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2018-08-10 12:21:02 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2018-08-10 12:21:02 +0200 |
| commit | 15da330aabab9bc09cbbe626b51b8eb3c06caa71 (patch) | |
| tree | 4f3e3b2f5d8f9e2fe840926d91fe5946d42080d0 /tools | |
| parent | a5136daace5e983a9269d3cce6cc18e2c74af28f (diff) | |
| download | mitjafelicijan.com-15da330aabab9bc09cbbe626b51b8eb3c06caa71.tar.gz | |
content update
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/editor/index.html | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tools/editor/index.html b/tools/editor/index.html index 158c472..61511bd 100644 --- a/tools/editor/index.html +++ b/tools/editor/index.html | |||
| @@ -17,16 +17,14 @@ | |||
| 17 | <body> | 17 | <body> |
| 18 | 18 | ||
| 19 | <style> | 19 | <style> |
| 20 | textarea { | 20 | article { |
| 21 | display: block; | 21 | display: block; |
| 22 | position: fixed; | 22 | position: fixed; |
| 23 | left: 0; | 23 | left: 0; |
| 24 | top: 0; | 24 | top: 0; |
| 25 | right: 0; | 25 | right: 0; |
| 26 | bottom: 0; | 26 | bottom: 0; |
| 27 | width: 100%; | 27 | padding: 40px; |
| 28 | height: 100%; | ||
| 29 | padding: 20px; | ||
| 30 | outline: none; | 28 | outline: none; |
| 31 | border: 0; | 29 | border: 0; |
| 32 | background: #333; | 30 | background: #333; |
| @@ -37,20 +35,20 @@ | |||
| 37 | } | 35 | } |
| 38 | </style> | 36 | </style> |
| 39 | 37 | ||
| 40 | <textarea></textarea> | 38 | <article contenteditable></article> |
| 41 | 39 | ||
| 42 | <script> | 40 | <script> |
| 43 | 41 | ||
| 44 | const autoSaveFrequency = 1000; | 42 | const autoSaveFrequency = 1000; |
| 45 | const editor = document.querySelector('textarea'); | 43 | const editor = document.querySelector('article'); |
| 46 | |||
| 47 | editor.focus(); | ||
| 48 | 44 | ||
| 49 | if (typeof(Storage) !== 'undefined') { | 45 | if (typeof(Storage) !== 'undefined') { |
| 50 | editor.value = localStorage.getItem('content'); | 46 | editor.innerHTML = sessionStorage.getItem('content'); |
| 47 | |||
| 51 | setInterval(function() { | 48 | setInterval(function() { |
| 52 | localStorage.setItem('content', editor.value); | 49 | sessionStorage.setItem('content', editor.innerHTML); |
| 53 | }, autoSaveFrequency); | 50 | }, autoSaveFrequency); |
| 51 | |||
| 54 | } else { | 52 | } else { |
| 55 | console.log('Local Storage not supported'); | 53 | console.log('Local Storage not supported'); |
| 56 | } | 54 | } |
