[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
```
- 前言
- 快速開始(quick_start)
- 下載(download)
- 配置(configuration)
- 格式(formats)
- API
- 內容(contents)
- 格式化(formatting)
- 選區(selection)
- 編輯器(editor)
- 事件(events)
- 模型(model)
- 擴展(extension)
- 增量(Delta)
- 模塊(modules)
- 工具欄(toolbar)
- 鍵盤(keyboard)
- 歷史記錄(history)
- 粘貼板(clipboard)
- 語法高亮(syntax)
- 主題(themes)
- 更多教程
- 為什么選擇Quill?
- 如何定制Quill?
- 設計Delta格式(未翻譯)
- 構建一個自定義模塊
- 將Quill加入你的編譯管線(未翻譯)
- Cloning Medium with Parchment
- 和其它富文本編輯器的對比(未翻譯)
- Designing the Delta Format
- 擴展模塊
- vue-quill-editor
- quill-image-extend-module
- quill-image-resize-module
- quill-image-drop-module
- quill-better-table
- quilljs-table
- 更多模塊