-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
168 lines (141 loc) · 4.43 KB
/
index.html
File metadata and controls
168 lines (141 loc) · 4.43 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>ezpzCode - Fastest Text Editor</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A web-based note-taking application that will help you to save any note as fast as the speed of light." />
<meta name="keywords" content="ezpzcode, ezpzcode text editor, text editor, editor, fastest text editor, fast editor, sarnav, ezpzcode.com, minimalist text editor" />
<link rel="shortcut icon" type="image/png" href="/img/favicon.png" />
<link
href="https://cdn.quilljs.com/1.3.6/quill.snow.css"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Nunito+Sans"
rel="stylesheet"
/>
<style>
html,
body {
margin: 0;
padding: 0;
height: 100vh;
width: 100%;
}
.ql-toolbar {
display: flex;
justify-content: center;
align-items: center;
}
.ql-toolbar.ql-snow {
border: none;
margin-top: 24px;
font-family: "Nunito Sans", sans-serif;
}
.ql-container.ql-snow {
border: none;
padding: 16px;
}
.ql-editor {
background: #fefefe;
height: 100vh;
}
#counter {
position: fixed;
bottom: 20px;
right: 20px;
color: #34515e;
}
</style>
<!-- Google Adsense -->
<script data-ad-client="ca-pub-3494337863342010" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-167607091-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-167607091-1');
</script>
</head>
<body>
<div id="editor"></div>
<div id="counter">0</div>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script>
var toolbarOptions = [
[{ size: [] }],
[{ align: [] }],
[{ color: [] }],
["bold", "italic", "underline", "strike"],
["blockquote", "code-block"],
[{ script: "sub" }, { script: "super" }],
["save"]
];
Quill.register("modules/counter", function(quill, options) {
var container = document.querySelector(options.container);
quill.on("text-change", function() {
var text = quill.getText().trim();
if (text.length > 0) {
container.innerText = text.split(/\s+/).length;
} else {
container.innerText = "0";
}
});
});
//Enable Grammarly extension
let Inline = Quill.import("blots/inline");
class GrammarlyInline extends Inline {}
GrammarlyInline.tagName = "G";
GrammarlyInline.blotName = "grammarly-inline";
GrammarlyInline.className = "gr_";
Quill.register(GrammarlyInline);
var quill = new Quill("#editor", {
modules: {
toolbar: {
container: toolbarOptions,
handlers: {
save: () => {
console.log("Saving....");
}
}
},
counter: {
container: "#counter"
}
},
theme: "snow"
});
var toolbar = quill.getModule("toolbar");
toolbar.addHandler("save", function() {
console.log("Saving...");
});
var customButton = document.querySelector(".ql-save");
customButton.innerHTML =
'<img src="img/save.svg" width="18px" height="18px">';
customButton.addEventListener("click", function() {
if (navigator.msSaveBlob) {
// IE 10+
navigator.msSaveBlob(
new Blob([elHtml], { type: "text/plain" + ";charset=utf-8;" }),
"text"
);
} else {
var link = document.createElement("a");
link.setAttribute("download", "text");
link.setAttribute(
"href",
"data:" +
"text/plain" +
";charset=utf-8," +
encodeURIComponent(quill.getText())
);
link.click();
}
});
document.querySelector(".ql-editor").removeAttribute("data-gramm");
</script>
</body>
</html>