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 ...
随机推荐
- Hadoop-2.9.2单机版安装(伪分布式模式)(一)
一.环境 硬件:虚拟机VMware.win7 操作系统:Centos-7 64位 主机名: hadoopServerOne 安装用户:root软件:jdk1.8.0_181.Hadoop-2.9.2 ...
- Python练手例子(2)
7.将一个列表的数据复制到另一个列表中. 程序分析:使用列表[:]. #python3.7 #适用于简单列表(即列表中都是基本的元素) a1 = [1,2] b1 = a1[:] print(b1) ...
- python语法_深浅拷贝
浅拷贝,.copy 只拷贝第一层(可用于建立银行共享账号). s1 = [‘a’,'b','c'] s2 = s1.copy() s2[0]='d' print(s2) print(s1) 此时修改s ...
- MyOD-Linux od命令的实现
MyOD 一.设计思路 确定MyOD的要求 根据需求可知MyOD需要实现类似Linux下 od -tx -tc XXX的功能,于是先去网上查找了一下od命令的-tx以及-tc参数的作用,经查找后了解到 ...
- django 时区设置 redis token缓存策略
from django.utils.timezone import utcimport datetime datetime.datetime.utcnow().replace(tzinfo=utc)# ...
- 一篇文章学懂Shell脚本,最简明的教程在这里
Shell脚本,就是利用Shell的命令解释的功能,对一个纯文本的文件进行解析,然后执行这些功能,也可以说Shell脚本就是一系列命令的集合. Shell可以直接使用在win/Unix/Linux上面 ...
- 使用maxwell实时同步mysql数据到kafka
一.软件环境: 操作系统:CentOS release 6.5 (Final) java版本: jdk1.8 zookeeper版本: zookeeper-3.4.11 kafka 版本: kafka ...
- node.js爬取ajax接口数据
爬取页面数据与爬取接口数据,我还是觉得爬取接口数据更加简单一点,主要爬取一些分页的数据. 爬取步骤: 1.明确目标接口地址,举个例子 : https://www.vcg.com/api/common/ ...
- WCF部署失败
HTTP 错误 404.3 - Not Found 由于扩展配置问题而无法提供您请求的页面.如果该页面是脚本,请添加处理程序.如果应下载文件,请添加 MIME 映射. 最可能的原因:•可能是缺少处理程 ...
- jeecg富文本编辑器增加字体(仿宋)
jeecg富文本编辑器增加字体(仿宋) 温馨提示:jeecg 提供了 uedit 富文本的实现,如下针对的是 uedit 增加仿宋字体示例. 主要修改三个文件:plug-in\ueditor\uedi ...