-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
43 lines (33 loc) · 891 Bytes
/
app.js
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
const previewBtn = document.querySelector("#preview-button");
const output = document.querySelector(".output");
const toolbarOptions = [
// font options
[{ font: [] }],
// header options
[{ header: [1, 2, 3] }],
// text utilities
["bold", "italic", "underline", "strike"],
// text colors and bg colors
[{ color: [] }, { background: [] }],
// lists
[{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
// block quotes and code blocks
["blockquote", "code-block"],
// media
["link", "image", "video"],
// alignment
[{ align: [] }],
];
const quill = new Quill("#editor-container", {
theme: "snow",
modules: {
toolbar: toolbarOptions,
},
});
previewBtn.addEventListener("click", () => {
const content = quill.root.innerHTML;
output.classList.add("active");
setTimeout(() => {
output.textContent = content;
}, 1200);
});