quill富文本编辑器 API
//1. 从第三个开始删除,删除4个
// console.log(this.quill.deleteText(2, 4)); // 12345678 1278
// 2.(返回对象)返回从第三个开始,返回4个,编辑器里面不变 .insert = 3456; 不写参数参数,默认全部
// console.log(this.quill.getContents(2, 4)); // 12345678 3456
//3.检索编辑器内容的长度 返回值是要加一
// console.log(this.quill.getLength(3)); // 12345678 9
//4.同quill.getContents(2, 4);返回值不一样,
// console.log(this.quill.getText(2, 4)); // 12345678 3456 //5.编辑器里值不会被覆盖 编辑器里插入值 (位置,类型,内容)
// console.log(this.quill.insertEmbed(10, 'image', 'https://quilljs.com/images/cloud.png'));
//6.编辑器里值不会被覆盖 编辑器里插入值(文本) (位置,内容, 格式)
// console.log(this.quill.insertText(0, 'Hello', 'bold', true));
// console.log(this.quill.insertText(5, 'Quill', {
// 'color': 'red',
// 'italic': true
// }));
//7.编辑器里值被覆盖 编辑器里插入值(文本) (位置,内容, 格式) 以{ insert: '\n' }结尾
// console.log(this.quill.setContents([
// { insert: 'Hello ' },
// { insert: 'World!', attributes: { bold: true } },
// { insert: '\n' }
// ]));
//8.编辑器里值被覆盖
// console.log(this.quill.setText('Hello\n'));
//9.没研究,会报错 home.vue?250d:109 Uncaught ReferenceError: Delta is not defined
// console.log(this.quill.updateContents(new Delta()
// .retain(6) // Keep 'Hello '
// .delete(5) // 'World' is deleted
// .insert('Quill')
// .retain(1, { bold: true }) // Apply bold to exclamation mark
// )); //10.设置编辑器里内容格式format
// this.quill.format('color', 'red');
// this.quill.format('align', 'right');
// this.quill.setText('Hello\nWorld!\n');
//11.formatLine
//formatLine(index: Number, length: Number, source: String = 'api'): Delta
// formatLine(index: Number, length: Number, format: String, value: any,
// source: String = 'api'): Delta
// formatLine(index: Number, length: Number, formats: { [String]: any },
// source: String = 'api'): Delta
// this.quill.formatLine(0, 2, 'align', 'right'); // right aligns the first line
// this.quill.formatLine(4, 4, 'align', 'center'); // center aligns both lines
// 12.formatText
// this.quill.setText('Hello\nWorld!\n'); // this.quill.formatText(0, 5, 'bold', true); // bolds 'hello' // this.quill.formatText(0, 5, { // unbolds 'hello' and set its color to blue
// 'bold': false,
// 'color': 'rgb(0, 0, 255)'
// }); // this.quill.formatText(5, 1, 'align', 'right'); // right aligns the 'hello' line
// 13 getFormat 获取格式
// this.quill.setText('Hello World!');
// this.quill.formatText(0, 2, 'bold', true);
// this.quill.formatText(1, 2, 'italic', true);
// this.quill.getFormat(0, 2); // { bold: true }
// this.quill.getFormat(1, 1); // { bold: true, italic: true }
// 14. 移除格式 removeFormat
// this.quill.setContents([
// { insert: 'Hello', { bold: true } },
// { insert: '\n', { align: 'center' } },
// { insert: { formula: 'x^2' } },
// { insert: '\n', { align: 'center' } },
// { insert: 'World', { italic: true }},
// { insert: '\n', { align: 'center' } }
// ]);
// this.quill.removeFormat(3, 7); // 15.getBounds 获取区域
// getBounds(index: Number, length: Number = 0):
// 返回值 { left: Number, top: Number, height: Number, width: Number }
// this.quill.setText('Hello\nWorld\n');
// console.log(this.quill.getBounds(0, 2)); // Returns { height: 15, width: 0, left: 27, top: 31 }
// 16.获取鼠标的位置 getSelection
// var range = this.quill.getSelection();
// if (range) {
// console.log(range)
// if (range.length == 0) {
// console.log('User cursor is at index', range.index);
// } else {
// var text = this.quill.getText(range.index, range.length);
// console.log(this.quill.getLength());
// console.log('User has highlighted: ', text);
// }
// } else {
// console.log('User cursor is not in editor');
// }
// 17
this.quill.on('text-change', function(delta, oldDelta, source) {
if (source == 'api') {
console.log("An API call triggered this change.");
} else if (source == 'user') {
console.log("A user action triggered this change.");
}
});
quill富文本编辑器 API的更多相关文章
- Quill 富文本编辑器
Quill 富文本编辑器 https://quilljs.com/ https://github.com/quilljs/quill https://github.com/quilljs/awesom ...
- Vue整合Quill富文本编辑器
Quill介绍 Quill是一款开源的富文本编辑器,基于可扩展的架构设计,提供丰富的 API 进行定制.截止2021年1月,在github上面已有28.8k的star. Quill项目地址:https ...
- 轻量级quill富文本编辑器
因为公司产品需要在移动端编辑文本,所以发现了这个轻量级的好东西,网上也没找到比较好的案例,就自己总结了下,有兴趣的直接复制代码运行看看就知道啦! 下面是quill.js的CDN加速地址: <!- ...
- Vue2 封装的 Quill 富文本编辑器组件 Vue-Quill-Editor
1.安装 npm install vue-quill-editor --save 2.使用 import { quillEditor } from 'vue-quill-editor' 3.组件中 & ...
- react-quill 富文本编辑器
适合react的一款轻量级富文本编辑器 1.http://blog.csdn.net/xiaoxiao23333/article/details/62055128 (推荐一款Markdown富文本编辑 ...
- quilljs 一款简单轻量的富文本编辑器(适合移动端)
quilljs入门使用教程: quill.js是一款强大的现代富文本编辑器插件.该富文本编辑器插件支持所有的现代浏览器.平板电脑和手机.它提供了文本编辑器的所有功能,并为开发者提供大量的配置参数和方法 ...
- angular4 富文本编辑器
使用quill富文本编辑器实现,angular项目中用到了ngx-quill插件. quill的GitHub地址:https://github.com/quilljs/quill ngx-quill的 ...
- vue-quill-editor 富文本编辑器插件介绍
Iblog项目中博文的文本编辑器采用了vue-quill-editor插件,本文将简单介绍其使用方法. 引入配置 安装模块 npm install vue-quill-editor --save in ...
- Quill – 可以灵活自定义的开源的富文本编辑器
Quill 的建立是为了解决现有的所见即所得(WYSIWYG)的编辑器本身就是所见即所得(指不能再扩张)的问题.如果编辑器不正是你想要的方式,这是很难或不可能对其进行自定义以满足您的需求. Quill ...
随机推荐
- HTML列表与表格
border:控制边框 width:宽度 height:高度 table是表格 tr:行 td:列★ colspan:合并列★rowspan:合并行★ <!doctype html> &l ...
- Retrieve pictures from Excel file using OLEDB
string file = @"C:\sample.xlsx"; if(System.IO.File.Exists(file)) { Microsoft.Office.Intero ...
- css学习_cs3s旋转的图片
1. ,鼠标移开后图片面向屏幕后又自动可见了. 2.css3动画 !!定义好动画后再引用 4.多组动画(百分比) 案例: 案例2----无缝滚动
- 杂_小技巧_将网页上的内容通过亚马逊邮箱传到kindle中
所需条件 1.kindle要联网 2.要有亚马逊邮箱 3.要有微信,电脑上或者手机上 操作步骤: 1.找到你想要传送到kindle上的文章网页 2.在微信中关注“亚马逊kindle服务号”并且按照里边 ...
- 一篇文章学懂Shell脚本,最简明的教程在这里
Shell脚本,就是利用Shell的命令解释的功能,对一个纯文本的文件进行解析,然后执行这些功能,也可以说Shell脚本就是一系列命令的集合. Shell可以直接使用在win/Unix/Linux上面 ...
- 简述移动端开发前端和app间的关系
<p>前端页面嵌套进app内部,一般有时候会进行一些交互,类似于前端页面请求后台接口一样,通常会起一个前端开发人员和app开发人员会相互协定一个协议;双方就协议而言去进行请求接口和返回数据 ...
- 2018-2019-2 网络对抗技术 20165225 Exp5 MSF基础应用
2018-2019-2 网络对抗技术 20165225 Exp5 MSF基础应用 验前准备 本实践目标是掌握metasploit的基本应用方式,重点常用的三种攻击方式的思路.具体需要完成: 一个主动攻 ...
- PySe-008-开启浏览器的手机模式
以 Chrome 为例,通过设置 chromeoption 的参数即可实现启动浏览器后,开启手机模式.相应设置的源代码如下所示: chromeOptions = webdriver.ChromeOpt ...
- 【mybatis】mybatis中 <if test=>等于的条件怎么写
- Port Channel and VPC
1.Port Channel 介绍 Port Channel 简介 绑定多个物理链路(最多8条),到一个单一的逻辑链路,在两个物理设备之间 每个物理端口只能被放入一个port-channel中. 在 ...