diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/editor/index.html | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/editor/index.html b/tools/editor/index.html index 3e91b4b..f9123d4 100644 --- a/tools/editor/index.html +++ b/tools/editor/index.html | |||
| @@ -46,16 +46,18 @@ | |||
| 46 | 46 | ||
| 47 | editor.addEventListener('paste', function (evt) { | 47 | editor.addEventListener('paste', function (evt) { |
| 48 | evt.preventDefault(); | 48 | evt.preventDefault(); |
| 49 | document.execCommand('insertHTML', false, evt.clipboardData.getData('text/plain')); | 49 | |
| 50 | let clipped = evt.clipboardData.getData('text/plain'); | ||
| 51 | clipped = clipped.replace(/(\r\n|\n|\r)/gm, "<br>"); | ||
| 52 | document.execCommand('insertHTML', false, clipped); | ||
| 50 | }); | 53 | }); |
| 51 | 54 | ||
| 52 | if (typeof (Storage) !== 'undefined') { | 55 | if (typeof (Storage) !== 'undefined') { |
| 53 | editor.innerHTML = sessionStorage.getItem('content'); | 56 | editor.innerHTML = localStorage.getItem('content'); |
| 54 | 57 | ||
| 55 | setInterval(function () { | 58 | setInterval(function () { |
| 56 | sessionStorage.setItem('content', editor.innerHTML); | 59 | localStorage.setItem('content', editor.innerHTML); |
| 57 | }, autoSaveFrequency); | 60 | }, autoSaveFrequency); |
| 58 | |||
| 59 | } else { | 61 | } else { |
| 60 | console.log('Local Storage not supported'); | 62 | console.log('Local Storage not supported'); |
| 61 | } | 63 | } |
