当前位置:网站首页>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();
},
}
},
}
}
}
}
}

边栏推荐
- ThinkPHP 5 log management
- 电子协会 C语言 1级 28 、字符菱形
- A brief talk on media inquiry
- Using JS to realize the sidebar of life information network
- Startup mode of SoC verification environment
- Specific operations for uploading pictures in PHP
- Apache+php uploading large files
- Working principle of asemi three-phase rectifier bridge
- DMA double buffer mode of stm32
- How PHP gets the user's City
猜你喜欢

Customize the console plot result style
![[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](/img/12/d41f8d5abcb61d2632a8b117bf1604.jpg)
[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

How micro engine uploads remote attachments

Web3 DAPP user experience best practices

Penetration test - directory traversal vulnerability

渗透测试-目录遍历漏洞

CSRF (Cross Site Request Forgery) &ssrf (server request forgery) (IV)

滲透測試-提權專題

How to install the blue lake plug-in to support Photoshop CC 2017

【FLink】access closed classloader classloader. check-leaked-classloader
随机推荐
TX Text Control 30.0 ActiveX
《QDebug 2022年6月》
buuctf(re)
parallel recovery slave next change & parallel recovery push change
Mysql interactive_ Timeout and wait_ Timeout differences
How micro engine uploads remote attachments
Introduction to the hardest core PWN in the whole network_ Graphic analysis
Even if you are not good at anything, you are growing a little bit [to your 2021 summary]
Penetration information collection steps (simplified version)
滲透測試-提權專題
【Keil】ADuCM4050官方库的GPIO输出宏定义
Laravel Aurora push
TeeChart Pro ActiveX 2022.1
JS verification code input number auto skip
Understand JS high-order function and write a high-order function
Filter & listener (XIV)
Click to jump out and drag the pop-up window
Reading and writing of nodejs excel (.Xlsx) files
2021-04-02
Essais de pénétration - sujets d'autorisation