-
Notifications
You must be signed in to change notification settings - Fork 137
/
index.html
89 lines (75 loc) · 1.84 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test of a New Beautiful Table</title>
<style>
body,
html {
margin: 0;
font-family: Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
body {
display: flex;
flex-direction: column;
align-items: center;
}
.block {
width: 800px;
margin-top: 40px;
}
#editorjs {
width: 900px;
min-height: 100px;
}
</style>
</head>
<body>
<div class="block"></div>
<div id="editorjs"></div>
<button class="save-button">Save</button>
<pre class="output"></pre>
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
<script type="module">
import Table from './src/index'
const editor = new EditorJS({
autofocus: true,
tools: {
table: {
class: Table,
inlineToolbar: true,
config: {
withHeadings: true,
maxRows: 5,
maxCols: 5
}
}
},
data: {
time: 1625072989362,
blocks: [
{
id: "XXVTfnMlcE",
type: "table",
data: {
withHeadings: true,
content: [
["English", "Russian", "Japanese"],
["Sweet", "Сладкий", "あまい"],
["Good morning", "Доброе утро", "おはようございます"]]
}
}
],
version: "2.22.1"
}
});
const saveButton = document.querySelector('.save-button');
const output = document.querySelector('.output');
saveButton.addEventListener('click', () => {
editor.save().then(savedData => {
output.innerHTML = JSON.stringify(savedData, null, 4);
});
});
</script>
</body>
</html>