-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
47 lines (40 loc) · 1.16 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>editorjs-style</title>
</head>
<body>
<div id="editorjs"></div>
<button id="button" type="button">Save</button>
<div id="output-data"></div>
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
<!-- For demo -->
<script src="https://cdn.jsdelivr.net/npm/editorjs-style@latest"></script>
<!-- For developing -->
<!--<script src="../dist/index.js"></script>-->
<script>
const data = {
blocks: [
{
type: 'paragraph',
data: {
text: 'test <editorjs-style style="background-color: pink;">editorjs-style</editorjs-style> test',
},
},
],
};
const editorJS = new EditorJS({
data,
tools: {
style: EditorJSStyle.StyleInlineTool,
},
});
document.querySelector('#button').addEventListener('click', async () => {
const outputData = await editorJS.save();
document.querySelector('#output-data').textContent =
JSON.stringify(outputData);
});
</script>
</body>
</html>