| 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 |
const toolbarOptions = [ |
| 37 |
[{'header': [1, 2, 3, , false] }], |
| 38 |
['bold', 'underline'], |
| 39 |
['image','video', 'code-block', 'formula'], |
| 40 |
[{ 'list': 'ordered' }, { 'list': 'bullet' }], |
| 41 |
[{ 'script': 'sub' }, { 'script': 'super' }], |
| 42 |
[{ 'indent': '-1' }, { 'indent': '+1' }], |
| 43 |
|
| 44 |
|
| 45 |
[{ 'color': [] }, { 'background': [] }], |
| 46 |
['omega','clean'] |
| 47 |
]; |
| 48 |
function loadquill(){ |
| 49 |
var helpeditor = new Quill('#quilleditor', { |
| 50 |
modules: { |
| 51 |
history: { |
| 52 |
delay: 2000, |
| 53 |
maxStack: 50, |
| 54 |
userOnly: true |
| 55 |
}, |
| 56 |
toolbar: toolbarOptions }, |
| 57 |
theme: 'snow', |
| 58 |
}); |
| 59 |
helpeditor.disable(); |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
var toolbar = helpeditor.getModule("toolbar"); |
| 65 |
toolbar.addHandler("omega", function () { |
| 66 |
console.log("omega"); |
| 67 |
}); |
| 68 |
var customButton = document.querySelector(".ql-omega"); |
| 69 |
customButton.addEventListener("click", function () { |
| 70 |
var range = helpeditor.getSelection(); |
| 71 |
if (range) { |
| 72 |
helpeditor.insertText(range.index, "Ω"); |
| 73 |
} |
| 74 |
}); |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
return helpeditor; |
| 81 |
} |