💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] ## debug <!-- Static method enabling logging messages at a given level: `'error'`, `'warn'`, `'log'`, or `'info'`. Passing `true` is equivalent to passing `'log'`. Passing `false` disables all messages. --> 启用记录信息的静态方法,给定的级别有:`'error'`, `'warn'`, `'log'`或`'info'`。传入`true`等同于传入`'log'`。传入`false`表示停用所有级别的消息记录。 **方法** ```javascript Quill.debug(level: String | Boolean) ``` **示例** ```javascript Quill.debug('info'); ``` ## import <!-- Static method returning Quill library, format, module, or theme. In general the path should map exactly to Quill source code directory structure. Unless stated otherwise, modification of returned entities may break required Quill functionality and is strongly discouraged. --> 返回Quill库、格式、模块或主题的静态方法。一般,路径应该准确映射到Quill源码的目录结构。除非另有说明,对返回实体的修改可能打断已经引入的Quill功能,所以千万不要这么做。 **方法** ```javascript Quill.import(path): any ``` **示例** ```javascript var Parchment = Quill.import('parchment'); var Delta = Quill.import('delta'); var Toolbar = Quill.import('modules/toolbar'); var Link = Quill.import('formats/link'); // Similar to ES6 syntax `import Link from 'quill/formats/link';` ``` ## register <!-- Registers a module, theme, or format(s), making them available to be added to an editor. Can later be retrieved with [`Quill.import`](/docs/api/#import). Use the path prefix of `'formats/'`, `'modules/'`, or `'themes/'` for registering formats, modules or themes, respectively. For formats specifically there is a short and to just pass in the format directly and the path will be autogenerated. Will overwrite existing definitions with the same path. --> 注册一个模块、主题或格式,让它们可用于添加到编辑器上。注册之后,可用[`Quill.import`](#import)引入。使用`'formats/'`, `'modules/'`或`'themes/'` 路径前缀来分别注册格式、模块和主题。对于格式,特有一个简短的方法,只需要传入格式对象,路径将会自动生成。如果传入路径将会直接覆盖已经定义的路径。 **方法** ```javascript Quill.register(format: Attributor | BlotDefinintion, supressWarning: Boolean = false) Quill.register(path: String, def: any, supressWarning: Boolean = false) Quill.register(defs: { [String]: any }, supressWarning: Boolean = false) ``` **示例** ```javascript var Module = Quill.import('core/module'); class CustomModule extends Module {} Quill.register('modules/custom-module', CustomModule); ``` ```javascript Quill.register({ 'formats/custom-format': CustomFormat, 'modules/custom-module-a': CustomModuleA, 'modules/custom-module-b': CustomModuleB, }); Quill.register(CustomFormat); // You cannot do Quill.register(CustomModuleA); as CustomModuleA is not a format ``` ## addContainer <!-- Adds and returns a container element inside the Quill container, sibling to the editor itself. By convention, Quill modules should have a class name prefixed with `ql-`. Optionally include a refNode where container should be inserted before. --> 在Quill容器内部新增并返回一个容器元素,和编辑器本身是兄弟关系。按照惯例,Quill模块应该有一个带前缀`ql-`的类名。可指定一个引用节点,新节点会插入改节点的前面。 **方法** ```javascript addContainer(className: String, refNode?: Node): Element addContainer(domNode: Node, refNode?: Node): Element ``` **示例** ```javascript var container = quill.addContainer('ql-custom'); ``` ## getModule <!-- Retrieves a module that has been added to the editor. --> 返回一个已经添加到编辑器的模块。 **方法** ```javascript getModule(name: String): any ``` **示例** ```javascript var toolbar = quill.getModule('toolbar'); ``` ## disable <!-- Shorthand for [`enable(false)`](#enable). --> [`enable(false)`](#enable)的快捷方法。 ## enable <!-- Set ability for user to edit, via input devices like the mouse or keyboard. Does not affect capabilities of API calls. --> 让通过鼠标或键盘等输入设备设置让用户能够编辑内容。当`source`为`"api"`或`"silent"时,不影响API的调用。 **方法** ```javascript enable(value: Boolean = true) ``` **示例** ```javascript quill.enable(); quill.enable(false); // Disables user input ```