-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
53 lines (48 loc) · 1.62 KB
/
example.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
<script src="src/uploader.js"></script>
<script src="src/index.js"></script>
<link href="src/index.css" rel="stylesheet"/>
<div id="editorjs"></div>
<button id="save-button">Save</button>
<pre id="output"></pre>
<script>
const editor = new EditorJS({
autofocus: true,
tools: {
checkmarks: {
class: HistoryList,
config: {
field: 'media',
additionalRequestData: {
collectionName: 'personality_preview',
},
additionalRequestHeaders: {
'X-CSRF-TOKEN': 'atMjlQTIPksjkBHRdVIU4FuYyVIK0wPfgMkTeORw'
},
endpoint: 'http://speka.loc.com/editor/api/posts/527/media',
namePlaceholder: 'Заголовок',
nameDescriptionPlaceholder: 'Підпис до заголовка',
descriptionPlaceholder: 'Опис',
linkPlaceholder: 'Посилання',
labelPlaceholder: 'Мітка'
},
}
}
});
const saveButton = document.getElementById('save-button');
const output = document.getElementById('output');
saveButton.addEventListener('click', () => {
editor.save().then( savedData => {
output.innerHTML = JSON.stringify(savedData, null, 4);
})
})
</script>
</body>
</html>