当前位置:网站首页>Extend the toolbar of quill editor
Extend the toolbar of quill editor
2022-06-25 05:09:00 【Lijianyi】
Kung Fu brothers can see my Blog www.maple.ink
Extend custom toolbar
Add custom toolbar , stay mounted Method monitor DOM Node creation , Insert the icon inward / written words , You can show it . stay handler Object to add the above customization toolbar Listening in , Trigger method .
// First, in the toolbar Add corresponding parameters in , In this case, the corresponding DOM The structure has already been created
editorOptions: {
modules: {
toolbar: {
container: [
['uploadImg'], // Expand upload picture
['uploadFile'] // Extended upload file
],
},
}
}

When the rich text editor is ready , You can add icons / The text is convenient and practical .
onEditorReady() {
console.log(' The rich text editor is ready ');
document.querySelector('.ql-formats .ql-uploadImg').innerText = ' chart ';
document.querySelector('.ql-formats .ql-uploadFile').innerText = ' writing ';
},
To expand the tool icon binding method :
data() {
return {
editorOptions: {
modules: {
toolbar: {
container: [
['uploadImg'], // Expand upload picture
['uploadFile'] // Extended upload file
],
handlers: {
'uploadImg': () => {
// Note that the arrow function is used here , Using the arrow function this Characteristics of
this.onUploadImage();
}
}
},
}
}
}
},
methods: {
onUploadImage() {
console.log(' Trigger upload ');
}
}
Insert an expression
It can be done by quill-emoji Plug in extensions vue-quill-editor The expression of .
// install quill-emoji
npm i quill-emoji
Register the plug-in in the component , And add corresponding parameters .
// Globally mount the rich text editor
import {
Quill, quillEditor} from 'vue-quill-editor';
// introduce emoji expression
import * as quillEmoji from 'quill-emoji';
import 'quill-emoji/dist/quill-emoji.css';
Quill.register('modules/quillEmoji', quillEmoji);
export default {
components: {
quillEditor
},
data() {
return {
editorOptions: {
modules: {
'emoji-toolbar': true,
'emoji-shortname': true,
toolbar: {
container: [
['emoji']
],
handlers: {
'uploadImg': () => {
this.onUploadImage();
},
}
},
}
}
}
}
}

边栏推荐
- Install pytorch through pip to solve the problem that torch cannot be used in jupyter notebook (modulenotfoundererror:no module named 'Torch').
- parallel recovery slave next change & parallel recovery push change
- Characteristics of ES6 arrow function
- Array: force deduction dichotomy
- DMA double buffer mode of stm32
- Activereportsjs V3.0 comes on stage
- Small sample learning data set
- Compatible with Internet Explorer
- ASEMI三相整流桥的工作原理
- 电脑的dwg文件怎么打开
猜你喜欢

The construction and usage of wampserver framework

In depth understanding of line height and vertical align

Compatible with Internet Explorer

Customize the console plot result style

电脑的dwg文件怎么打开

Penetration test - directory traversal vulnerability

File upload vulnerability (III)

My IC journey - the growth of senior chip design verification engineers - "Hu" said that IC engineers are perfect and advanced

DOM document object model (I)

Detailed summary of flex layout
随机推荐
[relax's law of life lying on the square] those poisonous chicken soup that seem to be too light and too heavy, but think carefully and fear
CTFHub-rce
Array: force deduction dichotomy
For in JS Of and for in
JS function to realize simple calculator
PHP uses JWT
渗透测试-目录遍历漏洞
What if the desktop computer is not connected to WiFi
A brief talk on media inquiry
February 20ctf record
《QDebug 2022年6月》
In depth understanding of line height and vertical align
parallel recovery slave next change & parallel recovery push change
How PHP gets the user's City
Use serialize in egg to read and write split tables
Small sample learning data set
Opensea PHP development kit
Five simple data types of JS
MySQL concept and operation (III)
cuda编译报错