diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2019-01-08 16:08:02 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2019-01-08 16:08:02 +0100 |
| commit | 5845a5be3c0cc86d6fca3c44e26f9cbf77931a05 (patch) | |
| tree | 658a7bc8e91554f10c154573b56a2c440ca16b09 /tools/editor | |
| parent | 1d321a51fdadf4c409d7e7d00096c51754bd0113 (diff) | |
| download | mitjafelicijan.com-5845a5be3c0cc86d6fca3c44e26f9cbf77931a05.tar.gz | |
Added author and update on editor
Diffstat (limited to 'tools/editor')
| -rw-r--r-- | tools/editor/index.html | 89 |
1 files changed, 49 insertions, 40 deletions
diff --git a/tools/editor/index.html b/tools/editor/index.html index 61511bd..3e91b4b 100644 --- a/tools/editor/index.html +++ b/tools/editor/index.html | |||
| @@ -1,59 +1,68 @@ | |||
| 1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> | 2 | <html lang="en"> |
| 3 | 3 | ||
| 4 | <head> | 4 | <head> |
| 5 | 5 | ||
| 6 | <meta charset="UTF-8"> | 6 | <meta charset="UTF-8"> |
| 7 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | 7 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 8 | <meta http-equiv="X-UA-Compatible" content="ie=edge"> | 8 | <meta http-equiv="X-UA-Compatible" content="ie=edge"> |
| 9 | 9 | ||
| 10 | <title>Editor</title> | 10 | <title>Editor</title> |
| 11 | 11 | ||
| 12 | <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> | 12 | <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> |
| 13 | <link rel="icon" href="favicon.ico" type="image/x-icon"> | 13 | <link rel="icon" href="favicon.ico" type="image/x-icon"> |
| 14 | 14 | ||
| 15 | </head> | 15 | </head> |
| 16 | |||
| 17 | <body> | ||
| 18 | |||
| 19 | <style> | ||
| 20 | article { | ||
| 21 | display: block; | ||
| 22 | position: fixed; | ||
| 23 | left: 0; | ||
| 24 | top: 0; | ||
| 25 | right: 0; | ||
| 26 | bottom: 0; | ||
| 27 | padding: 40px; | ||
| 28 | outline: none; | ||
| 29 | border: 0; | ||
| 30 | background: #333; | ||
| 31 | color: #fff; | ||
| 32 | font-size: 28px; | ||
| 33 | font-family: "Lucida Console", Monaco, monospace; | ||
| 34 | font-weight: 200; | ||
| 35 | } | ||
| 36 | </style> | ||
| 37 | 16 | ||
| 38 | <article contenteditable></article> | 17 | <body> |
| 39 | 18 | ||
| 40 | <script> | 19 | <style> |
| 20 | article { | ||
| 21 | display: block; | ||
| 22 | position: fixed; | ||
| 23 | left: 0; | ||
| 24 | top: 0; | ||
| 25 | right: 0; | ||
| 26 | bottom: 0; | ||
| 27 | padding: 40px; | ||
| 28 | outline: none; | ||
| 29 | border: 0; | ||
| 30 | background: #222; | ||
| 31 | color: #fff; | ||
| 32 | font-size: 28px; | ||
| 33 | font-family: Monaco, monospace; | ||
| 34 | font-weight: 200; | ||
| 35 | overflow: auto; | ||
| 36 | } | ||
| 37 | </style> | ||
| 41 | 38 | ||
| 39 | <article contenteditable></article> | ||
| 40 | |||
| 41 | <script> | ||
| 42 | |||
| 43 | window.addEventListener('load', (evt) => { | ||
| 42 | const autoSaveFrequency = 1000; | 44 | const autoSaveFrequency = 1000; |
| 43 | const editor = document.querySelector('article'); | 45 | const editor = document.querySelector('article'); |
| 44 | 46 | ||
| 45 | if (typeof(Storage) !== 'undefined') { | 47 | editor.addEventListener('paste', function (evt) { |
| 48 | evt.preventDefault(); | ||
| 49 | document.execCommand('insertHTML', false, evt.clipboardData.getData('text/plain')); | ||
| 50 | }); | ||
| 51 | |||
| 52 | if (typeof (Storage) !== 'undefined') { | ||
| 46 | editor.innerHTML = sessionStorage.getItem('content'); | 53 | editor.innerHTML = sessionStorage.getItem('content'); |
| 47 | 54 | ||
| 48 | setInterval(function() { | 55 | setInterval(function () { |
| 49 | sessionStorage.setItem('content', editor.innerHTML); | 56 | sessionStorage.setItem('content', editor.innerHTML); |
| 50 | }, autoSaveFrequency); | 57 | }, autoSaveFrequency); |
| 51 | 58 | ||
| 52 | } else { | 59 | } else { |
| 53 | console.log('Local Storage not supported'); | 60 | console.log('Local Storage not supported'); |
| 54 | } | 61 | } |
| 62 | }); | ||
| 63 | |||
| 64 | </script> | ||
| 55 | 65 | ||
| 56 | </script> | 66 | </body> |
| 57 | 67 | ||
| 58 | </body> | 68 | </html> \ No newline at end of file |
| 59 | </html> | ||
