forked from slab/quill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quill.dev.load.js
64 lines (54 loc) · 1.87 KB
/
quill.dev.load.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import stringify from 'json-stringify-pretty-compact';
import Quill from './quill'
let toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{ 'header': 1 }, { 'header': 2 }], // custom button values
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
[{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent
[{ 'direction': 'rtl' }], // text direction
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],
['link'],
['clean'], // remove formatting button
['locked', 'condition']
];
window.quill = new Quill('#editor', {
modules: {
toolbar: toolbarOptions
},
theme: 'snow'
});
let delta = {
"ops": [
{"insert": "Toto je v podminenem bloku "},
{"insert": "\n", "attributes": {"condition": { "id": "abcd123", "name": "variable1"}, "locked": {"contenteditable": "false"}}},
{"insert": " a tohle taky."},
{"insert": "\n", "attributes": {"condition": { "id": "abcd123", "name": "variable1"}}},
{"insert": "\n"},
{"insert": " Ted mam otevreny command dummyContainer a jak pisu dal, tak se to porad vklada."},
{"insert": "\n", "attributes": {"condition": { "id": "xyzz444", "name": "variable2"}}},
]
};
quill.setContents(delta);
setInterval(
function() {
document.getElementById(
'output_delta'
).value = stringify(quill.editor.getDelta(), {
maxLength: 110,
indent: 2,
});
},
500
);
setInterval(
function() {
document.getElementById('output_html').value = quill.root.innerHTML
},
500
);