当前位置:网站首页>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();
},
}
},
}
}
}
}
}
边栏推荐
- How to download and use Xiaobai one click reload on the official website
- Eyeshot 2022 Released
- 渗透测试-提权专题
- 2021-04-02
- Critical dependency: require function is used in a way in which dependencies
- 魔法猪系统重装大师怎么使用
- Abuse unlimited authorization -- is your address safe?
- parallel recovery slave next change & parallel recovery push change
- Virtual honeypot Honeyd installation and deployment
- A summary of the experiment of continue and break in C language
猜你喜欢
固態硬盤開盤數據恢複的方法
How to download and use Xiaobai one click reload on the official website
dotnet-exec 0.4.0 released
Visual studio 2022 interface beautification tutorial
Why does the SQL statement hit the index faster than it does not?
以太网是什么要怎么连接电脑
win11蓝牙无法连接怎么办?win11蓝牙无法连接的解决方法
Penetration test - directory traversal vulnerability
JS, BOM, DOM (VI)
How to install the blue lake plug-in to support Photoshop CC 2017
随机推荐
Student achievement management system based on SSH
cuda编译报错
Mysql interactive_ Timeout and wait_ Timeout differences
buuctf web
Working principle of asemi three-phase rectifier bridge
[image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]
CTFHUB SSRF
[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
Google Earth Engine(GEE)——全球JRC/GSW1_1/YearlyHistory数据集的批量下载(中国区域)
How to choose the years of investment in financial products?
Small sample learning data set
How to open the DWG file of the computer
JDBC (IV)
Leader: who can use redis expired monitoring to close orders and get out of here!
TeeChart Pro ActiveX 2022.1
Array: force deduction dichotomy
渗透测试-提权专题
parallel recovery slave next change & parallel recovery push change
2021-10-24
CSRF (Cross Site Request Forgery) &ssrf (server request forgery) (IV)