1 | import * as Parchment from 'parchment';
|
2 | import type { Op } from 'quill-delta';
|
3 | import Delta from 'quill-delta';
|
4 | import type { BlockEmbed } from '../blots/block.js';
|
5 | import type Block from '../blots/block.js';
|
6 | import type Scroll from '../blots/scroll.js';
|
7 | import type Clipboard from '../modules/clipboard.js';
|
8 | import type History from '../modules/history.js';
|
9 | import type Keyboard from '../modules/keyboard.js';
|
10 | import type Uploader from '../modules/uploader.js';
|
11 | import Editor from './editor.js';
|
12 | import Emitter from './emitter.js';
|
13 | import type { EmitterSource } from './emitter.js';
|
14 | import type { DebugLevel } from './logger.js';
|
15 | import Module from './module.js';
|
16 | import Selection, { Range } from './selection.js';
|
17 | import type { Bounds } from './selection.js';
|
18 | import Composition from './composition.js';
|
19 | import Theme from './theme.js';
|
20 | import type { ThemeConstructor } from './theme.js';
|
21 | import type { Rect } from './utils/scrollRectIntoView.js';
|
22 | declare const globalRegistry: Parchment.Registry;
|
23 |
|
24 |
|
25 |
|
26 | export interface QuillOptions {
|
27 | theme?: string;
|
28 | debug?: DebugLevel | boolean;
|
29 | registry?: Parchment.Registry;
|
30 | |
31 |
|
32 |
|
33 |
|
34 | readOnly?: boolean;
|
35 | |
36 |
|
37 |
|
38 |
|
39 | placeholder?: string;
|
40 | bounds?: HTMLElement | string | null;
|
41 | modules?: Record<string, unknown>;
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 | formats?: string[] | null;
|
48 | }
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | export interface ExpandedQuillOptions extends Omit<QuillOptions, 'theme' | 'formats'> {
|
54 | theme: ThemeConstructor;
|
55 | registry: Parchment.Registry;
|
56 | container: HTMLElement;
|
57 | modules: Record<string, unknown>;
|
58 | bounds?: HTMLElement | null;
|
59 | readOnly: boolean;
|
60 | }
|
61 | declare class Quill {
|
62 | static DEFAULTS: {
|
63 | bounds: null;
|
64 | modules: {
|
65 | clipboard: boolean;
|
66 | keyboard: boolean;
|
67 | history: boolean;
|
68 | uploader: boolean;
|
69 | };
|
70 | placeholder: string;
|
71 | readOnly: false;
|
72 | registry: Parchment.Registry;
|
73 | theme: string;
|
74 | };
|
75 | static events: {
|
76 | readonly EDITOR_CHANGE: "editor-change";
|
77 | readonly SCROLL_BEFORE_UPDATE: "scroll-before-update";
|
78 | readonly SCROLL_BLOT_MOUNT: "scroll-blot-mount";
|
79 | readonly SCROLL_BLOT_UNMOUNT: "scroll-blot-unmount";
|
80 | readonly SCROLL_OPTIMIZE: "scroll-optimize";
|
81 | readonly SCROLL_UPDATE: "scroll-update";
|
82 | readonly SCROLL_EMBED_UPDATE: "scroll-embed-update";
|
83 | readonly SELECTION_CHANGE: "selection-change";
|
84 | readonly TEXT_CHANGE: "text-change";
|
85 | readonly COMPOSITION_BEFORE_START: "composition-before-start";
|
86 | readonly COMPOSITION_START: "composition-start";
|
87 | readonly COMPOSITION_BEFORE_END: "composition-before-end";
|
88 | readonly COMPOSITION_END: "composition-end";
|
89 | };
|
90 | static sources: {
|
91 | readonly API: "api";
|
92 | readonly SILENT: "silent";
|
93 | readonly USER: "user";
|
94 | };
|
95 | static version: string;
|
96 | static imports: Record<string, unknown>;
|
97 | static debug(limit: DebugLevel | boolean): void;
|
98 | static find(node: Node, bubble?: boolean): Parchment.Blot | Quill | null;
|
99 | static import(name: 'core/module'): typeof Module;
|
100 | static import(name: `themes/${string}`): typeof Theme;
|
101 | static import(name: 'parchment'): typeof Parchment;
|
102 | static import(name: 'delta'): typeof Delta;
|
103 | static import(name: string): unknown;
|
104 | static register(path: string | Parchment.BlotConstructor | Parchment.Attributor | Record<string, unknown>, target?: Parchment.BlotConstructor | Parchment.Attributor | boolean, overwrite?: boolean): void;
|
105 | container: HTMLElement;
|
106 | root: HTMLDivElement;
|
107 | scroll: Scroll;
|
108 | emitter: Emitter;
|
109 | protected allowReadOnlyEdits: boolean;
|
110 | editor: Editor;
|
111 | composition: Composition;
|
112 | selection: Selection;
|
113 | theme: Theme;
|
114 | keyboard: Keyboard;
|
115 | clipboard: Clipboard;
|
116 | history: History;
|
117 | uploader: Uploader;
|
118 | options: ExpandedQuillOptions;
|
119 | constructor(container: HTMLElement | string, options?: QuillOptions);
|
120 | addContainer(container: string, refNode?: Node | null): HTMLDivElement;
|
121 | addContainer(container: HTMLElement, refNode?: Node | null): HTMLElement;
|
122 | blur(): void;
|
123 | deleteText(range: Range, source?: EmitterSource): Delta;
|
124 | deleteText(index: number, length: number, source?: EmitterSource): Delta;
|
125 | disable(): void;
|
126 | editReadOnly<T>(modifier: () => T): T;
|
127 | enable(enabled?: boolean): void;
|
128 | focus(options?: {
|
129 | preventScroll?: boolean;
|
130 | }): void;
|
131 | format(name: string, value: unknown, source?: EmitterSource): any;
|
132 | formatLine(index: number, length: number, formats: Record<string, unknown>, source?: EmitterSource): Delta;
|
133 | formatLine(index: number, length: number, name: string, value?: unknown, source?: EmitterSource): Delta;
|
134 | formatText(range: Range, name: string, value: unknown, source?: EmitterSource): Delta;
|
135 | formatText(index: number, length: number, name: string, value: unknown, source?: EmitterSource): Delta;
|
136 | formatText(index: number, length: number, formats: Record<string, unknown>, source?: EmitterSource): Delta;
|
137 | getBounds(index: number | Range, length?: number): Bounds | null;
|
138 | getContents(index?: number, length?: number): Delta;
|
139 | getFormat(index?: number, length?: number): {
|
140 | [format: string]: unknown;
|
141 | };
|
142 | getFormat(range?: Range): {
|
143 | [format: string]: unknown;
|
144 | };
|
145 | getIndex(blot: Parchment.Blot): number;
|
146 | getLength(): number;
|
147 | getLeaf(index: number): [Parchment.LeafBlot | null, number];
|
148 | getLine(index: number): [Block | BlockEmbed | null, number];
|
149 | getLines(range: Range): (Block | BlockEmbed)[];
|
150 | getLines(index?: number, length?: number): (Block | BlockEmbed)[];
|
151 | getModule(name: string): unknown;
|
152 | getSelection(focus: true): Range;
|
153 | getSelection(focus?: boolean): Range | null;
|
154 | getSemanticHTML(range: Range): string;
|
155 | getSemanticHTML(index?: number, length?: number): string;
|
156 | getText(range?: Range): string;
|
157 | getText(index?: number, length?: number): string;
|
158 | hasFocus(): boolean;
|
159 | insertEmbed(index: number, embed: string, value: unknown, source?: EmitterSource): any;
|
160 | insertText(index: number, text: string, source?: EmitterSource): Delta;
|
161 | insertText(index: number, text: string, formats: Record<string, unknown>, source?: EmitterSource): Delta;
|
162 | insertText(index: number, text: string, name: string, value: unknown, source?: EmitterSource): Delta;
|
163 | isEnabled(): boolean;
|
164 | off(...args: Parameters<(typeof Emitter)['prototype']['off']>): Emitter;
|
165 | on(event: (typeof Emitter)['events']['TEXT_CHANGE'], handler: (delta: Delta, oldContent: Delta, source: EmitterSource) => void): Emitter;
|
166 | on(event: (typeof Emitter)['events']['SELECTION_CHANGE'], handler: (range: Range, oldRange: Range, source: EmitterSource) => void): Emitter;
|
167 | on(event: (typeof Emitter)['events']['EDITOR_CHANGE'], handler: (...args: [
|
168 | (typeof Emitter)['events']['TEXT_CHANGE'],
|
169 | Delta,
|
170 | Delta,
|
171 | EmitterSource
|
172 | ] | [
|
173 | (typeof Emitter)['events']['SELECTION_CHANGE'],
|
174 | Range,
|
175 | Range,
|
176 | EmitterSource
|
177 | ]) => void): Emitter;
|
178 | on(event: string, ...args: unknown[]): Emitter;
|
179 | once(...args: Parameters<(typeof Emitter)['prototype']['once']>): Emitter;
|
180 | removeFormat(index: number, length: number, source?: EmitterSource): any;
|
181 | scrollRectIntoView(rect: Rect): void;
|
182 | |
183 |
|
184 |
|
185 | scrollIntoView(): void;
|
186 | |
187 |
|
188 |
|
189 |
|
190 | scrollSelectionIntoView(): void;
|
191 | setContents(delta: Delta | Op[], source?: EmitterSource): any;
|
192 | setSelection(range: Range | null, source?: EmitterSource): void;
|
193 | setSelection(index: number, source?: EmitterSource): void;
|
194 | setSelection(index: number, length?: number, source?: EmitterSource): void;
|
195 | setSelection(index: number, source?: EmitterSource): void;
|
196 | setText(text: string, source?: EmitterSource): any;
|
197 | update(source?: EmitterSource): void;
|
198 | updateContents(delta: Delta | Op[], source?: EmitterSource): any;
|
199 | }
|
200 | declare function expandConfig(containerOrSelector: HTMLElement | string, options: QuillOptions): ExpandedQuillOptions;
|
201 | type NormalizedIndexLength = [
|
202 | number,
|
203 | number,
|
204 | Record<string, unknown>,
|
205 | EmitterSource
|
206 | ];
|
207 | declare function overload(index: number, source?: EmitterSource): NormalizedIndexLength;
|
208 | declare function overload(index: number, length: number, source?: EmitterSource): NormalizedIndexLength;
|
209 | declare function overload(index: number, length: number, format: string, value: unknown, source?: EmitterSource): NormalizedIndexLength;
|
210 | declare function overload(index: number, length: number, format: Record<string, unknown>, source?: EmitterSource): NormalizedIndexLength;
|
211 | declare function overload(range: Range, source?: EmitterSource): NormalizedIndexLength;
|
212 | declare function overload(range: Range, format: string, value: unknown, source?: EmitterSource): NormalizedIndexLength;
|
213 | declare function overload(range: Range, format: Record<string, unknown>, source?: EmitterSource): NormalizedIndexLength;
|
214 | export type { Bounds, DebugLevel, EmitterSource };
|
215 | export { Parchment, Range };
|
216 | export { globalRegistry, expandConfig, overload, Quill as default };
|