aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2019-01-08 16:17:40 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2019-01-08 16:17:40 +0100
commitf697c72d5c17e071e9feb17044c27caaf0543110 (patch)
treed3fab994161b9645fc09676d2ed9bb02892d0caf /tools
parent5845a5be3c0cc86d6fca3c44e26f9cbf77931a05 (diff)
downloadmitjafelicijan.com-f697c72d5c17e071e9feb17044c27caaf0543110.tar.gz
updated editor tool
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/index.html10
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 }