quoin-editor 0.4.2 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +251 -0
- package/MIGRATION.md +233 -0
- package/README.md +78 -716
- package/dist/ai.cjs +1148 -0
- package/dist/ai.cjs.map +1 -0
- package/dist/ai.d.cts +68 -0
- package/dist/ai.d.ts +68 -0
- package/dist/ai.js +1148 -0
- package/dist/ai.js.map +1 -0
- package/dist/catalogue.cjs +59 -0
- package/dist/catalogue.cjs.map +1 -0
- package/dist/catalogue.d.cts +39 -0
- package/dist/catalogue.d.ts +39 -0
- package/dist/catalogue.js +59 -0
- package/dist/catalogue.js.map +1 -0
- package/dist/chunk-26Q4LSIU.js +100 -0
- package/dist/chunk-26Q4LSIU.js.map +1 -0
- package/dist/chunk-56C7GCKO.cjs +1385 -0
- package/dist/chunk-56C7GCKO.cjs.map +1 -0
- package/dist/chunk-5M4QG3ZC.cjs +3303 -0
- package/dist/chunk-5M4QG3ZC.cjs.map +1 -0
- package/dist/chunk-5R3ISX4A.cjs +6643 -0
- package/dist/chunk-5R3ISX4A.cjs.map +1 -0
- package/dist/chunk-62WKUAQY.js +3335 -0
- package/dist/chunk-62WKUAQY.js.map +1 -0
- package/dist/chunk-6LMS5J3Y.js +320 -0
- package/dist/chunk-6LMS5J3Y.js.map +1 -0
- package/dist/chunk-6PKVJZQV.cjs +100 -0
- package/dist/chunk-6PKVJZQV.cjs.map +1 -0
- package/dist/chunk-6YSGUAVW.js +376 -0
- package/dist/chunk-6YSGUAVW.js.map +1 -0
- package/dist/chunk-75C6PX2L.cjs +239 -0
- package/dist/chunk-75C6PX2L.cjs.map +1 -0
- package/dist/chunk-A4IJSJKL.js +598 -0
- package/dist/chunk-A4IJSJKL.js.map +1 -0
- package/dist/chunk-BTBHHBVR.cjs +3335 -0
- package/dist/chunk-BTBHHBVR.cjs.map +1 -0
- package/dist/chunk-CLTHD5GO.cjs +34 -0
- package/dist/chunk-CLTHD5GO.cjs.map +1 -0
- package/dist/chunk-EH5KXQXY.cjs +62 -0
- package/dist/chunk-EH5KXQXY.cjs.map +1 -0
- package/dist/chunk-ESMAW4NK.cjs +184 -0
- package/dist/chunk-ESMAW4NK.cjs.map +1 -0
- package/dist/chunk-EYFCOV3T.cjs +30 -0
- package/dist/chunk-EYFCOV3T.cjs.map +1 -0
- package/dist/chunk-F5V3IEEE.cjs +326 -0
- package/dist/chunk-F5V3IEEE.cjs.map +1 -0
- package/dist/chunk-GPIDU3GN.js +239 -0
- package/dist/chunk-GPIDU3GN.js.map +1 -0
- package/dist/chunk-HOIDJEVI.cjs +4063 -0
- package/dist/chunk-HOIDJEVI.cjs.map +1 -0
- package/dist/chunk-JJ3RASQS.cjs +706 -0
- package/dist/chunk-JJ3RASQS.cjs.map +1 -0
- package/dist/chunk-LE3F7WIP.js +6643 -0
- package/dist/chunk-LE3F7WIP.js.map +1 -0
- package/dist/chunk-LE5XMIFJ.cjs +14 -0
- package/dist/chunk-LE5XMIFJ.cjs.map +1 -0
- package/dist/chunk-LMAEPFTX.js +30 -0
- package/dist/chunk-LMAEPFTX.js.map +1 -0
- package/dist/chunk-LV6EYPJO.js +34 -0
- package/dist/chunk-LV6EYPJO.js.map +1 -0
- package/dist/chunk-MLRAVUFG.cjs +376 -0
- package/dist/chunk-MLRAVUFG.cjs.map +1 -0
- package/dist/chunk-MQUCCSWG.js +14 -0
- package/dist/chunk-MQUCCSWG.js.map +1 -0
- package/dist/chunk-O4Z2WMFF.js +62 -0
- package/dist/chunk-O4Z2WMFF.js.map +1 -0
- package/dist/chunk-OCCKQHCY.js +25 -0
- package/dist/chunk-OCCKQHCY.js.map +1 -0
- package/dist/chunk-PGSS4IOS.js +706 -0
- package/dist/chunk-PGSS4IOS.js.map +1 -0
- package/dist/chunk-PIWRSX7U.js +562 -0
- package/dist/chunk-PIWRSX7U.js.map +1 -0
- package/dist/chunk-PX6LZMH4.cjs +598 -0
- package/dist/chunk-PX6LZMH4.cjs.map +1 -0
- package/dist/chunk-QXG3HWDS.js +184 -0
- package/dist/chunk-QXG3HWDS.js.map +1 -0
- package/dist/chunk-RQW3P3GH.js +504 -0
- package/dist/chunk-RQW3P3GH.js.map +1 -0
- package/dist/chunk-SSIRYUCK.js +3303 -0
- package/dist/chunk-SSIRYUCK.js.map +1 -0
- package/dist/chunk-UBNG5YCG.js +326 -0
- package/dist/chunk-UBNG5YCG.js.map +1 -0
- package/dist/chunk-UCXLRRWY.js +1385 -0
- package/dist/chunk-UCXLRRWY.js.map +1 -0
- package/dist/chunk-UDAVVEFC.cjs +562 -0
- package/dist/chunk-UDAVVEFC.cjs.map +1 -0
- package/dist/chunk-UPSLDTLT.js +4063 -0
- package/dist/chunk-UPSLDTLT.js.map +1 -0
- package/dist/chunk-UWNZG2SD.cjs +25 -0
- package/dist/chunk-UWNZG2SD.cjs.map +1 -0
- package/dist/chunk-V3KLMSRO.cjs +504 -0
- package/dist/chunk-V3KLMSRO.cjs.map +1 -0
- package/dist/chunk-VACTAZWS.cjs +249 -0
- package/dist/chunk-VACTAZWS.cjs.map +1 -0
- package/dist/chunk-WMN6566P.js +249 -0
- package/dist/chunk-WMN6566P.js.map +1 -0
- package/dist/chunk-XX5FTPJR.cjs +320 -0
- package/dist/chunk-XX5FTPJR.cjs.map +1 -0
- package/dist/comments.cjs +1008 -0
- package/dist/comments.cjs.map +1 -0
- package/dist/comments.d.cts +93 -0
- package/dist/comments.d.ts +93 -0
- package/dist/comments.js +1008 -0
- package/dist/comments.js.map +1 -0
- package/dist/diff.cjs +346 -0
- package/dist/diff.cjs.map +1 -0
- package/dist/diff.d.cts +67 -0
- package/dist/diff.d.ts +67 -0
- package/dist/diff.js +346 -0
- package/dist/diff.js.map +1 -0
- package/dist/docx.cjs +874 -0
- package/dist/docx.cjs.map +1 -0
- package/dist/docx.d.cts +33 -0
- package/dist/docx.d.ts +33 -0
- package/dist/docx.js +874 -0
- package/dist/docx.js.map +1 -0
- package/dist/embed-provider-jXwlRmnp.d.cts +19 -0
- package/dist/embed-provider-jXwlRmnp.d.ts +19 -0
- package/dist/embed.cjs +17 -0
- package/dist/embed.cjs.map +1 -0
- package/dist/embed.d.cts +56 -0
- package/dist/embed.d.ts +56 -0
- package/dist/embed.js +17 -0
- package/dist/embed.js.map +1 -0
- package/dist/emoji-data.cjs +1968 -0
- package/dist/emoji-data.cjs.map +1 -0
- package/dist/emoji-data.js +1968 -0
- package/dist/emoji-data.js.map +1 -0
- package/dist/emoji-extension-CmPlRssm.d.ts +46 -0
- package/dist/emoji-extension-zJ6F7hW8.d.cts +46 -0
- package/dist/emoji.cjs +18 -0
- package/dist/emoji.cjs.map +1 -0
- package/dist/emoji.d.cts +31 -0
- package/dist/emoji.d.ts +31 -0
- package/dist/emoji.js +18 -0
- package/dist/emoji.js.map +1 -0
- package/dist/engine.cjs +119 -0
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +144 -0
- package/dist/engine.d.ts +144 -0
- package/dist/engine.js +119 -0
- package/dist/engine.js.map +1 -0
- package/dist/find-extension-BcRyE9K4.d.cts +41 -0
- package/dist/find-extension-CmFehyul.d.ts +41 -0
- package/dist/find.cjs +20 -0
- package/dist/find.cjs.map +1 -0
- package/dist/find.d.cts +44 -0
- package/dist/find.d.ts +44 -0
- package/dist/find.js +20 -0
- package/dist/find.js.map +1 -0
- package/dist/headless.cjs +151 -518
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +102 -69
- package/dist/headless.d.ts +102 -69
- package/dist/headless.js +149 -467
- package/dist/headless.js.map +1 -1
- package/dist/index-CFPmCee4.d.cts +68 -0
- package/dist/index-DiCGV60d.d.ts +68 -0
- package/dist/index.cjs +183 -2753
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +345 -253
- package/dist/index.d.ts +345 -253
- package/dist/index.js +168 -2696
- package/dist/index.js.map +1 -1
- package/dist/math.cjs +18 -0
- package/dist/math.cjs.map +1 -0
- package/dist/math.d.cts +49 -0
- package/dist/math.d.ts +49 -0
- package/dist/math.js +18 -0
- package/dist/math.js.map +1 -0
- package/dist/mention.cjs +18 -0
- package/dist/mention.cjs.map +1 -0
- package/dist/mention.d.cts +50 -0
- package/dist/mention.d.ts +50 -0
- package/dist/mention.js +18 -0
- package/dist/mention.js.map +1 -0
- package/dist/presence.cjs +562 -0
- package/dist/presence.cjs.map +1 -0
- package/dist/presence.d.cts +30 -0
- package/dist/presence.d.ts +30 -0
- package/dist/presence.js +562 -0
- package/dist/presence.js.map +1 -0
- package/dist/registry-CWBOSAHm.d.cts +121 -0
- package/dist/registry-CWBOSAHm.d.ts +121 -0
- package/dist/stats-extension-DisOEbbI.d.ts +40 -0
- package/dist/stats-extension-Dt1lgP3m.d.cts +40 -0
- package/dist/stats.cjs +19 -0
- package/dist/stats.cjs.map +1 -0
- package/dist/stats.d.cts +19 -0
- package/dist/stats.d.ts +19 -0
- package/dist/stats.js +19 -0
- package/dist/stats.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/table-extension-BTMJnT7J.d.ts +57 -0
- package/dist/table-extension-DxZz3jqp.d.cts +57 -0
- package/dist/table.cjs +50 -0
- package/dist/table.cjs.map +1 -0
- package/dist/table.d.cts +57 -0
- package/dist/table.d.ts +57 -0
- package/dist/table.js +50 -0
- package/dist/table.js.map +1 -0
- package/dist/to-html-C5t7xyaM.d.ts +21 -0
- package/dist/to-html-CNCITCln.d.cts +21 -0
- package/dist/toc-extension-CR9U-l6j.d.ts +25 -0
- package/dist/toc-extension-DGHywOBv.d.cts +25 -0
- package/dist/toc.cjs +18 -0
- package/dist/toc.cjs.map +1 -0
- package/dist/toc.d.cts +24 -0
- package/dist/toc.d.ts +24 -0
- package/dist/toc.js +18 -0
- package/dist/toc.js.map +1 -0
- package/dist/types-C6_QkXzy.d.ts +358 -0
- package/dist/types-CJ7Gq3GX.d.cts +358 -0
- package/dist/types-DULc8wwg.d.cts +120 -0
- package/dist/types-DULc8wwg.d.ts +120 -0
- package/dist/view-controller-BD1KwYfE.d.cts +105 -0
- package/dist/view-controller-y4cb60ue.d.ts +105 -0
- package/dist/view.cjs +23 -0
- package/dist/view.cjs.map +1 -0
- package/dist/view.d.cts +40 -0
- package/dist/view.d.ts +40 -0
- package/dist/view.js +23 -0
- package/dist/view.js.map +1 -0
- package/dist/yjs.cjs +864 -0
- package/dist/yjs.cjs.map +1 -0
- package/dist/yjs.d.cts +22 -0
- package/dist/yjs.d.ts +22 -0
- package/dist/yjs.js +864 -0
- package/dist/yjs.js.map +1 -0
- package/package.json +217 -18
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { E as EngineDoc, P as Pos, B as BlockAttrs, I as Inline, a as Selection, M as Mark, S as Schema, A as Attrs, Q as QuoinBlock, g as BlockSpec, k as MarkSpec, c as AtomSpec } from './types-DULc8wwg.js';
|
|
2
|
+
|
|
3
|
+
type Align = 'left' | 'center' | 'right' | 'justify';
|
|
4
|
+
|
|
5
|
+
type Assoc = -1 | 1;
|
|
6
|
+
type PosMap = (pos: Pos, assoc?: Assoc) => Pos;
|
|
7
|
+
type StepResult = {
|
|
8
|
+
doc: EngineDoc;
|
|
9
|
+
map: PosMap;
|
|
10
|
+
};
|
|
11
|
+
type StepJSON = {
|
|
12
|
+
readonly stepType: string;
|
|
13
|
+
} & Readonly<Record<string, unknown>>;
|
|
14
|
+
interface Step {
|
|
15
|
+
readonly stepType: string;
|
|
16
|
+
apply(doc: EngineDoc): StepResult;
|
|
17
|
+
invert(before: EngineDoc): Step;
|
|
18
|
+
toJSON(): StepJSON;
|
|
19
|
+
}
|
|
20
|
+
type CreatedBlock = {
|
|
21
|
+
id: string;
|
|
22
|
+
type: string;
|
|
23
|
+
attrs: BlockAttrs;
|
|
24
|
+
indent: number;
|
|
25
|
+
region: string;
|
|
26
|
+
regions?: Record<string, Inline>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type TransactionOrigin = 'input' | 'command' | 'paste' | 'drop' | 'remote' | 'reconcile' | 'ai' | 'history';
|
|
30
|
+
declare class Transaction {
|
|
31
|
+
#private;
|
|
32
|
+
readonly before: EditorState;
|
|
33
|
+
readonly time: number;
|
|
34
|
+
constructor(state: EditorState, time?: number);
|
|
35
|
+
get doc(): EngineDoc;
|
|
36
|
+
get docs(): readonly EngineDoc[];
|
|
37
|
+
get steps(): readonly Step[];
|
|
38
|
+
get maps(): readonly PosMap[];
|
|
39
|
+
get docChanged(): boolean;
|
|
40
|
+
get selection(): Selection | null;
|
|
41
|
+
get selectionSet(): boolean;
|
|
42
|
+
get storedMarks(): readonly Mark[] | null;
|
|
43
|
+
get storedMarksSet(): boolean;
|
|
44
|
+
get meta(): ReadonlyMap<string, unknown>;
|
|
45
|
+
get origin(): TransactionOrigin;
|
|
46
|
+
get addToHistory(): boolean;
|
|
47
|
+
step(step: Step): this;
|
|
48
|
+
maybeStep(step: Step): boolean;
|
|
49
|
+
setSelection(selection: Selection | null): this;
|
|
50
|
+
setStoredMarks(marks: readonly Mark[] | null): this;
|
|
51
|
+
setOrigin(origin: TransactionOrigin): this;
|
|
52
|
+
setMeta(key: string, value: unknown): this;
|
|
53
|
+
getMeta<T>(key: string): T | undefined;
|
|
54
|
+
mapPos(pos: Pos, assoc?: Assoc, fromStep?: number): Pos;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type PluginKey<T> = {
|
|
58
|
+
readonly name: string;
|
|
59
|
+
readonly __value?: T;
|
|
60
|
+
};
|
|
61
|
+
declare function createPluginKey<T>(name: string): PluginKey<T>;
|
|
62
|
+
type PluginSpec<T> = {
|
|
63
|
+
readonly key: PluginKey<T>;
|
|
64
|
+
init(state: EditorState): T;
|
|
65
|
+
apply(tr: Transaction, value: T, oldState: EditorState, newState: EditorState): T;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type EditorState = {
|
|
69
|
+
readonly doc: EngineDoc;
|
|
70
|
+
readonly selection: Selection | null;
|
|
71
|
+
readonly storedMarks: readonly Mark[] | null;
|
|
72
|
+
readonly schema: Schema;
|
|
73
|
+
readonly plugins: readonly PluginSpec<unknown>[];
|
|
74
|
+
readonly pluginState: ReadonlyMap<string, unknown>;
|
|
75
|
+
readonly clock: () => number;
|
|
76
|
+
};
|
|
77
|
+
declare function createState(config: {
|
|
78
|
+
doc: EngineDoc;
|
|
79
|
+
schema: Schema;
|
|
80
|
+
selection?: Selection | null;
|
|
81
|
+
plugins?: readonly PluginSpec<unknown>[];
|
|
82
|
+
clock?: () => number;
|
|
83
|
+
}): EditorState;
|
|
84
|
+
declare function applyTransaction(state: EditorState, tr: Transaction): EditorState;
|
|
85
|
+
declare function getPluginState<T>(state: EditorState, key: PluginKey<T>): T;
|
|
86
|
+
|
|
87
|
+
type Command = (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
88
|
+
|
|
89
|
+
type BlockStructureOptions = {
|
|
90
|
+
newId?: () => string;
|
|
91
|
+
};
|
|
92
|
+
declare function duplicateBlocks(options?: BlockStructureOptions): Command;
|
|
93
|
+
declare function insertBlockAfter(type: string, attrs?: BlockAttrs, options?: BlockStructureOptions): Command;
|
|
94
|
+
|
|
95
|
+
declare function setAttrs(patch: Record<string, unknown>): Command;
|
|
96
|
+
declare function setTextAlign(align: Align | null): Command;
|
|
97
|
+
declare function setBlockColor(colors: {
|
|
98
|
+
color?: string | null;
|
|
99
|
+
background?: string | null;
|
|
100
|
+
}): Command;
|
|
101
|
+
|
|
102
|
+
type InsertTextOptions = {
|
|
103
|
+
origin?: TransactionOrigin;
|
|
104
|
+
newId?: () => string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Inserts `value` at the selection, in place of any selected text or blocks, as a command an extension can return. It is
|
|
108
|
+
* an undo step of its own unless `options.origin` is `input`, which groups it with the typing around it.
|
|
109
|
+
*/
|
|
110
|
+
declare function insertText(value: string, options?: InsertTextOptions): Command;
|
|
111
|
+
|
|
112
|
+
declare function toggleMark(type: string, attrs?: Attrs): Command;
|
|
113
|
+
declare function setMark(type: string, attrs?: Attrs): Command;
|
|
114
|
+
declare function unsetMark(type: string): Command;
|
|
115
|
+
declare function setLink(href: string, title?: string): Command;
|
|
116
|
+
declare function insertAtom(type: string, attrs: Attrs): Command;
|
|
117
|
+
declare function insertMention(mention: {
|
|
118
|
+
id: string;
|
|
119
|
+
label: string;
|
|
120
|
+
kind?: string;
|
|
121
|
+
}): Command;
|
|
122
|
+
|
|
123
|
+
/** Moves the blocks and their nested blocks to `toIndex`, counted among the blocks that stay, as one range. */
|
|
124
|
+
declare function moveBlocksTo(ids: readonly string[], toIndex: number, indent: number): Command;
|
|
125
|
+
|
|
126
|
+
declare function setSelection(selection: Selection | null): Command;
|
|
127
|
+
|
|
128
|
+
declare function splitBlock(options?: {
|
|
129
|
+
newId?: () => string;
|
|
130
|
+
}): Command;
|
|
131
|
+
|
|
132
|
+
declare function setBlockType(type: string, attrs?: BlockAttrs): Command;
|
|
133
|
+
|
|
134
|
+
type CommandFactories = Readonly<Record<string, (...args: never[]) => Command>>;
|
|
135
|
+
type BoundCommands<F extends CommandFactories> = {
|
|
136
|
+
[K in keyof F]: (...args: Parameters<F[K]>) => boolean;
|
|
137
|
+
};
|
|
138
|
+
type Chain<F extends CommandFactories> = {
|
|
139
|
+
[K in keyof F]: (...args: Parameters<F[K]>) => Chain<F>;
|
|
140
|
+
} & {
|
|
141
|
+
run(): boolean;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
type InputRuleRange = {
|
|
145
|
+
block: string;
|
|
146
|
+
region: string;
|
|
147
|
+
from: number;
|
|
148
|
+
to: number;
|
|
149
|
+
};
|
|
150
|
+
type InputRuleContext = {
|
|
151
|
+
readonly newId: () => string;
|
|
152
|
+
};
|
|
153
|
+
type InputRule = {
|
|
154
|
+
readonly name: string;
|
|
155
|
+
readonly match: RegExp;
|
|
156
|
+
readonly blockTypes?: readonly string[];
|
|
157
|
+
readonly kinds?: readonly string[];
|
|
158
|
+
handler(state: EditorState, match: RegExpExecArray, range: InputRuleRange, context?: InputRuleContext): Transaction | null;
|
|
159
|
+
};
|
|
160
|
+
declare function insertTextWithRules(value: string, rules: readonly InputRule[], options?: {
|
|
161
|
+
newId?: () => string;
|
|
162
|
+
}): Command;
|
|
163
|
+
|
|
164
|
+
type DOMParserLike = {
|
|
165
|
+
parseFromString(html: string, type: 'text/html'): {
|
|
166
|
+
readonly body: object;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
type FromHTMLOptions = {
|
|
170
|
+
parser?: DOMParserLike;
|
|
171
|
+
newId?: () => string;
|
|
172
|
+
};
|
|
173
|
+
declare function fromHTML(html: string, options?: FromHTMLOptions): QuoinBlock[];
|
|
174
|
+
|
|
175
|
+
type Slice = {
|
|
176
|
+
readonly blocks: readonly QuoinBlock[];
|
|
177
|
+
readonly openStart: boolean;
|
|
178
|
+
readonly openEnd: boolean;
|
|
179
|
+
/** Read from plain text: its first line takes the type of an empty block it is pasted into. */
|
|
180
|
+
readonly plainText?: boolean;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
type TextStats = {
|
|
184
|
+
characters: number;
|
|
185
|
+
words: number;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
declare function insertSlice(slice: Slice, options?: {
|
|
189
|
+
newId?: () => string;
|
|
190
|
+
}): Command;
|
|
191
|
+
|
|
192
|
+
declare function pasteLinkOverSelection(text: string): Command;
|
|
193
|
+
|
|
194
|
+
declare const coreCommands: {
|
|
195
|
+
insertSlice: typeof insertSlice;
|
|
196
|
+
pasteLinkOverSelection: typeof pasteLinkOverSelection;
|
|
197
|
+
insertTextWithRules: typeof insertTextWithRules;
|
|
198
|
+
insertText: typeof insertText;
|
|
199
|
+
insertHardBreak: () => Command;
|
|
200
|
+
deleteSelection: () => Command;
|
|
201
|
+
deleteBackward: () => Command;
|
|
202
|
+
deleteForward: () => Command;
|
|
203
|
+
deleteWordBackward: () => Command;
|
|
204
|
+
deleteWordForward: () => Command;
|
|
205
|
+
deleteToLineStart: () => Command;
|
|
206
|
+
deleteToLineEnd: () => Command;
|
|
207
|
+
splitBlock: typeof splitBlock;
|
|
208
|
+
undo: () => Command;
|
|
209
|
+
redo: () => Command;
|
|
210
|
+
undoInputRule: () => Command;
|
|
211
|
+
toggleMark: typeof toggleMark;
|
|
212
|
+
setMark: typeof setMark;
|
|
213
|
+
unsetMark: typeof unsetMark;
|
|
214
|
+
setLink: typeof setLink;
|
|
215
|
+
unsetLink: () => Command;
|
|
216
|
+
clearFormatting: () => Command;
|
|
217
|
+
insertAtom: typeof insertAtom;
|
|
218
|
+
insertMention: typeof insertMention;
|
|
219
|
+
setBlockType: typeof setBlockType;
|
|
220
|
+
setAttrs: typeof setAttrs;
|
|
221
|
+
toggleTask: () => Command;
|
|
222
|
+
indent: () => Command;
|
|
223
|
+
outdent: () => Command;
|
|
224
|
+
moveBlocksUp: () => Command;
|
|
225
|
+
moveBlocksDown: () => Command;
|
|
226
|
+
moveBlocksTo: typeof moveBlocksTo;
|
|
227
|
+
duplicateBlocks: typeof duplicateBlocks;
|
|
228
|
+
deleteBlocks: () => Command;
|
|
229
|
+
insertBlockAfter: typeof insertBlockAfter;
|
|
230
|
+
setTextAlign: typeof setTextAlign;
|
|
231
|
+
setBlockColor: typeof setBlockColor;
|
|
232
|
+
selectAll: () => Command;
|
|
233
|
+
selectBlock: () => Command;
|
|
234
|
+
setSelection: typeof setSelection;
|
|
235
|
+
};
|
|
236
|
+
type CoreCommands = typeof coreCommands;
|
|
237
|
+
type CoreExtensionOptions = {
|
|
238
|
+
typography?: {
|
|
239
|
+
dashes?: 'em' | 'en' | 'none';
|
|
240
|
+
} | false;
|
|
241
|
+
newId?: () => string;
|
|
242
|
+
};
|
|
243
|
+
declare function coreExtensions(options?: CoreExtensionOptions): Extension[];
|
|
244
|
+
|
|
245
|
+
type KeyLike = {
|
|
246
|
+
key: string;
|
|
247
|
+
code?: string;
|
|
248
|
+
altKey: boolean;
|
|
249
|
+
ctrlKey: boolean;
|
|
250
|
+
metaKey: boolean;
|
|
251
|
+
shiftKey: boolean;
|
|
252
|
+
};
|
|
253
|
+
declare function normalizeKey(name: string, isMac: boolean): string;
|
|
254
|
+
declare function keyName(event: KeyLike, isMac: boolean): string;
|
|
255
|
+
|
|
256
|
+
type EditorOptions = {
|
|
257
|
+
blocks: readonly QuoinBlock[];
|
|
258
|
+
extensions?: readonly Extension[];
|
|
259
|
+
onChange?: (blocks: QuoinBlock[]) => void;
|
|
260
|
+
onTransaction?: (tr: Transaction, state: EditorState) => void;
|
|
261
|
+
newId?: () => string;
|
|
262
|
+
now?: () => number;
|
|
263
|
+
isMac?: boolean;
|
|
264
|
+
/** Turns a storage key into the url written for IMAGE and FILE blocks in copies and, by default, in toMarkdown. */
|
|
265
|
+
resolveAssetUrl?: (key: string) => string;
|
|
266
|
+
};
|
|
267
|
+
type MarkdownOptions = {
|
|
268
|
+
comments?: boolean;
|
|
269
|
+
/** Write what markdown cannot hold as quoin comments. Plain export drops block-level extras and other data. */
|
|
270
|
+
lossless?: boolean;
|
|
271
|
+
resolveAssetUrl?: (key: string) => string;
|
|
272
|
+
};
|
|
273
|
+
type Editor<F extends CommandFactories = CoreCommands> = {
|
|
274
|
+
readonly state: EditorState;
|
|
275
|
+
readonly schema: Schema;
|
|
276
|
+
dispatch(tr: Transaction): void;
|
|
277
|
+
createTransaction(): Transaction;
|
|
278
|
+
subscribe(listener: (state: EditorState, tr: Transaction | null) => void): () => void;
|
|
279
|
+
readonly commands: BoundCommands<F>;
|
|
280
|
+
chain(): Chain<F>;
|
|
281
|
+
can(): BoundCommands<F>;
|
|
282
|
+
isActive(name: string, attrs?: Record<string, unknown>): boolean;
|
|
283
|
+
insertText(text: string): boolean;
|
|
284
|
+
handleKey(event: KeyLike): boolean;
|
|
285
|
+
paste(data: {
|
|
286
|
+
json?: string;
|
|
287
|
+
html?: string;
|
|
288
|
+
text?: string;
|
|
289
|
+
}, parser?: DOMParserLike): boolean;
|
|
290
|
+
copy(): {
|
|
291
|
+
json: string;
|
|
292
|
+
html: string;
|
|
293
|
+
text: string;
|
|
294
|
+
} | null;
|
|
295
|
+
getBlocks(): QuoinBlock[];
|
|
296
|
+
setBlocks(blocks: readonly QuoinBlock[]): boolean;
|
|
297
|
+
/** Runs the extensions' `onMount`, as a view does when it attaches; returns the means to end that mount. */
|
|
298
|
+
mount(): () => void;
|
|
299
|
+
decorations(): readonly Decoration[];
|
|
300
|
+
toMarkdown(options?: MarkdownOptions): string;
|
|
301
|
+
stats(): TextStats;
|
|
302
|
+
destroy(): void;
|
|
303
|
+
};
|
|
304
|
+
declare function createEditor<F extends CommandFactories = CoreCommands>(options: EditorOptions): Editor<F>;
|
|
305
|
+
|
|
306
|
+
type Decoration = {
|
|
307
|
+
readonly kind: 'inline';
|
|
308
|
+
readonly block: string;
|
|
309
|
+
readonly region: string;
|
|
310
|
+
readonly from: number;
|
|
311
|
+
readonly to: number;
|
|
312
|
+
readonly attrs: Attrs;
|
|
313
|
+
} | {
|
|
314
|
+
readonly kind: 'widget';
|
|
315
|
+
readonly block: string;
|
|
316
|
+
readonly region: string;
|
|
317
|
+
readonly offset: number;
|
|
318
|
+
readonly key: string;
|
|
319
|
+
readonly widget: string;
|
|
320
|
+
readonly attrs: Attrs;
|
|
321
|
+
readonly side?: -1 | 1;
|
|
322
|
+
}
|
|
323
|
+
/** Attributes written on the element of a whole block: `data-*` and `aria-*` names only. */
|
|
324
|
+
| {
|
|
325
|
+
readonly kind: 'block';
|
|
326
|
+
readonly block: string;
|
|
327
|
+
readonly attrs: Attrs;
|
|
328
|
+
};
|
|
329
|
+
type PasteRule = {
|
|
330
|
+
readonly name: string;
|
|
331
|
+
match(text: string, state: EditorState): Command | null;
|
|
332
|
+
};
|
|
333
|
+
type Extension = {
|
|
334
|
+
readonly name: string;
|
|
335
|
+
readonly priority?: number;
|
|
336
|
+
readonly blocks?: readonly BlockSpec[];
|
|
337
|
+
readonly marks?: readonly MarkSpec[];
|
|
338
|
+
readonly atoms?: readonly AtomSpec[];
|
|
339
|
+
readonly inputRules?: readonly InputRule[];
|
|
340
|
+
readonly pasteRules?: readonly PasteRule[];
|
|
341
|
+
readonly keymap?: Readonly<Record<string, Command>>;
|
|
342
|
+
readonly commands?: CommandFactories;
|
|
343
|
+
readonly plugins?: readonly PluginSpec<unknown>[];
|
|
344
|
+
readonly decorations?: (state: EditorState) => readonly Decoration[];
|
|
345
|
+
readonly onTransaction?: (tr: Transaction, state: EditorState) => void;
|
|
346
|
+
/**
|
|
347
|
+
* Refuses a transaction before it applies by returning false: the editor drops it whole. Undo and redo, the undo of an
|
|
348
|
+
* input rule, the blocks the host supplies and remote transactions are never filtered.
|
|
349
|
+
*/
|
|
350
|
+
readonly filterTransaction?: (tr: Transaction, state: EditorState) => boolean;
|
|
351
|
+
/** Returns false to refuse blocks the host supplies that differ from the document, which then stays as it is. */
|
|
352
|
+
readonly filterHostBlocks?: (blocks: readonly QuoinBlock[], state: EditorState) => boolean;
|
|
353
|
+
/** Runs on each `editor.mount()`; what it returns runs when that mount ends or the editor is destroyed. */
|
|
354
|
+
readonly onMount?: (editor: Editor<CommandFactories>) => (() => void) | void;
|
|
355
|
+
readonly ui?: unknown;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
export { type Align as A, type BlockStructureOptions as B, type CommandFactories as C, type Decoration as D, type Extension as E, type FromHTMLOptions as F, createState as G, fromHTML as H, type InputRule as I, getPluginState as J, type KeyLike as K, insertBlockAfter as L, type MarkdownOptions as M, insertText as N, insertTextWithRules as O, type PluginKey as P, keyName as Q, normalizeKey as R, type Step as S, Transaction as T, setBlockType as U, toggleMark as V, type Editor as a, type Command as b, type EditorState as c, type PluginSpec as d, type Assoc as e, type BoundCommands as f, type Chain as g, type CoreCommands as h, type CoreExtensionOptions as i, type CreatedBlock as j, type DOMParserLike as k, type EditorOptions as l, type InputRuleContext as m, type InputRuleRange as n, type InsertTextOptions as o, type PasteRule as p, type PosMap as q, type Slice as r, type StepJSON as s, type StepResult as t, type TextStats as u, type TransactionOrigin as v, applyTransaction as w, coreExtensions as x, createEditor as y, createPluginKey as z };
|