-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
49 lines (41 loc) · 1.54 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>My Web Page</title>
<link href="https://fonts.googleapis.com/css?family=Signika&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href = "main.css">
<link rel="stylesheet" type="text/css" href="trix.css">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/paper.min.css">
</head>
<body>
<!-- This is a comment -->
<h1>Welcome to My-note!</h1>
<div class="paper container">
<div id="note">
<input id="x" type="hidden" name="content">
<<trix-editor input="x"></trix-editor>>
</div>
</div>
</body>
<script src="https://unpkg.com/filer/dist/filer.min.js"></script>
<script type="text/javascript" src="trix.js"></script>
<script>
const fs = new Filer.FileSystem();
window.addEventListener('DOMContentLoaded', (event) => {
fs.readFile('/note', 'utf8', function(err, data) {
var element = document.querySelector("trix-editor");
if (err)
element.editor.insertString("Start typing to take notes...");
else {
element.editor.loadJSON(JSON.parse(localStorage["editorState"]));
}
})
});
var saveFile = function(){
var element = document.querySelector("trix-editor");
localStorage["editorState"] = JSON.stringify(element.editor)
}
var interval = window.setInterval(saveFile, 2000);
</script>
</html>