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

边栏推荐
- A summary of the experiment of continue and break in C language
- Click to jump out and drag the pop-up window
- The print area becomes smaller after epplus copies the template
- TeeChart Pro ActiveX 2022.1
- There is 404 in the laravel visit, except the home page is redirected; Index php
- Reading and writing of nodejs excel (.Xlsx) files
- Leader: who can use redis expired monitoring to close orders and get out of here!
- What if win11 Bluetooth fails to connect? Solution of win11 Bluetooth unable to connect
- How PHP gets the user's City
- 【Keil】ADuCM4050官方库的GPIO输出宏定义
猜你喜欢

Install pytorch through pip to solve the problem that torch cannot be used in jupyter notebook (modulenotfoundererror:no module named 'Torch').

Five simple data types of JS

File upload vulnerability (III)

Reading and writing of nodejs excel (.Xlsx) files

buuctf web

Matlab notes

CTFHub-rce

Read the general components of antd source code

Kotlin compose perfect todo project surface rendering background and shadow

Deeply understand the characteristics of standard flow and off standard elements
随机推荐
Could not find “store“ in the context of “Connect(homePage)
Mobile number regular expression input box loses focus verification
ASEMI三相整流桥的工作原理
滲透測試-提權專題
Small sample learning data set
小白一键重装官网下载使用方法
The construction and usage of wampserver framework
Laravel's little knowledge
基于SSH实现的学生成绩管理系统
Array: force deduction dichotomy
H5 native player [learn video]
MySQL prevents Chinese garbled code and solves the problem of Chinese garbled code
Prototypical Networks for Few-shot Learning
File upload vulnerability (III)
固態硬盤開盤數據恢複的方法
Detailed summary of position positioning
Opensea PHP development kit
Personalized Federated Learning with Moreau Envelopes
TX Text Control 30.0 ActiveX
Page electronic clock (use js to dynamically obtain time display)