aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/index.html')
-rw-r--r--tools/editor/index.html72
1 files changed, 0 insertions, 72 deletions
diff --git a/tools/editor/index.html b/tools/editor/index.html
deleted file mode 100644
index 3bdef13..0000000
--- a/tools/editor/index.html
+++ /dev/null
@@ -1,72 +0,0 @@
1<!DOCTYPE html>
2<html lang="en">
3
4<head>
5
6 <meta charset="UTF-8">
7 <meta name="viewport" content="width=device-width, initial-scale=1.0">
8 <meta http-equiv="X-UA-Compatible" content="ie=edge">
9
10 <title>Editor</title>
11
12 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
13 <link rel="icon" href="favicon.ico" type="image/x-icon">
14
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: 70px;
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 line-height: 130%;
36 overflow: auto;
37 }
38 ::selection { background:#ff0; color:#000 }
39 </style>
40
41 <article contenteditable></article>
42
43 <script>
44
45 window.addEventListener('load', (evt) => {
46 const autoSaveFrequency = 1000;
47 const editor = document.querySelector('article');
48
49 editor.addEventListener('paste', function (evt) {
50 evt.preventDefault();
51
52 let clipped = evt.clipboardData.getData('text/plain');
53 clipped = clipped.replace(/(\r\n|\n|\r)/gm, "<br>");
54 document.execCommand('insertHTML', false, clipped);
55 });
56
57 if (typeof (Storage) !== 'undefined') {
58 editor.innerHTML = localStorage.getItem('content');
59
60 setInterval(function () {
61 localStorage.setItem('content', editor.innerHTML);
62 }, autoSaveFrequency);
63 } else {
64 console.log('Local Storage not supported');
65 }
66 });
67
68 </script>
69
70</body>
71
72</html>