-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
57 lines (50 loc) · 1.42 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
<html>
<head>
<title>Editor.js example page</title>
<style>
body {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
</style>
</head>
<body>
<div id="editorjs"></div>
<button id="save-button">Save</button>
<pre id="output"></pre>
<script type="module">
import EditorJS from '@editorjs/editorjs';
import Header from '@editorjs/header';
import Expand from './src/index.ts';
const editor = new EditorJS({
tools: {
header: {
class: Header,
tunes: ['expand']
},
expand: {
class: Expand,
config: {
url: 'https://api.openai.com/v1/chat/completions',
method: 'POST',
model: 'gpt-3.5-turbo',
credential: {
'Content-Type': 'application/json',
Authorization: 'Bearer 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'
},
genPrompts: (origin) => {
return `What is :${origin}`
}
}
}
}
});
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>