quill
Advanced tools
Comparing version 2.0.1 to 2.0.2
import Quill, { Parchment, Range } from './core/quill.js'; | ||
import type { Bounds, DebugLevel, EmitterSource, ExpandedQuillOptions, QuillOptions } from './core/quill.js'; | ||
import Delta, { Op, OpIterator, AttributeMap } from 'quill-delta'; | ||
export { default as Module } from './core/module.js'; | ||
export { Delta, Op, OpIterator, AttributeMap, Parchment, Range }; | ||
export type { Bounds, DebugLevel, EmitterSource, ExpandedQuillOptions, QuillOptions, }; | ||
export default Quill; |
@@ -17,2 +17,3 @@ import Quill, { Parchment, Range } from './core/quill.js'; | ||
import UINode from './modules/uiNode.js'; | ||
export { default as Module } from './core/module.js'; | ||
export { Delta, Op, OpIterator, AttributeMap, Parchment, Range }; | ||
@@ -19,0 +20,0 @@ Quill.register({ |
import type Quill from './quill.js'; | ||
declare abstract class Module<T extends {} = {}> { | ||
protected quill: Quill; | ||
quill: Quill; | ||
protected options: Partial<T>; | ||
@@ -5,0 +5,0 @@ static DEFAULTS: {}; |
@@ -104,3 +104,5 @@ import * as Parchment from 'parchment'; | ||
static import(name: string): unknown; | ||
static register(path: string | Parchment.BlotConstructor | Parchment.Attributor | Record<string, unknown>, target?: Parchment.BlotConstructor | Parchment.Attributor | boolean, overwrite?: boolean): void; | ||
static register(targets: Record<string, Parchment.RegistryDefinition | Record<string, unknown> | Theme | Module | Function>, overwrite?: boolean): void; | ||
static register(target: Parchment.RegistryDefinition, overwrite?: boolean): void; | ||
static register(path: string, target: any, overwrite?: boolean): void; | ||
container: HTMLElement; | ||
@@ -107,0 +109,0 @@ root: HTMLDivElement; |
@@ -43,3 +43,3 @@ import { merge } from 'lodash-es'; | ||
static sources = Emitter.sources; | ||
static version = typeof "2.0.1" === 'undefined' ? 'dev' : "2.0.1"; | ||
static version = typeof "2.0.2" === 'undefined' ? 'dev' : "2.0.2"; | ||
static imports = { | ||
@@ -67,17 +67,20 @@ delta: Delta, | ||
} | ||
static register(path, target) { | ||
let overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
if (typeof path !== 'string') { | ||
const name = 'attrName' in path ? path.attrName : path.blotName; | ||
static register() { | ||
if (typeof (arguments.length <= 0 ? undefined : arguments[0]) !== 'string') { | ||
const target = arguments.length <= 0 ? undefined : arguments[0]; | ||
const overwrite = !!(arguments.length <= 1 ? undefined : arguments[1]); | ||
const name = 'attrName' in target ? target.attrName : target.blotName; | ||
if (typeof name === 'string') { | ||
// Shortcut for formats: | ||
// register(Blot | Attributor, overwrite) | ||
// @ts-expect-error | ||
this.register(`formats/${name}`, path, target); | ||
this.register(`formats/${name}`, target, overwrite); | ||
} else { | ||
Object.keys(path).forEach(key => { | ||
// @ts-expect-error | ||
this.register(key, path[key], target); | ||
Object.keys(target).forEach(key => { | ||
this.register(key, target[key], overwrite); | ||
}); | ||
} | ||
} else { | ||
const path = arguments.length <= 0 ? undefined : arguments[0]; | ||
const target = arguments.length <= 1 ? undefined : arguments[1]; | ||
const overwrite = !!(arguments.length <= 2 ? undefined : arguments[2]); | ||
if (this.imports[path] != null && !overwrite) { | ||
@@ -87,10 +90,6 @@ debug.warn(`Overwriting ${path} with`, target); | ||
this.imports[path] = target; | ||
if ((path.startsWith('blots/') || path.startsWith('formats/')) && target && typeof target !== 'boolean' && | ||
// @ts-expect-error | ||
target.blotName !== 'abstract') { | ||
if ((path.startsWith('blots/') || path.startsWith('formats/')) && target && typeof target !== 'boolean' && target.blotName !== 'abstract') { | ||
globalRegistry.register(target); | ||
} | ||
// @ts-expect-error | ||
if (typeof target.register === 'function') { | ||
// @ts-expect-error | ||
target.register(globalRegistry); | ||
@@ -97,0 +96,0 @@ } |
/*! | ||
* Quill Editor v2.0.1 | ||
* Quill Editor v2.0.2 | ||
* https://quilljs.com | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2017-2024, Slab |
/*! | ||
* Quill Editor v2.0.1 | ||
* Quill Editor v2.0.2 | ||
* https://quilljs.com | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2017-2024, Slab |
@@ -120,2 +120,7 @@ import { cloneDeep, isEqual } from 'lodash-es'; | ||
if (evt.defaultPrevented || evt.isComposing) return; | ||
// evt.isComposing is false when pressing Enter/Backspace when composing in Safari | ||
// https://bugs.webkit.org/show_bug.cgi?id=165004 | ||
const isComposing = evt.keyCode === 229 && (evt.key === 'Enter' || evt.key === 'Backspace'); | ||
if (isComposing) return; | ||
const bindings = (this.bindings[evt.key] || []).concat(this.bindings[evt.which] || []); | ||
@@ -122,0 +127,0 @@ const matches = bindings.filter(binding => Keyboard.match(evt, binding)); |
@@ -18,3 +18,3 @@ import Delta from 'quill-delta'; | ||
format(name: string, value: unknown): void; | ||
replaceWith(name: string, value: unknown): Blot; | ||
replaceWith(name: string | Blot, value?: any): Blot; | ||
} | ||
@@ -21,0 +21,0 @@ declare class SyntaxCodeBlockContainer extends CodeBlockContainer { |
@@ -154,3 +154,2 @@ import Delta from 'quill-delta'; | ||
} | ||
// @ts-expect-error | ||
SyntaxCodeBlockContainer.allowedChildren = [SyntaxCodeBlock]; | ||
@@ -173,3 +172,2 @@ SyntaxCodeBlock.requiredContainer = SyntaxCodeBlockContainer; | ||
Quill.register(CodeToken, true); | ||
// @ts-expect-error | ||
Quill.register(SyntaxCodeBlock, true); | ||
@@ -176,0 +174,0 @@ Quill.register(SyntaxCodeBlockContainer, true); |
import Quill from '../core/quill.js'; | ||
import Module from '../core/module.js'; | ||
import type { Range } from '../core/selection.js'; | ||
type Handler = (value: any) => void; | ||
type Handler = (this: Toolbar, value: any) => void; | ||
export type ToolbarConfig = Array<string[] | Array<string | Record<string, unknown>>>; | ||
@@ -6,0 +6,0 @@ export interface ToolbarProps { |
@@ -216,3 +216,3 @@ import Delta from 'quill-delta'; | ||
} else { | ||
this.quill.removeFormat(range, Quill.sources.USER); | ||
this.quill.removeFormat(range.index, range.length, Quill.sources.USER); | ||
} | ||
@@ -233,3 +233,5 @@ }, | ||
const range = this.quill.getSelection(); | ||
// @ts-expect-error | ||
const formats = this.quill.getFormat(range); | ||
// @ts-expect-error | ||
const indent = parseInt(formats.indent || 0, 10); | ||
@@ -250,2 +252,3 @@ if (value === '+1' || value === '-1') { | ||
const range = this.quill.getSelection(); | ||
// @ts-expect-error | ||
const formats = this.quill.getFormat(range); | ||
@@ -252,0 +255,0 @@ if (value === 'check') { |
@@ -45,8 +45,10 @@ import Delta from 'quill-delta'; | ||
handler(range, files) { | ||
if (!this.quill.scroll.query('image')) { | ||
return; | ||
} | ||
const promises = files.map(file => { | ||
return new Promise(resolve => { | ||
const reader = new FileReader(); | ||
reader.onload = e => { | ||
// @ts-expect-error Fix me later | ||
resolve(e.target.result); | ||
reader.onload = () => { | ||
resolve(reader.result); | ||
}; | ||
@@ -53,0 +55,0 @@ reader.readAsDataURL(file); |
{ | ||
"name": "quill", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Your powerful, rich text editor", | ||
@@ -5,0 +5,0 @@ "author": "Jason Chen <jhchen7@gmail.com>", |
import Quill, { Parchment, Range } from './core.js'; | ||
import type { Bounds, DebugLevel, EmitterSource, ExpandedQuillOptions, QuillOptions } from './core.js'; | ||
export { Module } from './core.js'; | ||
export type { Bounds, DebugLevel, EmitterSource, ExpandedQuillOptions, QuillOptions, }; | ||
export { Parchment, Range }; | ||
export default Quill; |
@@ -80,4 +80,5 @@ import Quill, { Parchment, Range } from './core.js'; | ||
}, true); | ||
export { Module } from './core.js'; | ||
export { Parchment, Range }; | ||
export default Quill; | ||
//# sourceMappingURL=quill.js.map |
@@ -1,3 +0,1 @@ | ||
Note: This branch and README covers the upcoming 2.0 release. View [1.x docs here](https://github.com/quilljs/quill/tree/1.3.6). | ||
<h1 align="center"> | ||
@@ -10,7 +8,7 @@ <a href="https://quilljs.com/" title="Quill">Quill Rich Text Editor</a> | ||
<p align="center"> | ||
<a title="Documentation" href="https://quilljs.com/docs/"><strong>Documentation</strong></a> | ||
<a title="Documentation" href="https://quilljs.com/docs/quickstart"><strong>Documentation</strong></a> | ||
• | ||
<a title="Development" href="https://github.com/quilljs/quill/blob/master/.github/DEVELOPMENT.md"><strong>Development</strong></a> | ||
<a title="Development" href="https://github.com/quilljs/quill/blob/main/.github/DEVELOPMENT.md"><strong>Development</strong></a> | ||
• | ||
<a title="Contributing" href="https://github.com/quilljs/quill/blob/master/.github/CONTRIBUTING.md"><strong>Contributing</strong></a> | ||
<a title="Contributing" href="https://github.com/quilljs/quill/blob/main/.github/CONTRIBUTING.md"><strong>Contributing</strong></a> | ||
• | ||
@@ -20,13 +18,9 @@ <a title="Interactive Playground" href="https://quilljs.com/playground/"><strong>Interactive Playground</strong></a> | ||
<p align="center"> | ||
<a href="https://github.com/quilljs/quill/actions" title="Build Status"> | ||
<img src="https://github.com/quilljs/quill/actions/workflows/main.yml/badge.svg" alt="Build Status"> | ||
</a> | ||
<a href="https://npmjs.com/package/quill" title="Version"> | ||
<img src="https://img.shields.io/npm/v/quill.svg" alt="Version"> | ||
</a> | ||
<a href="https://npmjs.com/package/quill" title="Downloads"> | ||
<img src="https://img.shields.io/npm/dm/quill.svg" alt="Downloads"> | ||
</a> | ||
<a href="https://github.com/quilljs/quill/actions" title="Build Status"><img src="https://github.com/quilljs/quill/actions/workflows/main.yml/badge.svg" alt="Build Status"></a> | ||
<a href="https://npmjs.com/package/quill" title="Version"><img src="https://img.shields.io/npm/v/quill.svg" alt="Version"></a> | ||
<a href="https://npmjs.com/package/quill" title="Downloads"><img src="https://img.shields.io/npm/dm/quill.svg" alt="Downloads"></a> | ||
</p> | ||
<hr/> | ||
[Quill](https://quilljs.com/) is a modern rich text editor built for compatibility and extensibility. It was created by [Jason Chen](https://twitter.com/jhchen) and [Byron Milligan](https://twitter.com/byronmilligan) and actively maintained by [Slab](https://slab.com). | ||
@@ -36,2 +30,69 @@ | ||
## Quickstart | ||
Instantiate a new Quill object with a css selector for the div that should become the editor. | ||
```html | ||
<!-- Include Quill stylesheet --> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/quill@2/dist/quill.snow.css" | ||
rel="stylesheet" | ||
/> | ||
<!-- Create the toolbar container --> | ||
<div id="toolbar"> | ||
<button class="ql-bold">Bold</button> | ||
<button class="ql-italic">Italic</button> | ||
</div> | ||
<!-- Create the editor container --> | ||
<div id="editor"> | ||
<p>Hello World!</p> | ||
<p>Some initial <strong>bold</strong> text</p> | ||
<p><br /></p> | ||
</div> | ||
<!-- Include the Quill library --> | ||
<script src="https://cdn.jsdelivr.net/npm/quill@2/dist/quill.js"></script> | ||
<!-- Initialize Quill editor --> | ||
<script> | ||
const quill = new Quill("#editor", { | ||
theme: "snow", | ||
}); | ||
</script> | ||
``` | ||
Take a look at the [Quill](https://quilljs.com/) website for more documentation, guides and [live playground](https://quilljs.com/playground/)! | ||
## Download | ||
```shell | ||
npm install quill | ||
``` | ||
### CDN | ||
```html | ||
<!-- Main Quill library --> | ||
<script src="https://cdn.jsdelivr.net/npm/quill@2/dist/quill.js"></script> | ||
<!-- Theme included stylesheets --> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/quill@2/dist/quill.snow.css" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/quill@2/dist/quill.bubble.css" | ||
rel="stylesheet" | ||
/> | ||
<!-- Core build with no theme, formatting, non-essential modules --> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/quill@2/dist/quill.core.css" | ||
rel="stylesheet" | ||
/> | ||
<script src="https://cdn.jsdelivr.net/npm/quill@2/dist/quill.core.js"></script> | ||
``` | ||
## Community | ||
@@ -42,4 +103,6 @@ | ||
- [Contribute](https://github.com/quilljs/quill/blob/main/.github/CONTRIBUTING.md) on [Issues](https://github.com/quilljs/quill/issues) | ||
- Follow [@jhchen](https://twitter.com/jhchen) and [@quilljs](https://twitter.com/quilljs) on Twitter | ||
- Ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/quill) | ||
- If privacy is required, email support@quilljs.com | ||
- Ask questions on [Discussions](https://github.com/quilljs/quill/discussions) | ||
## License | ||
BSD 3-clause |
import BaseTheme, { BaseTooltip } from './base.js'; | ||
import type { Bounds } from '../core/selection.js'; | ||
import type Quill from '../core.js'; | ||
import Quill from '../core/quill.js'; | ||
import type { ThemeOptions } from '../core/theme.js'; | ||
@@ -5,0 +5,0 @@ import type Toolbar from '../modules/toolbar.js'; |
@@ -6,2 +6,3 @@ import { merge } from 'lodash-es'; | ||
import icons from '../ui/icons.js'; | ||
import Quill from '../core/quill.js'; | ||
const TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ | ||
@@ -103,4 +104,5 @@ header: 1 | ||
if (!value) { | ||
this.quill.format('link', false); | ||
this.quill.format('link', false, Quill.sources.USER); | ||
} else { | ||
// @ts-expect-error | ||
this.quill.theme.tooltip.edit(); | ||
@@ -107,0 +109,0 @@ } |
import BaseTheme from './base.js'; | ||
import type Quill from '../core.js'; | ||
import Quill from '../core/quill.js'; | ||
import type Toolbar from '../modules/toolbar.js'; | ||
@@ -4,0 +4,0 @@ import type { ThemeOptions } from '../core/theme.js'; |
@@ -7,2 +7,3 @@ import { merge } from 'lodash-es'; | ||
import icons from '../ui/icons.js'; | ||
import Quill from '../core/quill.js'; | ||
const TOOLBAR_CONFIG = [[{ | ||
@@ -108,2 +109,3 @@ header: ['1', '2', '3', false] | ||
} | ||
// @ts-expect-error | ||
const { | ||
@@ -114,3 +116,3 @@ tooltip | ||
} else { | ||
this.quill.format('link', false); | ||
this.quill.format('link', false, Quill.sources.USER); | ||
} | ||
@@ -117,0 +119,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3036792
9691
105