//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的更多相关文章

  1. Quill 富文本编辑器

    Quill 富文本编辑器 https://quilljs.com/ https://github.com/quilljs/quill https://github.com/quilljs/awesom ...

  2. Vue整合Quill富文本编辑器

    Quill介绍 Quill是一款开源的富文本编辑器,基于可扩展的架构设计,提供丰富的 API 进行定制.截止2021年1月,在github上面已有28.8k的star. Quill项目地址:https ...

  3. 轻量级quill富文本编辑器

    因为公司产品需要在移动端编辑文本,所以发现了这个轻量级的好东西,网上也没找到比较好的案例,就自己总结了下,有兴趣的直接复制代码运行看看就知道啦! 下面是quill.js的CDN加速地址: <!- ...

  4. Vue2 封装的 Quill 富文本编辑器组件 Vue-Quill-Editor

    1.安装 npm install vue-quill-editor --save 2.使用 import { quillEditor } from 'vue-quill-editor' 3.组件中 & ...

  5. react-quill 富文本编辑器

    适合react的一款轻量级富文本编辑器 1.http://blog.csdn.net/xiaoxiao23333/article/details/62055128 (推荐一款Markdown富文本编辑 ...

  6. quilljs 一款简单轻量的富文本编辑器(适合移动端)

    quilljs入门使用教程: quill.js是一款强大的现代富文本编辑器插件.该富文本编辑器插件支持所有的现代浏览器.平板电脑和手机.它提供了文本编辑器的所有功能,并为开发者提供大量的配置参数和方法 ...

  7. angular4 富文本编辑器

    使用quill富文本编辑器实现,angular项目中用到了ngx-quill插件. quill的GitHub地址:https://github.com/quilljs/quill ngx-quill的 ...

  8. vue-quill-editor 富文本编辑器插件介绍

    Iblog项目中博文的文本编辑器采用了vue-quill-editor插件,本文将简单介绍其使用方法. 引入配置 安装模块 npm install vue-quill-editor --save in ...

  9. Quill – 可以灵活自定义的开源的富文本编辑器

    Quill 的建立是为了解决现有的所见即所得(WYSIWYG)的编辑器本身就是所见即所得(指不能再扩张)的问题.如果编辑器不正是你想要的方式,这是很难或不可能对其进行自定义以满足您的需求. Quill ...

随机推荐

  1. myeclipse使用git图文教程

    Git介绍与使用 1.什么是Git Git是分布式版本控制系统 Git是一款免费.开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. 2.集中式版本控制系统(CVS / SVN等) 集中 ...

  2. ab 站点压力测试工具

    ab--压力测试工具 前端时间由于需要测试一个网站的高并发的情况,使用到了一个ab测试工具,下面是我自己的体验及参考网上别人的博客所写,希望对大家有所帮助. ab工具简介 ab 全称:apache b ...

  3. 洛谷 P3379 【模板】最近公共祖先(LCA)

    题目描述 如题,给定一棵有根多叉树,请求出指定两个点直接最近的公共祖先. 输入输出格式 输入格式: 第一行包含三个正整数N.M.S,分别表示树的结点个数.询问的个数和树根结点的序号. 接下来N-1行每 ...

  4. ASP.NET Core 从 gitlab-ci 环境变量读取配置

    最近在加强持续集成,遇到一个场景需要通过 gitlab-ci 环境变量(Settings -> Settings -> CI/CD -> Variables )在持续集成时向 ASP ...

  5. 一篇搞懂python文件读写操作(r/r+/rb/w/w+/wb/a/a+/ab)

           关于文件操作的几种常用方式,网上已有很多解说,内容很丰富,但也因此有些杂乱复杂.今天,我就以我个人的学习经验写一篇详细又易懂的总结文章,希望大家看完之后会有所收获. 一.核心功能 ‘r’ ...

  6. direction: rtl;

    这个属性,有点无语,费了点时间. <style type="text/css"> .hao {direction: rtl;}</style> <se ...

  7. Java笔记--引用类型的使用

    使用引用类型的一般步骤: 1.导包:指定需要使用的目标在什么位置,在publicclass之前一行写代码 import 包名路径 2.创建:通常需要创建之才能使用,格式: 数据类型 变量名称 = ne ...

  8. Linux netfilter 学习笔记

    https://blog.csdn.net/lickylin/article/details/33321905

  9. Install Superset from Python3.6

    本文安装Superset大致分为以下部分: 在操作系统中安装相关依赖,我所用的操作系统为Centos6.5 安装Python3.6.6 安装Superset 详细步骤如下: 相关依赖的安装 yum i ...

  10. Cookie/Session的机制与安全

    转载自:https://harttle.land/2015/08/10/cookie-session.html Cookie和Session是为了在无状态的HTTP协议之上维护会话状态,使得服务器可以 ...