1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- ---
- title: Registries
- ---
- Registries allow multiple editors with different formats to coexist on the same page.
- If you register a format with `Quill.register()`, the format will be registered to a global registry,
- which will be used by all Quill instances.
- However, in some cases, you might want to have multiple registries, so that different Quill instances
- can have different formats. For example, you might want to have a Quill instance that only supports
- bold and italic, and another Quill instance that supports bold, italic, and underline.
- ## Usage
- To create a Quill with a custom registry, you can pass in a registry object to the Quill constructor:
- ```js
- const registry = new Parchment.Registry();
- // Register the formats that you need for the editor with `registry.register()`.
- // We will cover this in more detail in the next section.
- const quill = new Quill(
- registry,
- // ...other options
- })
- ```
- ## Register Formats
- A custom registry doesn
- There are some essential formats that you will need to register in order to have a functional editor:
- <Sandpack
- defaultShowPreview
- files={{
-
- <!-- Include stylesheet -->
- <link href="{{site.cdn}}/quill.snow.css" rel="stylesheet" />
- <div id="editor">
- </div>
- <!-- Include the Quill library -->
- <script src="{{site.cdn}}/quill.js"></script>
- <script src="/index.js"></script>`,
- "/index.js": `
- const Parchment = Quill.import(
- // Essential formats
- const Block = Quill.import(
- const Break = Quill.import(
- const Container = Quill.import(
- const Cursor = Quill.import(
- const Inline = Quill.import(
- const Scroll = Quill.import(
- const Text= Quill.import(
- const registry = new Parchment.Registry();
- registry.register(
- Scroll,
- Block,
- Break,
- Container,
- Cursor,
- Inline,
- Text,
- );
- const quill = new Quill(
- registry,
- theme:
- });
- `}}
- />
- <Hint>
- You may have noticed that the format buttons on the toolbar above doesn
- This is because we haven
- The toolbar module doesn
- Follow [this guide](/docs/modules/toolbar) to learn more about how to customize the toolbar.
- </Hint>
|