[TOC]
<!--
Quill allows several ways to customize it to suit your needs.
This section is dedicated to tweaking existing functionality.
See the [Modules](/docs/modules/) section for adding new functionality and the [Themes](模塊modules.md) section for styling.
-->
Quill允許多種方式去自定義來滿足你的需求。本節主要說明如何調整現有的功能。添加新功能參見[模塊](模塊modules.md)小節, 更改樣式請參見[主題](主題themes.md)小節。
## 容器
<!--
Quill requires a container where the editor will be appended. You can pass in either a CSS selector or a DOM object.
-->
Quill需要一個容器放置編輯器,可以通過一個CSS選擇器或一個DOM對象來設置。
```javascript
var editor = new Quill('.editor'); // First matching element will be used
```
```javascript
var container = document.getElementById('editor');
var editor = new Quill(container);
```
```javascript
var container = $('.editor').get(0);
var editor = new Quill(container);
```
## 選項
<!--
To configure Quill, pass in an options object
-->
可以通過傳入option對象來配置Quill:
```javascript
var options = {
debug: 'info',
modules: {
toolbar: '#toolbar'
},
placeholder: 'Compose an epic...',
readOnly: true,
theme: 'snow'
};
var editor = new Quill('#editor', options);
```
<!--
The following keys are recognized:
-->
可設置的選項值:
### bounds
默認值: `document.body`
<!--
DOM Element or a CSS selector for a DOM Element, within which the editor's ui elements (i.e. tooltips, etc.) should be confined. Currently, it only considers left and right boundaries.
-->
可以設置為DOM元素或代表DOM元素的CSS選擇器,用來包含編輯器的UI元素(比如tooltips等等),當前只考慮左右邊界。
### debug
默認值: `warn`
<!--
Shortcut for [debug](/docs/api/#debug). Note `debug` is a static method and will affect other instances of Quill editors on the page. Only warning and error messages are enabled by default.
-->
[debug](api/擴展extension.md)的快捷方式。注意,debug是一個靜態方法并且可能影響當前頁面內Quill編輯器實例。默認只顯示警告和錯誤信息。
### formats
默認值: All formats
<!--
Whitelist of formats to allow in the editor. See [Formats](/docs/formats/) for a complete list.
-->
編輯器允許的格式列表白名單。完整的列表,請見[Formats](格式formats.md)。
### modules
<!--
Collection of modules to include and respective options. See [Modules](/docs/modules/) for more information.
-->
需要引入模塊的集合及它們各自的選項。詳情見See [Modules](模塊modules.md)。
### placeholder
默認值: None
<!--
Placeholder text to show when editor is empty.
-->
當編輯器為空時顯示的占位符文字。
### readOnly
默認值: `false`
<!--
Whether to instantiate the editor to read-only mode.
-->
是否將編輯器實例設置為只讀模式。
### scrollingContainer
默認值: `null`
<!--
DOM Element or a CSS selector for a DOM Element, specifying which container has the scrollbars (i.e. `overflow-y: auto`),
if is has been changed from the default `ql-editor` with custom CSS. Necessary to fix scroll jumping bugs when Quill is set to [auto grow](/playground/#autogrow)
its height, and another ancestor container is responsible from the scrolling.
-->
當默認的'ql-editor'元素已經被自定義CSS改變,可以設置為DOM元素或代表DOM元素的CSS選擇器,指定有滾動條(`overflow-y: auto`)的容器。
當Quill被設置成自適應高度,需要修復這個滾動時跳動的bug,從而讓另一個祖先容器負責滾動。
<!--
*Note: Some browsers will still jump when this value is `body`. Use a separate child `div` to avoid this.*
-->
*注意: 當這個值為`body`u時,某些瀏覽器依然會跳動,可以使用一個單獨的`DIV`來避免這種情況*
### strict
默認值: `true`
<!--
Some improvements and modifications, under a strict interpretation of semver, would warrant a major version bump.
To prevent small changes from inflating Quill's version number, they are disabled by this `strict` flag.
Specific changes can be found in the [Changelog](https://github.com/quilljs/quill/blob/master/CHANGELOG.md) and
searching for "strict". Setting this to `false` opts into potential future improvements.
-->
在semver的嚴格解釋下,一些改進或修改被要求一個大版本的bump。它們通過`strict`嚴格標志來防止對Quill版本號進行小的更改。可以在
[Changelog](https://github.com/quilljs/quill/blob/master/CHANGELOG.md)中搜索"strict"查找具體的更改信息。設置為'flase'表示同意未來潛在的改進。
### theme
<!--
Name of theme to use. The builtin options are "bubble" or "snow".
An invalid or falsy value will load a default minimal theme.
Note the theme's specific stylesheet still needs to be included manually.
See [Themes](主題themes.md) for more information.
-->
使用主題的名稱。這個內置的選項是"bubble"或"snow"。一個無效或錯誤的值將加載默認的最小化主題。注意,主題的樣式表任需要手動包含。詳情,請見[主題](主題themes.md)
- 前言
- 快速開始(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
- 更多模塊