1 | import { __INTERNAL_REMIRROR_IDENTIFIER_KEY__ } from '@remirror/core-constants';
|
2 | import { AcceptUndefined } from '@remirror/core-types';
|
3 | import { AnchorHeadProps } from '@remirror/core-types';
|
4 | import { And } from '@remirror/core-types';
|
5 | import { AnyConstructor } from '@remirror/core-types';
|
6 | import { AnyFunction } from '@remirror/core-types';
|
7 | import { applyClonedTransaction } from '@remirror/core-utils';
|
8 | import { ApplySchemaAttributes } from '@remirror/core-types';
|
9 | import { areSchemasCompatible } from '@remirror/core-utils';
|
10 | import { areStatesEqual } from '@remirror/core-utils';
|
11 | import { Array1 } from '@remirror/core-types';
|
12 | import { Array2 } from '@remirror/core-types';
|
13 | import { Array3 } from '@remirror/core-types';
|
14 | import { assert } from '@remirror/core-helpers';
|
15 | import { assertGet } from '@remirror/core-helpers';
|
16 | import { Asyncify } from '@remirror/core-types';
|
17 | import { AsyncReturnType } from '@remirror/core-types';
|
18 | import { atDocEnd } from '@remirror/core-utils';
|
19 | import { atDocStart } from '@remirror/core-utils';
|
20 | import { AttributesProps } from '@remirror/core-types';
|
21 | import { Brand } from '@remirror/core-types';
|
22 | import { callIfDefined } from '@remirror/core-helpers';
|
23 | import { CamelCase } from '@remirror/core-types';
|
24 | import { camelCase } from '@remirror/core-helpers';
|
25 | import { canInsertNode } from '@remirror/core-utils';
|
26 | import { capitalCase } from '@remirror/core-helpers';
|
27 | import { capitalize } from '@remirror/core-helpers';
|
28 | import { Cast } from '@remirror/core-helpers';
|
29 | import { chainableEditorState } from '@remirror/core-utils';
|
30 | import { chainCommands } from '@remirror/core-utils';
|
31 | import { chainKeyBindingCommands } from '@remirror/core-utils';
|
32 | import { clamp } from '@remirror/core-helpers';
|
33 | import { Class } from '@remirror/core-types';
|
34 | import { ClassName } from '@remirror/core-helpers';
|
35 | import { cleanupOS } from '@remirror/core-helpers';
|
36 | import { clone } from '@remirror/core-helpers';
|
37 | import { cloneTransaction } from '@remirror/core-utils';
|
38 | import { CommandFunction } from '@remirror/core-types';
|
39 | import { CommandFunctionProps } from '@remirror/core-types';
|
40 | import { composeTransactionSteps } from '@remirror/core-utils';
|
41 | import { ConditionalExcept } from '@remirror/core-types';
|
42 | import { ConditionalKeys } from '@remirror/core-types';
|
43 | import { ConditionalPick } from '@remirror/core-types';
|
44 | import { ConditionalReturnKeys } from '@remirror/core-types';
|
45 | import { ConditionalReturnPick } from '@remirror/core-types';
|
46 | import { constantCase } from '@remirror/core-helpers';
|
47 | import { containsAttributes } from '@remirror/core-utils';
|
48 | import { containsNodesOfType } from '@remirror/core-utils';
|
49 | import { convertCommand } from '@remirror/core-utils';
|
50 | import { convertPixelsToDomUnit } from '@remirror/core-utils';
|
51 | import { Coords } from '@remirror/core-types';
|
52 | import { CoreIcon } from '@remirror/icons';
|
53 | import { createDocumentNode } from '@remirror/core-utils';
|
54 | import { CreateDocumentNodeProps } from '@remirror/core-utils';
|
55 | import { CustomDocumentProps } from '@remirror/core-utils';
|
56 | import { CustomHandler } from '@remirror/core-types';
|
57 | import { CustomHandlerKey } from '@remirror/core-types';
|
58 | import { CustomHandlerKeyList } from '@remirror/core-types';
|
59 | import { CustomHandlerShape } from '@remirror/core-types';
|
60 | import { cx } from '@remirror/core-helpers';
|
61 | import { debounce } from '@remirror/core-helpers';
|
62 | import { DebouncedFunction } from '@remirror/core-helpers';
|
63 | import { Decoration } from '@remirror/core-types';
|
64 | import { DecorationSet } from '@remirror/core-types';
|
65 | import { DecorationSet as DecorationSet_2 } from '@remirror/pm/view';
|
66 | import { deepMerge } from '@remirror/core-helpers';
|
67 | import { DeepPartial } from '@remirror/core-types';
|
68 | import { DeepString } from '@remirror/core-types';
|
69 | import { DefaultDocNodeOptions } from '@remirror/core-utils';
|
70 | import { defaultImport } from '@remirror/core-helpers';
|
71 | import { DelimiterCase } from '@remirror/core-types';
|
72 | import { Diff } from '@remirror/core-types';
|
73 | import type { DirectEditorProps } from '@remirror/pm/view';
|
74 | import { DispatchFunction } from '@remirror/core-types';
|
75 | import { Dispose } from '@remirror/core-types';
|
76 | import { DOM_SIZE_UNITS } from '@remirror/core-utils';
|
77 | import { DOMCompatibleAttributes } from '@remirror/core-types';
|
78 | import { DOMOutputSpec } from '@remirror/core-types';
|
79 | import { DomSizeUnit } from '@remirror/core-utils';
|
80 | import { Dynamic } from '@remirror/core-types';
|
81 | import { DynamicAttributeCreator } from '@remirror/core-types';
|
82 | import { DynamicKey } from '@remirror/core-types';
|
83 | import { DynamicKeyList } from '@remirror/core-types';
|
84 | import { DynamicShape } from '@remirror/core-types';
|
85 | import { EditorSchema } from '@remirror/core-types';
|
86 | import { EditorState } from '@remirror/core-types';
|
87 | import { EditorState as EditorState_2 } from '@remirror/pm/state';
|
88 | import { EditorStateProps } from '@remirror/core-types';
|
89 | import { EditorView } from '@remirror/core-types';
|
90 | import { EditorView as EditorView_2 } from '@remirror/pm/view';
|
91 | import { EditorViewProps } from '@remirror/core-types';
|
92 | import { EMPTY_ARRAY } from '@remirror/core-constants';
|
93 | import { EMPTY_NODE } from '@remirror/core-constants';
|
94 | import { EMPTY_PARAGRAPH_NODE } from '@remirror/core-constants';
|
95 | import { EmptyShape } from '@remirror/core-types';
|
96 | import { endPositionOfParent } from '@remirror/core-utils';
|
97 | import { Entries } from '@remirror/core-types';
|
98 | import { entries } from '@remirror/core-helpers';
|
99 | import { Entry } from '@remirror/core-types';
|
100 | import { environment } from '@remirror/core-utils';
|
101 | import { ErrorConstant } from '@remirror/core-constants';
|
102 | import { Except } from '@remirror/core-types';
|
103 | import { ExtensionPriority } from '@remirror/core-constants';
|
104 | import { ExtensionTag } from '@remirror/core-constants';
|
105 | import { ExtensionTagType } from '@remirror/core-constants';
|
106 | import { extractPixelSize } from '@remirror/core-utils';
|
107 | import { findBlockNodes } from '@remirror/core-utils';
|
108 | import { findChildren } from '@remirror/core-utils';
|
109 | import { findChildrenByAttribute } from '@remirror/core-utils';
|
110 | import { findChildrenByMark } from '@remirror/core-utils';
|
111 | import { findChildrenByNode } from '@remirror/core-utils';
|
112 | import { findElementAtPosition } from '@remirror/core-utils';
|
113 | import { findInlineNodes } from '@remirror/core-utils';
|
114 | import { findMatches } from '@remirror/core-helpers';
|
115 | import { findNodeAtPosition } from '@remirror/core-utils';
|
116 | import { findNodeAtSelection } from '@remirror/core-utils';
|
117 | import { findParentNode } from '@remirror/core-utils';
|
118 | import { findParentNodeOfType } from '@remirror/core-utils';
|
119 | import { findPositionOfNodeAfter } from '@remirror/core-utils';
|
120 | import { findPositionOfNodeBefore } from '@remirror/core-utils';
|
121 | import { FindProsemirrorNodeResult } from '@remirror/core-utils';
|
122 | import { findSelectedNodeOfType } from '@remirror/core-utils';
|
123 | import { findTextNodes } from '@remirror/core-utils';
|
124 | import { FixedLengthArray } from '@remirror/core-types';
|
125 | import { flattenArray } from '@remirror/core-helpers';
|
126 | import { Flavor } from '@remirror/core-types';
|
127 | import { Flavoring } from '@remirror/core-types';
|
128 | import { FlipPartialAndRequired } from '@remirror/core-types';
|
129 | import { format } from '@remirror/core-helpers';
|
130 | import { Fragment } from '@remirror/core-types';
|
131 | import { FragmentStringHandlerOptions } from '@remirror/core-utils';
|
132 | import { freeze } from '@remirror/core-helpers';
|
133 | import { FromToProps } from '@remirror/core-types';
|
134 | import { Get } from '@remirror/core-types';
|
135 | import { get } from '@remirror/core-helpers';
|
136 | import { GetAcceptUndefined } from '@remirror/core-types';
|
137 | import { getActiveNode } from '@remirror/core-utils';
|
138 | import { GetAttributes } from '@remirror/core-types';
|
139 | import { GetAttributesProps } from '@remirror/core-types';
|
140 | import { getChangedNodeRanges } from '@remirror/core-utils';
|
141 | import { getChangedNodes } from '@remirror/core-utils';
|
142 | import { getChangedRanges } from '@remirror/core-utils';
|
143 | import { GetConstructorProps } from '@remirror/core-types';
|
144 | import { getCursor } from '@remirror/core-utils';
|
145 | import { GetCustomHandler } from '@remirror/core-types';
|
146 | import { getDefaultBlockNode } from '@remirror/core-utils';
|
147 | import { getDefaultDocNode } from '@remirror/core-utils';
|
148 | import { getDocRange } from '@remirror/core-utils';
|
149 | import { getDocument } from '@remirror/core-utils';
|
150 | import { GetDynamic } from '@remirror/core-types';
|
151 | import { GetFixed } from '@remirror/core-types';
|
152 | import { GetFixedCustomHandler } from '@remirror/core-types';
|
153 | import { GetFixedDynamic } from '@remirror/core-types';
|
154 | import { GetFixedProps } from '@remirror/core-types';
|
155 | import { GetFixedStatic } from '@remirror/core-types';
|
156 | import { GetFlippedStatic } from '@remirror/core-types';
|
157 | import { getFontSize } from '@remirror/core-utils';
|
158 | import { GetHandler } from '@remirror/core-types';
|
159 | import { getInvalidContent } from '@remirror/core-utils';
|
160 | import { getLazyArray } from '@remirror/core-helpers';
|
161 | import { GetMappedCustomHandler } from '@remirror/core-types';
|
162 | import { GetMappedHandler } from '@remirror/core-types';
|
163 | import { getMarkAttributes } from '@remirror/core-utils';
|
164 | import { GetMarkRange } from '@remirror/core-utils';
|
165 | import { getMarkRange } from '@remirror/core-utils';
|
166 | import { getMarkRanges } from '@remirror/core-utils';
|
167 | import { getMarkType } from '@remirror/core-utils';
|
168 | import { getMatchString } from '@remirror/core-utils';
|
169 | import { getNodeType } from '@remirror/core-utils';
|
170 | import { GetPartialDynamic } from '@remirror/core-types';
|
171 | import { getRemirrorJSON } from '@remirror/core-utils';
|
172 | import { GetRequiredKeys } from '@remirror/core-types';
|
173 | import { getSelectedGroup } from '@remirror/core-utils';
|
174 | import { getSelectedWord } from '@remirror/core-utils';
|
175 | import { getShortcutSymbols } from '@remirror/core-utils';
|
176 | import { GetStatic } from '@remirror/core-types';
|
177 | import { GetStaticAndDynamic } from '@remirror/core-types';
|
178 | import { getStyle } from '@remirror/core-utils';
|
179 | import { getTextContentFromSlice } from '@remirror/core-utils';
|
180 | import { getTextSelection } from '@remirror/core-utils';
|
181 | import { Handler } from '@remirror/core-types';
|
182 | import { HandlerKey } from '@remirror/core-types';
|
183 | import { HandlerKeyList } from '@remirror/core-types';
|
184 | import { HandlerShape } from '@remirror/core-types';
|
185 | import { hasOwnProperty } from '@remirror/core-helpers';
|
186 | import { hasTransactionChanged } from '@remirror/core-utils';
|
187 | import { htmlToProsemirrorNode } from '@remirror/core-utils';
|
188 | import { I18nFormatter } from '@remirror/core-types';
|
189 | import { IfEmpty } from '@remirror/core-types';
|
190 | import { IfHasRequiredProperties } from '@remirror/core-types';
|
191 | import { IfMatches } from '@remirror/core-types';
|
192 | import { IfNoRequiredProperties } from '@remirror/core-types';
|
193 | import { includes } from '@remirror/core-helpers';
|
194 | import { IndexUnionFromTuple } from '@remirror/core-types';
|
195 | import { InputRule } from '@remirror/core-types';
|
196 | import { InvalidContentBlock } from '@remirror/core-utils';
|
197 | import { InvalidContentHandler } from '@remirror/core-utils';
|
198 | import { InvalidContentHandlerProps } from '@remirror/core-utils';
|
199 | import { invariant } from '@remirror/core-helpers';
|
200 | import { isAllSelection } from '@remirror/core-utils';
|
201 | import { isAndroidOS } from '@remirror/core-helpers';
|
202 | import { isArray } from '@remirror/core-helpers';
|
203 | import { isBoolean } from '@remirror/core-helpers';
|
204 | import { isChrome } from '@remirror/core-utils';
|
205 | import { isClass } from '@remirror/core-helpers';
|
206 | import { isDate } from '@remirror/core-helpers';
|
207 | import { isDefaultBlockNode } from '@remirror/core-utils';
|
208 | import { isDefaultDocNode } from '@remirror/core-utils';
|
209 | import { isDirectInstanceOf } from '@remirror/core-helpers';
|
210 | import { isDocNode } from '@remirror/core-utils';
|
211 | import { isDocNodeEmpty } from '@remirror/core-utils';
|
212 | import { isDomNode } from '@remirror/core-utils';
|
213 | import { isEditorSchema } from '@remirror/core-utils';
|
214 | import { isEditorState } from '@remirror/core-utils';
|
215 | import { isElementDomNode } from '@remirror/core-utils';
|
216 | import { isEmptyArray } from '@remirror/core-helpers';
|
217 | import { isEmptyBlockNode } from '@remirror/core-utils';
|
218 | import { isEmptyObject } from '@remirror/core-helpers';
|
219 | import { isEndOfTextBlock } from '@remirror/core-utils';
|
220 | import { isEqual } from '@remirror/core-helpers';
|
221 | import { isError } from '@remirror/core-helpers';
|
222 | import { isFunction } from '@remirror/core-helpers';
|
223 | import { isIdentifierOfType } from '@remirror/core-utils';
|
224 | import { isInstanceOf } from '@remirror/core-helpers';
|
225 | import { isInteger } from '@remirror/core-helpers';
|
226 | import { isJSONPrimitive } from '@remirror/core-helpers';
|
227 | import { isMap } from '@remirror/core-helpers';
|
228 | import { isMarkActive } from '@remirror/core-utils';
|
229 | import { isMarkType } from '@remirror/core-utils';
|
230 | import { isNativePromise } from '@remirror/core-helpers';
|
231 | import { isNodeActive } from '@remirror/core-utils';
|
232 | import { isNodeOfType } from '@remirror/core-utils';
|
233 | import { isNodeSelection } from '@remirror/core-utils';
|
234 | import { isNodeType } from '@remirror/core-utils';
|
235 | import { isNonEmptyArray } from '@remirror/core-helpers';
|
236 | import { isNull } from '@remirror/core-helpers';
|
237 | import { isNullOrUndefined } from '@remirror/core-helpers';
|
238 | import { isNumber } from '@remirror/core-helpers';
|
239 | import { isObject } from '@remirror/core-helpers';
|
240 | import { isPlainObject } from '@remirror/core-helpers';
|
241 | import { isPrimitive } from '@remirror/core-helpers';
|
242 | import { isPromise } from '@remirror/core-helpers';
|
243 | import { isProsemirrorFragment } from '@remirror/core-utils';
|
244 | import { isProsemirrorMark } from '@remirror/core-utils';
|
245 | import { isProsemirrorNode } from '@remirror/core-utils';
|
246 | import { isRegExp } from '@remirror/core-helpers';
|
247 | import { isRemirrorJSON } from '@remirror/core-utils';
|
248 | import { isRemirrorType } from '@remirror/core-utils';
|
249 | import { isResolvedPos } from '@remirror/core-utils';
|
250 | import { isSafari } from '@remirror/core-utils';
|
251 | import { isSafeInteger } from '@remirror/core-helpers';
|
252 | import { isSelection } from '@remirror/core-utils';
|
253 | import { isSelectionEmpty } from '@remirror/core-utils';
|
254 | import { isSet } from '@remirror/core-helpers';
|
255 | import { isStartOfDoc } from '@remirror/core-utils';
|
256 | import { isStartOfTextBlock } from '@remirror/core-utils';
|
257 | import { isString } from '@remirror/core-helpers';
|
258 | import { isSymbol } from '@remirror/core-helpers';
|
259 | import { isTextDomNode } from '@remirror/core-utils';
|
260 | import { isTextSelection } from '@remirror/core-utils';
|
261 | import { isTransaction } from '@remirror/core-utils';
|
262 | import { isUndefined } from '@remirror/core-helpers';
|
263 | import { IterableElement } from '@remirror/core-types';
|
264 | import { joinStyles } from '@remirror/core-utils';
|
265 | import { JsonArray } from '@remirror/core-types';
|
266 | import { JsonObject } from '@remirror/core-types';
|
267 | import { JsonPrimitive } from '@remirror/core-types';
|
268 | import { JsonValue } from '@remirror/core-types';
|
269 | import { KebabCase } from '@remirror/core-types';
|
270 | import { kebabCase } from '@remirror/core-helpers';
|
271 | import { KeepPartialProperties } from '@remirror/core-types';
|
272 | import { KeyBindingCommandFunction } from '@remirror/core-types';
|
273 | import { KeyBindingNames } from '@remirror/core-types';
|
274 | import { KeyBindingProps } from '@remirror/core-types';
|
275 | import { KeyBindings } from '@remirror/core-types';
|
276 | import { keys } from '@remirror/core-helpers';
|
277 | import { last } from '@remirror/core-helpers';
|
278 | import { LEAF_NODE_REPLACING_CHARACTER } from '@remirror/core-constants';
|
279 | import { lift } from '@remirror/core-utils';
|
280 | import { Listable } from '@remirror/core-types';
|
281 | import { Literal } from '@remirror/core-types';
|
282 | import { LiteralUnion } from '@remirror/core-types';
|
283 | import { MakeNullable } from '@remirror/core-types';
|
284 | import { MakeOptional } from '@remirror/core-types';
|
285 | import { MakeReadonly } from '@remirror/core-types';
|
286 | import { MakeRequired } from '@remirror/core-types';
|
287 | import { MakeUndefined } from '@remirror/core-types';
|
288 | import { ManagerPhase } from '@remirror/core-constants';
|
289 | import { Mapping } from '@remirror/core-types';
|
290 | import { Mark } from '@remirror/core-types';
|
291 | import { Mark as Mark_2 } from '@remirror/pm/model';
|
292 | import { markEqualsType } from '@remirror/core-utils';
|
293 | import { MarkExtensionSpec } from '@remirror/core-types';
|
294 | import { markInputRule } from '@remirror/core-utils';
|
295 | import { MarkSpecOverride } from '@remirror/core-types';
|
296 | import { MarkType } from '@remirror/core-types';
|
297 | import { MarkTypeProps } from '@remirror/core-types';
|
298 | import { MarkTypesProps } from '@remirror/core-types';
|
299 | import { MarkWithAttributes } from '@remirror/core-types';
|
300 | import { MarkWithAttributesProps } from '@remirror/core-types';
|
301 | import { Merge } from '@remirror/core-types';
|
302 | import { mergeDOMRects } from '@remirror/core-utils';
|
303 | import { MergeExclusive } from '@remirror/core-types';
|
304 | import { mergeKeyBindings } from '@remirror/core-utils';
|
305 | import { mergeProsemirrorKeyBindings } from '@remirror/core-utils';
|
306 | import { MinArray } from '@remirror/core-types';
|
307 | import { mutateTag } from '@remirror/core-constants';
|
308 | import { NamedShortcut } from '@remirror/core-constants';
|
309 | import { NamedStringHandlers } from '@remirror/core-utils';
|
310 | import { NodeExtensionSpec } from '@remirror/core-types';
|
311 | import { nodeInputRule } from '@remirror/core-utils';
|
312 | import { NodeMarkOptions } from '@remirror/core-types';
|
313 | import { NodeSpecOverride } from '@remirror/core-types';
|
314 | import { NodeStringHandlerOptions } from '@remirror/core-utils';
|
315 | import { NodeType } from '@remirror/core-types';
|
316 | import { NodeType as NodeType_2 } from '@remirror/pm/model';
|
317 | import { NodeTypeProps } from '@remirror/core-types';
|
318 | import { NodeTypesProps } from '@remirror/core-types';
|
319 | import { NodeView } from '@remirror/core-types';
|
320 | import { NodeViewMethod } from '@remirror/core-types';
|
321 | import { NodeWithAttributes } from '@remirror/core-types';
|
322 | import { NodeWithAttributesProps } from '@remirror/core-types';
|
323 | import { NodeWithPosition } from '@remirror/core-utils';
|
324 | import { NON_BREAKING_SPACE_CHAR } from '@remirror/core-constants';
|
325 | import { nonChainable } from '@remirror/core-utils';
|
326 | import { NonChainableCommandFunction } from '@remirror/core-types';
|
327 | import { NonNullableShape } from '@remirror/core-types';
|
328 | import { noop } from '@remirror/core-helpers';
|
329 | import { NULL_CHARACTER } from '@remirror/core-constants';
|
330 | import { Nullable } from '@remirror/core-types';
|
331 | import { object } from '@remirror/core-helpers';
|
332 | import { ObjectMark } from '@remirror/core-types';
|
333 | import { ObservableLike } from '@remirror/core-types';
|
334 | import { omit } from '@remirror/core-helpers';
|
335 | import { omitExtraAttributes } from '@remirror/core-utils';
|
336 | import { omitUndefined } from '@remirror/core-helpers';
|
337 | import { Opaque } from '@remirror/core-types';
|
338 | import { OptionalMarkProps } from '@remirror/core-types';
|
339 | import { OptionalProsemirrorNodeProps } from '@remirror/core-types';
|
340 | import { PackageJson } from '@remirror/core-types';
|
341 | import { ParsedDomSize } from '@remirror/core-utils';
|
342 | import { parseSizeUnit } from '@remirror/core-utils';
|
343 | import { PartialDeep } from '@remirror/core-types';
|
344 | import { PartialWithRequiredKeys } from '@remirror/core-types';
|
345 | import { PascalCase } from '@remirror/core-types';
|
346 | import { pascalCase } from '@remirror/core-helpers';
|
347 | import { pathCase } from '@remirror/core-helpers';
|
348 | import { pick } from '@remirror/core-helpers';
|
349 | import { PickPartial } from '@remirror/core-types';
|
350 | import { PickRequired } from '@remirror/core-types';
|
351 | import { plainInputRule } from '@remirror/core-utils';
|
352 | import { Plugin as Plugin_2 } from '@remirror/pm/state';
|
353 | import { PluginKey } from '@remirror/core-types';
|
354 | import type { PluginSpec } from '@remirror/pm/state';
|
355 | import { PosProps } from '@remirror/core-types';
|
356 | import { Predicate } from '@remirror/core-types';
|
357 | import { PredicateProps } from '@remirror/core-types';
|
358 | import { preserveSelection } from '@remirror/core-utils';
|
359 | import { Primitive } from '@remirror/core-types';
|
360 | import { PrimitiveSelection } from '@remirror/core-types';
|
361 | import { Promisable } from '@remirror/core-types';
|
362 | import { ProsemirrorAttributes } from '@remirror/core-types';
|
363 | import { ProsemirrorCommandFunction } from '@remirror/core-types';
|
364 | import { ProsemirrorKeyBindings } from '@remirror/core-types';
|
365 | import { ProsemirrorNode } from '@remirror/core-types';
|
366 | import { ProsemirrorNodeProps } from '@remirror/core-types';
|
367 | import { prosemirrorNodeToDom } from '@remirror/core-utils';
|
368 | import { prosemirrorNodeToHtml } from '@remirror/core-utils';
|
369 | import { ProsemirrorPlugin } from '@remirror/core-types';
|
370 | import { ProsemirrorPlugin as ProsemirrorPlugin_2 } from '@remirror/pm';
|
371 | import { randomFloat } from '@remirror/core-helpers';
|
372 | import { randomInt } from '@remirror/core-helpers';
|
373 | import { range } from '@remirror/core-helpers';
|
374 | import { rangeHasMark } from '@remirror/core-utils';
|
375 | import { RangeProps } from '@remirror/core-types';
|
376 | import { ReadonlyDeep } from '@remirror/core-types';
|
377 | import { RegExpProps } from '@remirror/core-types';
|
378 | import { REMIRROR_WEBVIEW_NAME } from '@remirror/core-constants';
|
379 | import { RemirrorContentType } from '@remirror/core-types';
|
380 | import { RemirrorError } from '@remirror/core-helpers';
|
381 | import { RemirrorErrorOptions } from '@remirror/core-helpers';
|
382 | import { RemirrorIdentifier } from '@remirror/core-constants';
|
383 | import { RemirrorIdentifierShape } from '@remirror/core-types';
|
384 | import { RemirrorJSON } from '@remirror/core-types';
|
385 | import { RemirrorMessage } from '@remirror/core-types';
|
386 | import { RemoveAnnotation } from '@remirror/core-types';
|
387 | import { RemoveAnnotations } from '@remirror/core-types';
|
388 | import { RemoveFlavoring } from '@remirror/core-types';
|
389 | import { removeMark } from '@remirror/core-utils';
|
390 | import { RemoveMarkProps } from '@remirror/core-utils';
|
391 | import { removeNodeAfter } from '@remirror/core-utils';
|
392 | import { removeNodeAtPosition } from '@remirror/core-utils';
|
393 | import { removeNodeBefore } from '@remirror/core-utils';
|
394 | import { Replace } from '@remirror/core-types';
|
395 | import { replaceNodeAtPosition } from '@remirror/core-utils';
|
396 | import { replaceText } from '@remirror/core-utils';
|
397 | import { ReplaceTextProps } from '@remirror/core-utils';
|
398 | import { RequireAtLeastOne } from '@remirror/core-types';
|
399 | import { RequireExactlyOne } from '@remirror/core-types';
|
400 | import { ResolvedPos } from '@remirror/core-types';
|
401 | import { ResolvedPosProps } from '@remirror/core-types';
|
402 | import { SchemaAttributes } from '@remirror/core-types';
|
403 | import { SchemaAttributesObject } from '@remirror/core-types';
|
404 | import { SchemaJSON } from '@remirror/core-utils';
|
405 | import { SchemaProps } from '@remirror/core-types';
|
406 | import { schemaToJSON } from '@remirror/core-utils';
|
407 | import { SELECTED_NODE_CLASS_NAME } from '@remirror/core-constants';
|
408 | import { SELECTED_NODE_CLASS_SELECTOR } from '@remirror/core-constants';
|
409 | import { Selection as Selection_2 } from '@remirror/core-types';
|
410 | import { SelectionProps } from '@remirror/core-types';
|
411 | import { set } from '@remirror/core-helpers';
|
412 | import { setBlockType } from '@remirror/core-utils';
|
413 | import { SetOptional } from '@remirror/core-types';
|
414 | import { SetRequired } from '@remirror/core-types';
|
415 | import { SetReturnType } from '@remirror/core-types';
|
416 | import { setStyle } from '@remirror/core-utils';
|
417 | import { shallowClone } from '@remirror/core-helpers';
|
418 | import { Shape } from '@remirror/core-types';
|
419 | import { ShouldSkipFunction } from '@remirror/core-utils';
|
420 | import { ShouldSkipProps } from '@remirror/core-utils';
|
421 | import { shouldUseDomEnvironment } from '@remirror/core-utils';
|
422 | import { Simplify } from '@remirror/core-types';
|
423 | import { SkippableInputRule } from '@remirror/core-utils';
|
424 | import { Slice } from '@remirror/core-types';
|
425 | import { SnakeCase } from '@remirror/core-types';
|
426 | import { snakeCase } from '@remirror/core-helpers';
|
427 | import { sort } from '@remirror/core-helpers';
|
428 | import { spaceCase } from '@remirror/core-helpers';
|
429 | import { startCase } from '@remirror/core-helpers';
|
430 | import { startPositionOfParent } from '@remirror/core-utils';
|
431 | import { STATE_OVERRIDE } from '@remirror/core-constants';
|
432 | import { StateJSON } from '@remirror/core-types';
|
433 | import { Static } from '@remirror/core-types';
|
434 | import { StaticKey } from '@remirror/core-types';
|
435 | import { StaticKeyList } from '@remirror/core-types';
|
436 | import { StaticShape } from '@remirror/core-types';
|
437 | import { StrictReplace } from '@remirror/core-types';
|
438 | import { StringHandler } from '@remirror/core-utils';
|
439 | import { StringHandlerOptions } from '@remirror/core-utils';
|
440 | import { StringHandlerProps } from '@remirror/core-utils';
|
441 | import { Stringified } from '@remirror/core-types';
|
442 | import { StringKey } from '@remirror/core-types';
|
443 | import { Suggester } from '@remirror/pm/suggest';
|
444 | import { SuggestState } from '@remirror/pm/suggest';
|
445 | import { take } from '@remirror/core-helpers';
|
446 | import { textBetween } from '@remirror/core-utils';
|
447 | import { TextProps } from '@remirror/core-types';
|
448 | import { throttle } from '@remirror/core-helpers';
|
449 | import { ThrottledFunction } from '@remirror/core-helpers';
|
450 | import { toggleBlockItem } from '@remirror/core-utils';
|
451 | import { ToggleBlockItemProps } from '@remirror/core-utils';
|
452 | import { toggleWrap } from '@remirror/core-utils';
|
453 | import { toString as toString_2 } from '@remirror/core-helpers';
|
454 | import { Transaction } from '@remirror/core-types';
|
455 | import { Transaction as Transaction_2 } from '@remirror/pm/state';
|
456 | import { TransactionProps } from '@remirror/core-types';
|
457 | import { TransactionTransformer } from '@remirror/core-types';
|
458 | import { TrStateProps } from '@remirror/core-types';
|
459 | import { TsConfigJson } from '@remirror/core-types';
|
460 | import { TupleOf } from '@remirror/core-types';
|
461 | import { TupleUnion } from '@remirror/core-types';
|
462 | import { TupleValue } from '@remirror/core-types';
|
463 | import { TypedArray } from '@remirror/core-types';
|
464 | import { UndefinedFlipPartialAndRequired } from '@remirror/core-types';
|
465 | import { UndefinedPickPartial } from '@remirror/core-types';
|
466 | import { UnionToIntersection } from '@remirror/core-types';
|
467 | import { uniqueArray } from '@remirror/core-helpers';
|
468 | import { uniqueBy } from '@remirror/core-helpers';
|
469 | import { uniqueId } from '@remirror/core-helpers';
|
470 | import { UnknownShape } from '@remirror/core-types';
|
471 | import { unset } from '@remirror/core-helpers';
|
472 | import { Unsubscribe } from 'nanoevents';
|
473 | import { updateMark } from '@remirror/core-utils';
|
474 | import { UpdateMarkProps } from '@remirror/core-utils';
|
475 | import { UseDefault } from '@remirror/core-types';
|
476 | import { ValidOptions } from '@remirror/core-types';
|
477 | import { Value } from '@remirror/core-types';
|
478 | import { ValueOf } from '@remirror/core-types';
|
479 | import { values } from '@remirror/core-helpers';
|
480 | import { within } from '@remirror/core-helpers';
|
481 | import { wrapIn } from '@remirror/core-utils';
|
482 | import { Writable } from '@remirror/core-types';
|
483 | import { Writeable } from '@remirror/core-types';
|
484 | import { ZERO_WIDTH_SPACE_CHAR } from '@remirror/core-constants';
|
485 |
|
486 | export { __INTERNAL_REMIRROR_IDENTIFIER_KEY__ }
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 | declare interface AbstractNodeAttributes {
|
493 | id?: any;
|
494 | error?: string | null;
|
495 | }
|
496 |
|
497 | export { AcceptUndefined }
|
498 |
|
499 | export declare enum ActionType {
|
500 | ADD_PLACEHOLDER = 0,
|
501 | REMOVE_PLACEHOLDER = 1
|
502 | }
|
503 |
|
504 |
|
505 |
|
506 |
|
507 | declare type ActiveFromExtensions<Extension extends AnyExtension> = Record<GetNodeNameUnion<Extension> extends never ? string : GetNodeNameUnion<Extension>, (attrs?: ProsemirrorAttributes) => boolean> & Record<GetMarkNameUnion<Extension> extends never ? string : GetMarkNameUnion<Extension>, (attrs?: ProsemirrorAttributes) => boolean>;
|
508 | export { ActiveFromExtensions }
|
509 | export { ActiveFromExtensions as ActiveFromExtensions_alias_1 }
|
510 | export { ActiveFromExtensions as ActiveFromExtensions_alias_2 }
|
511 |
|
512 | declare type AddCustomHandler<Options extends ValidOptions> = (props: Partial<GetCustomHandler<Options>>) => Dispose | undefined;
|
513 | export { AddCustomHandler }
|
514 | export { AddCustomHandler as AddCustomHandler_alias_1 }
|
515 |
|
516 | declare type AddFrameworkHandler<Extension extends AnyExtension> = <Key extends keyof FrameworkEvents<Extension>>(event: Key, cb: FrameworkEvents<Extension>[Key]) => Unsubscribe;
|
517 | export { AddFrameworkHandler }
|
518 | export { AddFrameworkHandler as AddFrameworkHandler_alias_1 }
|
519 |
|
520 | declare type AddHandler<Options extends ValidOptions> = <Key extends keyof GetHandler<Options>>(key: Key, method: GetHandler<Options>[Key]) => Dispose;
|
521 | export { AddHandler }
|
522 | export { AddHandler as AddHandler_alias_1 }
|
523 |
|
524 |
|
525 |
|
526 |
|
527 | export declare type AddHandlers<Options extends ValidOptions> = (props: Partial<GetHandler<Options>>) => Dispose;
|
528 |
|
529 | declare interface AddPlaceholderAction {
|
530 | type: ActionType.ADD_PLACEHOLDER;
|
531 | id: string;
|
532 | payload: any;
|
533 | pos: number;
|
534 | }
|
535 |
|
536 | export { AnchorHeadProps }
|
537 |
|
538 | export { And }
|
539 |
|
540 | export declare type AnyBaseClassConstructor = Replace<BaseClassConstructor<any, any>, {
|
541 | new (...args: any[]): AnyFunction;
|
542 | }>;
|
543 |
|
544 | export declare interface AnyBaseClassOverrides {
|
545 | addCustomHandler: AnyFunction;
|
546 | addHandler: AnyFunction;
|
547 | clone: AnyFunction;
|
548 | }
|
549 |
|
550 | export { AnyConstructor }
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 | declare type AnyExtension = Replace<Extension<Shape>, Remirror.AnyExtensionOverrides> & object;
|
559 | export { AnyExtension }
|
560 | export { AnyExtension as AnyExtension_alias_1 }
|
561 | export { AnyExtension as AnyExtension_alias_2 }
|
562 |
|
563 |
|
564 |
|
565 |
|
566 | declare type AnyExtensionConstructor = Replace<ExtensionConstructor<any>, {
|
567 | new (...args: any[]): AnyExtension;
|
568 | }>;
|
569 | export { AnyExtensionConstructor }
|
570 | export { AnyExtensionConstructor as AnyExtensionConstructor_alias_1 }
|
571 | export { AnyExtensionConstructor as AnyExtensionConstructor_alias_2 }
|
572 |
|
573 | export { AnyFunction }
|
574 |
|
575 | declare type AnyManagerStore = Remirror.ManagerStore<any>;
|
576 | export { AnyManagerStore }
|
577 | export { AnyManagerStore as AnyManagerStore_alias_1 }
|
578 | export { AnyManagerStore as AnyManagerStore_alias_2 }
|
579 |
|
580 |
|
581 |
|
582 |
|
583 | declare type AnyMarkExtension = Replace<MarkExtension<Shape>, Remirror.AnyExtensionOverrides> & object;
|
584 | export { AnyMarkExtension }
|
585 | export { AnyMarkExtension as AnyMarkExtension_alias_1 }
|
586 | export { AnyMarkExtension as AnyMarkExtension_alias_2 }
|
587 |
|
588 |
|
589 |
|
590 |
|
591 | declare type AnyNodeExtension = Replace<NodeExtension<Shape>, Remirror.AnyExtensionOverrides> & object;
|
592 | export { AnyNodeExtension }
|
593 | export { AnyNodeExtension as AnyNodeExtension_alias_1 }
|
594 | export { AnyNodeExtension as AnyNodeExtension_alias_2 }
|
595 |
|
596 |
|
597 |
|
598 |
|
599 | declare type AnyPlainExtension = Replace<PlainExtension<Shape>, Remirror.AnyExtensionOverrides> & object;
|
600 | export { AnyPlainExtension }
|
601 | export { AnyPlainExtension as AnyPlainExtension_alias_1 }
|
602 | export { AnyPlainExtension as AnyPlainExtension_alias_2 }
|
603 |
|
604 | declare type AnyRemirrorManager = Simplify<Replace<RemirrorManager<AnyExtension>, {
|
605 | clone: () => AnyRemirrorManager;
|
606 | store: Replace<Remirror.ManagerStore<AnyExtension>, {
|
607 | chain: any;
|
608 | }>;
|
609 | output: Replace<FrameworkOutput<AnyExtension>, {
|
610 | chain: any;
|
611 | manager: AnyRemirrorManager;
|
612 | }> | undefined;
|
613 | view: EditorView;
|
614 | addView: (view: EditorView) => void;
|
615 | attachFramework: (framework: any, updateHandler: (props: StateUpdateLifecycleProps) => void) => void;
|
616 |
|
617 | ['~E']: AnyExtension;
|
618 |
|
619 | ['~AN']: string;
|
620 |
|
621 | ['~N']: string;
|
622 |
|
623 | ['~M']: string;
|
624 |
|
625 | ['~P']: string;
|
626 | }>>;
|
627 | export { AnyRemirrorManager }
|
628 | export { AnyRemirrorManager as AnyRemirrorManager_alias_1 }
|
629 | export { AnyRemirrorManager as AnyRemirrorManager_alias_2 }
|
630 |
|
631 | declare interface AppendLifecycleProps extends EditorStateProps {
|
632 | |
633 |
|
634 |
|
635 | tr: Transaction;
|
636 | |
637 |
|
638 |
|
639 | previousState: EditorState;
|
640 | |
641 |
|
642 |
|
643 | transactions: readonly Transaction[];
|
644 | }
|
645 | export { AppendLifecycleProps }
|
646 | export { AppendLifecycleProps as AppendLifecycleProps_alias_1 }
|
647 |
|
648 | export { applyClonedTransaction }
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 | export declare function applyMark(type: string | MarkType, attrs?: ProsemirrorAttributes, selectionPoint?: PrimitiveSelection): CommandFunction;
|
659 |
|
660 | export { ApplySchemaAttributes }
|
661 |
|
662 | declare interface ApplyStateLifecycleProps extends EditorStateProps {
|
663 | |
664 |
|
665 |
|
666 | tr: Transaction;
|
667 | |
668 |
|
669 |
|
670 | previousState: EditorState;
|
671 | }
|
672 | export { ApplyStateLifecycleProps }
|
673 | export { ApplyStateLifecycleProps as ApplyStateLifecycleProps_alias_1 }
|
674 |
|
675 | export { areSchemasCompatible }
|
676 |
|
677 | export { areStatesEqual }
|
678 |
|
679 | export { Array1 }
|
680 |
|
681 | export { Array2 }
|
682 |
|
683 | export { Array3 }
|
684 |
|
685 | export { assert }
|
686 |
|
687 | export { assertGet }
|
688 |
|
689 | export { Asyncify }
|
690 |
|
691 | export { AsyncReturnType }
|
692 |
|
693 | export { atDocEnd }
|
694 |
|
695 | export { atDocStart }
|
696 |
|
697 | declare type AttributePropFunction<Extension extends AnyExtension> = (params: RemirrorEventListenerProps<Extension>) => Record<string, string>;
|
698 | export { AttributePropFunction }
|
699 | export { AttributePropFunction as AttributePropFunction_alias_1 }
|
700 | export { AttributePropFunction as AttributePropFunction_alias_2 }
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 | declare class AttributesExtension extends PlainExtension {
|
715 | get name(): "attributes";
|
716 | private attributeList;
|
717 | private attributeObject;
|
718 | |
719 |
|
720 |
|
721 |
|
722 |
|
723 | onCreate(): void;
|
724 | private readonly updateAttributes;
|
725 | private transformAttributes;
|
726 | }
|
727 | export { AttributesExtension }
|
728 | export { AttributesExtension as AttributesExtension_alias_1 }
|
729 | export { AttributesExtension as AttributesExtension_alias_2 }
|
730 |
|
731 | export { AttributesProps }
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 | declare type AttrsFromExtensions<Extension extends AnyExtension> = Record<GetNodeNameUnion<Extension> extends never ? string : GetNodeNameUnion<Extension>, (attrs?: ProsemirrorAttributes) => ProsemirrorAttributes | undefined> & Record<GetMarkNameUnion<Extension> extends never ? string : GetMarkNameUnion<Extension>, (attrs?: ProsemirrorAttributes) => ProsemirrorAttributes | undefined>;
|
738 | export { AttrsFromExtensions }
|
739 | export { AttrsFromExtensions as AttrsFromExtensions_alias_1 }
|
740 | export { AttrsFromExtensions as AttrsFromExtensions_alias_2 }
|
741 |
|
742 | export declare abstract class BaseClass<Options extends ValidOptions = EmptyShape, DefaultStaticOptions extends Shape = EmptyShape> {
|
743 | |
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 | static readonly defaultOptions: any;
|
750 | |
751 |
|
752 |
|
753 | static readonly staticKeys: string[];
|
754 | |
755 |
|
756 |
|
757 | static readonly handlerKeys: string[];
|
758 | |
759 |
|
760 |
|
761 | static handlerKeyOptions: Partial<Record<string, HandlerKeyOptions> & {
|
762 | [GENERAL_OPTIONS]?: HandlerKeyOptions;
|
763 | }>;
|
764 | |
765 |
|
766 |
|
767 | static readonly customHandlerKeys: string[];
|
768 | |
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 | ['~O']: Options & DefaultStaticOptions;
|
775 | |
776 |
|
777 |
|
778 |
|
779 | abstract readonly [__INTERNAL_REMIRROR_IDENTIFIER_KEY__]: RemirrorIdentifier;
|
780 | |
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 | abstract get name(): string;
|
798 | |
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 | get options(): RemoveAnnotations<GetFixed<Options> & DefaultStaticOptions>;
|
812 | |
813 |
|
814 |
|
815 | get dynamicKeys(): string[];
|
816 | |
817 |
|
818 |
|
819 |
|
820 | get initialOptions(): RemoveAnnotations<GetFixed<Options> & DefaultStaticOptions>;
|
821 | |
822 |
|
823 |
|
824 | private readonly _initialOptions;
|
825 | |
826 |
|
827 |
|
828 | private readonly _dynamicKeys;
|
829 | |
830 |
|
831 |
|
832 | private _options;
|
833 | |
834 |
|
835 |
|
836 | private _mappedHandlers;
|
837 | constructor(defaultOptions: DefaultStaticOptions, ...[options]: ConstructorProps<Options, DefaultStaticOptions>);
|
838 | /**
|
839 | * This method is called by the extension constructor. It is not strictly a
|
840 | * lifecycle method since at this point the manager has not yet been
|
841 | * instantiated.
|
842 | *
|
843 | * @remarks
|
844 | *
|
845 | * It should be used instead of overriding the constructor which is strongly
|
846 | * advised against.
|
847 | *
|
848 | * There are some limitations when using this method.
|
849 | *
|
850 | * - Accessing `this.store` will throw an error since the manager hasn't been
|
851 | * created and it hasn't yet been attached to the extensions.
|
852 | * - `this.type` in `NodeExtension` and `MarkExtension` will also throw an
|
853 | * error since the schema hasn't been created yet.
|
854 | *
|
855 | * You should use this to setup any instance properties with the options
|
856 | * provided to the extension.
|
857 | */
|
858 | protected init(): void;
|
859 | /**
|
860 | * Clone the current instance with the provided options. If nothing is
|
861 | * provided it uses the same initial options as the current instance.
|
862 | */
|
863 | abstract clone(...parameters: ConstructorProps<Options, DefaultStaticOptions>): BaseClass<Options, DefaultStaticOptions>;
|
864 | /**
|
865 | * Get the dynamic keys for this extension.
|
866 | */
|
867 | private getDynamicKeys;
|
868 | /**
|
869 | * Throw an error if non dynamic keys are updated.
|
870 | */
|
871 | private ensureAllKeysAreDynamic;
|
872 | /**
|
873 | * Update the properties with the provided partial value when changed.
|
874 | */
|
875 | setOptions(update: GetPartialDynamic<Options>): void;
|
876 | /**
|
877 | * Reset the extension properties to their default values.
|
878 | *
|
879 | * @nonVirtual
|
880 | */
|
881 | resetOptions(): void;
|
882 | /**
|
883 | * Override this to receive updates whenever the options have been updated on
|
884 | * this instance. This method is called after the updates have already been
|
885 | * applied to the instance. If you need more control over exactly how the
|
886 | * option should be applied you should set the option to be `Custom`.
|
887 | *
|
888 | * **Please Note**:
|
889 | *
|
890 | * This must be defined as a instance method and not a property since it is
|
891 | * called in the constructor.
|
892 | *
|
893 | * ```ts
|
894 | * class ThisPreset extends Preset {
|
895 | * // GOOD ✅
|
896 | * onSetOptions(props: OnSetOptionsProps<Options>) {}
|
897 | *
|
898 | * // BAD ❌
|
899 | * onSetOptions = (props: OnSetOptionsProps<Options>) => {}
|
900 | * }
|
901 | * ```
|
902 | *
|
903 | * @abstract
|
904 | */
|
905 | protected onSetOptions?(props: OnSetOptionsProps<Options>): void;
|
906 | /**
|
907 | * Update the private options.
|
908 | */
|
909 | private getDynamicOptions;
|
910 | /**
|
911 | * Update the dynamic options.
|
912 | */
|
913 | private updateDynamicOptions;
|
914 | /**
|
915 | * Set up the mapped handlers object with default values (an empty array);
|
916 | */
|
917 | private populateMappedHandlers;
|
918 | /**
|
919 | * This is currently fudged together, I'm not sure it will work.
|
920 | */
|
921 | private createDefaultHandlerOptions;
|
922 | /**
|
923 | * Add a handler to the event handlers so that it is called along with all the
|
924 | * other handler methods.
|
925 | *
|
926 | * This is helpful for integrating react hooks which can be used in multiple
|
927 | * places. The original problem with fixed properties is that you can only
|
928 | * assign to a method once and it overwrites any other methods. This pattern
|
929 | * for adding handlers allows for multiple usages of the same handler in the
|
930 | * most relevant part of the code.
|
931 | *
|
932 | * More to come on this pattern.
|
933 | *
|
934 | * @nonVirtual
|
935 | */
|
936 | addHandler<Key extends keyof GetHandler<Options>>(key: Key, method: GetHandler<Options>[Key], priority?: ExtensionPriority): Dispose;
|
937 | /**
|
938 | * Determines if handlers exist for the given key.
|
939 | *
|
940 | * Checking the existence of a handler property directly gives wrong results.
|
941 | * `this.options.onHandlerName` is always truthy because it is a reference to
|
942 | * the wrapper function that calls each handler.
|
943 | *
|
944 | * ```ts
|
945 | *
|
946 | * // GOOD ✅
|
947 | * if (!this.hasHandlers('onHandlerName')) {
|
948 | * return;
|
949 | * }
|
950 | *
|
951 | *
|
952 | * if (!this.options.onHandlerName) {
|
953 | * return;
|
954 | * }
|
955 | * ```
|
956 | *
|
957 | * @param key The handler to test
|
958 | */
|
959 | hasHandlers<Key extends keyof GetHandler<Options>>(key: Key): boolean;
|
960 | private sortHandlers;
|
961 | /**
|
962 | * A method that can be used to add a custom handler. It is up to the
|
963 | * extension creator to manage the handlers and dispose methods.
|
964 | */
|
965 | addCustomHandler<Key extends keyof GetCustomHandler<Options>>(key: Key, value: Required<GetCustomHandler<Options>>[Key]): Dispose;
|
966 | /**
|
967 | * Override this method if you want to set custom handlers on your extension.
|
968 | *
|
969 | * This must return a dispose function.
|
970 | */
|
971 | protected onAddCustomHandler?: AddCustomHandler<Options>;
|
972 | }
|
973 |
|
974 | export declare interface BaseClass<Options extends ValidOptions, DefaultStaticOptions extends Shape = EmptyShape> {
|
975 | constructor: BaseClassConstructor<Options, DefaultStaticOptions>;
|
976 | }
|
977 |
|
978 | export declare interface BaseClassConstructor<Options extends ValidOptions = EmptyShape, DefaultStaticOptions extends Shape = EmptyShape> extends Function {
|
979 | new (...args: ConstructorProps<Options, DefaultStaticOptions>): any;
|
980 | /**
|
981 | * The identifier for the constructor which can determine whether it is a node
|
982 | * constructor, mark constructor or plain constructor.
|
983 | * @internal
|
984 | */
|
985 | readonly [__INTERNAL_REMIRROR_IDENTIFIER_KEY__]: RemirrorIdentifier;
|
986 | /**
|
987 | * Defines the `defaultOptions` for all extension instances.
|
988 | *
|
989 | * @remarks
|
990 | *
|
991 | * Once set it can't be updated during run time. Some of the settings are
|
992 | * optional and some are not. Any non-required settings must be specified in
|
993 | * the `defaultOptions`.
|
994 | *
|
995 | * **Please note**: There is a slight downside when setting up
|
996 | * `defaultOptions`. `undefined` is not supported for partial settings at this
|
997 | * point in time. As a workaround use `null` as the type and pass it as the
|
998 | * value in the default settings.
|
999 | *
|
1000 | * @defaultValue {}
|
1001 | *
|
1002 | * @internal
|
1003 | */
|
1004 | readonly defaultOptions: DefaultOptions<Options, DefaultStaticOptions>;
|
1005 | /**
|
1006 | * An array of the keys that are static for this extension.
|
1007 | *
|
1008 | * This is actually currently unused, but might become useful in the future.
|
1009 | * An auto-fix lint rule will be added should that be the case.
|
1010 | */
|
1011 | readonly staticKeys: string[];
|
1012 | /**
|
1013 | * An array of all the keys which correspond to the the event handler options.
|
1014 | *
|
1015 | * This **MUST** be present if you want to use event handlers in your
|
1016 | * extension.
|
1017 | *
|
1018 | * Every key here is automatically removed from the `setOptions` method and is
|
1019 | * added to the `addHandler` method for adding new handlers. The
|
1020 | * `this.options[key]` is automatically replaced with a method that combines
|
1021 | * all the handlers into one method that can be called effortlessly. All this
|
1022 | * work is done for you.
|
1023 | */
|
1024 | readonly handlerKeys: string[];
|
1025 | /**
|
1026 | * Customize the way the handler should behave.
|
1027 | */
|
1028 | readonly handlerKeyOptions: Partial<Record<string, HandlerKeyOptions> & {
|
1029 | __ALL__?: HandlerKeyOptions;
|
1030 | }>;
|
1031 | /**
|
1032 | * A list of the custom keys in the extension or preset options.
|
1033 | */
|
1034 | readonly customHandlerKeys: string[];
|
1035 | }
|
1036 |
|
1037 | declare interface BaseExtensionOptions extends Remirror.BaseExtensionOptions {
|
1038 | /**
|
1039 | * An object which excludes certain functionality from an extension.
|
1040 | */
|
1041 | exclude?: ExcludeOptions;
|
1042 | /**
|
1043 | * The priority with which this extension should be loaded by the manager.
|
1044 | *
|
1045 | * @remarks
|
1046 | *
|
1047 | * Each priority level corresponds to a higher level of importance for the
|
1048 | * extension within the editor.
|
1049 | *
|
1050 | * When this is set to `null` the `defaultPriority` level for the extension
|
1051 | * will be used instead.
|
1052 | */
|
1053 | priority?: ExtensionPriority;
|
1054 | }
|
1055 | export { BaseExtensionOptions }
|
1056 | export { BaseExtensionOptions as BaseExtensionOptions_alias_1 }
|
1057 |
|
1058 | declare interface BaseFramework<Extension extends AnyExtension> {
|
1059 | /**
|
1060 | * The name of the framework being used.
|
1061 | */
|
1062 | readonly name: string;
|
1063 | /**
|
1064 | * The state that is initially passed into the editor.
|
1065 | */
|
1066 | initialEditorState: EditorState;
|
1067 | /**
|
1068 | * The minimum required output from the framework.
|
1069 | */
|
1070 | readonly frameworkOutput: FrameworkOutput<Extension>;
|
1071 | /**
|
1072 | * Destroy the framework and cleanup all created listeners.
|
1073 | */
|
1074 | destroy(): void;
|
1075 | }
|
1076 | export { BaseFramework }
|
1077 | export { BaseFramework as BaseFramework_alias_1 }
|
1078 | export { BaseFramework as BaseFramework_alias_2 }
|
1079 |
|
1080 | declare interface BasePlaceholder {
|
1081 | /**
|
1082 | * A custom class name to use for the placeholder decoration. All the trackers
|
1083 | * will automatically be given the class name `remirror-tracker-position`
|
1084 | *
|
1085 | * @defaultValue ''
|
1086 | */
|
1087 | className?: string;
|
1088 | /**
|
1089 | * A custom html element or string for a created element tag name.
|
1090 | *
|
1091 | * @defaultValue 'tracker'
|
1092 | */
|
1093 | nodeName?: string;
|
1094 | }
|
1095 |
|
1096 | export { Brand }
|
1097 |
|
1098 | declare interface BuiltinOptions extends SuggestOptions, KeymapOptions, DecorationsOptions, InputRulesOptions {
|
1099 | }
|
1100 | export { BuiltinOptions }
|
1101 | export { BuiltinOptions as BuiltinOptions_alias_1 }
|
1102 | export { BuiltinOptions as BuiltinOptions_alias_2 }
|
1103 |
|
1104 | declare type BuiltinPreset = TagsExtension | SchemaExtension | AttributesExtension | PluginsExtension | InputRulesExtension | PasteRulesExtension | NodeViewsExtension | SuggestExtension | CommandsExtension | HelpersExtension | KeymapExtension | DocChangedExtension | UploadExtension | DecorationsExtension;
|
1105 | export { BuiltinPreset }
|
1106 | export { BuiltinPreset as BuiltinPreset_alias_1 }
|
1107 | export { BuiltinPreset as BuiltinPreset_alias_2 }
|
1108 |
|
1109 | /**
|
1110 | * Provides all the builtin extensions to the editor.
|
1111 | *
|
1112 | * @remarks
|
1113 | *
|
1114 | * This is used automatically and (at the time of writing) can't be removed from
|
1115 | * the editor. If you feel that there's a compelling reason to override these
|
1116 | * extensions feel free to create a [discussion
|
1117 | * here](https://github.com/remirror/remirror/discussions/category_choices) and
|
1118 | * it can be addressed.
|
1119 | *
|
1120 | * @category Builtin Extension
|
1121 | *
|
1122 | * The order of these extension are important.
|
1123 | *
|
1124 | * - [[`TagsExtension`]] is places first because it provides tagging which is
|
1125 | * used by the schema extension.
|
1126 | * - [[`SchemeExtension`]] goes next because it's super important to the editor
|
1127 | * functionality and needs to run before everything else which might depend
|
1128 | * on it.
|
1129 | */
|
1130 | declare function builtinPreset(options?: GetStaticAndDynamic<BuiltinOptions>): BuiltinPreset[];
|
1131 | export { builtinPreset }
|
1132 | export { builtinPreset as builtinPreset_alias_1 }
|
1133 | export { builtinPreset as builtinPreset_alias_2 }
|
1134 |
|
1135 | export { callIfDefined }
|
1136 |
|
1137 | export { CamelCase }
|
1138 |
|
1139 | export { camelCase }
|
1140 |
|
1141 | export { canInsertNode }
|
1142 |
|
1143 | export { capitalCase }
|
1144 |
|
1145 | export { capitalize }
|
1146 |
|
1147 | export { Cast }
|
1148 |
|
1149 | declare interface ChainableCommandDecoratorOptions<Options extends Shape> extends Remirror.CommandDecoratorOptions<Options> {
|
1150 | /**
|
1151 | * Set this to `true` to disable chaining of this command. This means it will
|
1152 | * no longer be available when running `
|
1153 | *
|
1154 | * @defaultValue false
|
1155 | */
|
1156 | disableChaining?: false;
|
1157 | }
|
1158 |
|
1159 | export { chainableEditorState }
|
1160 |
|
1161 | export { chainCommands }
|
1162 |
|
1163 | declare interface ChainedCommandProps {
|
1164 | |
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 | run: (options?: {
|
1178 | exitEarly?: boolean;
|
1179 | }) => void;
|
1180 | |
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 | tr: () => Transaction;
|
1186 | |
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 | enabled: () => boolean;
|
1197 | }
|
1198 | export { ChainedCommandProps }
|
1199 | export { ChainedCommandProps as ChainedCommandProps_alias_1 }
|
1200 | export { ChainedCommandProps as ChainedCommandProps_alias_2 }
|
1201 |
|
1202 | declare type ChainedFromExtensions<Extension extends AnyExtension, Chained extends ChainedIntersection<Extension> = ChainedIntersection<Extension>> = _ChainedFromExtensions<Extension, Chained> & ((tr: Transaction) => _ChainedFromExtensions<Extension, Chained>);
|
1203 | export { ChainedFromExtensions }
|
1204 | export { ChainedFromExtensions as ChainedFromExtensions_alias_1 }
|
1205 | export { ChainedFromExtensions as ChainedFromExtensions_alias_2 }
|
1206 |
|
1207 | declare type _ChainedFromExtensions<Extension extends AnyExtension, Chained extends ChainedIntersection<Extension> = ChainedIntersection<Extension>> = ChainedCommandProps & NewChainedCommandProps<Extension, Chained> & {
|
1208 | [Command in keyof Chained]: Chained[Command] extends (...args: any[]) => any ? (...args: Parameters<Chained[Command]>) => ChainedFromExtensions<Extension> : never;
|
1209 | };
|
1210 |
|
1211 | declare type ChainedIntersection<Extension extends AnyExtension> = UnionToIntersection<MapToChainedCommand<GetCommands<Extension> | GetDecoratedCommands<Extension>>>;
|
1212 | export { ChainedIntersection }
|
1213 | export { ChainedIntersection as ChainedIntersection_alias_1 }
|
1214 | export { ChainedIntersection as ChainedIntersection_alias_2 }
|
1215 |
|
1216 | export { chainKeyBindingCommands }
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 | declare type ChangedOptions<Options extends ValidOptions> = {
|
1222 | [Key in keyof GetDynamic<Options>]: Changes<GetDynamic<Options>[Key]>;
|
1223 | };
|
1224 | export { ChangedOptions }
|
1225 | export { ChangedOptions as ChangedOptions_alias_1 }
|
1226 |
|
1227 | declare type Changes<Type> = {
|
1228 | |
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 | changed: false;
|
1234 | } | {
|
1235 | |
1236 |
|
1237 |
|
1238 | changed: true;
|
1239 | |
1240 |
|
1241 |
|
1242 |
|
1243 | previousValue: Type;
|
1244 | |
1245 |
|
1246 |
|
1247 |
|
1248 | value: Type;
|
1249 | };
|
1250 |
|
1251 | export { clamp }
|
1252 |
|
1253 | export { Class }
|
1254 |
|
1255 | export { ClassName }
|
1256 |
|
1257 | export { cleanupOS }
|
1258 |
|
1259 | export { clone }
|
1260 |
|
1261 | export { cloneTransaction }
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 | declare type CombinedTags<Name extends string = string> = Record<ExtensionTagType, Name[]>;
|
1270 | export { CombinedTags }
|
1271 | export { CombinedTags as CombinedTags_alias_1 }
|
1272 | export { CombinedTags as CombinedTags_alias_2 }
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 | declare function command<Extension extends AnyExtension>(options?: ChainableCommandDecoratorOptions<Required<GetOptions<Extension>>>): ExtensionDecorator<Extension, CommandFunction, void>;
|
1327 |
|
1328 | declare function command<Extension extends AnyExtension>(options: NonChainableCommandDecoratorOptions<Required<GetOptions<Extension>>>): ExtensionDecorator<Extension, NonChainableCommandFunction, void>;
|
1329 | export { command }
|
1330 | export { command as command_alias_1 }
|
1331 | export { command as command_alias_2 }
|
1332 |
|
1333 | declare type CommandDecoratorMessage = CommandDecoratorValue<string>;
|
1334 | export { CommandDecoratorMessage }
|
1335 | export { CommandDecoratorMessage as CommandDecoratorMessage_alias_1 }
|
1336 | export { CommandDecoratorMessage as CommandDecoratorMessage_alias_2 }
|
1337 |
|
1338 | declare interface CommandDecoratorMessageProps {
|
1339 | |
1340 |
|
1341 |
|
1342 | enabled: boolean;
|
1343 | |
1344 |
|
1345 |
|
1346 | active: boolean;
|
1347 | |
1348 |
|
1349 |
|
1350 | attrs: ProsemirrorAttributes | undefined;
|
1351 | |
1352 |
|
1353 |
|
1354 |
|
1355 | t: I18nFormatter;
|
1356 | }
|
1357 | export { CommandDecoratorMessageProps }
|
1358 | export { CommandDecoratorMessageProps as CommandDecoratorMessageProps_alias_1 }
|
1359 | export { CommandDecoratorMessageProps as CommandDecoratorMessageProps_alias_2 }
|
1360 |
|
1361 | declare type CommandDecoratorOptions<Options extends Shape = Shape> = ChainableCommandDecoratorOptions<Options> | NonChainableCommandDecoratorOptions<Options>;
|
1362 | export { CommandDecoratorOptions }
|
1363 | export { CommandDecoratorOptions as CommandDecoratorOptions_alias_1 }
|
1364 | export { CommandDecoratorOptions as CommandDecoratorOptions_alias_2 }
|
1365 |
|
1366 | declare type CommandDecoratorShortcut = string | {
|
1367 | shortcut: string;
|
1368 | attrs: ProsemirrorAttributes;
|
1369 | } | string[] | Array<{
|
1370 | shortcut: string;
|
1371 | attrs: ProsemirrorAttributes;
|
1372 | }>;
|
1373 | export { CommandDecoratorShortcut }
|
1374 | export { CommandDecoratorShortcut as CommandDecoratorShortcut_alias_1 }
|
1375 | export { CommandDecoratorShortcut as CommandDecoratorShortcut_alias_2 }
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 | declare type CommandDecoratorValue<Value> = ((props: CommandDecoratorMessageProps) => Value) | Value;
|
1382 | export { CommandDecoratorValue }
|
1383 | export { CommandDecoratorValue as CommandDecoratorValue_alias_1 }
|
1384 | export { CommandDecoratorValue as CommandDecoratorValue_alias_2 }
|
1385 |
|
1386 | declare interface CommandExtensionMeta {
|
1387 | forcedUpdates?: UpdatableViewProps[];
|
1388 | }
|
1389 | export { CommandExtensionMeta }
|
1390 | export { CommandExtensionMeta as CommandExtensionMeta_alias_1 }
|
1391 | export { CommandExtensionMeta as CommandExtensionMeta_alias_2 }
|
1392 |
|
1393 | export { CommandFunction }
|
1394 |
|
1395 | export { CommandFunctionProps }
|
1396 |
|
1397 | declare interface CommandMetadata {
|
1398 | type: 'command';
|
1399 | /**
|
1400 | * Was this called as part of a chain?
|
1401 | */
|
1402 | chain: boolean;
|
1403 | /**
|
1404 | * Is this a decorated command?
|
1405 | */
|
1406 | decorated: boolean;
|
1407 | /**
|
1408 | * The name of the extension.
|
1409 | */
|
1410 | extension: string;
|
1411 | /**
|
1412 | * The name of the command that was called.
|
1413 | */
|
1414 | name: string;
|
1415 | }
|
1416 |
|
1417 | /**
|
1418 | * Utility type for pulling all the command names from a list
|
1419 | */
|
1420 | declare type CommandNames<Extension extends AnyExtension> = StringKey<CommandsFromExtensions<Extension>>;
|
1421 | export { CommandNames }
|
1422 | export { CommandNames as CommandNames_alias_1 }
|
1423 | export { CommandNames as CommandNames_alias_2 }
|
1424 |
|
1425 | declare interface CommandOptions {
|
1426 | /**
|
1427 | * The className that is added to all tracker positions
|
1428 | *
|
1429 | * '@defaultValue 'remirror-tracker-position'
|
1430 | */
|
1431 | trackerClassName?: Static<string>;
|
1432 | /**
|
1433 | * The default element that is used for all trackers.
|
1434 | *
|
1435 | * @defaultValue 'span'
|
1436 | */
|
1437 | trackerNodeName?: Static<string>;
|
1438 | }
|
1439 | export { CommandOptions }
|
1440 | export { CommandOptions as CommandOptions_alias_1 }
|
1441 | export { CommandOptions as CommandOptions_alias_2 }
|
1442 |
|
1443 | /**
|
1444 | * Generate chained and unchained commands for making changes to the editor.
|
1445 | *
|
1446 | * @remarks
|
1447 | *
|
1448 | * Typically actions are used to create interactive menus. For example a menu
|
1449 | * can use a command to toggle bold formatting or to undo the last action.
|
1450 | *
|
1451 | * @category Builtin Extension
|
1452 | */
|
1453 | declare class CommandsExtension extends PlainExtension<CommandOptions> {
|
1454 | get name(): "commands";
|
1455 | /**
|
1456 | * The current transaction which allows for making commands chainable.
|
1457 | *
|
1458 | * It is shared by all the commands helpers and can even be used in the
|
1459 | * [[`KeymapExtension`]].
|
1460 | *
|
1461 | * @internal
|
1462 | */
|
1463 | get transaction(): Transaction;
|
1464 | /**
|
1465 | * This is the holder for the shared transaction which is shared by commands
|
1466 | * in order to support chaining.
|
1467 | *
|
1468 | * @internal
|
1469 | */
|
1470 | private _transaction?;
|
1471 | /**
|
1472 | * Track the decorated command data.
|
1473 | */
|
1474 | private readonly decorated;
|
1475 | onCreate(): void;
|
1476 | /**
|
1477 | * Attach commands once the view is attached.
|
1478 | */
|
1479 | onView(view: EditorView_2): void;
|
1480 | /**
|
1481 | * Update the cached transaction whenever the state is updated.
|
1482 | */
|
1483 | onStateUpdate({ state }: StateUpdateLifecycleProps): void;
|
1484 | /**
|
1485 | * Create a plugin that solely exists to track forced updates via the
|
1486 | * generated plugin key.
|
1487 | */
|
1488 | createPlugin(): CreateExtensionPlugin;
|
1489 | /**
|
1490 | * Enable custom commands to be used within the editor by users.
|
1491 | *
|
1492 | * This is preferred to the initial idea of setting commands on the
|
1493 | * manager or even as a prop. The problem is that there's no typechecking
|
1494 | * and it should be just fine to add your custom commands here to see the
|
1495 | * dispatched immediately.
|
1496 | *
|
1497 | * To use it, firstly define the command.
|
1498 | *
|
1499 | * ```ts
|
1500 | * import { CommandFunction } from 'remirror';
|
1501 | *
|
1502 | * const myCustomCommand: CommandFunction = ({ tr, dispatch }) => {
|
1503 | * dispatch?.(tr.insertText('My Custom Command'));
|
1504 | *
|
1505 | * return true;
|
1506 | * }
|
1507 | * ```
|
1508 | *
|
1509 | * And then use it within the component.
|
1510 | *
|
1511 | * ```ts
|
1512 | * import React, { useCallback } from 'react';
|
1513 | * import { useRemirror } from '@remirror/react';
|
1514 | *
|
1515 | * const MyEditorButton = () => {
|
1516 | * const { commands } = useRemirror();
|
1517 | * const onClick = useCallback(() => {
|
1518 | * commands.customDispatch(myCustomCommand);
|
1519 | * }, [commands])
|
1520 | *
|
1521 | * return <button onClick={onClick}>Custom Command</button>
|
1522 | * }
|
1523 | * ```
|
1524 | *
|
1525 | * An alternative is to use a custom command directly from a
|
1526 | * `prosemirror-*` library. This can be accomplished in the following way.
|
1527 | *
|
1528 | *
|
1529 | * ```ts
|
1530 | * import { joinDown } from 'prosemirror-commands';
|
1531 | * import { convertCommand } from 'remirror';
|
1532 | *
|
1533 | * const MyEditorButton = () => {
|
1534 | * const { commands } = useRemirror();
|
1535 | * const onClick = useCallback(() => {
|
1536 | * commands.customDispatch(convertCommand(joinDown));
|
1537 | * }, [commands]);
|
1538 | *
|
1539 | * return <button onClick={onClick}>Custom Command</button>;
|
1540 | * };
|
1541 | * ```
|
1542 | */
|
1543 | customDispatch(command: CommandFunction): CommandFunction;
|
1544 | /**
|
1545 | * Insert text into the dom at the current location by default. If a
|
1546 | * promise is provided instead of text the resolved value will be inserted
|
1547 | * at the tracked position.
|
1548 | */
|
1549 | insertText(text: string | (() => Promise<string>), options?: InsertTextOptions): CommandFunction;
|
1550 | /**
|
1551 | * Select the text within the provided range.
|
1552 | *
|
1553 | * Here are some ways it can be used.
|
1554 | *
|
1555 | * ```ts
|
1556 | *
|
1557 | * commands.selectText('end');
|
1558 | *
|
1559 | *
|
1560 | * commands.selectText('start');
|
1561 | *
|
1562 | *
|
1563 | * commands.selectText('all')
|
1564 | *
|
1565 | *
|
1566 | *
|
1567 | * commands.selectText({ from: 10, to: 15 });
|
1568 | *
|
1569 | *
|
1570 | * commands.selectText({ anchor: 10, head: 15 });
|
1571 | *
|
1572 | *
|
1573 | * commands.selectText(10);
|
1574 | *
|
1575 | *
|
1576 | * commands.selectText(TextSelection.near(state.doc.resolve(10)))
|
1577 | * ```
|
1578 | *
|
1579 | * Although this is called `selectText` you can provide your own selection
|
1580 | * option which can be any type of selection.
|
1581 | */
|
1582 | selectText(selection: PrimitiveSelection, options?: {
|
1583 | forceUpdate?: boolean;
|
1584 | }): CommandFunction;
|
1585 | /**
|
1586 | * Select the link at the current location.
|
1587 | */
|
1588 | selectMark(type: string | MarkType): CommandFunction;
|
1589 | /**
|
1590 | * Delete the provided range or current selection.
|
1591 | */
|
1592 | delete(range?: FromToProps): CommandFunction;
|
1593 | /**
|
1594 | * Fire an empty update to trigger an update to all decorations, and state
|
1595 | * that may not yet have run.
|
1596 | *
|
1597 | * This can be used in extensions to trigger updates when certain options that
|
1598 | * affect the editor state have changed.
|
1599 | *
|
1600 | * @param action - provide an action which is called just before the empty
|
1601 | * update is dispatched (only when dispatch is available). This can be used in
|
1602 | * chainable editor scenarios when you want to lazily invoke an action at the
|
1603 | * point the update is about to be applied.
|
1604 | */
|
1605 | emptyUpdate(action?: () => void): CommandFunction;
|
1606 | /**
|
1607 | * Force an update of the specific updatable ProseMirror props.
|
1608 | *
|
1609 | * This command is always available as a builtin command.
|
1610 | *
|
1611 | * @category Builtin Command
|
1612 | */
|
1613 | forceUpdate(...keys: UpdatableViewProps[]): CommandFunction;
|
1614 | /**
|
1615 | * Update the attributes for the node at the specified `pos` in the
|
1616 | * editor.
|
1617 | *
|
1618 | * @category Builtin Command
|
1619 | */
|
1620 | updateNodeAttributes<Type extends object>(pos: number, attrs: ProsemirrorAttributes<Type>): CommandFunction;
|
1621 | /**
|
1622 | * Set the content of the editor while preserving history.
|
1623 | *
|
1624 | * Under the hood this is replacing the content in the document with the new
|
1625 | * state.doc of the provided content.
|
1626 | *
|
1627 | * If the content is a string you will need to ensure you have the proper
|
1628 | * string handler set up in the editor.
|
1629 | */
|
1630 | setContent(content: RemirrorContentType, selection?: PrimitiveSelection): CommandFunction;
|
1631 | /**
|
1632 | * Reset the content of the editor while preserving the history.
|
1633 | *
|
1634 | * This means that undo and redo will still be active since the doc is replaced with a new doc.
|
1635 | */
|
1636 | resetContent(): CommandFunction;
|
1637 | /**
|
1638 | * Fire an update to remove the current range selection. The cursor will
|
1639 | * be placed at the anchor of the current range selection.
|
1640 | *
|
1641 | * A range selection is a non-empty text selection.
|
1642 | *
|
1643 | * @category Builtin Command
|
1644 | */
|
1645 | emptySelection(): CommandFunction;
|
1646 | /**
|
1647 | * Insert a new line into the editor.
|
1648 | *
|
1649 | * Depending on editor setup and where the cursor is placed this may have
|
1650 | * differing impacts.
|
1651 | *
|
1652 | * @category Builtin Command
|
1653 | */
|
1654 | insertNewLine(): CommandFunction;
|
1655 | /**
|
1656 | * Insert a node into the editor with the provided content.
|
1657 | *
|
1658 | * @category Builtin Command
|
1659 | */
|
1660 | insertNode(node: string | NodeType | ProsemirrorNode | Fragment, options?: InsertNodeOptions): CommandFunction;
|
1661 | /**
|
1662 | * Set the focus for the editor.
|
1663 | *
|
1664 | * If using this with chaining this should only be placed at the end of
|
1665 | * the chain. It can cause hard to debug issues when used in the middle of
|
1666 | * a chain.
|
1667 | *
|
1668 | * ```tsx
|
1669 | * import { useCallback } from 'react';
|
1670 | * import { useRemirrorContext } from '@remirror/react';
|
1671 | *
|
1672 | * const MenuButton = () => {
|
1673 | * const { chain } = useRemirrorContext();
|
1674 | * const onClick = useCallback(() => {
|
1675 | * chain
|
1676 | * .toggleBold()
|
1677 | * .focus('end')
|
1678 | * .run();
|
1679 | * }, [chain])
|
1680 | *
|
1681 | * return <button onClick={onClick}>Bold</button>
|
1682 | * }
|
1683 | * ```
|
1684 | */
|
1685 | focus(position?: FocusType): CommandFunction;
|
1686 | /**
|
1687 | * Blur focus from the editor and also update the selection at the same
|
1688 | * time.
|
1689 | */
|
1690 | blur(position?: PrimitiveSelection): CommandFunction;
|
1691 | /**
|
1692 | * Set the block type of the current selection or the provided range.
|
1693 | *
|
1694 | * @param nodeType - the node type to create
|
1695 | * @param attrs - the attributes to add to the node type
|
1696 | * @param selection - the position in the document to set the block node
|
1697 | * @param preserveAttrs - when true preserve the attributes at the provided selection
|
1698 | */
|
1699 | setBlockNodeType(nodeType: string | NodeType, attrs?: ProsemirrorAttributes, selection?: PrimitiveSelection, preserveAttrs?: boolean): CommandFunction;
|
1700 | /**
|
1701 | * Toggle between wrapping an inactive node with the provided node type, and
|
1702 | * lifting it up into it's parent.
|
1703 | *
|
1704 | * @param nodeType - the node type to toggle
|
1705 | * @param attrs - the attrs to use for the node
|
1706 | * @param selection - the selection point in the editor to perform the action
|
1707 | */
|
1708 | toggleWrappingNode(nodeType: string | NodeType, attrs?: ProsemirrorAttributes, selection?: PrimitiveSelection): CommandFunction;
|
1709 | /**
|
1710 | * Toggle a block between the provided type and toggleType.
|
1711 | */
|
1712 | toggleBlockNodeItem(toggleProps: ToggleBlockItemProps): CommandFunction;
|
1713 | /**
|
1714 | * Wrap the selection or the provided text in a node of the given type with the
|
1715 | * given attributes.
|
1716 | */
|
1717 | wrapInNode(nodeType: string | NodeType, attrs?: ProsemirrorAttributes, range?: FromToProps | undefined): CommandFunction;
|
1718 | /**
|
1719 | * Removes a mark from the current selection or provided range.
|
1720 | */
|
1721 | applyMark(markType: string | MarkType, attrs?: ProsemirrorAttributes, selection?: PrimitiveSelection): CommandFunction;
|
1722 | /**
|
1723 | * Removes a mark from the current selection or provided range.
|
1724 | */
|
1725 | toggleMark(props: ToggleMarkProps): CommandFunction;
|
1726 | /**
|
1727 | * Removes a mark from the current selection or provided range.
|
1728 | */
|
1729 | removeMark(props: RemoveMarkProps): CommandFunction;
|
1730 | /**
|
1731 | * Set the meta data to attach to the editor on the next update.
|
1732 | */
|
1733 | setMeta(name: string, value: unknown): CommandFunction;
|
1734 | /**
|
1735 | * Select all text in the editor.
|
1736 | */
|
1737 | selectAll(): CommandFunction;
|
1738 | /**
|
1739 | * Copy the selected content for non empty selections.
|
1740 | */
|
1741 | copy(): CommandFunction;
|
1742 | /**
|
1743 | * Select all text in the editor.
|
1744 | */
|
1745 | paste(): CommandFunction;
|
1746 | /**
|
1747 | * Cut the selected content.
|
1748 | */
|
1749 | cut(): CommandFunction;
|
1750 | /**
|
1751 | * Replaces text with an optional appended string at the end. The replacement
|
1752 | * can be text, or a custom node.
|
1753 | *
|
1754 | * @param props - see [[`ReplaceTextProps`]]
|
1755 | */
|
1756 | replaceText(props: ReplaceTextProps): CommandFunction;
|
1757 | /**
|
1758 | * Get the all the decorated commands available on the editor instance.
|
1759 | */
|
1760 | getAllCommandOptions(): Helper<Record<string, WithName<CommandDecoratorOptions>>>;
|
1761 | /**
|
1762 | * Get the options that were passed into the provided command.
|
1763 | */
|
1764 | getCommandOptions(name: string): Helper<WithName<CommandDecoratorOptions> | undefined>;
|
1765 | /**
|
1766 | * A short hand way of getting the `view`, `state`, `tr` and `dispatch`
|
1767 | * methods.
|
1768 | */
|
1769 | getCommandProp(): Helper<Required<CommandFunctionProps>>;
|
1770 | /**
|
1771 | * Update the command options via a shallow merge of the provided options. If
|
1772 | * no options are provided the entry is deleted.
|
1773 | *
|
1774 | * @internal
|
1775 | */
|
1776 | updateDecorated(name: string, options?: Partial<WithName<CommandDecoratorOptions>>): void;
|
1777 | /**
|
1778 | * Needed on iOS since `requestAnimationFrame` doesn't breaks the focus
|
1779 | * implementation.
|
1780 | */
|
1781 | private handleIosFocus;
|
1782 | /**
|
1783 | * Focus the editor after a slight delay.
|
1784 | */
|
1785 | private delayedFocus;
|
1786 | /**
|
1787 | * A helper for forcing through updates in the view layer. The view layer can
|
1788 | * check for the meta data of the transaction with
|
1789 | * `manager.store.getForcedUpdate(tr)`. If that has a value then it should use
|
1790 | * the unique symbol to update the key.
|
1791 | */
|
1792 | private readonly forceUpdateTransaction;
|
1793 | /**
|
1794 | * Check for a forced update in the transaction. This pulls the meta data
|
1795 | * from the transaction and if it is true then it was a forced update.
|
1796 | *
|
1797 | * ```ts
|
1798 | * import { CommandsExtension } from 'remirror/extensions';
|
1799 | *
|
1800 | * const commandsExtension = manager.getExtension(CommandsExtension);
|
1801 | * log(commandsExtension.getForcedUpdates(tr))
|
1802 | * ```
|
1803 | *
|
1804 | * This can be used for updating:
|
1805 | *
|
1806 | * - `nodeViews`
|
1807 | * - `editable` status of the editor
|
1808 | * - `attributes` - for the top level node
|
1809 | *
|
1810 | * @internal
|
1811 | */
|
1812 | private getForcedUpdates;
|
1813 | /**
|
1814 | * Get the command metadata.
|
1815 | */
|
1816 | private getCommandMeta;
|
1817 | private setCommandMeta;
|
1818 | /**
|
1819 | * Add the commands from the provided `commands` property to the `chained`,
|
1820 | * `original` and `unchained` objects.
|
1821 | */
|
1822 | private addCommands;
|
1823 | /**
|
1824 | * Create an unchained command method.
|
1825 | */
|
1826 | private unchainedFactory;
|
1827 | /**
|
1828 | * Create the unchained command.
|
1829 | */
|
1830 | private createUnchainedCommand;
|
1831 | /**
|
1832 | * Create a chained command method.
|
1833 | */
|
1834 | private chainedFactory;
|
1835 | }
|
1836 | export { CommandsExtension }
|
1837 | export { CommandsExtension as CommandsExtension_alias_1 }
|
1838 | export { CommandsExtension as CommandsExtension_alias_2 }
|
1839 |
|
1840 | /**
|
1841 | * Utility type which receives an extension and provides the type of actions it
|
1842 | * makes available.
|
1843 | *
|
1844 | * @typeParam Extension - the extensions being used within the editor
|
1845 | * @typeParam Expanded - auto generated from `Extension`. These are the
|
1846 | * fully expanded extensions with all sub extensions automatically provided. You
|
1847 | * never need to provide this type as it is automatically calculated.
|
1848 | */
|
1849 | declare type CommandsFromExtensions<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = UnionToIntersection<MapToUnchainedCommand<GetCommands<Expanded> | GetDecoratedCommands<Expanded>>>;
|
1850 | export { CommandsFromExtensions }
|
1851 | export { CommandsFromExtensions as CommandsFromExtensions_alias_1 }
|
1852 | export { CommandsFromExtensions as CommandsFromExtensions_alias_2 }
|
1853 |
|
1854 | /**
|
1855 | * The type of a non chainable command. It is a function with an `enabled`
|
1856 | * method to check whether the command can be run.
|
1857 | */
|
1858 | declare interface CommandShape<Parameter extends any[] = []> {
|
1859 | /**
|
1860 | * Returns true when the command can be run and false when it can't be run. It
|
1861 | * basically runs the command without dispatching it to see whether it returns
|
1862 | * true or false.
|
1863 | *
|
1864 | * @remarks
|
1865 | *
|
1866 | * Some commands can have rules and restrictions. For example, formatting like
|
1867 | *`bold` is disabled within a `codeBlock`. In this case
|
1868 | *`commands.toggleBold.enabled()` returns `false` when within a `codeBlock`
|
1869 | *and `true` when outside.
|
1870 | *
|
1871 | * @param args - The same arguments that are applied to the command function.
|
1872 | */
|
1873 | enabled: (...args: Parameter) => boolean;
|
1874 | /**
|
1875 | * This function gives you access to the original command defined by the
|
1876 | * extension in your editor exactly as it was defined.
|
1877 | *
|
1878 | * The function returns a function that takes the CommandFunctionProps of
|
1879 | * `{ state, dispatch?, tr, view? }` object.
|
1880 | *
|
1881 | * ```ts
|
1882 | * function command(...args: any[]) => CommandFunction;
|
1883 | * ```
|
1884 | */
|
1885 | original: (...args: Parameter) => CommandFunction;
|
1886 | /**
|
1887 | * Commands which are not attached to a node extension or a mark extension can
|
1888 | * optionally define custom `isActive` checker.
|
1889 | *
|
1890 | * This is used for checking if `centerAlign` is active from the
|
1891 | * `@remirror/extension-node-formatting`.
|
1892 | */
|
1893 | active?: () => boolean;
|
1894 | (...args: Parameter): void;
|
1895 | }
|
1896 | export { CommandShape }
|
1897 | export { CommandShape as CommandShape_alias_1 }
|
1898 |
|
1899 | declare interface CommandUiDecoratorOptions {
|
1900 | /**
|
1901 | * The default command icon to use if this has a UI representation.
|
1902 | */
|
1903 | icon?: CommandDecoratorValue<CoreIcon | CommandUiIcon>;
|
1904 | /**
|
1905 | * A label for the command with support for i18n. This makes use of
|
1906 | * `babel-plugin-macros` to generate the message.
|
1907 | */
|
1908 | label?: CommandDecoratorMessage;
|
1909 | /**
|
1910 | * An i18n compatible description which can be used to provide extra context
|
1911 | * for the command.
|
1912 | */
|
1913 | description?: CommandDecoratorMessage;
|
1914 | /**
|
1915 | * A keyboard shortcut which can be used to run the specified command.
|
1916 | *
|
1917 | * Rather than defining this here, you should create a decorated `keyBinding`
|
1918 | * and set the `command` name option. This way the shortcut will dynamically
|
1919 | * be added at runtime.
|
1920 | */
|
1921 | shortcut?: CommandDecoratorShortcut;
|
1922 | }
|
1923 | export { CommandUiDecoratorOptions }
|
1924 | export { CommandUiDecoratorOptions as CommandUiDecoratorOptions_alias_1 }
|
1925 | export { CommandUiDecoratorOptions as CommandUiDecoratorOptions_alias_2 }
|
1926 |
|
1927 | declare interface CommandUiIcon {
|
1928 | /**
|
1929 | * The icon name.
|
1930 | */
|
1931 | name: CoreIcon;
|
1932 | /**
|
1933 | * Text placed in a superscript position. For `ltr` this is in the top right
|
1934 | * hand corner of the icon.
|
1935 | */
|
1936 | sup?: string;
|
1937 | /**
|
1938 | * Text placed in a subscript position. For `ltr` this is in the bottom right
|
1939 | * hand corner.
|
1940 | */
|
1941 | sub?: string;
|
1942 | }
|
1943 | export { CommandUiIcon }
|
1944 | export { CommandUiIcon as CommandUiIcon_alias_1 }
|
1945 | export { CommandUiIcon as CommandUiIcon_alias_2 }
|
1946 |
|
1947 | export { composeTransactionSteps }
|
1948 |
|
1949 | export { ConditionalExcept }
|
1950 |
|
1951 | export { ConditionalKeys }
|
1952 |
|
1953 | export { ConditionalPick }
|
1954 |
|
1955 | export { ConditionalReturnKeys }
|
1956 |
|
1957 | export { ConditionalReturnPick }
|
1958 |
|
1959 | export { constantCase }
|
1960 |
|
1961 | /**
|
1962 | * Auto infers the parameter for the constructor. If there is a required static
|
1963 | * option then the TypeScript compiler will error if nothing is passed in.
|
1964 | */
|
1965 | export declare type ConstructorProps<Options extends ValidOptions, DefaultStaticOptions extends Shape> = IfNoRequiredProperties<GetStatic<Options>, [
|
1966 | options?: GetConstructorProps<Options> & DefaultStaticOptions
|
1967 | ], [
|
1968 | options: GetConstructorProps<Options> & DefaultStaticOptions
|
1969 | ]>;
|
1970 |
|
1971 | export { containsAttributes }
|
1972 |
|
1973 | export { containsNodesOfType }
|
1974 |
|
1975 | export { convertCommand }
|
1976 |
|
1977 | export { convertPixelsToDomUnit }
|
1978 |
|
1979 | export { Coords }
|
1980 |
|
1981 | export { CoreIcon }
|
1982 |
|
1983 | export { createDocumentNode }
|
1984 |
|
1985 | export { CreateDocumentNodeProps }
|
1986 |
|
1987 | declare interface CreateEditorStateProps extends Omit<StringHandlerProps, 'stringHandler'> {
|
1988 | /**
|
1989 | * This is where content can be supplied to the Editor.
|
1990 | *
|
1991 | * @remarks
|
1992 | *
|
1993 | * Content can either be
|
1994 | * - a string (which will be parsed by the stringHandler)
|
1995 | * - JSON object matching Prosemirror expected shape
|
1996 | * - A top level ProsemirrorNode
|
1997 | *
|
1998 | * If this is left undefined then the editor will use the default empty `doc`.
|
1999 | */
|
2000 | content?: RemirrorContentType;
|
2001 | /**
|
2002 | * The selection that the user should have in the created node.
|
2003 | *
|
2004 | * @defaultValue 'end'
|
2005 | */
|
2006 | selection?: PrimitiveSelection;
|
2007 | /**
|
2008 | * A function which transforms a string into a prosemirror node.
|
2009 | *
|
2010 | * @remarks
|
2011 | *
|
2012 | * Can be used to transform markdown / html or any other string format into a
|
2013 | * prosemirror node.
|
2014 | *
|
2015 | * See [[`fromHTML`]] for an example of how this could work.
|
2016 | */
|
2017 | stringHandler?: keyof Remirror.StringHandlers | StringHandler;
|
2018 | }
|
2019 | export { CreateEditorStateProps }
|
2020 | export { CreateEditorStateProps as CreateEditorStateProps_alias_1 }
|
2021 | export { CreateEditorStateProps as CreateEditorStateProps_alias_2 }
|
2022 |
|
2023 | /**
|
2024 | * An interface for creating custom plugins in your `remirror` editor.
|
2025 | */
|
2026 | declare interface CreateExtensionPlugin<PluginState = any> extends Pick<PluginSpec<PluginState>, 'props' | 'state' | 'key' | 'view' | 'filterTransaction' | 'appendTransaction'> {
|
2027 | /**
|
2028 | Additional properties are allowed on plugin specs, which can be
|
2029 | read via [`Plugin.spec`](https://prosemirror.net/docs/ref/#state.Plugin.spec).
|
2030 | */
|
2031 | [key: string]: any;
|
2032 | }
|
2033 | export { CreateExtensionPlugin }
|
2034 | export { CreateExtensionPlugin as CreateExtensionPlugin_alias_1 }
|
2035 |
|
2036 | declare type CreateStateFromContent = (content: RemirrorContentType, selection?: PrimitiveSelection) => EditorState;
|
2037 | export { CreateStateFromContent }
|
2038 | export { CreateStateFromContent as CreateStateFromContent_alias_1 }
|
2039 | export { CreateStateFromContent as CreateStateFromContent_alias_2 }
|
2040 |
|
2041 | export declare function createUploadContext(): UploadContext;
|
2042 |
|
2043 | export declare function createUploadPlaceholderPlugin(): Plugin_2<UploadPlaceholderPluginData>;
|
2044 |
|
2045 | export { CustomDocumentProps }
|
2046 |
|
2047 | export { CustomHandler }
|
2048 |
|
2049 | export { CustomHandlerKey }
|
2050 |
|
2051 | export { CustomHandlerKeyList }
|
2052 |
|
2053 | declare interface CustomHandlerKeysProps<Options extends Shape = EmptyShape> {
|
2054 | customHandlerKeys: CustomHandlerKeyList<Options>;
|
2055 | }
|
2056 |
|
2057 | /**
|
2058 | * @internal
|
2059 | */
|
2060 | declare type CustomHandlerMethod<Options extends ValidOptions> = <Key extends keyof GetCustomHandler<Options>>(key: Key, value: Required<GetCustomHandler<Options>>[Key]) => Dispose;
|
2061 | export { CustomHandlerMethod }
|
2062 | export { CustomHandlerMethod as CustomHandlerMethod_alias_1 }
|
2063 |
|
2064 | export { CustomHandlerShape }
|
2065 |
|
2066 | export { cx }
|
2067 |
|
2068 | declare interface DataProps<Data = any> {
|
2069 | /**
|
2070 | * The data to store for this placeholder.
|
2071 | */
|
2072 | data?: Data;
|
2073 | }
|
2074 |
|
2075 | export { debounce }
|
2076 |
|
2077 | export { DebouncedFunction }
|
2078 |
|
2079 | export { Decoration }
|
2080 |
|
2081 | declare type DecorationPlaceholder = WidgetPlaceholder | NodePlaceholder | InlinePlaceholder;
|
2082 | export { DecorationPlaceholder }
|
2083 | export { DecorationPlaceholder as DecorationPlaceholder_alias_1 }
|
2084 | export { DecorationPlaceholder as DecorationPlaceholder_alias_2 }
|
2085 |
|
2086 | declare interface DecorationPlaceholderMeta {
|
2087 | /**
|
2088 | * The trackers to add.
|
2089 | */
|
2090 | added?: Array<WithBase<DecorationPlaceholder>>;
|
2091 | /**
|
2092 | * The trackers to update with new data. Data is an object and is used to
|
2093 | * include properties like `progress` for progress indicators. Only `widget`
|
2094 | * decorations can be updated in this way.
|
2095 | */
|
2096 | updated?: Array<{
|
2097 | id: unknown;
|
2098 | data: any;
|
2099 | }>;
|
2100 | /**
|
2101 | * The trackers to remove.
|
2102 | */
|
2103 | removed?: unknown[];
|
2104 | /**
|
2105 | * When set to true will delete all the active trackers.
|
2106 | */
|
2107 | clearTrackers?: boolean;
|
2108 | }
|
2109 | export { DecorationPlaceholderMeta }
|
2110 | export { DecorationPlaceholderMeta as DecorationPlaceholderMeta_alias_1 }
|
2111 | export { DecorationPlaceholderMeta as DecorationPlaceholderMeta_alias_2 }
|
2112 |
|
2113 | export { DecorationSet }
|
2114 |
|
2115 | /**
|
2116 | * Simplify the process of adding decorations to the editor. All the decorations
|
2117 | * added to the document this way are automatically tracked which allows for
|
2118 | * custom components to be nested inside decorations.
|
2119 | *
|
2120 | * @category Builtin Extension
|
2121 | */
|
2122 | declare class DecorationsExtension extends PlainExtension<DecorationsOptions> {
|
2123 | get name(): "decorations";
|
2124 | /**
|
2125 | * The placeholder decorations.
|
2126 | */
|
2127 | private placeholders;
|
2128 | /**
|
2129 | * A map of the html elements to their decorations.
|
2130 | */
|
2131 | private readonly placeholderWidgets;
|
2132 | onCreate(): void;
|
2133 | /**
|
2134 | * Create the extension plugin for inserting decorations into the editor.
|
2135 | */
|
2136 | createPlugin(): CreateExtensionPlugin;
|
2137 | updateDecorations(): CommandFunction;
|
2138 | /**
|
2139 | * Command to dispatch a transaction adding the placeholder decoration to
|
2140 | * be tracked.
|
2141 | *
|
2142 | * @param id - the value that is used to identify this tracker. This can
|
2143 | * be any value. A promise, a function call, a string.
|
2144 | * @param options - the options to call the tracked position with. You can
|
2145 | * specify the range `{ from: number; to: number }` as well as the class
|
2146 | * name.
|
2147 | */
|
2148 | addPlaceholder(id: unknown, placeholder: DecorationPlaceholder, deleteSelection?: boolean): CommandFunction;
|
2149 | /**
|
2150 | * A command to updated the placeholder decoration.
|
2151 | *
|
2152 | * To update multiple placeholders you can use chained commands.
|
2153 | *
|
2154 | * ```ts
|
2155 | * let idsWithData: Array<{id: unknown, data: number}>;
|
2156 | *
|
2157 | * for (const { id, data } of idsWithData) {
|
2158 | * chain.updatePlaceholder(id, data);
|
2159 | * }
|
2160 | *
|
2161 | * chain.run();
|
2162 | * ```
|
2163 | */
|
2164 | updatePlaceholder<Data = any>(id: unknown, data: Data): CommandFunction;
|
2165 | /**
|
2166 | * A command to remove the specified placeholder decoration.
|
2167 | */
|
2168 | removePlaceholder(id: unknown): CommandFunction;
|
2169 | /**
|
2170 | * A command to remove all active placeholder decorations.
|
2171 | */
|
2172 | clearPlaceholders(): CommandFunction;
|
2173 | /**
|
2174 | * Find the position for the tracker with the ID specified.
|
2175 | *
|
2176 | * @param id - the unique position id which can be any type
|
2177 | */
|
2178 | findPlaceholder(id: unknown): Helper<FromToProps | undefined>;
|
2179 | /**
|
2180 | * Find the positions of all the trackers in document.
|
2181 | */
|
2182 | findAllPlaceholders(): Helper<Map<unknown, FromToProps>>;
|
2183 | /**
|
2184 | * Add some decorations based on the provided settings.
|
2185 | */
|
2186 | createDecorations(state: EditorState): DecorationSet_2;
|
2187 | /**
|
2188 | * This stores all tracked positions in the editor and maps them via the
|
2189 | * transaction updates.
|
2190 | */
|
2191 | onApplyState(): void;
|
2192 | /**
|
2193 | * Add a widget placeholder and track it as a widget placeholder.
|
2194 | */
|
2195 | private addWidgetPlaceholder;
|
2196 | /**
|
2197 | * Add an inline placeholder.
|
2198 | */
|
2199 | private addInlinePlaceholder;
|
2200 | /**
|
2201 | * Add a placeholder for nodes.
|
2202 | */
|
2203 | private addNodePlaceholder;
|
2204 | /**
|
2205 | * Add the node and class name to the placeholder object.
|
2206 | */
|
2207 | private withRequiredBase;
|
2208 | /**
|
2209 | * Get the command metadata.
|
2210 | */
|
2211 | private getMeta;
|
2212 | /**
|
2213 | * Set the metadata for the command.
|
2214 | */
|
2215 | private setMeta;
|
2216 | /**
|
2217 | * Add a placeholder decoration with the specified params to the transaction
|
2218 | * and return the transaction.
|
2219 | *
|
2220 | * It is up to you to dispatch the transaction or you can just use the
|
2221 | * commands.
|
2222 | */
|
2223 | private addPlaceholderTransaction;
|
2224 | /**
|
2225 | * Update the data stored by a placeholder.
|
2226 | *
|
2227 | * This replaces the whole data value.
|
2228 | */
|
2229 | private updatePlaceholderTransaction;
|
2230 | /**
|
2231 | * Discards a previously defined tracker once not needed.
|
2232 | *
|
2233 | * This should be used to cleanup once the position is no longer needed.
|
2234 | */
|
2235 | private removePlaceholderTransaction;
|
2236 | /**
|
2237 | * This helper returns a transaction that clears all position trackers when
|
2238 | * any exist.
|
2239 | *
|
2240 | * Otherwise it returns undefined.
|
2241 | */
|
2242 | private clearPlaceholdersTransaction;
|
2243 | /**
|
2244 | * Handles delayed commands which rely on the
|
2245 | */
|
2246 | private readonly createPlaceholderCommand;
|
2247 | }
|
2248 | export { DecorationsExtension }
|
2249 | export { DecorationsExtension as DecorationsExtension_alias_1 }
|
2250 | export { DecorationsExtension as DecorationsExtension_alias_2 }
|
2251 |
|
2252 | declare interface DecorationsOptions {
|
2253 | /**
|
2254 | * This setting is for adding a decoration to the selected text and can be
|
2255 | * used to preserve the marker for the selection when the editor loses focus.
|
2256 | *
|
2257 | * You can set it as `'selection'` to match the default styles provided by
|
2258 | * `@remirror/styles`.
|
2259 | *
|
2260 | * @defaultValue undefined
|
2261 | */
|
2262 | persistentSelectionClass?: AcceptUndefined<string | boolean>;
|
2263 | /**
|
2264 | * Add custom decorations to the editor via `extension.addHandler`. This can
|
2265 | * be used via the `useDecorations` hook available from `remirror/react`.
|
2266 | */
|
2267 | decorations: Handler<(state: EditorState) => DecorationSet_2>;
|
2268 | /**
|
2269 | * The className that is added to all placeholder positions
|
2270 | *
|
2271 | * '@defaultValue 'placeholder'
|
2272 | */
|
2273 | placeholderClassName?: Static<string>;
|
2274 | /**
|
2275 | * The default element that is used for all placeholders.
|
2276 | *
|
2277 | * @defaultValue 'span'
|
2278 | */
|
2279 | placeholderNodeName?: Static<string>;
|
2280 | }
|
2281 | export { DecorationsOptions }
|
2282 | export { DecorationsOptions as DecorationsOptions_alias_1 }
|
2283 | export { DecorationsOptions as DecorationsOptions_alias_2 }
|
2284 |
|
2285 | declare interface DecorationsOptions_2 {
|
2286 | }
|
2287 |
|
2288 | export { deepMerge }
|
2289 |
|
2290 | export { DeepPartial }
|
2291 |
|
2292 | export { DeepString }
|
2293 |
|
2294 | /**
|
2295 | * The default named shortcuts used within `remirror`.
|
2296 | */
|
2297 | declare const DEFAULT_SHORTCUTS: ShortcutMap;
|
2298 | export { DEFAULT_SHORTCUTS }
|
2299 | export { DEFAULT_SHORTCUTS as DEFAULT_SHORTCUTS_alias_1 }
|
2300 | export { DEFAULT_SHORTCUTS as DEFAULT_SHORTCUTS_alias_2 }
|
2301 |
|
2302 | export { DefaultDocNodeOptions }
|
2303 |
|
2304 | /**
|
2305 | * Get the expected type signature for the `defaultOptions`. Requires that every
|
2306 | * optional setting key (except for keys which are defined on the
|
2307 | * `BaseExtensionOptions`) has a value assigned.
|
2308 | */
|
2309 | declare type DefaultExtensionOptions<Options extends ValidOptions> = DefaultOptions<Options, BaseExtensionOptions>;
|
2310 | export { DefaultExtensionOptions }
|
2311 | export { DefaultExtensionOptions as DefaultExtensionOptions_alias_1 }
|
2312 | export { DefaultExtensionOptions as DefaultExtensionOptions_alias_2 }
|
2313 |
|
2314 | export { defaultImport }
|
2315 |
|
2316 | /**
|
2317 | * Get the expected type signature for the `defaultOptions`. Requires that every
|
2318 | * optional setting key (except for keys which are defined on the
|
2319 | * `BaseExtensionOptions`) has a value assigned.
|
2320 | */
|
2321 | export declare type DefaultOptions<Options extends ValidOptions, DefaultStaticOptions extends Shape> = MakeUndefined<UndefinedFlipPartialAndRequired<GetStatic<Options>> & Partial<DefaultStaticOptions> & GetFixedDynamic<Options>, StringKey<GetAcceptUndefined<Options>>>;
|
2322 |
|
2323 | declare interface DefaultOptionsProps<Options extends Shape = EmptyShape> {
|
2324 | /**
|
2325 | * The default options.
|
2326 | *
|
2327 | * All non required options must have a default value provided.
|
2328 | *
|
2329 | * Please note that as mentioned in this issue
|
2330 | * [#624](https://github.com/remirror/remirror/issues/624), partial options
|
2331 | * can cause trouble when setting a default.
|
2332 | *
|
2333 | * If you need to accept `undefined `as an acceptable default option there are
|
2334 | * two possible ways to resolve this.
|
2335 | *
|
2336 | * #### Use `AcceptUndefined`
|
2337 | *
|
2338 | * This is the preferred solution and should be used instead of the following
|
2339 | * `null` union.
|
2340 | *
|
2341 | * ```ts
|
2342 | * import { AcceptUndefined } from 'remirror';
|
2343 | *
|
2344 | * interface Options {
|
2345 | * optional?: AcceptUndefined<string>;
|
2346 | * }
|
2347 | * ```
|
2348 | *
|
2349 | * Now when the options are consumed by this decorator there should be no
|
2350 | * errors when setting the value to `undefined`.
|
2351 | *
|
2352 | * #### `null` union
|
2353 | *
|
2354 | * If you don't mind using nulls in your code then this might appeal to you.
|
2355 | *
|
2356 | * ```ts
|
2357 | * interface Options {
|
2358 | * optional?: string | null;
|
2359 | * }
|
2360 | * ```
|
2361 | *
|
2362 | * @defaultValue {}
|
2363 | */
|
2364 | defaultOptions: DefaultExtensionOptions<Options>;
|
2365 | }
|
2366 |
|
2367 | declare interface DefaultPriorityProps {
|
2368 | /**
|
2369 | * The default priority for this extension.
|
2370 | *
|
2371 | * @defaultValue {}
|
2372 | */
|
2373 | defaultPriority?: ExtensionPriority;
|
2374 | }
|
2375 |
|
2376 | declare class DelayedCommand<Value> {
|
2377 | private readonly promiseCreator;
|
2378 | private readonly failureHandlers;
|
2379 | private readonly successHandlers;
|
2380 | private readonly validateHandlers;
|
2381 | constructor(promiseCreator: DelayedPromiseCreator<Value>);
|
2382 | /**
|
2383 | * The commands that will immediately be run and used to evaluate whether to
|
2384 | * proceed.
|
2385 | */
|
2386 | validate(handler: CommandFunction, method?: 'push' | 'unshift'): this;
|
2387 | /**
|
2388 | * Add a success callback to the handler.
|
2389 | */
|
2390 | success(handler: CommandFunction<{
|
2391 | value: Value;
|
2392 | }>, method?: 'push' | 'unshift'): this;
|
2393 | /**
|
2394 | * Add a failure callback to the handler.
|
2395 | */
|
2396 | failure(handler: CommandFunction<{
|
2397 | error: any;
|
2398 | }>, method?: 'push' | 'unshift'): this;
|
2399 | private runHandlers;
|
2400 | /**
|
2401 | * Generate the `remirror` command.
|
2402 | */
|
2403 | readonly generateCommand: () => CommandFunction;
|
2404 | }
|
2405 | export { DelayedCommand }
|
2406 | export { DelayedCommand as DelayedCommand_alias_1 }
|
2407 |
|
2408 | /**
|
2409 | * Add tentative support for delayed commands in the editor.
|
2410 | *
|
2411 | * Delayed commands are commands that run an immediate action, like adding a
|
2412 | * tracker to a position in the document. Once the promise that is provided is
|
2413 | * returned the `onDone` parameter is run with the document in the current
|
2414 | * state. The tracker that was added can now be used to insert content, delete
|
2415 | * content or replace content.
|
2416 | *
|
2417 | * @experimental This is still being worked on and the API is subject to changes
|
2418 | * in structure going forward.
|
2419 | *
|
2420 | * @deprecated use [[`DelayedCommand`]] instead.
|
2421 | *
|
2422 | */
|
2423 | declare function delayedCommand<Value>({ immediate, promise, onDone, onFail, }: DelayedCommandProps<Value>): CommandFunction;
|
2424 | export { delayedCommand }
|
2425 | export { delayedCommand as delayedCommand_alias_1 }
|
2426 |
|
2427 | /**
|
2428 | * The parameter that is passed into `DelayedCommand`s.
|
2429 | */
|
2430 | declare interface DelayedCommandProps<Value> {
|
2431 | /**
|
2432 | * Runs as soon as the command is triggered. For most delayed commands within
|
2433 | * the `remirror` codebase this is used to add a position tracker to the
|
2434 | * document.
|
2435 | */
|
2436 | immediate?: CommandFunction;
|
2437 | /**
|
2438 | * The promise that provides the value that the `onDone` callback uses to
|
2439 | * complete the delayed command.
|
2440 | */
|
2441 | promise: DelayedValue<Value>;
|
2442 | /**
|
2443 | * Called when the provided promise resolves.
|
2444 | */
|
2445 | onDone: CommandFunction<{
|
2446 | value: Value;
|
2447 | }>;
|
2448 | /**
|
2449 | * Called when the promise fails. This could be used to cleanup the active
|
2450 | * position trackers when the delayed command fails.
|
2451 | */
|
2452 | onFail?: CommandFunction;
|
2453 | }
|
2454 |
|
2455 | declare interface DelayedPlaceholderCommandProps<Value> {
|
2456 | /**
|
2457 | * A function that returns a promise.
|
2458 | */
|
2459 | promise: DelayedPromiseCreator<Value>;
|
2460 | /**
|
2461 | * The placeholder configuration.
|
2462 | */
|
2463 | placeholder: DecorationPlaceholder;
|
2464 | /**
|
2465 | * Called when the promise succeeds and the placeholder still exists. If no
|
2466 | * placeholder can be found (for example, the user has deleted the entire
|
2467 | * document) then the failure handler is called instead.
|
2468 | */
|
2469 | onSuccess: (value: Value, range: FromToProps, commandProps: CommandFunctionProps) => boolean;
|
2470 | /**
|
2471 | * Called when a failure is encountered.
|
2472 | */
|
2473 | onFailure?: CommandFunction<{
|
2474 | error: any;
|
2475 | }>;
|
2476 | }
|
2477 | export { DelayedPlaceholderCommandProps }
|
2478 | export { DelayedPlaceholderCommandProps as DelayedPlaceholderCommandProps_alias_1 }
|
2479 | export { DelayedPlaceholderCommandProps as DelayedPlaceholderCommandProps_alias_2 }
|
2480 |
|
2481 | declare type DelayedPromiseCreator<Value> = (props: CommandFunctionProps) => Promise<Value>;
|
2482 | export { DelayedPromiseCreator }
|
2483 | export { DelayedPromiseCreator as DelayedPromiseCreator_alias_1 }
|
2484 |
|
2485 | declare type DelayedValue<Type> = Promise<Type> | (() => Promise<Type>);
|
2486 | export { DelayedValue }
|
2487 | export { DelayedValue as DelayedValue_alias_1 }
|
2488 |
|
2489 | export { DelimiterCase }
|
2490 |
|
2491 | export { Diff }
|
2492 |
|
2493 | export { DispatchFunction }
|
2494 |
|
2495 | export { Dispose }
|
2496 |
|
2497 | declare class DocChangedExtension extends PlainExtension<DocChangedOptions> {
|
2498 | get name(): "docChanged";
|
2499 | onStateUpdate(props: StateUpdateLifecycleProps): void;
|
2500 | }
|
2501 | export { DocChangedExtension }
|
2502 | export { DocChangedExtension as DocChangedExtension_alias_1 }
|
2503 | export { DocChangedExtension as DocChangedExtension_alias_2 }
|
2504 |
|
2505 | declare interface DocChangedOptions {
|
2506 | docChanged?: Handler<(props: StateUpdateLifecycleProps) => void>;
|
2507 | }
|
2508 | export { DocChangedOptions }
|
2509 | export { DocChangedOptions as DocChangedOptions_alias_1 }
|
2510 | export { DocChangedOptions as DocChangedOptions_alias_2 }
|
2511 |
|
2512 | export { DOM_SIZE_UNITS }
|
2513 |
|
2514 | export { DOMCompatibleAttributes }
|
2515 |
|
2516 | export { DOMOutputSpec }
|
2517 |
|
2518 | export { DomSizeUnit }
|
2519 |
|
2520 | export { Dynamic }
|
2521 |
|
2522 | export { DynamicAttributeCreator }
|
2523 |
|
2524 | export { DynamicKey }
|
2525 |
|
2526 | export { DynamicKeyList }
|
2527 |
|
2528 | /**
|
2529 | * Get the options from any constructor. Can be used for both presets and
|
2530 | * extensions.
|
2531 | */
|
2532 | declare type DynamicOptionsOfConstructor<Constructor extends AnyConstructor> = GetPartialDynamic<GetOptions<InstanceType<Constructor>>>;
|
2533 | export { DynamicOptionsOfConstructor }
|
2534 | export { DynamicOptionsOfConstructor as DynamicOptionsOfConstructor_alias_1 }
|
2535 |
|
2536 | export { DynamicShape }
|
2537 |
|
2538 | export { EditorSchema }
|
2539 |
|
2540 | export { EditorState }
|
2541 |
|
2542 | export { EditorStateProps }
|
2543 |
|
2544 | export { EditorView }
|
2545 |
|
2546 | export { EditorViewProps }
|
2547 |
|
2548 | export { EMPTY_ARRAY }
|
2549 |
|
2550 | export { EMPTY_NODE }
|
2551 |
|
2552 | export { EMPTY_PARAGRAPH_NODE }
|
2553 |
|
2554 | export { EmptyShape }
|
2555 |
|
2556 | export { endPositionOfParent }
|
2557 |
|
2558 | export { Entries }
|
2559 |
|
2560 | export { entries }
|
2561 |
|
2562 | export { Entry }
|
2563 |
|
2564 | export { environment }
|
2565 |
|
2566 | export { ErrorConstant }
|
2567 |
|
2568 | export { Except }
|
2569 |
|
2570 | declare interface ExcludeOptions extends Partial<Remirror.ExcludeOptions> {
|
2571 | }
|
2572 | export { ExcludeOptions }
|
2573 | export { ExcludeOptions as ExcludeOptions_alias_1 }
|
2574 |
|
2575 | /**
|
2576 | * Extensions are fundamental to the way that Remirror works by grouping
|
2577 | * together the functionality and handling the management of similar concerns.
|
2578 | *
|
2579 | * @remarks
|
2580 | *
|
2581 | * Extension can adjust editor functionality in any way. Here are some
|
2582 | * examples.
|
2583 | *
|
2584 | * - How the editor displays certain content, i.e. **bold**, _italic_,
|
2585 | * **underline**.
|
2586 | * - Which commands should be made available e.g. `commands.toggleBold()` to
|
2587 | * toggle the weight of the selected text.
|
2588 | * - Check if a command is currently enabled (i.e a successful dry run) e.g.
|
2589 | * `commands.toggleBold.enabled()`.
|
2590 | * - Register Prosemirror `Plugin`s, `keymap`s, `InputRule`s `PasteRule`s,
|
2591 | * `Suggestions`, and custom `nodeViews` which affect the behavior of the
|
2592 | * editor.
|
2593 | *
|
2594 | * There are three types of `Extension`.
|
2595 | *
|
2596 | * - `NodeExtension` - For creating Prosemirror nodes in the editor. See
|
2597 | * {@link NodeExtension}
|
2598 | * - `MarkExtension` - For creating Prosemirror marks in the editor. See
|
2599 | * {@link MarkExtension}
|
2600 | * - `PlainExtension` - For behavior which doesn't map to a `ProsemirrorNode` or
|
2601 | * `Mark` and as a result doesn't directly affect the Prosemirror `Schema` or
|
2602 | * content. See {@link PlainExtension}.
|
2603 | *
|
2604 | * This `Extension` is an abstract class that should not be used directly but
|
2605 | * rather extended to add the intended functionality.
|
2606 | *
|
2607 | * ```ts
|
2608 | * import { PlainExtension, Static } from 'remirror';
|
2609 | *
|
2610 | * interface AwesomeExtensionOptions {
|
2611 | * isAwesome?: Static<boolean>;
|
2612 | * id?: string;
|
2613 | * }
|
2614 | *
|
2615 | * class AwesomeExtension extends PlainExtension<AwesomeExtensionOptions> {
|
2616 | * static defaultOptions: DefaultExtensionOptions<AwesomeExtensionOptions> = {
|
2617 | * isAwesome: true,
|
2618 | * id: '',
|
2619 | * }
|
2620 | *
|
2621 | * get name() {
|
2622 | * return 'awesome' as const;
|
2623 | * }
|
2624 | * }
|
2625 | * ```
|
2626 | */
|
2627 | declare abstract class Extension<Options extends ValidOptions = EmptyShape> extends BaseClass<Options, BaseExtensionOptions> {
|
2628 | /**
|
2629 | * The default priority for this family of extensions.
|
2630 | */
|
2631 | static readonly defaultPriority: ExtensionPriority;
|
2632 | /**
|
2633 | * Allows for the `RemirrorManager` or `Preset`'s to override the priority of
|
2634 | * an extension.
|
2635 | */
|
2636 | private priorityOverride?;
|
2637 | /**
|
2638 | * The priority level for this instance of the extension. A higher value
|
2639 | * corresponds to a higher priority extension
|
2640 | */
|
2641 | get priority(): ExtensionPriority;
|
2642 | /**
|
2643 | * The name that the constructor should have, which doesn't get mangled in
|
2644 | * production.
|
2645 | */
|
2646 | get constructorName(): string;
|
2647 | /**
|
2648 | * The store is a shared object that's internal to each extension. It includes
|
2649 | * often used items like the `view` and `schema` that are added by the
|
2650 | * extension manager and also the lifecycle extension methods.
|
2651 | *
|
2652 | * **NOTE** - The store is not available until the manager has been created
|
2653 | * and received the extension. As a result trying to access the store during
|
2654 | * `init` and `constructor` will result in a runtime error.
|
2655 | *
|
2656 | * Some properties of the store are available at different phases. You should
|
2657 | * check the inline documentation to know when a certain property is useable
|
2658 | * in your extension.
|
2659 | */
|
2660 | protected get store(): Remirror.ExtensionStore;
|
2661 | /**
|
2662 | * The list of extensions added to the editor by this `Preset`.
|
2663 | */
|
2664 | get extensions(): Array<this['~E']>;
|
2665 | /**
|
2666 | * Private list of extension stored within this [[`Preset`]].
|
2667 | */
|
2668 | private _extensions;
|
2669 | /**
|
2670 | * An extension mapping of the extensions and their constructors.
|
2671 | */
|
2672 | private readonly extensionMap;
|
2673 | /**
|
2674 | * This store is can be modified by the extension manager with and lifecycle
|
2675 | * extension methods.
|
2676 | *
|
2677 | * Different properties are added at different times so it's important to
|
2678 | * check the documentation for each property to know what phase is being
|
2679 | * added.
|
2680 | */
|
2681 | private _store?;
|
2682 | constructor(...args: ExtensionConstructorProps<Options>);
|
2683 | /**
|
2684 | * When there are duplicate extensions used within the editor the extension
|
2685 | * manager will call this method and make sure all extension holders are using
|
2686 | * the same instance of the `ExtensionConstructor`.
|
2687 | *
|
2688 | * @internal
|
2689 | */
|
2690 | replaceChildExtension(constructor: AnyExtensionConstructor, extension: this['~E']): void;
|
2691 | /**
|
2692 | * Not for usage. This is purely for types to make it easier to infer
|
2693 | * available sub extension types.
|
2694 | *
|
2695 | * @internal
|
2696 | */
|
2697 | ['~E']: ReturnType<this['createExtensions']>[number];
|
2698 | /**
|
2699 | * Create the extensions which will be consumed by the preset. Override this
|
2700 | * if you would like to make your extension a parent to other (holder)
|
2701 | * extensions which don't make sense existing outside of the context of this
|
2702 | * extension.
|
2703 | *
|
2704 | * @remarks
|
2705 | *
|
2706 | * Since this method is called in the constructor it should always be created
|
2707 | * as an instance method and not a property. Properties aren't available for
|
2708 | * the call to the parent class.
|
2709 | *
|
2710 | * ```ts
|
2711 | * class HolderExtension extends PlainExtension {
|
2712 | * get name() {
|
2713 | * return 'holder'
|
2714 | * }
|
2715 | *
|
2716 | * // GOOD ✅
|
2717 | * createExtensions() {
|
2718 | * return [];
|
2719 | * }
|
2720 | *
|
2721 | *
|
2722 | * createExtensions = () => {
|
2723 | * return [];
|
2724 | * }
|
2725 | * }
|
2726 | * ```
|
2727 | */
|
2728 | createExtensions(): AnyExtension[];
|
2729 | /**
|
2730 | * Get an extension from this holder extension by providing the desired
|
2731 | * `Constructor`.
|
2732 | *
|
2733 | * @param Constructor - the extension constructor to find in the editor.
|
2734 | *
|
2735 | * @remarks
|
2736 | *
|
2737 | * This method will throw an error if the constructor doesn't exist within the
|
2738 | * extension created by this extension.
|
2739 | *
|
2740 | * It can be used to forward options and attach handlers to the children
|
2741 | * extensions. It is the spiritual replacement of the `Preset` extension.
|
2742 | *
|
2743 | * ```ts
|
2744 | * import { PlainExtension, OnSetOptionsProps } from 'remirror';
|
2745 | *
|
2746 | * interface ParentOptions { weight?: string }
|
2747 | *
|
2748 | * class ParentExtension extends PlainExtension<ParentOptions> {
|
2749 | * get name() {
|
2750 | * return 'parent' as const;
|
2751 | * }
|
2752 | *
|
2753 | * createExtensions() {
|
2754 | * return [new BoldExtension()]
|
2755 | * }
|
2756 | *
|
2757 | * onSetOptions(options: OnSetOptionsProps<ParentOptions>): void {
|
2758 | * if (options.changes.weight.changed) {
|
2759 | *
|
2760 | * this.getExtension(BoldExtension).setOption({ weight: options.changes.weight.value });
|
2761 | * }
|
2762 | * }
|
2763 | * }
|
2764 | * ```
|
2765 | */
|
2766 | getExtension<Type extends this['~E']['constructor']>(Constructor: Type): InstanceType<Type>;
|
2767 | /**
|
2768 | * Check if the type of this extension's constructor matches the type of the
|
2769 | * provided constructor.
|
2770 | */
|
2771 | isOfType<Type extends AnyExtensionConstructor>(Constructor: Type): this is InstanceType<Type>;
|
2772 | /**
|
2773 | * Pass a reference to the globally shared `ExtensionStore` for this
|
2774 | * extension.
|
2775 | *
|
2776 | * @remarks
|
2777 | *
|
2778 | * The extension store allows extensions to access important variables without
|
2779 | * complicating their creator methods.
|
2780 | *
|
2781 | * ```ts
|
2782 | * import { PlainExtension } from 'remirror';
|
2783 | *
|
2784 | * class Awesome extends PlainExtension {
|
2785 | * customMethod() {
|
2786 | * if (this.store.view.hasFocus()) {
|
2787 | * log('dance dance dance');
|
2788 | * }
|
2789 | * }
|
2790 | * }
|
2791 | * ```
|
2792 | *
|
2793 | * This should only be called by the `RemirrorManager`.
|
2794 | *
|
2795 | * @internal
|
2796 | * @nonVirtual
|
2797 | */
|
2798 | setStore(store: Remirror.ExtensionStore): void;
|
2799 | /**
|
2800 | * Clone an extension.
|
2801 | */
|
2802 | clone(...args: ExtensionConstructorProps<Options>): Extension<Options>;
|
2803 | /**
|
2804 | * Set the priority override for this extension. This is used in the
|
2805 | * `RemirrorManager` in order to override the priority of an extension.
|
2806 | *
|
2807 | * If you set the first parameter to `undefined` it will remove the priority
|
2808 | * override.
|
2809 | *
|
2810 | * @internal
|
2811 | */
|
2812 | setPriority(priority: undefined | ExtensionPriority): void;
|
2813 | /**
|
2814 | * This handler is called when the `RemirrorManager` is first created.
|
2815 | *
|
2816 | * @remarks
|
2817 | *
|
2818 | * Since it is called as soon as the manager is some methods may not be
|
2819 | * available in the extension store. When accessing methods on `this.store` be
|
2820 | * shore to check when they become available in the lifecycle.
|
2821 | *
|
2822 | * You can return a `Dispose` function which will automatically be called when
|
2823 | * the extension is destroyed.
|
2824 | *
|
2825 | * This handler is called before the `onView` handler.
|
2826 | *
|
2827 | * @category Lifecycle Methods
|
2828 | */
|
2829 | onCreate?(): Dispose | void;
|
2830 | /**
|
2831 | * This event happens when the view is first received from the view layer
|
2832 | * (e.g. React).
|
2833 | *
|
2834 | * Return a dispose function which will be called when the extension is
|
2835 | * destroyed.
|
2836 | *
|
2837 | * This handler is called after the `onCreate` handler.
|
2838 | *
|
2839 | * @category Lifecycle Methods
|
2840 | */
|
2841 | onView?(view: EditorView): Dispose | void;
|
2842 | /**
|
2843 | * This can be used by the `Extension` to append a transaction to the latest
|
2844 | * update.
|
2845 | *
|
2846 | * This is shorthand for the `ProsemirrorPlugin.spec.appendTransaction`.
|
2847 | *
|
2848 | * @category Lifecycle Methods
|
2849 | */
|
2850 | onAppendTransaction?(props: AppendLifecycleProps): void;
|
2851 | /**
|
2852 | * This is called when the prosemirror editor state is first attached to the
|
2853 | * editor. It can be useful for doing some preparation work.
|
2854 | *
|
2855 | * This is a shorthand for creating a plugin and adding the
|
2856 | * [[`Plugin.spec.state.init`]].
|
2857 | *
|
2858 | * @category Lifecycle Methods
|
2859 | */
|
2860 | onInitState?(state: EditorState): void;
|
2861 | /**
|
2862 | * This is called when the state is being applied to the editor. This can be
|
2863 | * used as a shorthand for the [[`Plugin.spec.state.apply`]] method.
|
2864 | *
|
2865 | * For example, when using [[`createDecorations`]] you can respond to editor
|
2866 | * updates within this callback.
|
2867 | *
|
2868 | * @category Lifecycle Methods
|
2869 | */
|
2870 | onApplyState?(props: ApplyStateLifecycleProps): void;
|
2871 | /**
|
2872 | * This handler is called after a transaction successfully updates the editor
|
2873 | * state. It is called asynchronously after the [[`onApplyState`]] hook has
|
2874 | * been run run.
|
2875 | *
|
2876 | * @category Lifecycle Methods
|
2877 | */
|
2878 | onStateUpdate?(props: StateUpdateLifecycleProps): void;
|
2879 | /**
|
2880 | * Called when the extension is being destroyed.
|
2881 | *
|
2882 | * @category Lifecycle Methods
|
2883 | */
|
2884 | onDestroy?(): void;
|
2885 | }
|
2886 |
|
2887 | /**
|
2888 | * Declaration merging since the constructor property can't be defined on the
|
2889 | * actual class.
|
2890 | */
|
2891 | declare interface Extension<Options extends ValidOptions = EmptyShape> extends Remirror.BaseExtension {
|
2892 | /**
|
2893 | * The type of the constructor for the extension.
|
2894 | */
|
2895 | constructor: ExtensionConstructor<Options>;
|
2896 | /**
|
2897 | * An extension can declare the extensions it requires.
|
2898 | *
|
2899 | * @remarks
|
2900 | *
|
2901 | * When creating the extension manager the extension will be checked for
|
2902 | * required extension as well as a quick check to see if the required
|
2903 | * extension is already included. If not present a descriptive error will be
|
2904 | * thrown.
|
2905 | */
|
2906 | requiredExtensions?: AnyExtensionConstructor[];
|
2907 | }
|
2908 | export { Extension }
|
2909 | export { Extension as Extension_alias_1 }
|
2910 | export { Extension as Extension_alias_2 }
|
2911 |
|
2912 | /**
|
2913 | * A decorator for the remirror extension.
|
2914 | *
|
2915 | * This adds static properties to the extension constructor.
|
2916 | */
|
2917 | declare function extension<Options extends Shape = EmptyShape>(options: ExtensionDecoratorOptions<Options>): <Type extends AnyExtensionConstructor>(ReadonlyConstructor: Type, context?: ClassDecoratorContext<Type> | undefined) => Type;
|
2918 | export { extension }
|
2919 | export { extension as extension_alias_1 }
|
2920 | export { extension as extension_alias_2 }
|
2921 |
|
2922 | declare type ExtensionCommandFunction = (...args: any[]) => CommandFunction;
|
2923 | export { ExtensionCommandFunction }
|
2924 | export { ExtensionCommandFunction as ExtensionCommandFunction_alias_1 }
|
2925 |
|
2926 | /**
|
2927 | * The return signature for an extensions command method.
|
2928 | */
|
2929 | declare interface ExtensionCommandReturn {
|
2930 | [command: string]: ExtensionCommandFunction;
|
2931 | }
|
2932 | export { ExtensionCommandReturn }
|
2933 | export { ExtensionCommandReturn as ExtensionCommandReturn_alias_1 }
|
2934 |
|
2935 | declare interface ExtensionConstructor<Options extends ValidOptions = EmptyShape> extends BaseClassConstructor<Options, BaseExtensionOptions>, Partial<Remirror.StaticExtensionOptions> {
|
2936 | new (...args: ExtensionConstructorProps<Options>): Extension<Options>;
|
2937 | /**
|
2938 | * The default priority level for all instance of this extension.
|
2939 | *
|
2940 | * @defaultValue ExtensionPriority.Default
|
2941 | */
|
2942 | readonly defaultPriority: ExtensionPriority;
|
2943 | }
|
2944 | export { ExtensionConstructor }
|
2945 | export { ExtensionConstructor as ExtensionConstructor_alias_1 }
|
2946 | export { ExtensionConstructor as ExtensionConstructor_alias_2 }
|
2947 |
|
2948 | /**
|
2949 | * Auto infers the parameter for the constructor. If there is a required static
|
2950 | * option then the TypeScript compiler will error if nothing is passed in.
|
2951 | */
|
2952 | declare type ExtensionConstructorProps<Options extends ValidOptions> = ConstructorProps<Options, BaseExtensionOptions>;
|
2953 | export { ExtensionConstructorProps }
|
2954 | export { ExtensionConstructorProps as ExtensionConstructorProps_alias_1 }
|
2955 | export { ExtensionConstructorProps as ExtensionConstructorProps_alias_2 }
|
2956 |
|
2957 | declare type ExtensionDecorator<Extension extends AnyExtension, Fn, Return> = (method: AnyFunction<Fn>, context: ClassMethodDecoratorContext<Extension, AnyFunction<Fn>>) => Return;
|
2958 |
|
2959 | declare type ExtensionDecoratorOptions<Options extends Shape = EmptyShape> = DefaultPriorityProps & IfHasRequiredProperties<DefaultExtensionOptions<Options>, DefaultOptionsProps<Options>, Partial<DefaultOptionsProps<Options>>> & IfEmpty<GetStatic<Options>, Partial<StaticKeysProps<Options>>, StaticKeysProps<Options>> & IfEmpty<GetHandler<Options>, Partial<HandlerKeysProps<Options>>, HandlerKeysProps<Options>> & IfEmpty<GetCustomHandler<Options>, Partial<CustomHandlerKeysProps<Options>>, CustomHandlerKeysProps<Options>> & Partial<Remirror.StaticExtensionOptions>;
|
2960 | export { ExtensionDecoratorOptions }
|
2961 | export { ExtensionDecoratorOptions as ExtensionDecoratorOptions_alias_1 }
|
2962 | export { ExtensionDecoratorOptions as ExtensionDecoratorOptions_alias_2 }
|
2963 |
|
2964 | /**
|
2965 | * The return signature for an extensions helper method.
|
2966 | */
|
2967 | declare interface ExtensionHelperReturn {
|
2968 | [helper: string]: AnyFunction;
|
2969 | }
|
2970 | export { ExtensionHelperReturn }
|
2971 | export { ExtensionHelperReturn as ExtensionHelperReturn_alias_1 }
|
2972 |
|
2973 | declare interface ExtensionListProps<Extension extends AnyExtension = AnyExtension> {
|
2974 | /**
|
2975 | * The extensions property.
|
2976 | */
|
2977 | readonly extensions: readonly Extension[];
|
2978 | }
|
2979 | export { ExtensionListProps }
|
2980 | export { ExtensionListProps as ExtensionListProps_alias_1 }
|
2981 | export { ExtensionListProps as ExtensionListProps_alias_2 }
|
2982 |
|
2983 | export { ExtensionPriority }
|
2984 |
|
2985 | /**
|
2986 | * The extension store which is shared across all extensions. It provides access
|
2987 | * to methods and data that can be used throughout the extension lifecycle.
|
2988 | */
|
2989 | declare interface ExtensionStore extends Remirror.ExtensionStore {
|
2990 | }
|
2991 | export { ExtensionStore }
|
2992 | export { ExtensionStore as ExtensionStore_alias_1 }
|
2993 |
|
2994 | export { ExtensionTag }
|
2995 |
|
2996 | export { ExtensionTagType }
|
2997 |
|
2998 | /**
|
2999 | * A function that returns the extension to be used in the RemirrorManager. This
|
3000 | * is similar to a preset function except that it takes no arguments.
|
3001 | *
|
3002 | * ```ts
|
3003 | * import { RemirrorManager } from 'remirror';
|
3004 | * import { BoldExtension, ItalicExtension } from 'remirror/extensions';
|
3005 | *
|
3006 | * const template = () => [new BoldExtension(), new ItalicExtension()]
|
3007 | * const manager = RemirrorManager.create(template);
|
3008 | * ```
|
3009 | *
|
3010 | * If the template is mixed in with other manager creators it will add the
|
3011 | * relevant extension provided.
|
3012 | */
|
3013 | declare type ExtensionTemplate<Extension extends AnyExtension> = () => Extension[];
|
3014 | export { ExtensionTemplate }
|
3015 | export { ExtensionTemplate as ExtensionTemplate_alias_1 }
|
3016 |
|
3017 | /**
|
3018 | * This is the object shape that is returned from the combined transformation.
|
3019 | */
|
3020 | export declare interface ExtensionTransformation<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> {
|
3021 | /**
|
3022 | * The list of extensions sorted by priority and original extension. Every
|
3023 | * extension passed in and those contained by presets are placed here.
|
3024 | */
|
3025 | extensions: Expanded[];
|
3026 | /**
|
3027 | * A map where the key is the [[`ExtensionConstructor`]] and the value is the
|
3028 | * [[`Extension`]] instance. This is used to lookup extensions contained
|
3029 | * within a manager. It is a weak map so that values can be garbage collected
|
3030 | * when references to the constructor are lost.
|
3031 | */
|
3032 | extensionMap: WeakMap<GetConstructor<Expanded>, Expanded>;
|
3033 | }
|
3034 |
|
3035 | /**
|
3036 | * This helper function extracts all the lifecycle methods from the provided
|
3037 | * extension and adds them to the provided `handler` container.
|
3038 | */
|
3039 | export declare function extractLifecycleMethods(props: SetupExtensionProps): void;
|
3040 |
|
3041 | export { extractPixelSize }
|
3042 |
|
3043 | declare interface FileUploader<NodeAttributes> {
|
3044 | /**
|
3045 | * Inserts the file (but doesn't start the upload operation) and returns an
|
3046 | * object with this to be uploaded file's attributes.
|
3047 | */
|
3048 | insert: (file: File) => NodeAttributes;
|
3049 | /**
|
3050 | * Starts the upload operation and returns a promise. The promise will be
|
3051 | * resolved by a successful upload with uploaded file's attributes, or rejected
|
3052 | * because of an error.
|
3053 | *
|
3054 | * `upload` can update the object `context` to update information during
|
3055 | * the upload process. `context` will be passed to the render function. The
|
3056 | * render function can add a listener to `context` by using `context.addListener`
|
3057 | * to get the updated values. The default render function will try to find the
|
3058 | * keys `loaded` and `total` in `context`, which are two numbers that
|
3059 | * represent the progress of the upload.
|
3060 | */
|
3061 | upload: (context: UploadContext) => Promise<NodeAttributes>;
|
3062 | /**
|
3063 | * Aborts the upload operation.
|
3064 | */
|
3065 | abort: () => void;
|
3066 | }
|
3067 | export { FileUploader }
|
3068 | export { FileUploader as FileUploader_alias_1 }
|
3069 | export { FileUploader as FileUploader_alias_2 }
|
3070 | export { FileUploader as FileUploader_alias_3 }
|
3071 |
|
3072 | export { findBlockNodes }
|
3073 |
|
3074 | export { findChildren }
|
3075 |
|
3076 | export { findChildrenByAttribute }
|
3077 |
|
3078 | export { findChildrenByMark }
|
3079 |
|
3080 | export { findChildrenByNode }
|
3081 |
|
3082 | export { findElementAtPosition }
|
3083 |
|
3084 | export { findInlineNodes }
|
3085 |
|
3086 | export { findMatches }
|
3087 |
|
3088 | export { findNodeAtPosition }
|
3089 |
|
3090 | export { findNodeAtSelection }
|
3091 |
|
3092 | export { findParentNode }
|
3093 |
|
3094 | export { findParentNodeOfType }
|
3095 |
|
3096 | export { findPositionOfNodeAfter }
|
3097 |
|
3098 | export { findPositionOfNodeBefore }
|
3099 |
|
3100 | export { FindProsemirrorNodeResult }
|
3101 |
|
3102 | export { findSelectedNodeOfType }
|
3103 |
|
3104 | export { findTextNodes }
|
3105 |
|
3106 | declare function findUploadPlaceholderPayload(state: EditorState_2, id: string): any | undefined;
|
3107 | export { findUploadPlaceholderPayload }
|
3108 | export { findUploadPlaceholderPayload as findUploadPlaceholderPayload_alias_1 }
|
3109 | export { findUploadPlaceholderPayload as findUploadPlaceholderPayload_alias_2 }
|
3110 | export { findUploadPlaceholderPayload as findUploadPlaceholderPayload_alias_3 }
|
3111 |
|
3112 | /**
|
3113 | * Try to find the position of the placeholder in the document based on the
|
3114 | * upload placeholder id
|
3115 | *
|
3116 | * @remarks
|
3117 | *
|
3118 | * This function will first try to find the position based on the decoration set.
|
3119 | * However, in some cases (e.g. `ReplaceStep`) the decoration will not be
|
3120 | * available. In that case, it will then try to find every node in the document
|
3121 | * recursively, which is much slower than the decoration set way in a large
|
3122 | * document.
|
3123 | */
|
3124 | declare function findUploadPlaceholderPos(state: EditorState_2, id: string): number | undefined;
|
3125 | export { findUploadPlaceholderPos }
|
3126 | export { findUploadPlaceholderPos as findUploadPlaceholderPos_alias_1 }
|
3127 | export { findUploadPlaceholderPos as findUploadPlaceholderPos_alias_2 }
|
3128 | export { findUploadPlaceholderPos as findUploadPlaceholderPos_alias_3 }
|
3129 |
|
3130 | export { FixedLengthArray }
|
3131 |
|
3132 | export { flattenArray }
|
3133 |
|
3134 | export { Flavor }
|
3135 |
|
3136 | export { Flavoring }
|
3137 |
|
3138 | export { FlipPartialAndRequired }
|
3139 |
|
3140 | /**
|
3141 | * The type of arguments acceptable for the focus parameter.
|
3142 | *
|
3143 | * - Can be a prosemirror selection
|
3144 | * - A range of `{ from: number; to: number }`
|
3145 | * - A single position with a `number`
|
3146 | * - A string of `'start' | 'end'`
|
3147 | * - `true` which sets the focus to the current position or start.
|
3148 | */
|
3149 | declare type FocusType = PrimitiveSelection | boolean;
|
3150 | export { FocusType }
|
3151 | export { FocusType as FocusType_alias_1 }
|
3152 |
|
3153 | /**
|
3154 | * Provides the list of Prosemirror EditorView props that should be updated/
|
3155 | */
|
3156 | declare type ForcedUpdateMeta = UpdatableViewProps[];
|
3157 | export { ForcedUpdateMeta }
|
3158 | export { ForcedUpdateMeta as ForcedUpdateMeta_alias_1 }
|
3159 | export { ForcedUpdateMeta as ForcedUpdateMeta_alias_2 }
|
3160 |
|
3161 | export { format }
|
3162 |
|
3163 | export { Fragment }
|
3164 |
|
3165 | export { FragmentStringHandlerOptions }
|
3166 |
|
3167 | /**
|
3168 | * This is the `Framework` class which is used to create an abstract class for
|
3169 | * implementing `Remirror` into the framework of your choice.
|
3170 | *
|
3171 | * The best way to learn how to use it is to take a look at the [[`DomFramework`]]
|
3172 | * and [[`ReactFramework`]] implementations.
|
3173 | *
|
3174 | * @remarks
|
3175 | *
|
3176 | * There are two methods and one getter property which must be implemented for this
|
3177 | */
|
3178 | declare abstract class Framework<Extension extends AnyExtension = BuiltinPreset, Props extends FrameworkProps<Extension> = FrameworkProps<Extension>, Output extends FrameworkOutput<Extension> = FrameworkOutput<Extension>> implements BaseFramework<Extension> {
|
3179 | #private;
|
3180 | /**
|
3181 | * A previous state that can be overridden by the framework implementation.
|
3182 | */
|
3183 | protected previousStateOverride?: EditorState;
|
3184 | /**
|
3185 | * The event listener which allows consumers to subscribe to the different
|
3186 | * events taking place in the editor. Events currently supported are:
|
3187 | *
|
3188 | * - `destroy`
|
3189 | * - `focus`
|
3190 | * - `blur`
|
3191 | * - `updated`
|
3192 | */
|
3193 | protected get addHandler(): AddFrameworkHandler<Extension>;
|
3194 | /**
|
3195 | * The updatable view props.
|
3196 | */
|
3197 | protected get updatableViewProps(): UpdatableViewPropsObject;
|
3198 | /**
|
3199 | * True when this is the first render of the editor.
|
3200 | */
|
3201 | protected get firstRender(): boolean;
|
3202 | /**
|
3203 | * Store the name of the framework.
|
3204 | */
|
3205 | abstract get name(): string;
|
3206 | /**
|
3207 | * The props passed in when creating or updating the `Framework` instance.
|
3208 | */
|
3209 | get props(): Props;
|
3210 | /**
|
3211 | * Returns the previous editor state. On the first render it defaults to
|
3212 | * returning the current state. For the first render the previous state and
|
3213 | * current state will always be equal.
|
3214 | */
|
3215 | protected get previousState(): EditorState;
|
3216 | /**
|
3217 | * The instance of the [[`RemirrorManager`]].
|
3218 | */
|
3219 | protected get manager(): RemirrorManager<Extension>;
|
3220 | /**
|
3221 | * The ProseMirror [[`EditorView`]].
|
3222 | */
|
3223 | protected get view(): EditorView;
|
3224 | /**
|
3225 | * A unique id for the editor. Can be used to differentiate between editors.
|
3226 | *
|
3227 | * Please note that this ID is only locally unique, it should not be used as a
|
3228 | * database key.
|
3229 | */
|
3230 | protected get uid(): string;
|
3231 | /**
|
3232 | * The initial editor state from when the editor was first created.
|
3233 | */
|
3234 | get initialEditorState(): EditorState;
|
3235 | constructor(options: FrameworkOptions<Extension, Props>);
|
3236 | /**
|
3237 | * Setup the manager event listeners which are disposed of when the manager is
|
3238 | * destroyed.
|
3239 | */
|
3240 | private updateListener;
|
3241 | /**
|
3242 | * Update the constructor props passed in. Useful for frameworks like react
|
3243 | * where props are constantly changing and when using hooks function closures
|
3244 | * can become stale.
|
3245 | *
|
3246 | * You can call the update method with the new `props` to update the internal
|
3247 | * state of this instance.
|
3248 | */
|
3249 | update(options: FrameworkOptions<Extension, Props>): this;
|
3250 | /**
|
3251 | * Retrieve the editor state.
|
3252 | */
|
3253 | protected readonly getState: () => EditorState;
|
3254 | /**
|
3255 | * Retrieve the previous editor state.
|
3256 | */
|
3257 | protected readonly getPreviousState: () => EditorState;
|
3258 | /**
|
3259 | * This method must be implement by the extending framework class. It returns
|
3260 | * an [[`EditorView`]] which is added to the [[`RemirrorManager`]].
|
3261 | */
|
3262 | protected abstract createView(state: EditorState, element?: Element): EditorView;
|
3263 | /**
|
3264 | * This is used to implement how the state updates are used within your
|
3265 | * application instance.
|
3266 | *
|
3267 | * It must be implemented.
|
3268 | */
|
3269 | protected abstract updateState(props: UpdateStateProps): void;
|
3270 | /**
|
3271 | * Update the view props.
|
3272 | */
|
3273 | protected updateViewProps(...keys: UpdatableViewProps[]): void;
|
3274 | /**
|
3275 | * This sets the attributes for the ProseMirror Dom node.
|
3276 | */
|
3277 | protected getAttributes(ssr?: false): Record<string, string>;
|
3278 | protected getAttributes(ssr: true): Shape;
|
3279 | /**
|
3280 | * Part of the Prosemirror API and is called whenever there is state change in
|
3281 | * the editor.
|
3282 | *
|
3283 | * @internalremarks
|
3284 | * How does it work when transactions are dispatched one after the other.
|
3285 | */
|
3286 | protected readonly dispatchTransaction: (tr: Transaction) => void;
|
3287 | /**
|
3288 | * Adds `onBlur` and `onFocus` listeners.
|
3289 | *
|
3290 | * When extending this class make sure to call this method once
|
3291 | * `ProsemirrorView` has been added to the dom.
|
3292 | */
|
3293 | protected addFocusListeners(): void;
|
3294 | /**
|
3295 | * Remove `onBlur` and `onFocus` listeners.
|
3296 | *
|
3297 | * When extending this class in your framework, make sure to call this just
|
3298 | * before the view is destroyed.
|
3299 | */
|
3300 | protected removeFocusListeners(): void;
|
3301 | /**
|
3302 | * Called when the component unmounts and is responsible for cleanup.
|
3303 | *
|
3304 | * @remarks
|
3305 | *
|
3306 | * - Removes listeners for the editor `blur` and `focus` events
|
3307 | */
|
3308 | destroy(): void;
|
3309 | /**
|
3310 | * Use this method in the `onUpdate` event to run all change handlers.
|
3311 | */
|
3312 | readonly onChange: (props?: ListenerProps) => void;
|
3313 | /**
|
3314 | * Listener for editor 'blur' events
|
3315 | */
|
3316 | private readonly onBlur;
|
3317 | /**
|
3318 | * Listener for editor 'focus' events
|
3319 | */
|
3320 | private readonly onFocus;
|
3321 | /**
|
3322 | * Sets the content of the editor. This bypasses the update function.
|
3323 | *
|
3324 | * @param content
|
3325 | * @param triggerChange
|
3326 | */
|
3327 | private readonly setContent;
|
3328 | /**
|
3329 | * Clear the content of the editor (reset to the default empty node).
|
3330 | *
|
3331 | * @param triggerChange - whether to notify the onChange handler that the
|
3332 | * content has been reset
|
3333 | */
|
3334 | private readonly clearContent;
|
3335 | /**
|
3336 | * Creates the props passed into all event listener handlers. e.g.
|
3337 | * `onChange`
|
3338 | */
|
3339 | protected eventListenerProps(props?: ListenerProps): RemirrorEventListenerProps<Extension>;
|
3340 | protected readonly createStateFromContent: CreateStateFromContent;
|
3341 | /**
|
3342 | * Focus the editor.
|
3343 | */
|
3344 | protected readonly focus: (position?: FocusType) => void;
|
3345 | /**
|
3346 | * Blur the editor.
|
3347 | */
|
3348 | protected readonly blur: (position?: PrimitiveSelection) => void;
|
3349 | /**
|
3350 | * Methods and properties which are made available to all consumers of the
|
3351 | * `Framework` class.
|
3352 | */
|
3353 | protected get baseOutput(): FrameworkOutput<Extension>;
|
3354 | /**
|
3355 | * Every framework implementation must provide it's own custom output.
|
3356 | */
|
3357 | abstract get frameworkOutput(): Output;
|
3358 | }
|
3359 | export { Framework }
|
3360 | export { Framework as Framework_alias_1 }
|
3361 | export { Framework as Framework_alias_2 }
|
3362 |
|
3363 | declare interface FrameworkEvents<Extension extends AnyExtension> extends Pick<ManagerEvents, 'destroy'> {
|
3364 | /**
|
3365 | * An event listener which is called whenever the editor gains focus.
|
3366 | */
|
3367 | focus: (params: RemirrorEventListenerProps<Extension>, event: Event) => void;
|
3368 | /**
|
3369 | * An event listener which is called whenever the editor is blurred.
|
3370 | */
|
3371 | blur: (params: RemirrorEventListenerProps<Extension>, event: Event) => void;
|
3372 | /**
|
3373 | * Called on every state update after the state has been applied to the editor.
|
3374 | *
|
3375 | * This should be used to track the current editor state and check if commands
|
3376 | * are enabled.
|
3377 | */
|
3378 | updated: RemirrorEventListener<Extension>;
|
3379 | }
|
3380 | export { FrameworkEvents }
|
3381 | export { FrameworkEvents as FrameworkEvents_alias_1 }
|
3382 |
|
3383 | declare interface FrameworkOptions<Extension extends AnyExtension, Props extends FrameworkProps<Extension>> {
|
3384 | /**
|
3385 | * The initial editor state
|
3386 | */
|
3387 | initialEditorState: EditorState;
|
3388 | /**
|
3389 | * A method for getting the passed in props.
|
3390 | */
|
3391 | getProps: () => Props;
|
3392 | /**
|
3393 | * When provided the view will immediately be inserted into the dom within
|
3394 | * this element.
|
3395 | */
|
3396 | element?: Element;
|
3397 | }
|
3398 | export { FrameworkOptions }
|
3399 | export { FrameworkOptions as FrameworkOptions_alias_1 }
|
3400 | export { FrameworkOptions as FrameworkOptions_alias_2 }
|
3401 |
|
3402 | /**
|
3403 | * This is the base output that is created by a framework.
|
3404 | */
|
3405 | declare interface FrameworkOutput<Extension extends AnyExtension> extends Remirror.ManagerStore<Extension> {
|
3406 | /**
|
3407 | * The manager which was used to create this editor.
|
3408 | */
|
3409 | manager: RemirrorManager<Extension>;
|
3410 | /**
|
3411 | * Add event handlers to the remirror editor at runtime.
|
3412 | */
|
3413 | addHandler: AddFrameworkHandler<Extension>;
|
3414 | /**
|
3415 | * The unique id for the editor instance.
|
3416 | */
|
3417 | uid: string;
|
3418 | /**
|
3419 | * Clears all editor content.
|
3420 | *
|
3421 | * @param options - includes a `triggerChange` handler which should be
|
3422 | * triggered by the update.
|
3423 | *
|
3424 | * To use this in a controlled editor, you must set `triggerChange` to `true`.
|
3425 | */
|
3426 | clearContent: (options?: TriggerChangeProps) => void;
|
3427 | /**
|
3428 | * Replace all editor content with the new content.
|
3429 | *
|
3430 | * @remarks
|
3431 | *
|
3432 | * Allows for the editor content to be overridden by force.
|
3433 | *
|
3434 | * @param triggerOnChange - whether the `onChange` handler should be triggered
|
3435 | * by the update. Defaults to `false`.
|
3436 | *
|
3437 | * To use this in a controlled editor, you must set `triggerChange` to `true`.
|
3438 | */
|
3439 | setContent: (content: RemirrorContentType, options?: TriggerChangeProps) => void;
|
3440 | /**
|
3441 | * A getter function for the current editor state. It's a wrapper around
|
3442 | * `view.state`.
|
3443 | */
|
3444 | getState: () => EditorState;
|
3445 | /**
|
3446 | * A getter function for the previous prosemirror editor state. It can be used
|
3447 | * to check what's changed between states.
|
3448 | */
|
3449 | getPreviousState: () => EditorState;
|
3450 | /**
|
3451 | * Get an extension by it's constructor.
|
3452 | */
|
3453 | getExtension: <ExtensionConstructor extends AnyExtensionConstructor>(Constructor: ExtensionConstructor) => InstanceType<ExtensionConstructor>;
|
3454 | /**
|
3455 | * Assert if an extension is present by it's constructor.
|
3456 | */
|
3457 | hasExtension: <ExtensionConstructor extends AnyExtensionConstructor>(Constructor: ExtensionConstructor) => boolean;
|
3458 | /**
|
3459 | * Focus the editor at the `start` | `end` a specific position or at a valid
|
3460 | * range between `{ from, to }`.
|
3461 | *
|
3462 | * @deprecated This method may be removed in the future and it is advisable to
|
3463 | * use `commands.focus()`.
|
3464 | */
|
3465 | focus: (position?: FocusType) => void;
|
3466 | /**
|
3467 | * Blur the editor.
|
3468 | *
|
3469 | * @deprecated This method may be removed in the future and it is advisable to
|
3470 | * use `commands.blur()`.
|
3471 | */
|
3472 | blur: (position?: PrimitiveSelection) => void;
|
3473 | }
|
3474 | export { FrameworkOutput }
|
3475 | export { FrameworkOutput as FrameworkOutput_alias_1 }
|
3476 | export { FrameworkOutput as FrameworkOutput_alias_2 }
|
3477 |
|
3478 | /**
|
3479 | * The base options for an editor wrapper. This is used within the react and dom
|
3480 | * implementations.
|
3481 | */
|
3482 | declare interface FrameworkProps<Extension extends AnyExtension> {
|
3483 | /**
|
3484 | * Pass in the extension manager.
|
3485 | *
|
3486 | * The manager is responsible for handling all Prosemirror related
|
3487 | * functionality.
|
3488 | */
|
3489 | manager: RemirrorManager<Extension>;
|
3490 | /**
|
3491 | * Set the starting value for the editor.
|
3492 | *
|
3493 | * Without setting the value prop `onChange` remirror renders as an uncontrolled
|
3494 | * component. Value changes are passed back out of the editor and there is now
|
3495 | * way to set the value via props. As a result this is the only opportunity to
|
3496 | * directly control the rendered text.
|
3497 | *
|
3498 | * @defaultValue `{ type: 'doc', content: [{ type: 'paragraph' }] }`
|
3499 | */
|
3500 | initialContent?: RemirrorContentType | [RemirrorContentType, PrimitiveSelection];
|
3501 | /**
|
3502 | * Adds attributes directly to the prosemirror element.
|
3503 | *
|
3504 | * @defaultValue {}
|
3505 | */
|
3506 | attributes?: Record<string, string> | AttributePropFunction<Extension>;
|
3507 | /**
|
3508 | * Additional classes which can be passed into the the editor wrapper. These
|
3509 | * are placed on root `Prosemirror` element and can be used to effect styling
|
3510 | * within the editor.
|
3511 | */
|
3512 | classNames?: ClassName[];
|
3513 | /**
|
3514 | * Determines whether this editor is editable or not.
|
3515 | *
|
3516 | * @defaultValue true
|
3517 | */
|
3518 | editable?: boolean;
|
3519 | /**
|
3520 | * When set to true focus will be place on the editor as soon as it first
|
3521 | * loads.
|
3522 | *
|
3523 | * @defaultValue false
|
3524 | */
|
3525 | autoFocus?: FocusType;
|
3526 | /**
|
3527 | * An event listener which is called whenever the editor gains focus.
|
3528 | */
|
3529 | onFocus?: (params: RemirrorEventListenerProps<Extension>, event: Event) => void;
|
3530 | /**
|
3531 | * An event listener which is called whenever the editor is blurred.
|
3532 | */
|
3533 | onBlur?: (params: RemirrorEventListenerProps<Extension>, event: Event) => void;
|
3534 | /**
|
3535 | * Called on every change to the Prosemirror state.
|
3536 | */
|
3537 | onChange?: RemirrorEventListener<Extension>;
|
3538 | /**
|
3539 | * A method called when the editor is dispatching the transaction.
|
3540 | *
|
3541 | * @remarks
|
3542 | * Use this to update the transaction which will be used to update the editor
|
3543 | * state.
|
3544 | */
|
3545 | onDispatchTransaction?: TransactionTransformer;
|
3546 | /**
|
3547 | * Sets the accessibility label for the editor instance.
|
3548 | *
|
3549 | * @defaultValue ''
|
3550 | */
|
3551 | label?: string;
|
3552 | }
|
3553 | export { FrameworkProps }
|
3554 | export { FrameworkProps as FrameworkProps_alias_1 }
|
3555 | export { FrameworkProps as FrameworkProps_alias_2 }
|
3556 |
|
3557 | export { freeze }
|
3558 |
|
3559 | export { FromToProps }
|
3560 |
|
3561 | declare const GENERAL_OPTIONS: "__ALL__";
|
3562 |
|
3563 | export { Get }
|
3564 |
|
3565 | export { get }
|
3566 |
|
3567 | export { GetAcceptUndefined }
|
3568 |
|
3569 | export { getActiveNode }
|
3570 |
|
3571 | export { GetAttributes }
|
3572 |
|
3573 | export { GetAttributesProps }
|
3574 |
|
3575 | export { getChangedNodeRanges }
|
3576 |
|
3577 | export { getChangedNodes }
|
3578 |
|
3579 | /**
|
3580 | * Get the property changes and the next value from an update.
|
3581 | */
|
3582 | export declare function getChangedOptions<Options extends ValidOptions>(props: GetChangedOptionsProps<Options>): GetChangeOptionsReturn<Options>;
|
3583 |
|
3584 | export declare interface GetChangedOptionsProps<Options extends ValidOptions> {
|
3585 | /**
|
3586 | * The previous readonly properties object.
|
3587 | */
|
3588 | previousOptions: GetFixedDynamic<Options>;
|
3589 | /**
|
3590 | * The partial update object that was passed through.
|
3591 | */
|
3592 | update: GetPartialDynamic<Options>;
|
3593 | /**
|
3594 | * A method to check whether two values are equal.
|
3595 | */
|
3596 | equals?: (valueA: unknown, valueB: unknown) => boolean;
|
3597 | }
|
3598 |
|
3599 | export { getChangedRanges }
|
3600 |
|
3601 | declare interface GetChangeOptionsReturn<Options extends ValidOptions> {
|
3602 | /**
|
3603 | * The next value of the properties after the update.This also includes values
|
3604 | * which have not been changed.
|
3605 | */
|
3606 | options: GetFixedDynamic<Options>;
|
3607 | /**
|
3608 | * An object with all the keys showing what's been changed. This should be
|
3609 | * used to determine the children extensions which should be updated.
|
3610 | *
|
3611 | * @remarks
|
3612 | *
|
3613 | * Using this can prevent unnecessary updates. It's possible for new
|
3614 | * properties to be passed that are identical to the previous, by checking if
|
3615 | * the object was changed this can be avoided.
|
3616 | *
|
3617 | * This uses a discriminated union. When the `changed` property is true then
|
3618 | * the object has a value as well.
|
3619 | *
|
3620 | * ```ts
|
3621 | * if (changes.myProperty.changed) {
|
3622 | * doSomething(changes.myProperty.value);
|
3623 | * }
|
3624 | * ```
|
3625 | */
|
3626 | changes: Readonly<Required<ChangedOptions<Options>>>;
|
3627 | /**
|
3628 | * Pick the changed values by their key. An object populated with only the
|
3629 | * changed items will be returned to you.
|
3630 | */
|
3631 | pickChanged: PickChanged<Options>;
|
3632 | }
|
3633 | export { GetChangeOptionsReturn }
|
3634 | export { GetChangeOptionsReturn as GetChangeOptionsReturn_alias_1 }
|
3635 |
|
3636 | /**
|
3637 | * Get the commands from a `RemirrorManager`, `Extension` or `Preset`.
|
3638 | */
|
3639 | declare type GetCommands<Type extends {
|
3640 | ['~C']: unknown;
|
3641 | }> = Type['~C'];
|
3642 | export { GetCommands }
|
3643 | export { GetCommands as GetCommands_alias_1 }
|
3644 |
|
3645 | /**
|
3646 | * Get the constructor of an instance.
|
3647 | */
|
3648 | declare type GetConstructor<Type extends {
|
3649 | constructor: unknown;
|
3650 | }> = Type['constructor'];
|
3651 | export { GetConstructor }
|
3652 | export { GetConstructor as GetConstructor_alias_1 }
|
3653 |
|
3654 | export { GetConstructorProps }
|
3655 |
|
3656 | export { getCursor }
|
3657 |
|
3658 | export { GetCustomHandler }
|
3659 |
|
3660 | /**
|
3661 | * This uses a hack available via conditional types and `Distributive
|
3662 | * conditional types`. When a conditional is used on a union it distributes the
|
3663 | * types so that the union can avoid the case where:
|
3664 | *
|
3665 | * > access is restricted to members that are common to all types in the union
|
3666 | *
|
3667 | * A better explanation is available here
|
3668 | * https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types
|
3669 | */
|
3670 | declare type GetDecoratedCommands<Type> = Type extends AnyExtension ? ConditionalPick<Type, AnyFunction<CommandFunction>> : never;
|
3671 |
|
3672 | declare type GetDecoratedHelpers<Type> = Type extends object ? RemoveHelpers<ConditionalReturnPick<Type, HelperAnnotation>> : never;
|
3673 |
|
3674 | declare type GetDecoratedUiCommands<Type> = Type extends AnyExtension ? ConditionalPick<Type, AnyFunction<UiCommandFunction>> : never;
|
3675 |
|
3676 | export { getDefaultBlockNode }
|
3677 |
|
3678 | export { getDefaultDocNode }
|
3679 |
|
3680 | export { getDocRange }
|
3681 |
|
3682 | export { getDocument }
|
3683 |
|
3684 | export { GetDynamic }
|
3685 |
|
3686 | /**
|
3687 | * Get the extension type and the extension type of all sub extensions.
|
3688 | *
|
3689 | * This uses recursive conditional types which are only available in
|
3690 | * `typescript@4.1` https://github.com/microsoft/TypeScript/pull/40002
|
3691 | *
|
3692 | * @typeParam Extension - The union of extensions.
|
3693 | */
|
3694 | declare type GetExtensions<Extension> = AnyExtension extends Extension ? AnyExtension : Extension extends AnyExtension ? // Now create the union of the provided extension and it's recursively
|
3695 | Extension | GetExtensions<Extension['~E']> : AnyExtension;
|
3696 | export { GetExtensions }
|
3697 | export { GetExtensions as GetExtensions_alias_1 }
|
3698 | export { GetExtensions as GetExtensions_alias_2 }
|
3699 |
|
3700 | export { GetFixed }
|
3701 |
|
3702 | export { GetFixedCustomHandler }
|
3703 |
|
3704 | export { GetFixedDynamic }
|
3705 |
|
3706 | export { GetFixedProps }
|
3707 |
|
3708 | export { GetFixedStatic }
|
3709 |
|
3710 | export { GetFlippedStatic }
|
3711 |
|
3712 | export { getFontSize }
|
3713 |
|
3714 | export { GetHandler }
|
3715 |
|
3716 | /**
|
3717 | * Get the helpers provided by an from a `RemirrorManager`, `Extension` or
|
3718 | * `Preset`.
|
3719 | */
|
3720 | declare type GetHelpers<Type extends {
|
3721 | ['~H']: unknown;
|
3722 | }> = Type['~H'];
|
3723 | export { GetHelpers }
|
3724 | export { GetHelpers as GetHelpers_alias_1 }
|
3725 |
|
3726 | export { getInvalidContent }
|
3727 |
|
3728 | export { getLazyArray }
|
3729 |
|
3730 | export { GetMappedCustomHandler }
|
3731 |
|
3732 | export { GetMappedHandler }
|
3733 |
|
3734 | export { getMarkAttributes }
|
3735 |
|
3736 | /**
|
3737 | * A utility type for retrieving the name of an extension only when it's a mark
|
3738 | * extension.
|
3739 | *
|
3740 | * @typeParam Extension - the extensions being used within the editor
|
3741 | * @typeParam Expanded - auto generated from `Extension`. These are the
|
3742 | * fully expanded extensions with all sub extensions automatically provided. You
|
3743 | * never need to provide this type as it is automatically calculated.
|
3744 | */
|
3745 | declare type GetMarkNameUnion<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = Expanded extends AnyMarkExtension ? Expanded['name'] : never;
|
3746 | export { GetMarkNameUnion }
|
3747 | export { GetMarkNameUnion as GetMarkNameUnion_alias_1 }
|
3748 | export { GetMarkNameUnion as GetMarkNameUnion_alias_2 }
|
3749 |
|
3750 | export { GetMarkRange }
|
3751 |
|
3752 | export { getMarkRange }
|
3753 |
|
3754 | export { getMarkRanges }
|
3755 |
|
3756 | export { getMarkType }
|
3757 |
|
3758 | export { getMatchString }
|
3759 |
|
3760 | /**
|
3761 | * Get the names of all available extensions.
|
3762 | */
|
3763 | declare type GetNameUnion<Extension extends AnyExtension> = GetExtensions<Extension>['name'];
|
3764 | export { GetNameUnion }
|
3765 | export { GetNameUnion as GetNameUnion_alias_1 }
|
3766 | export { GetNameUnion as GetNameUnion_alias_2 }
|
3767 |
|
3768 | /**
|
3769 | * A utility type for retrieving the name of an extension only when it's a node
|
3770 | * extension.
|
3771 | *
|
3772 | * @typeParam Extension - the extensions being used within the editor
|
3773 | * @typeParam Expanded - auto generated from `Extension`. These are the
|
3774 | * fully expanded extensions with all sub extensions automatically provided. You
|
3775 | * never need to provide this type as it is automatically calculated.
|
3776 | */
|
3777 | declare type GetNodeNameUnion<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = Expanded extends AnyNodeExtension ? Expanded['name'] : never;
|
3778 | export { GetNodeNameUnion }
|
3779 | export { GetNodeNameUnion as GetNodeNameUnion_alias_1 }
|
3780 | export { GetNodeNameUnion as GetNodeNameUnion_alias_2 }
|
3781 |
|
3782 | export { getNodeType }
|
3783 |
|
3784 | /**
|
3785 | * Get the static extension settings.
|
3786 | */
|
3787 | declare type GetOptions<Type extends {
|
3788 | ['~O']: unknown;
|
3789 | }> = Type['~O'];
|
3790 | export { GetOptions }
|
3791 | export { GetOptions as GetOptions_alias_1 }
|
3792 |
|
3793 | export { GetPartialDynamic }
|
3794 |
|
3795 | /**
|
3796 | * A utility type for retrieving the name of an extension only when it's a plain
|
3797 | * extension.
|
3798 | *
|
3799 | * @typeParam Extension - the extensions being used within the editor
|
3800 | * @typeParam Expanded - auto generated from `Extension`. These are the
|
3801 | * fully expanded extensions with all sub extensions automatically provided. You
|
3802 | * never need to provide this type as it is automatically calculated.
|
3803 | */
|
3804 | declare type GetPlainNameUnion<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = Expanded extends AnyPlainExtension ? Expanded['name'] : never;
|
3805 | export { GetPlainNameUnion }
|
3806 | export { GetPlainNameUnion as GetPlainNameUnion_alias_1 }
|
3807 | export { GetPlainNameUnion as GetPlainNameUnion_alias_2 }
|
3808 |
|
3809 | export { getRemirrorJSON }
|
3810 |
|
3811 | export { GetRequiredKeys }
|
3812 |
|
3813 | export { getSelectedGroup }
|
3814 |
|
3815 | export { getSelectedWord }
|
3816 |
|
3817 | export { getShortcutSymbols }
|
3818 |
|
3819 | export { GetStatic }
|
3820 |
|
3821 | export { GetStaticAndDynamic }
|
3822 |
|
3823 | export { getStyle }
|
3824 |
|
3825 | export { getTextContentFromSlice }
|
3826 |
|
3827 | declare interface GetTextHelperOptions extends Partial<EditorStateProps> {
|
3828 | /**
|
3829 | * The divider used to separate text blocks.
|
3830 | *
|
3831 | * @defaultValue '\n\n'
|
3832 | */
|
3833 | lineBreakDivider?: string;
|
3834 | }
|
3835 |
|
3836 | export { getTextSelection }
|
3837 |
|
3838 | /**
|
3839 | * Shortcuts used within google docs.
|
3840 | */
|
3841 | declare const GOOGLE_DOC_SHORTCUTS: ShortcutMap;
|
3842 | export { GOOGLE_DOC_SHORTCUTS }
|
3843 | export { GOOGLE_DOC_SHORTCUTS as GOOGLE_DOC_SHORTCUTS_alias_1 }
|
3844 | export { GOOGLE_DOC_SHORTCUTS as GOOGLE_DOC_SHORTCUTS_alias_2 }
|
3845 |
|
3846 | export { Handler }
|
3847 |
|
3848 | export { HandlerKey }
|
3849 |
|
3850 | export { HandlerKeyList }
|
3851 |
|
3852 | declare interface HandlerKeyOptions<ReturnType = any, Args extends any[] = any[]> {
|
3853 | /**
|
3854 | * When this value is encountered the handler will exit early.
|
3855 | *
|
3856 | * Set the value to `'__IGNORE__'` to ignore the early return value.
|
3857 | */
|
3858 | earlyReturnValue?: LiteralUnion<typeof IGNORE, Primitive> | ((value: unknown) => boolean);
|
3859 | /**
|
3860 | * Allows combining the values from the handlers together to produce a single
|
3861 | * reduced output value.
|
3862 | */
|
3863 | reducer?: {
|
3864 | /**
|
3865 | * Combine the value with the the previous value
|
3866 | */
|
3867 | accumulator: (accumulated: ReturnType, latestValue: ReturnType, ...args: Args) => ReturnType;
|
3868 | /**
|
3869 | * The a function that returns the default value for combined handler
|
3870 | * values. This is required for setting up a default value.
|
3871 | */
|
3872 | getDefault: (...args: Args) => ReturnType;
|
3873 | };
|
3874 | }
|
3875 | export { HandlerKeyOptions }
|
3876 | export { HandlerKeyOptions as HandlerKeyOptions_alias_1 }
|
3877 |
|
3878 | /**
|
3879 | * This notifies the extension which options are handlers. Handlers typically
|
3880 | * represent event handlers that are called in response to something happening.
|
3881 | *
|
3882 | * An `onChange` option could be a handler. When designing the API I had to
|
3883 | * consider that often times, you might want to listen to a handler in several
|
3884 | * places.
|
3885 | *
|
3886 | * A limitation of the static and dynamic options is that there is only one
|
3887 | * value per extension. So if there is a `minValue` option and that min value
|
3888 | * option is set in the extension then it becomes the value for all consumers of
|
3889 | * the extension. Handlers don't have the same expected behaviour. It is
|
3890 | * generally expected that you should be able to subscribe to an event in
|
3891 | * multiple places.
|
3892 | *
|
3893 | * In order to make this possible with `remirror` the handlers are automatically
|
3894 | * created based on the handler keys you provide. Each handler is an array and
|
3895 | * when the handler is called with `this.options.onChange`, each item in the
|
3896 | * array is called based on the rules provided.
|
3897 | */
|
3898 | declare interface HandlerKeysProps<Options extends Shape = EmptyShape> {
|
3899 | /**
|
3900 | * The list of the option names which are event handlers.
|
3901 | */
|
3902 | handlerKeys: HandlerKeyList<Options>;
|
3903 | /**
|
3904 | * Customize how the handler should work.
|
3905 | *
|
3906 | * This allows you to decide how the handlers will be composed together.
|
3907 | * Currently it only support function handlers, but you can tell the extension
|
3908 | * to exit early when a certain return value is received.
|
3909 | *
|
3910 | * ```ts
|
3911 | * const handlerOptions = { onChange: { earlyReturnValue: true }};
|
3912 | * ```
|
3913 | *
|
3914 | * The above setting means that onChange will exit early as soon as one of the
|
3915 | * methods returns true.
|
3916 | */
|
3917 | handlerKeyOptions?: MappedHandlerKeyOptions<Options>;
|
3918 | }
|
3919 |
|
3920 | export { HandlerShape }
|
3921 |
|
3922 | export { hasOwnProperty }
|
3923 |
|
3924 | export { hasTransactionChanged }
|
3925 |
|
3926 | /**
|
3927 | * Determine if there are active file uploads in the given state
|
3928 | *
|
3929 | * @remarks
|
3930 | * This utility is useful to warn users there are still active uploads before
|
3931 | * exiting or saving a document.
|
3932 | *
|
3933 | * @see https://remirror.vercel.app/?path=/story/extensions-file--with-upload-incomplete-warning
|
3934 | *
|
3935 | * @param state - the editor state
|
3936 | */
|
3937 | declare function hasUploadingFile(state: EditorState_2): boolean;
|
3938 | export { hasUploadingFile }
|
3939 | export { hasUploadingFile as hasUploadingFile_alias_1 }
|
3940 | export { hasUploadingFile as hasUploadingFile_alias_2 }
|
3941 | export { hasUploadingFile as hasUploadingFile_alias_3 }
|
3942 |
|
3943 | /**
|
3944 | * An annotation which marks decorated helper methods for an extension.
|
3945 | */
|
3946 | declare type Helper<Type> = Type extends null | undefined ? Type : Type & HelperAnnotation;
|
3947 | export { Helper }
|
3948 | export { Helper as Helper_alias_1 }
|
3949 | export { Helper as Helper_alias_2 }
|
3950 |
|
3951 | /**
|
3952 | * A decorator which can be applied to top level methods on an extension to
|
3953 | * identify them as helpers. This can be used as a replacement for the
|
3954 | * `createHelpers` method.
|
3955 | *
|
3956 | * To allow the TypeScript compiler to automatically infer types, please create
|
3957 | * your methods with the following type signature.
|
3958 | *
|
3959 | * ```ts
|
3960 | * import { Helper } from '@remirror/core';
|
3961 | *
|
3962 | * type Signature = (...args: any[]) => Helper<SomeReturnType>;
|
3963 | * ```
|
3964 | *
|
3965 | * The following is an example of how this can be used within your extension.
|
3966 | *
|
3967 | * ```ts
|
3968 | * import { helper, Helper } from '@remirror/core';
|
3969 | *
|
3970 | * class MyExtension {
|
3971 | * get name() {
|
3972 | * return 'my';
|
3973 | * }
|
3974 | *
|
3975 | * @helper()
|
3976 | * alwaysTrue(): Helper<boolean> {
|
3977 | * return true;
|
3978 | * }
|
3979 | * }
|
3980 | * ```
|
3981 | *
|
3982 | * The above helper can now be used within your editor instance.
|
3983 | *
|
3984 | * ```tsx
|
3985 | * import { useRemirrorContext } from '@remirror/react';
|
3986 | *
|
3987 | * const MyEditorButton = () => {
|
3988 | * const { helpers } = useRemirrorContext();
|
3989 | *
|
3990 | * return helpers.alwaysTrue() ? <button>My Button</button> : null
|
3991 | * }
|
3992 | * ```
|
3993 | *
|
3994 | * @category Method Decorator
|
3995 | */
|
3996 | declare function helper(options?: HelperDecoratorOptions): <Extension extends AnyExtension, Type>(method: AnyFunction<NonNullable<Type> extends HelperAnnotation ? Type : never>, context: ClassMethodDecoratorContext<Extension, (this: Extension, ...args: any) => any>) => AnyFunction<NonNullable<Type> extends HelperAnnotation ? Type : never>;
|
3997 | export { helper }
|
3998 | export { helper as helper_alias_1 }
|
3999 | export { helper as helper_alias_2 }
|
4000 |
|
4001 | declare type HelperAnnotation = Flavoring<'HelperAnnotation'>;
|
4002 | export { HelperAnnotation }
|
4003 | export { HelperAnnotation as HelperAnnotation_alias_1 }
|
4004 | export { HelperAnnotation as HelperAnnotation_alias_2 }
|
4005 |
|
4006 | declare interface HelperDecoratorOptions {
|
4007 | }
|
4008 | export { HelperDecoratorOptions }
|
4009 | export { HelperDecoratorOptions as HelperDecoratorOptions_alias_1 }
|
4010 | export { HelperDecoratorOptions as HelperDecoratorOptions_alias_2 }
|
4011 |
|
4012 | /**
|
4013 | * A function with a return signature annotated as a helper.
|
4014 | */
|
4015 | declare type HelperFunction<Type extends HelperAnnotation = HelperAnnotation> = AnyFunction<Type>;
|
4016 | export { HelperFunction }
|
4017 | export { HelperFunction as HelperFunction_alias_1 }
|
4018 | export { HelperFunction as HelperFunction_alias_2 }
|
4019 |
|
4020 | /**
|
4021 | * Utility type for pulling all the action names from a list
|
4022 | */
|
4023 | declare type HelperNames<Extension extends AnyExtension> = StringKey<HelpersFromExtensions<Extension>>;
|
4024 | export { HelperNames }
|
4025 | export { HelperNames as HelperNames_alias_1 }
|
4026 | export { HelperNames as HelperNames_alias_2 }
|
4027 |
|
4028 | /**
|
4029 | * Helpers are custom methods that can provide extra functionality to the
|
4030 | * editor.
|
4031 | *
|
4032 | * @remarks
|
4033 | *
|
4034 | * They can be used for pulling information from the editor or performing custom
|
4035 | * async commands.
|
4036 | *
|
4037 | * Also provides the default helpers used within the extension.
|
4038 | *
|
4039 | * @category Builtin Extension
|
4040 | */
|
4041 | declare class HelpersExtension extends PlainExtension {
|
4042 | get name(): "helpers";
|
4043 | /**
|
4044 | * Add the `html` and `text` string handlers to the editor.
|
4045 | */
|
4046 | onCreate(): void;
|
4047 | /**
|
4048 | * Check whether the selection is empty.
|
4049 | */
|
4050 | isSelectionEmpty(state?: EditorState): Helper<boolean>;
|
4051 | isViewEditable(state?: EditorState): Helper<boolean>;
|
4052 | /**
|
4053 | * Get the full JSON output for the ProseMirror editor state object.
|
4054 | */
|
4055 | getStateJSON(state?: EditorState): Helper<StateJSON>;
|
4056 | /**
|
4057 | * Get the JSON output for the main ProseMirror `doc` node.
|
4058 | *
|
4059 | * This can be used to persist data between sessions and can be passed as
|
4060 | * content to the `initialContent` prop.
|
4061 | */
|
4062 | getJSON(state?: EditorState): Helper<RemirrorJSON>;
|
4063 | /**
|
4064 | * Insert a html string as a ProseMirror Node.
|
4065 | *
|
4066 | * @category Builtin Command
|
4067 | */
|
4068 | insertHtml(html: string, options?: InsertNodeOptions): CommandFunction;
|
4069 | /**
|
4070 | * A method to get all the content in the editor as text. Depending on the
|
4071 | * content in your editor, it is not guaranteed to preserve it 100%, so it's
|
4072 | * best to test that it meets your needs before consuming.
|
4073 | */
|
4074 | getText({ lineBreakDivider, state, }?: GetTextHelperOptions): Helper<string>;
|
4075 | getTextBetween(from: number, to: number, doc?: ProsemirrorNode): Helper<string>;
|
4076 | /**
|
4077 | * Get the html from the current state, or provide a custom state.
|
4078 | */
|
4079 | getHTML(state?: EditorState): Helper<string>;
|
4080 | /**
|
4081 | * Wrap the content in a pre tag to preserve whitespace and see what the
|
4082 | * editor does with it.
|
4083 | */
|
4084 | private textToProsemirrorNode;
|
4085 | }
|
4086 | export { HelpersExtension }
|
4087 | export { HelpersExtension as HelpersExtension_alias_1 }
|
4088 | export { HelpersExtension as HelpersExtension_alias_2 }
|
4089 |
|
4090 | /**
|
4091 | * Utility type which receives an extension and provides the type of helpers it
|
4092 | * makes available.
|
4093 | *
|
4094 | * @typeParam Extension - the extensions being used within the editor
|
4095 | * @typeParam Expanded - auto generated from `Extension`. These are the
|
4096 | * fully expanded extensions with all sub extensions automatically provided. You
|
4097 | * never need to provide this type as it is automatically calculated.
|
4098 | */
|
4099 | declare type HelpersFromExtensions<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = UnionToIntersection<MapHelpers<GetHelpers<Expanded> | GetDecoratedHelpers<Expanded>>>;
|
4100 | export { HelpersFromExtensions }
|
4101 | export { HelpersFromExtensions as HelpersFromExtensions_alias_1 }
|
4102 | export { HelpersFromExtensions as HelpersFromExtensions_alias_2 }
|
4103 |
|
4104 | export { htmlToProsemirrorNode }
|
4105 |
|
4106 | export { I18nFormatter }
|
4107 |
|
4108 | /**
|
4109 | * The extra identifiers that can be used.
|
4110 | *
|
4111 | * - `nodes` - match all nodes
|
4112 | * - `marks` - match all marks
|
4113 | * - `all` - match everything in the editor
|
4114 | * - `string[]` - match the selected node and mark names
|
4115 | * - [[`IdentifiersObject`]] - match by `ExtensionTag` and type name.
|
4116 | */
|
4117 | declare type Identifiers = 'nodes' | 'marks' | 'all' | readonly string[] | IdentifiersObject;
|
4118 | export { Identifiers }
|
4119 | export { Identifiers as Identifiers_alias_1 }
|
4120 | export { Identifiers as Identifiers_alias_2 }
|
4121 |
|
4122 | /**
|
4123 | * The interface for adding extra attributes to multiple node and mark
|
4124 | * extensions.
|
4125 | */
|
4126 | declare interface IdentifierSchemaAttributes {
|
4127 | /**
|
4128 | * The nodes or marks to add extra attributes to.
|
4129 | *
|
4130 | * This can either be an array of the strings or the following specific
|
4131 | * identifiers:
|
4132 | *
|
4133 | * - 'nodes' for all nodes
|
4134 | * - 'marks' for all marks
|
4135 | * - 'all' for all extensions which touch the schema.
|
4136 | */
|
4137 | identifiers: Identifiers;
|
4138 | /**
|
4139 | * The attributes to be added.
|
4140 | */
|
4141 | attributes: SchemaAttributes;
|
4142 | }
|
4143 | export { IdentifierSchemaAttributes }
|
4144 | export { IdentifierSchemaAttributes as IdentifierSchemaAttributes_alias_1 }
|
4145 | export { IdentifierSchemaAttributes as IdentifierSchemaAttributes_alias_2 }
|
4146 |
|
4147 | /**
|
4148 | * With tags, you can select a specific sub selection of marks and nodes. This
|
4149 | * will be the basis for adding advanced formatting to remirror.
|
4150 | *
|
4151 | * ```ts
|
4152 | * import { ExtensionTag } from 'remirror';
|
4153 | * import { createCoreManager, CorePreset } from 'remirror/extensions';
|
4154 | * import { WysiwygPreset } from 'remirror/extensions';
|
4155 | *
|
4156 | * const manager = createCoreManager(() => [new WysiwygPreset(), new CorePreset()], {
|
4157 | * extraAttributes: [
|
4158 | * {
|
4159 | * identifiers: {
|
4160 | * tags: [ExtensionTag.NodeBlock],
|
4161 | * type: 'node',
|
4162 | * },
|
4163 | * attributes: { role: 'presentation' },
|
4164 | * },
|
4165 | * ],
|
4166 | * });
|
4167 | * ```
|
4168 | *
|
4169 | * Each item in the tags array should be read as an `OR` so the following would
|
4170 | * match `Tag1` OR `Tag2` OR `Tag3`.
|
4171 | *
|
4172 | * ```json
|
4173 | * { tags: ["Tag1", "Tag2", "Tag3"] }
|
4174 | * ```
|
4175 | *
|
4176 | * The `type` property (`mark | node`) is exclusive and limits the type of
|
4177 | * extension names that will be matched. When `mark` is set it only matches with
|
4178 | * marks.
|
4179 | */
|
4180 | declare interface IdentifiersObject {
|
4181 | /**
|
4182 | * Determines how the array of tags are combined:
|
4183 | *
|
4184 | * - `all` - the extension only matches when all tags are present.
|
4185 | * - `any` - the extension will match if it includes any of the specified
|
4186 | * tags.
|
4187 | *
|
4188 | * This only affects the `tags` property.
|
4189 | *
|
4190 | * The saddest part about this property is that, as a UK resident, I've
|
4191 | * succumbed to using the Americanized spelling instead of the Oxford
|
4192 | * Dictionary defined spelling of `behaviour` 😢
|
4193 | *
|
4194 | * @defaultValue 'any'
|
4195 | */
|
4196 | behavior?: 'all' | 'any';
|
4197 | /**
|
4198 | * Will find relevant names based on the defined `behaviour`.
|
4199 | */
|
4200 | tags?: ExtensionTagType[];
|
4201 | /**
|
4202 | * Additional names to include. These will still be added even if the
|
4203 | * extension name matches with `excludeTags` member.
|
4204 | */
|
4205 | names?: string[];
|
4206 | /**
|
4207 | * Whether to restrict by whether this is a [[`ProsemirrorNode`]] or a
|
4208 | * [[`Mark`]]. Leave blank to accept all types.
|
4209 | */
|
4210 | type?: 'node' | 'mark';
|
4211 | /**
|
4212 | * Exclude these names from being matched.
|
4213 | */
|
4214 | excludeNames?: string[];
|
4215 | /**
|
4216 | * Exclude these tags from being matched. Will always exclude if any of the
|
4217 | * tags
|
4218 | */
|
4219 | excludeTags?: string[];
|
4220 | }
|
4221 | export { IdentifiersObject }
|
4222 | export { IdentifiersObject as IdentifiersObject_alias_1 }
|
4223 | export { IdentifiersObject as IdentifiersObject_alias_2 }
|
4224 |
|
4225 | export { IfEmpty }
|
4226 |
|
4227 | export { IfHasRequiredProperties }
|
4228 |
|
4229 | export { IfMatches }
|
4230 |
|
4231 | export { IfNoRequiredProperties }
|
4232 |
|
4233 | declare const IGNORE = "__IGNORE__";
|
4234 |
|
4235 | export { includes }
|
4236 |
|
4237 | export { IndexUnionFromTuple }
|
4238 |
|
4239 | declare interface InlinePlaceholder<Data = any> extends BasePlaceholder, Partial<FromToProps>, DataProps<Data> {
|
4240 | type: 'inline';
|
4241 | }
|
4242 |
|
4243 | export { InputRule }
|
4244 |
|
4245 | /**
|
4246 | * This extension allows others extension to add the `createInputRules` method
|
4247 | * for automatically transforming text when a certain regex pattern is typed.
|
4248 | *
|
4249 | * @remarks
|
4250 | *
|
4251 | * This is an example of adding custom functionality to an extension via the
|
4252 | * `ExtensionParameterMethods`.
|
4253 | *
|
4254 | * @category Builtin Extension
|
4255 | */
|
4256 | declare class InputRulesExtension extends PlainExtension<InputRulesOptions> {
|
4257 | get name(): "inputRules";
|
4258 | /**
|
4259 | * Add the extension store method for rebuilding all input rules.
|
4260 | */
|
4261 | onCreate(): void;
|
4262 | /**
|
4263 | * Add the `inputRules` plugin to the editor.
|
4264 | */
|
4265 | createExternalPlugins(): ProsemirrorPlugin[];
|
4266 | private generateInputRulesPlugin;
|
4267 | /**
|
4268 | * The method for rebuilding all the input rules.
|
4269 | *
|
4270 | * 1. Rebuild inputRules.
|
4271 | * 2. Replace the old input rules plugin.
|
4272 | * 3. Update the plugins used in the state (triggers an editor update).
|
4273 | */
|
4274 | private rebuildInputRules;
|
4275 | }
|
4276 | export { InputRulesExtension }
|
4277 | export { InputRulesExtension as InputRulesExtension_alias_1 }
|
4278 | export { InputRulesExtension as InputRulesExtension_alias_2 }
|
4279 |
|
4280 | declare interface InputRulesOptions {
|
4281 | /**
|
4282 | * Handlers which can be registered to check whether an input rule should be
|
4283 | * active at this time.
|
4284 | *
|
4285 | * The handlers are given a parameter with the current `state`, the `fullMatch`
|
4286 | * and the `captureGroup` and can determine whether the input rule should
|
4287 | * still be run.
|
4288 | *
|
4289 | * Return `true` to prevent any active input rules from being triggered.
|
4290 | */
|
4291 | shouldSkipInputRule?: Handler<ShouldSkipFunction>;
|
4292 | }
|
4293 | export { InputRulesOptions }
|
4294 | export { InputRulesOptions as InputRulesOptions_alias_1 }
|
4295 | export { InputRulesOptions as InputRulesOptions_alias_2 }
|
4296 |
|
4297 | declare interface InsertNodeOptions {
|
4298 | attrs?: ProsemirrorAttributes;
|
4299 | marks?: Array<Mark_2 | string | MarkType>;
|
4300 | /**
|
4301 | * The content to insert.
|
4302 | */
|
4303 | content?: Fragment | ProsemirrorNode | ProsemirrorNode[] | string;
|
4304 | /**
|
4305 | * @deprecated use selection property instead.
|
4306 | */
|
4307 | range?: FromToProps;
|
4308 | /**
|
4309 | * Set the selection where the command should occur.
|
4310 | */
|
4311 | selection?: PrimitiveSelection;
|
4312 | /**
|
4313 | * Set this to true to replace an empty parent block with this content (if the
|
4314 | * content is a block node).
|
4315 | */
|
4316 | replaceEmptyParentBlock?: boolean;
|
4317 | }
|
4318 | export { InsertNodeOptions }
|
4319 | export { InsertNodeOptions as InsertNodeOptions_alias_1 }
|
4320 | export { InsertNodeOptions as InsertNodeOptions_alias_2 }
|
4321 |
|
4322 | /**
|
4323 | * Insert text into the dom at the current location by default. If a promise is
|
4324 | * provided then the text will be inserted at the tracked position when the
|
4325 | * promise is resolved.
|
4326 | */
|
4327 | declare function insertText(text: string, options?: InsertTextOptions): CommandFunction;
|
4328 | export { insertText }
|
4329 | export { insertText as insertText_alias_1 }
|
4330 |
|
4331 | export declare interface InsertTextOptions extends Partial<FromToProps> {
|
4332 | /**
|
4333 | * Marks can be added to the inserted text.
|
4334 | */
|
4335 | marks?: Record<string, ProsemirrorAttributes>;
|
4336 | }
|
4337 |
|
4338 | export { InvalidContentBlock }
|
4339 |
|
4340 | export { InvalidContentHandler }
|
4341 |
|
4342 | export { InvalidContentHandlerProps }
|
4343 |
|
4344 | export { invariant }
|
4345 |
|
4346 | export { isAllSelection }
|
4347 |
|
4348 | export { isAndroidOS }
|
4349 |
|
4350 | export { isArray }
|
4351 |
|
4352 | export { isBoolean }
|
4353 |
|
4354 | export { isChrome }
|
4355 |
|
4356 | export { isClass }
|
4357 |
|
4358 | export { isDate }
|
4359 |
|
4360 | export { isDefaultBlockNode }
|
4361 |
|
4362 | export { isDefaultDocNode }
|
4363 |
|
4364 | /**
|
4365 | * Returns `true` when the provided value is a delayed value.
|
4366 | */
|
4367 | declare function isDelayedValue<Type>(value: unknown): value is DelayedValue<Type>;
|
4368 | export { isDelayedValue }
|
4369 | export { isDelayedValue as isDelayedValue_alias_1 }
|
4370 |
|
4371 | export { isDirectInstanceOf }
|
4372 |
|
4373 | export { isDocNode }
|
4374 |
|
4375 | export { isDocNodeEmpty }
|
4376 |
|
4377 | export { isDomNode }
|
4378 |
|
4379 | export { isEditorSchema }
|
4380 |
|
4381 | export { isEditorState }
|
4382 |
|
4383 | export { isElementDomNode }
|
4384 |
|
4385 | export { isEmptyArray }
|
4386 |
|
4387 | export { isEmptyBlockNode }
|
4388 |
|
4389 | export { isEmptyObject }
|
4390 |
|
4391 | export { isEndOfTextBlock }
|
4392 |
|
4393 | export { isEqual }
|
4394 |
|
4395 | export { isError }
|
4396 |
|
4397 | /**
|
4398 | * Determines if the passed value is an extension.
|
4399 | *
|
4400 | * @param value - the value to test
|
4401 | */
|
4402 | declare function isExtension<Type extends AnyExtension = AnyExtension>(value: unknown): value is Type;
|
4403 | export { isExtension }
|
4404 | export { isExtension as isExtension_alias_1 }
|
4405 | export { isExtension as isExtension_alias_2 }
|
4406 |
|
4407 | /**
|
4408 | * Determines if the passed value is an extension constructor.
|
4409 | *
|
4410 | * @param value - the value to test
|
4411 | */
|
4412 | declare function isExtensionConstructor<Type extends AnyExtensionConstructor = AnyExtensionConstructor>(value: unknown): value is Type;
|
4413 | export { isExtensionConstructor }
|
4414 | export { isExtensionConstructor as isExtensionConstructor_alias_1 }
|
4415 | export { isExtensionConstructor as isExtensionConstructor_alias_2 }
|
4416 |
|
4417 | /**
|
4418 | * Check if the provided string is an extension tag.
|
4419 | */
|
4420 | declare function isExtensionTag(value: string): value is ExtensionTagType;
|
4421 | export { isExtensionTag }
|
4422 | export { isExtensionTag as isExtensionTag_alias_1 }
|
4423 | export { isExtensionTag as isExtensionTag_alias_2 }
|
4424 |
|
4425 | export { isFunction }
|
4426 |
|
4427 | export { isIdentifierOfType }
|
4428 |
|
4429 | export { isInstanceOf }
|
4430 |
|
4431 | export { isInteger }
|
4432 |
|
4433 | export { isJSONPrimitive }
|
4434 |
|
4435 | export { isMap }
|
4436 |
|
4437 | export { isMarkActive }
|
4438 |
|
4439 | /**
|
4440 | * Determines if the passed in extension is a mark extension. Useful as a type
|
4441 | * guard where a particular type of extension is needed.
|
4442 | *
|
4443 | * @param value - the extension to check
|
4444 | */
|
4445 | declare function isMarkExtension<Type extends AnyMarkExtension = AnyMarkExtension>(value: unknown): value is Type;
|
4446 | export { isMarkExtension }
|
4447 | export { isMarkExtension as isMarkExtension_alias_1 }
|
4448 | export { isMarkExtension as isMarkExtension_alias_2 }
|
4449 |
|
4450 | export { isMarkType }
|
4451 |
|
4452 | export declare interface IsNameUniqueProps {
|
4453 | /**
|
4454 | * The name to check against
|
4455 | */
|
4456 | name: string;
|
4457 | /**
|
4458 | * The set to check within
|
4459 | */
|
4460 | set: Set<string>;
|
4461 | /**
|
4462 | * The error code to use
|
4463 | *
|
4464 | * @defaultValue 'extension'
|
4465 | */
|
4466 | code: ErrorConstant.DUPLICATE_HELPER_NAMES | ErrorConstant.DUPLICATE_COMMAND_NAMES;
|
4467 | }
|
4468 |
|
4469 | export { isNativePromise }
|
4470 |
|
4471 | export { isNodeActive }
|
4472 |
|
4473 | /**
|
4474 | * Determines if the passed in extension is a node extension. Useful as a type
|
4475 | * guard where a particular type of extension is needed.
|
4476 | *
|
4477 | * @param value - the extension to check
|
4478 | */
|
4479 | declare function isNodeExtension<Type extends AnyNodeExtension = AnyNodeExtension>(value: unknown): value is Type;
|
4480 | export { isNodeExtension }
|
4481 | export { isNodeExtension as isNodeExtension_alias_1 }
|
4482 | export { isNodeExtension as isNodeExtension_alias_2 }
|
4483 |
|
4484 | export { isNodeOfType }
|
4485 |
|
4486 | export { isNodeSelection }
|
4487 |
|
4488 | export { isNodeType }
|
4489 |
|
4490 | export { isNonEmptyArray }
|
4491 |
|
4492 | export { isNull }
|
4493 |
|
4494 | export { isNullOrUndefined }
|
4495 |
|
4496 | export { isNumber }
|
4497 |
|
4498 | export { isObject }
|
4499 |
|
4500 | /**
|
4501 | * Checks whether the provided value is a plain extension.
|
4502 | *
|
4503 | * @param value - the extension to check
|
4504 | */
|
4505 | declare function isPlainExtension<Type extends AnyPlainExtension = AnyPlainExtension>(value: unknown): value is Type;
|
4506 | export { isPlainExtension }
|
4507 | export { isPlainExtension as isPlainExtension_alias_1 }
|
4508 | export { isPlainExtension as isPlainExtension_alias_2 }
|
4509 |
|
4510 | export { isPlainObject }
|
4511 |
|
4512 | export { isPrimitive }
|
4513 |
|
4514 | export { isPromise }
|
4515 |
|
4516 | export { isProsemirrorFragment }
|
4517 |
|
4518 | export { isProsemirrorMark }
|
4519 |
|
4520 | export { isProsemirrorNode }
|
4521 |
|
4522 | export { isRegExp }
|
4523 |
|
4524 | export { isRemirrorJSON }
|
4525 |
|
4526 | /**
|
4527 | * Checks to see whether the provided value is a `RemirrorManager` instance.
|
4528 | *
|
4529 | * An optional parameter `mustIncludeList` is available if you want to check
|
4530 | * that the manager includes all the listed extensions.
|
4531 | *
|
4532 | * @param value - the value to check
|
4533 | * @param mustIncludeList - an array of presets and extension the manager must
|
4534 | * include to pass the test. The identifier can either be the Extension / Preset
|
4535 | * name e.g. `bold`, or the Extension / Preset constructor `BoldExtension`
|
4536 | */
|
4537 | declare function isRemirrorManager<Extension extends AnyExtension = AnyExtension>(value: unknown, mustIncludeList?: Array<AnyExtensionConstructor | string>): value is RemirrorManager<Extension>;
|
4538 | export { isRemirrorManager }
|
4539 | export { isRemirrorManager as isRemirrorManager_alias_1 }
|
4540 | export { isRemirrorManager as isRemirrorManager_alias_2 }
|
4541 |
|
4542 | export { isRemirrorType }
|
4543 |
|
4544 | export { isResolvedPos }
|
4545 |
|
4546 | export { isSafari }
|
4547 |
|
4548 | export { isSafeInteger }
|
4549 |
|
4550 | export { isSelection }
|
4551 |
|
4552 | export { isSelectionEmpty }
|
4553 |
|
4554 | export { isSet }
|
4555 |
|
4556 | export { isStartOfDoc }
|
4557 |
|
4558 | export { isStartOfTextBlock }
|
4559 |
|
4560 | export { isString }
|
4561 |
|
4562 | export { isSymbol }
|
4563 |
|
4564 | export { isTextDomNode }
|
4565 |
|
4566 | export { isTextSelection }
|
4567 |
|
4568 | export { isTransaction }
|
4569 |
|
4570 | export { isUndefined }
|
4571 |
|
4572 | export { IterableElement }
|
4573 |
|
4574 | export { joinStyles }
|
4575 |
|
4576 | export { JsonArray }
|
4577 |
|
4578 | export { JsonObject }
|
4579 |
|
4580 | export { JsonPrimitive }
|
4581 |
|
4582 | export { JsonValue }
|
4583 |
|
4584 | export { KebabCase }
|
4585 |
|
4586 | export { kebabCase }
|
4587 |
|
4588 | export { KeepPartialProperties }
|
4589 |
|
4590 | /**
|
4591 | * A decorator which can be applied to an extension method to
|
4592 | * identify as a key binding method. This can be used as a replacement for
|
4593 | * the `createKeymap` method depending on your preference.
|
4594 | *
|
4595 | * If you prefer not to use decorators, then you can continue using
|
4596 | * `createKeymap`.
|
4597 | *
|
4598 | * @category Method Decorator
|
4599 | */
|
4600 | declare function keyBinding<Extension extends AnyExtension>(options: KeybindingDecoratorOptions<Required<GetOptions<Extension>>>): (method: KeyBindingCommandFunction, context: ClassMethodDecoratorContext<Extension>) => KeyBindingCommandFunction;
|
4601 | export { keyBinding }
|
4602 | export { keyBinding as keyBinding_alias_1 }
|
4603 | export { keyBinding as keyBinding_alias_2 }
|
4604 |
|
4605 | export { KeyBindingCommandFunction }
|
4606 |
|
4607 | declare interface KeybindingDecoratorOptions<Options extends Shape = Shape> {
|
4608 | /**
|
4609 | * The keypress sequence to intercept.
|
4610 | *
|
4611 | * - `Enter`
|
4612 | * - `Shift-Enter`
|
4613 | */
|
4614 | shortcut: KeyboardShortcut;
|
4615 | /**
|
4616 | * This can be used to set a keybinding as inactive based on the provided
|
4617 | * options.
|
4618 | */
|
4619 | isActive?: (options: Options, store: Remirror.ExtensionStore) => boolean;
|
4620 | /**
|
4621 | * The priority for this keybinding.
|
4622 | */
|
4623 | priority?: ExtensionPriority | ((options: Options, store: Remirror.ExtensionStore) => ExtensionPriority);
|
4624 | /**
|
4625 | * The name of the command that the keybinding should be attached to.
|
4626 | */
|
4627 | command?: Remirror.AllUiCommandNames;
|
4628 | }
|
4629 | export { KeybindingDecoratorOptions }
|
4630 | export { KeybindingDecoratorOptions as KeybindingDecoratorOptions_alias_1 }
|
4631 | export { KeybindingDecoratorOptions as KeybindingDecoratorOptions_alias_2 }
|
4632 |
|
4633 | declare interface KeyBindingMetadata {
|
4634 | type: 'keyBinding';
|
4635 | /**
|
4636 | * The name of the extension used.
|
4637 | */
|
4638 | extension: string;
|
4639 | /**
|
4640 | * The shortcut used to invoke this keybinding.
|
4641 | */
|
4642 | shortcut: string;
|
4643 | }
|
4644 |
|
4645 | export { KeyBindingNames }
|
4646 |
|
4647 | export { KeyBindingProps }
|
4648 |
|
4649 | export { KeyBindings }
|
4650 |
|
4651 | /**
|
4652 | * KeyBindings as a tuple with priority and the keymap.
|
4653 | */
|
4654 | declare type KeyBindingsTuple = [priority: ExtensionPriority, bindings: KeyBindings];
|
4655 | export { KeyBindingsTuple }
|
4656 | export { KeyBindingsTuple as KeyBindingsTuple_alias_1 }
|
4657 | export { KeyBindingsTuple as KeyBindingsTuple_alias_2 }
|
4658 |
|
4659 | declare type KeyboardShortcut = KeyboardShortcutValue | KeyboardShortcutFunction;
|
4660 | export { KeyboardShortcut }
|
4661 | export { KeyboardShortcut as KeyboardShortcut_alias_1 }
|
4662 | export { KeyboardShortcut as KeyboardShortcut_alias_2 }
|
4663 |
|
4664 | declare type KeyboardShortcutFunction<Options extends Shape = Shape> = (options: Options, store: Remirror.ExtensionStore) => KeyboardShortcut;
|
4665 | export { KeyboardShortcutFunction }
|
4666 | export { KeyboardShortcutFunction as KeyboardShortcutFunction_alias_1 }
|
4667 | export { KeyboardShortcutFunction as KeyboardShortcutFunction_alias_2 }
|
4668 |
|
4669 | declare type KeyboardShortcuts = keyof typeof keyboardShortcuts | ShortcutMap;
|
4670 | export { KeyboardShortcuts }
|
4671 | export { KeyboardShortcuts as KeyboardShortcuts_alias_1 }
|
4672 | export { KeyboardShortcuts as KeyboardShortcuts_alias_2 }
|
4673 |
|
4674 | declare const keyboardShortcuts: {
|
4675 | default: ShortcutMap;
|
4676 | googleDoc: ShortcutMap;
|
4677 | };
|
4678 | export { keyboardShortcuts }
|
4679 | export { keyboardShortcuts as keyboardShortcuts_alias_1 }
|
4680 | export { keyboardShortcuts as keyboardShortcuts_alias_2 }
|
4681 |
|
4682 | declare type KeyboardShortcutValue = Listable<LiteralUnion<'Enter' | 'ArrowDown' | 'ArrowUp' | 'ArrowLeft' | 'ArrowRight' | 'Escape' | 'Delete' | 'Backspace', string>>;
|
4683 | export { KeyboardShortcutValue }
|
4684 | export { KeyboardShortcutValue as KeyboardShortcutValue_alias_1 }
|
4685 | export { KeyboardShortcutValue as KeyboardShortcutValue_alias_2 }
|
4686 |
|
4687 | /**
|
4688 | * This extension allows others extension to use the `createKeymaps` method.
|
4689 | *
|
4690 | * @remarks
|
4691 | *
|
4692 | * Keymaps are the way of controlling how the editor responds to a keypress and
|
4693 | * different key combinations.
|
4694 | *
|
4695 | * Without this extension most of the shortcuts and behaviors we have come to
|
4696 | * expect from text editors would not be provided.
|
4697 | *
|
4698 | * @category Builtin Extension
|
4699 | */
|
4700 | declare class KeymapExtension extends PlainExtension<KeymapOptions> {
|
4701 | get name(): "keymap";
|
4702 | /**
|
4703 | * The custom keybindings added by the handlers. In react these can be added
|
4704 | * via `hooks`.
|
4705 | */
|
4706 | private extraKeyBindings;
|
4707 | /**
|
4708 | * Track the backward exits from a mark to allow double tapping the left arrow
|
4709 | * to move to the previous block node.
|
4710 | */
|
4711 | private readonly backwardMarkExitTracker;
|
4712 | /**
|
4713 | * The underlying keydown handler.
|
4714 | */
|
4715 | private keydownHandler;
|
4716 | /**
|
4717 | * Get the shortcut map.
|
4718 | */
|
4719 | private get shortcutMap();
|
4720 | /**
|
4721 | * This adds the `createKeymap` method functionality to all extensions.
|
4722 | */
|
4723 | onCreate(): void;
|
4724 | /** Add the created keymap to the available plugins. */
|
4725 | createExternalPlugins(): ProsemirrorPlugin[];
|
4726 | private setupKeydownHandler;
|
4727 | /**
|
4728 | * Updates the stored keymap bindings on this extension.
|
4729 | */
|
4730 | private generateKeymapBindings;
|
4731 | /**
|
4732 | * Handle exiting the mark forwards.
|
4733 | */
|
4734 | arrowRightShortcut(props: KeyBindingProps): boolean;
|
4735 | /**
|
4736 | * Handle the arrow left key to exit the mark.
|
4737 | */
|
4738 | arrowLeftShortcut(props: KeyBindingProps): boolean;
|
4739 | /**
|
4740 | * Handle exiting the mark forwards.
|
4741 | */
|
4742 | backspace(props: KeyBindingProps): boolean;
|
4743 | /**
|
4744 | * Create the base keymap and give it a low priority so that all other keymaps
|
4745 | * override it.
|
4746 | */
|
4747 | createKeymap(): PrioritizedKeyBindings;
|
4748 | /**
|
4749 | * Get the real shortcut name from the named shortcut.
|
4750 | */
|
4751 | getNamedShortcut(shortcut: string, options?: Shape): Helper<string[]>;
|
4752 | /**
|
4753 | * @internalremarks
|
4754 | *
|
4755 | * Think about the case where bindings are disposed of and then added in a
|
4756 | * different position in the `extraKeyBindings` array. This is especially
|
4757 | * pertinent when using hooks.
|
4758 | */
|
4759 | protected onAddCustomHandler: AddCustomHandler<KeymapOptions>;
|
4760 | /**
|
4761 | * Handle changes in the dynamic properties.
|
4762 | */
|
4763 | protected onSetOptions(props: OnSetOptionsProps<KeymapOptions>): void;
|
4764 | private sortKeymaps;
|
4765 | /**
|
4766 | * The method for rebuilding all the extension keymaps.
|
4767 | *
|
4768 | * 1. Rebuild keymaps.
|
4769 | * 2. Replace `this.keydownHandler` with the new keydown handler.
|
4770 | */
|
4771 | private readonly rebuildKeymap;
|
4772 | /**
|
4773 | * Exits the mark forwards when at the end of a block node.
|
4774 | */
|
4775 | private exitMarkForwards;
|
4776 | private exitNodeBackwards;
|
4777 | /**
|
4778 | * Exit a mark when at the beginning of a block node.
|
4779 | */
|
4780 | private exitMarkBackwards;
|
4781 | }
|
4782 | export { KeymapExtension }
|
4783 | export { KeymapExtension as KeymapExtension_alias_1 }
|
4784 | export { KeymapExtension as KeymapExtension_alias_2 }
|
4785 |
|
4786 | declare interface KeymapOptions {
|
4787 | /**
|
4788 | * The shortcuts to use for named keybindings in the editor.
|
4789 | *
|
4790 | * @defaultValue 'default'
|
4791 | */
|
4792 | shortcuts?: KeyboardShortcuts;
|
4793 | /**
|
4794 | * Determines whether a backspace after an input rule has been applied should
|
4795 | * reverse the effect of the input rule.
|
4796 | *
|
4797 | * @defaultValue true
|
4798 | */
|
4799 | undoInputRuleOnBackspace?: boolean;
|
4800 | /**
|
4801 | * Determines whether the escape key selects the current node.
|
4802 | *
|
4803 | * @defaultValue false
|
4804 | */
|
4805 | selectParentNodeOnEscape?: boolean;
|
4806 | /**
|
4807 | * When true will exclude the default prosemirror keymap.
|
4808 | *
|
4809 | * @remarks
|
4810 | *
|
4811 | * You might want to set this to true if you want to fully customise the
|
4812 | * keyboard mappings for your editor. Otherwise it is advisable to leave it
|
4813 | * unchanged.
|
4814 | *
|
4815 | * @defaultValue false
|
4816 | */
|
4817 | excludeBaseKeymap?: boolean;
|
4818 | /**
|
4819 | * Whether to support exiting marks when the left and right array keys are
|
4820 | * pressed.
|
4821 | *
|
4822 | * Can be set to
|
4823 | *
|
4824 | * - `true` - enables exits from both the entrance and the end of the mark
|
4825 | */
|
4826 | exitMarksOnArrowPress?: boolean;
|
4827 | /**
|
4828 | * The implementation for the extra keybindings added to the settings.
|
4829 | *
|
4830 | * @remarks
|
4831 | *
|
4832 | * This allows for you to add extra key mappings which will be checked before
|
4833 | * the default keymaps, if they return false then the default keymaps are
|
4834 | * still checked.
|
4835 | *
|
4836 | * No key mappings are removed in this process.
|
4837 | *
|
4838 | * ```ts
|
4839 | * const extension = BaseKeymapExtension.create({ keymap: {
|
4840 | * Enter({ state, dispatch }) {
|
4841 | *
|
4842 | * return true;
|
4843 | * },
|
4844 | * }});
|
4845 | * ```
|
4846 | */
|
4847 | keymap?: CustomHandler<PrioritizedKeyBindings>;
|
4848 | }
|
4849 | export { KeymapOptions }
|
4850 | export { KeymapOptions as KeymapOptions_alias_1 }
|
4851 | export { KeymapOptions as KeymapOptions_alias_2 }
|
4852 |
|
4853 | export { keys }
|
4854 |
|
4855 | export { last }
|
4856 |
|
4857 | export { LEAF_NODE_REPLACING_CHARACTER }
|
4858 |
|
4859 | /**
|
4860 | * A legacy decorator (pre Stage 3) which can be applied to top level methods
|
4861 | * on an extension to identify them as commands. This can be used as a
|
4862 | * replacement for the `createCommands` method.
|
4863 | *
|
4864 | * If you prefer not to use decorators, then you can continue using
|
4865 | * `createCommands`. Internally the decorators are being used as they are better
|
4866 | * for documentation purposes.
|
4867 | *
|
4868 | * For automated type inference methods that use this decorator must implement
|
4869 | * the following type signature.
|
4870 | *
|
4871 | * ```ts
|
4872 | * import { CommandFunction } from '@remirror/core';
|
4873 | *
|
4874 | * type Signature = (...args: any[]) => CommandFunction;
|
4875 | * ```
|
4876 | *
|
4877 | * The following is an example of how this can be used within your extension.
|
4878 | *
|
4879 | * ```ts
|
4880 | * import { legacyCommand, CommandFunction } from '@remirror/core';
|
4881 | *
|
4882 | * class MyExtension {
|
4883 | * get name() {
|
4884 | * return 'my';
|
4885 | * }
|
4886 | *
|
4887 | * @legacyCommand()
|
4888 | * myCommand(text: string): CommandFunction {
|
4889 | * return ({ tr, dispatch }) => {
|
4890 | * dispatch?.(tr.insertText('my command ' + text));
|
4891 | * return true;
|
4892 | * }
|
4893 | * }
|
4894 | * }
|
4895 | * ```
|
4896 | *
|
4897 | * The above command can now be used within your editor instance.
|
4898 | *
|
4899 | * ```tsx
|
4900 | * import { useRemirrorContext } from '@remirror/react';
|
4901 | *
|
4902 | * const MyEditorButton = () => {
|
4903 | * const { commands } = useRemirrorContext();
|
4904 | *
|
4905 | * return <button onClick={() => commands.myCommand('hello')}>My Button</button>
|
4906 | * }
|
4907 | * ```
|
4908 | *
|
4909 | * @category Method Decorator
|
4910 | * @deprecated legacy - please use the ES2023 decorator `@command`
|
4911 | */
|
4912 | declare function legacyCommand<Extension extends AnyExtension>(options?: ChainableCommandDecoratorOptions<Required<GetOptions<Extension>>>): ExtensionDecorator<Extension, CommandFunction, void>;
|
4913 |
|
4914 | declare function legacyCommand<Extension extends AnyExtension>(options: NonChainableCommandDecoratorOptions<Required<GetOptions<Extension>>>): ExtensionDecorator<Extension, NonChainableCommandFunction, void>;
|
4915 | export { legacyCommand }
|
4916 | export { legacyCommand as legacyCommand_alias_1 }
|
4917 | export { legacyCommand as legacyCommand_alias_2 }
|
4918 |
|
4919 | /**
|
4920 | * A legacy decorator (pre Stage 3) which can be applied to top level methods
|
4921 | * on an extension to identify them as helpers. This can be used as a
|
4922 | * replacement for the `createHelpers` method.
|
4923 | *
|
4924 | * To allow the TypeScript compiler to automatically infer types, please create
|
4925 | * your methods with the following type signature.
|
4926 | *
|
4927 | * ```ts
|
4928 | * import { Helper } from '@remirror/core';
|
4929 | *
|
4930 | * type Signature = (...args: any[]) => Helper<SomeReturnType>;
|
4931 | * ```
|
4932 | *
|
4933 | * The following is an example of how this can be used within your extension.
|
4934 | *
|
4935 | * ```ts
|
4936 | * import { legacyHelper, Helper } from '@remirror/core';
|
4937 | *
|
4938 | * class MyExtension {
|
4939 | * get name() {
|
4940 | * return 'my';
|
4941 | * }
|
4942 | *
|
4943 | * @legacyHelper()
|
4944 | * alwaysTrue(): Helper<boolean> {
|
4945 | * return true;
|
4946 | * }
|
4947 | * }
|
4948 | * ```
|
4949 | *
|
4950 | * The above helper can now be used within your editor instance.
|
4951 | *
|
4952 | * ```tsx
|
4953 | * import { useRemirrorContext } from '@remirror/react';
|
4954 | *
|
4955 | * const MyEditorButton = () => {
|
4956 | * const { helpers } = useRemirrorContext();
|
4957 | *
|
4958 | * return helpers.alwaysTrue() ? <button>My Button</button> : null
|
4959 | * }
|
4960 | * ```
|
4961 | *
|
4962 | * @category Method Decorator
|
4963 | * @deprecated legacy - please use the ES2023 decorator `@helper`
|
4964 | */
|
4965 | declare function legacyHelper(options?: HelperDecoratorOptions): <Extension extends AnyExtension, Type>(target: Extension, propertyKey: string, _descriptor: TypedPropertyDescriptor<AnyFunction<NonNullable<Type> extends HelperAnnotation ? Type : never>>) => void;
|
4966 | export { legacyHelper }
|
4967 | export { legacyHelper as legacyHelper_alias_1 }
|
4968 | export { legacyHelper as legacyHelper_alias_2 }
|
4969 |
|
4970 | /**
|
4971 | * A legacy decorator (pre Stage 3) which can be applied to an extension
|
4972 | * method to identify as a key binding method. This can be used as a
|
4973 | * replacement for the `createKeymap` method depending on your
|
4974 | * preference.
|
4975 | *
|
4976 | * If you prefer not to use decorators, then you can continue using
|
4977 | * `createKeymap`.
|
4978 | *
|
4979 | * @category Method Decorator
|
4980 | * @deprecated legacy - please use the ES2023 decorator `@keyBinding`
|
4981 | */
|
4982 | declare function legacyKeyBinding<Extension extends AnyExtension>(options: KeybindingDecoratorOptions<Required<GetOptions<Extension>>>): (target: Extension, propertyKey: string, _descriptor: TypedPropertyDescriptor<KeyBindingCommandFunction>) => void;
|
4983 | export { legacyKeyBinding }
|
4984 | export { legacyKeyBinding as legacyKeyBinding_alias_1 }
|
4985 | export { legacyKeyBinding as legacyKeyBinding_alias_2 }
|
4986 |
|
4987 | export { lift }
|
4988 |
|
4989 | export { Listable }
|
4990 |
|
4991 | declare interface ListenerProps extends Partial<EditorStateProps>, Partial<TransactionProps> {
|
4992 | /**
|
4993 | * When the state updates are not controlled and it was a transaction that
|
4994 | * caused the state to be updated this value captures all the transaction
|
4995 | * updates caused by prosemirror plugins hook state methods like
|
4996 | * `filterTransactions` and `appendTransactions`.
|
4997 | *
|
4998 | * This is for advanced users only.
|
4999 | */
|
5000 | transactions?: readonly Transaction[];
|
5001 | }
|
5002 | export { ListenerProps }
|
5003 | export { ListenerProps as ListenerProps_alias_1 }
|
5004 | export { ListenerProps as ListenerProps_alias_2 }
|
5005 |
|
5006 | export { Literal }
|
5007 |
|
5008 | export { LiteralUnion }
|
5009 |
|
5010 | export { MakeNullable }
|
5011 |
|
5012 | export { MakeOptional }
|
5013 |
|
5014 | export { MakeReadonly }
|
5015 |
|
5016 | export { MakeRequired }
|
5017 |
|
5018 | export { MakeUndefined }
|
5019 |
|
5020 | declare interface ManagerEvents {
|
5021 | /**
|
5022 | * Called when the state is updated.
|
5023 | */
|
5024 | stateUpdate: (props: StateUpdateLifecycleProps) => void;
|
5025 | /**
|
5026 | * Called whenever the manager is cloned with the newly created manager
|
5027 | * instance.
|
5028 | *
|
5029 | * This is mainly used for testing so that the RemirrorTester can always
|
5030 | * reference the latest manager.
|
5031 | */
|
5032 | clone: (manager: AnyRemirrorManager) => void;
|
5033 | /**
|
5034 | * Called whenever the manager is recreated with the newly created manager
|
5035 | * instance.
|
5036 | *
|
5037 | * This is mainly used for testing so that the RemirrorTester can always
|
5038 | * reference the latest manager.
|
5039 | */
|
5040 | recreate: (manager: AnyRemirrorManager) => void;
|
5041 | /**
|
5042 | * An event listener which is called whenever the manager is destroyed.
|
5043 | */
|
5044 | destroy: () => void;
|
5045 | }
|
5046 | export { ManagerEvents }
|
5047 | export { ManagerEvents as ManagerEvents_alias_1 }
|
5048 | export { ManagerEvents as ManagerEvents_alias_2 }
|
5049 |
|
5050 | export declare interface ManagerLifecycleHandlers {
|
5051 | /**
|
5052 | * Contains the methods run when the manager is first created.
|
5053 | */
|
5054 | create: Array<() => Dispose | void>;
|
5055 | /**
|
5056 | * Holds the methods to run once the Editor has received the view from the
|
5057 | * attached.
|
5058 | */
|
5059 | view: Array<(view: EditorView) => Dispose | void>;
|
5060 | /**
|
5061 | * The update method is called every time the state updates. This allows
|
5062 | * extensions to listen to updates.
|
5063 | */
|
5064 | update: Array<(props: StateUpdateLifecycleProps) => void>;
|
5065 | /**
|
5066 | * Called when the manager is being destroyed.
|
5067 | */
|
5068 | destroy: Array<() => void>;
|
5069 | }
|
5070 |
|
5071 | export { ManagerPhase }
|
5072 |
|
5073 | declare type ManagerStoreKeys = keyof Remirror.ManagerStore<any>;
|
5074 | export { ManagerStoreKeys }
|
5075 | export { ManagerStoreKeys as ManagerStoreKeys_alias_1 }
|
5076 | export { ManagerStoreKeys as ManagerStoreKeys_alias_2 }
|
5077 |
|
5078 | /**
|
5079 | * A utility type which maps the passed in extension helpers to a method called
|
5080 | * with `manager.data.helpers.helperName()`.
|
5081 | */
|
5082 | declare type MapHelpers<RawHelpers extends Record<string, AnyFunction>> = {
|
5083 | [Helper in keyof RawHelpers]: RawHelpers[Helper];
|
5084 | };
|
5085 | export { MapHelpers }
|
5086 | export { MapHelpers as MapHelpers_alias_1 }
|
5087 | export { MapHelpers as MapHelpers_alias_2 }
|
5088 |
|
5089 | declare type MappedHandlerKeyOptions<Options extends Shape = EmptyShape> = {
|
5090 | [Key in keyof GetHandler<Options>]?: HandlerKeyOptions<ReturnType<GetHandler<Options>[Key]>, Parameters<GetHandler<Options>[Key]>>;
|
5091 | } & {
|
5092 | __ALL__?: HandlerKeyOptions;
|
5093 | };
|
5094 |
|
5095 | export { Mapping }
|
5096 |
|
5097 | /**
|
5098 | * A utility type which maps the chained commands.
|
5099 | */
|
5100 | declare type MapToChainedCommand<RawCommands extends Record<string, AnyFunction>> = {
|
5101 | [Command in keyof RawCommands]: ReturnType<RawCommands[Command]> extends NonChainableCommandFunction ? void : (...args: Parameters<RawCommands[Command]>) => any;
|
5102 | };
|
5103 | export { MapToChainedCommand }
|
5104 | export { MapToChainedCommand as MapToChainedCommand_alias_1 }
|
5105 | export { MapToChainedCommand as MapToChainedCommand_alias_2 }
|
5106 |
|
5107 | /**
|
5108 | * A utility type which maps the passed in extension command in an action that
|
5109 | * is store in the `manager.store.actions.commandName()`.
|
5110 | */
|
5111 | declare type MapToUnchainedCommand<RawCommands extends Record<string, AnyFunction>> = {
|
5112 | [Command in keyof RawCommands]: CommandShape<Parameters<RawCommands[Command]>>;
|
5113 | };
|
5114 | export { MapToUnchainedCommand }
|
5115 | export { MapToUnchainedCommand as MapToUnchainedCommand_alias_1 }
|
5116 | export { MapToUnchainedCommand as MapToUnchainedCommand_alias_2 }
|
5117 |
|
5118 | export { Mark }
|
5119 |
|
5120 | export { markEqualsType }
|
5121 |
|
5122 | /**
|
5123 | * A mark extension is based on the `Mark` concept from from within prosemirror
|
5124 | * {@link https://prosemirror.net/docs/guide/#schema.marks}
|
5125 | *
|
5126 | * @remarks
|
5127 | *
|
5128 | * Marks are used to add extra styling or other information to inline content.
|
5129 | * Mark types are objects much like node types, used to tag mark objects and
|
5130 | * provide additional information about them.
|
5131 | */
|
5132 | declare abstract class MarkExtension<Options extends ValidOptions = EmptyShape> extends Extension<Options> {
|
5133 | /** @internal */
|
5134 | static get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.MarkExtensionConstructor;
|
5135 | /**
|
5136 | * Whether to disable extra attributes for this extension.
|
5137 | */
|
5138 | static readonly disableExtraAttributes: boolean;
|
5139 | /** @internal */
|
5140 | get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.MarkExtension;
|
5141 | /**
|
5142 | * Provides access to the mark type from the schema.
|
5143 | *
|
5144 | * @remarks
|
5145 | *
|
5146 | * The type is available as soon as the schema is created by the
|
5147 | * `SchemaExtension` which has the priority `Highest`. It should be safe to
|
5148 | * access in any of the lifecycle methods.
|
5149 | */
|
5150 | get type(): MarkType;
|
5151 | constructor(...args: ExtensionConstructorProps<Options>);
|
5152 | /**
|
5153 | * Provide a method for creating the schema. This is required in order to
|
5154 | * create a `MarkExtension`.
|
5155 | *
|
5156 | * @remarks
|
5157 | *
|
5158 | * The main difference between the return value of this method and Prosemirror
|
5159 | * `MarkSpec` is that that the `toDOM` method doesn't allow dom manipulation.
|
5160 | * You can only return an array or string.
|
5161 | *
|
5162 | * For more advanced requirements, it may be possible to create a `nodeView`
|
5163 | * to manage the dom interactions.
|
5164 | */
|
5165 | abstract createMarkSpec(extra: ApplySchemaAttributes, override: MarkSpecOverride): MarkExtensionSpec;
|
5166 | }
|
5167 |
|
5168 | declare interface MarkExtension<Options extends ValidOptions = EmptyShape> extends Extension<Options>, Remirror.MarkExtension {
|
5169 | }
|
5170 | export { MarkExtension }
|
5171 | export { MarkExtension as MarkExtension_alias_1 }
|
5172 | export { MarkExtension as MarkExtension_alias_2 }
|
5173 |
|
5174 | export { MarkExtensionSpec }
|
5175 |
|
5176 | export { markInputRule }
|
5177 |
|
5178 | export { MarkSpecOverride }
|
5179 |
|
5180 | export { MarkType }
|
5181 |
|
5182 | export { MarkTypeProps }
|
5183 |
|
5184 | export { MarkTypesProps }
|
5185 |
|
5186 | export { MarkWithAttributes }
|
5187 |
|
5188 | export { MarkWithAttributesProps }
|
5189 |
|
5190 | export { Merge }
|
5191 |
|
5192 | export { mergeDOMRects }
|
5193 |
|
5194 | export { MergeExclusive }
|
5195 |
|
5196 | export { mergeKeyBindings }
|
5197 |
|
5198 | export { mergeProsemirrorKeyBindings }
|
5199 |
|
5200 | declare type Metadata = CommandMetadata | KeyBindingMetadata;
|
5201 | export { Metadata }
|
5202 | export { Metadata as Metadata_alias_1 }
|
5203 | export { Metadata as Metadata_alias_2 }
|
5204 |
|
5205 | /**
|
5206 | * Support meta data for commands and key bindings.
|
5207 | *
|
5208 | * Metadata is dded to all commands and keybindings and that information is
|
5209 | * provided to the `onChange` handle whenever the state is updated.
|
5210 | *
|
5211 | * @internalremarks
|
5212 | *
|
5213 | * TODO capture keybindings as well. This will be more difficult since
|
5214 | * keybindings can dynamically be added to the editor.
|
5215 | */
|
5216 | declare class MetaExtension extends PlainExtension<MetaOptions> {
|
5217 | get name(): "meta";
|
5218 | onCreate(): void;
|
5219 | /**
|
5220 | * This is here to provide a
|
5221 | */
|
5222 | createPlugin(): CreateExtensionPlugin;
|
5223 | /**
|
5224 | * Intercept command names and attributes.
|
5225 | */
|
5226 | private captureCommands;
|
5227 | /**
|
5228 | * Intercept command name and attributes.
|
5229 | */
|
5230 | private captureKeybindings;
|
5231 | /**
|
5232 | * Get the command metadata.
|
5233 | */
|
5234 | private getCommandMeta;
|
5235 | private setCommandMeta;
|
5236 | }
|
5237 | export { MetaExtension }
|
5238 | export { MetaExtension as MetaExtension_alias_1 }
|
5239 | export { MetaExtension as MetaExtension_alias_2 }
|
5240 |
|
5241 | declare interface MetaOptions {
|
5242 | /**
|
5243 | * Set to true to capture meta data on commands and keybindings. This creates
|
5244 | * a wrapper around every command and keybinding and as a result it may lead
|
5245 | * to a performance penalty.
|
5246 | */
|
5247 | capture?: Static<boolean>;
|
5248 | }
|
5249 | export { MetaOptions }
|
5250 | export { MetaOptions as MetaOptions_alias_1 }
|
5251 | export { MetaOptions as MetaOptions_alias_2 }
|
5252 |
|
5253 | export { MinArray }
|
5254 |
|
5255 | /**
|
5256 | * Mutate the default extension options.
|
5257 | *
|
5258 | * @remarks
|
5259 | *
|
5260 | * This is a dangerous method since it allows you to mutate the received object.
|
5261 | * Don't use it unless you absolutely have to.
|
5262 | *
|
5263 | * A potential use case is for adding a new default option to all extensions. It
|
5264 | * shows an example of how to accomplish this in a typesafe way.
|
5265 | *
|
5266 | * ```ts
|
5267 | * import { mutateDefaultExtensionOptions } from 'remirror';
|
5268 | *
|
5269 | * mutateDefaultExtensionOptions((settings) => {
|
5270 | *
|
5271 | * settings.customSetting = false;
|
5272 | * })
|
5273 | *
|
5274 | * declare global {
|
5275 | * namespace Remirror {
|
5276 | * interface BaseExtensionOptions {
|
5277 | * customSetting?: boolean;
|
5278 | * }
|
5279 | * }
|
5280 | * }
|
5281 | *```
|
5282 | *
|
5283 | * The mutation must happen before any extension have been instantiated.
|
5284 | */
|
5285 | declare function mutateDefaultExtensionOptions(mutatorMethod: (defaultOptions: BaseExtensionOptions) => void): void;
|
5286 | export { mutateDefaultExtensionOptions }
|
5287 | export { mutateDefaultExtensionOptions as mutateDefaultExtensionOptions_alias_1 }
|
5288 | export { mutateDefaultExtensionOptions as mutateDefaultExtensionOptions_alias_2 }
|
5289 |
|
5290 | export { mutateTag }
|
5291 |
|
5292 | export { NamedShortcut }
|
5293 |
|
5294 | export { NamedStringHandlers }
|
5295 |
|
5296 | declare interface NewChainedCommandProps<Extension extends AnyExtension, Chained extends ChainedIntersection<Extension> = ChainedIntersection<Extension>> {
|
5297 | /**
|
5298 | * Returns a new chain, with an empty command set.
|
5299 | *
|
5300 | * ```ts
|
5301 | * chain.toggleBold();
|
5302 | * chain.new().toggleItalic().run();
|
5303 | * ```
|
5304 | */
|
5305 | new: (tr?: Transaction) => ChainedFromExtensions<Extension, Chained>;
|
5306 | }
|
5307 | export { NewChainedCommandProps }
|
5308 | export { NewChainedCommandProps as NewChainedCommandProps_alias_1 }
|
5309 | export { NewChainedCommandProps as NewChainedCommandProps_alias_2 }
|
5310 |
|
5311 | /**
|
5312 | * Defines the abstract class for extensions which can place nodes into the
|
5313 | * prosemirror state.
|
5314 | *
|
5315 | * @remarks
|
5316 | *
|
5317 | * For more information see {@link https://prosemirror.net/docs/ref/#model.Node}
|
5318 | */
|
5319 | declare abstract class NodeExtension<Options extends ValidOptions = EmptyShape> extends Extension<Options> {
|
5320 | static get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.NodeExtensionConstructor;
|
5321 | /**
|
5322 | * Whether to disable extra attributes for this extension.
|
5323 | */
|
5324 | static readonly disableExtraAttributes: boolean;
|
5325 | /** @internal */
|
5326 | get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.NodeExtension;
|
5327 | /**
|
5328 | * Provides access to the node type from the schema.
|
5329 | */
|
5330 | get type(): NodeType;
|
5331 | constructor(...args: ExtensionConstructorProps<Options>);
|
5332 | /**
|
5333 | * Provide a method for creating the schema. This is required in order to
|
5334 | * create a `NodeExtension`.
|
5335 | *
|
5336 | * @remarks
|
5337 | *
|
5338 | * A node schema defines the behavior of the content within the editor. This
|
5339 | * is very tied to the prosemirror implementation and the best place to learn
|
5340 | * more about it is in the
|
5341 | * {@link https://prosemirror.net/docs/guide/#schema docs}.
|
5342 | *
|
5343 | * @params hole - a method that is meant to indicate where extra attributes
|
5344 | * should be placed (if they exist).
|
5345 | *
|
5346 | * The `hole` is a function that augments the passed object adding a special
|
5347 | * `secret` key which is used to insert the extra attributes setter.
|
5348 | *
|
5349 | * ```ts
|
5350 | * import { NodeExtension, SpecHole } from 'remirror';
|
5351 | *
|
5352 | * class AwesomeExtension extends NodeExtension {
|
5353 | * get name() { return 'awesome' as const'; }
|
5354 | *
|
5355 | * createNodeSpec() {
|
5356 | * return {
|
5357 | * toDOM: (node) => {
|
5358 | * return ['p', hole(), 0]
|
5359 | * }
|
5360 | * }
|
5361 | * }
|
5362 | * }
|
5363 | * ```
|
5364 | *
|
5365 | * The above example will have the `hole()` method call replaced with the
|
5366 | * extra attributes.
|
5367 | */
|
5368 | abstract createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec;
|
5369 | }
|
5370 |
|
5371 | declare interface NodeExtension<Options extends ValidOptions = EmptyShape> extends Extension<Options>, Remirror.NodeExtension {
|
5372 | }
|
5373 | export { NodeExtension }
|
5374 | export { NodeExtension as NodeExtension_alias_1 }
|
5375 | export { NodeExtension as NodeExtension_alias_2 }
|
5376 |
|
5377 | export { NodeExtensionSpec }
|
5378 |
|
5379 | export { nodeInputRule }
|
5380 |
|
5381 | export { NodeMarkOptions }
|
5382 |
|
5383 | declare interface NodePlaceholder<Data = any> extends BasePlaceholder, DataProps<Data> {
|
5384 | /**
|
5385 | * Set this as a node tracker.
|
5386 | */
|
5387 | type: 'node';
|
5388 | /**
|
5389 | * If provided the The `pos` must be directly before the node in order to be
|
5390 | * valid. If not provided it will select the parent node of the current
|
5391 | * selection.
|
5392 | */
|
5393 | pos: number | null;
|
5394 | }
|
5395 |
|
5396 | export { NodeSpecOverride }
|
5397 |
|
5398 | export { NodeStringHandlerOptions }
|
5399 |
|
5400 | export { NodeType }
|
5401 |
|
5402 | export { NodeTypeProps }
|
5403 |
|
5404 | export { NodeTypesProps }
|
5405 |
|
5406 | export { NodeView }
|
5407 |
|
5408 | export { NodeViewMethod }
|
5409 |
|
5410 | /**
|
5411 | * This extension allows others extension to add the `createNodeView` method
|
5412 | * for creating nodeViews which alter how the dom is rendered for the node.
|
5413 | *
|
5414 | * @remarks
|
5415 | *
|
5416 | * This is an example of adding custom functionality to an extension via the
|
5417 | * `ExtensionParameterMethods`.
|
5418 | *
|
5419 | * @category Builtin Extension
|
5420 | */
|
5421 | declare class NodeViewsExtension extends PlainExtension {
|
5422 | get name(): "nodeViews";
|
5423 | createPlugin(): CreateExtensionPlugin;
|
5424 | }
|
5425 | export { NodeViewsExtension }
|
5426 | export { NodeViewsExtension as NodeViewsExtension_alias_1 }
|
5427 | export { NodeViewsExtension as NodeViewsExtension_alias_2 }
|
5428 |
|
5429 | export { NodeWithAttributes }
|
5430 |
|
5431 | export { NodeWithAttributesProps }
|
5432 |
|
5433 | export { NodeWithPosition }
|
5434 |
|
5435 | export { NON_BREAKING_SPACE_CHAR }
|
5436 |
|
5437 | export { nonChainable }
|
5438 |
|
5439 | declare interface NonChainableCommandDecoratorOptions<Options extends Shape> extends Remirror.CommandDecoratorOptions<Options> {
|
5440 | /**
|
5441 | * Set this to `true` to disable chaining of this command. This means it will
|
5442 | * no longer be available when running `
|
5443 | *
|
5444 | * @defaultValue false
|
5445 | */
|
5446 | disableChaining: true;
|
5447 | }
|
5448 |
|
5449 | export { NonChainableCommandFunction }
|
5450 |
|
5451 | export { NonNullableShape }
|
5452 |
|
5453 | export { noop }
|
5454 |
|
5455 | export { NULL_CHARACTER }
|
5456 |
|
5457 | export { Nullable }
|
5458 |
|
5459 | export { object }
|
5460 |
|
5461 | export { ObjectMark }
|
5462 |
|
5463 | export { ObservableLike }
|
5464 |
|
5465 | export { omit }
|
5466 |
|
5467 | export { omitExtraAttributes }
|
5468 |
|
5469 | export { omitUndefined }
|
5470 |
|
5471 | declare interface OnSetOptionsProps<Options extends ValidOptions> extends Pick<GetChangeOptionsReturn<Options>, 'changes' | 'pickChanged'>, UpdateReasonProps {
|
5472 | |
5473 |
|
5474 |
|
5475 | initialOptions: RemoveAnnotations<GetFixedDynamic<Options>>;
|
5476 | |
5477 |
|
5478 |
|
5479 |
|
5480 | options: RemoveAnnotations<GetFixedDynamic<Options>>;
|
5481 | }
|
5482 | export { OnSetOptionsProps }
|
5483 | export { OnSetOptionsProps as OnSetOptionsProps_alias_1 }
|
5484 |
|
5485 | export { Opaque }
|
5486 |
|
5487 | export { OptionalMarkProps }
|
5488 |
|
5489 | export { OptionalProsemirrorNodeProps }
|
5490 |
|
5491 |
|
5492 |
|
5493 |
|
5494 |
|
5495 | declare type OptionsOfConstructor<Constructor extends AnyConstructor> = GetOptions<InstanceType<Constructor>>;
|
5496 | export { OptionsOfConstructor }
|
5497 | export { OptionsOfConstructor as OptionsOfConstructor_alias_1 }
|
5498 |
|
5499 | export { PackageJson }
|
5500 |
|
5501 | export { ParsedDomSize }
|
5502 |
|
5503 | export { parseSizeUnit }
|
5504 |
|
5505 | export { PartialDeep }
|
5506 |
|
5507 | export { PartialWithRequiredKeys }
|
5508 |
|
5509 | export { PascalCase }
|
5510 |
|
5511 | export { pascalCase }
|
5512 |
|
5513 |
|
5514 |
|
5515 |
|
5516 |
|
5517 |
|
5518 |
|
5519 |
|
5520 | declare class PasteRulesExtension extends PlainExtension {
|
5521 | get name(): "pasteRules";
|
5522 | createExternalPlugins(): ProsemirrorPlugin[];
|
5523 | private generatePasteRulesPlugin;
|
5524 | }
|
5525 | export { PasteRulesExtension }
|
5526 | export { PasteRulesExtension as PasteRulesExtension_alias_1 }
|
5527 | export { PasteRulesExtension as PasteRulesExtension_alias_2 }
|
5528 |
|
5529 | declare interface PasteRulesOptions {
|
5530 | }
|
5531 | export { PasteRulesOptions }
|
5532 | export { PasteRulesOptions as PasteRulesOptions_alias_1 }
|
5533 | export { PasteRulesOptions as PasteRulesOptions_alias_2 }
|
5534 |
|
5535 | export { pathCase }
|
5536 |
|
5537 | export { pick }
|
5538 |
|
5539 | declare type PickChanged<Options extends ValidOptions> = <Key extends keyof GetFixedDynamic<Options>>(keys: Key[]) => Partial<Pick<GetFixedDynamic<Options>, Key>>;
|
5540 | export { PickChanged }
|
5541 | export { PickChanged as PickChanged_alias_1 }
|
5542 |
|
5543 | export { PickPartial }
|
5544 |
|
5545 | export { PickRequired }
|
5546 |
|
5547 | declare interface PlaceholderConfig extends TextProps {
|
5548 | className: string;
|
5549 | }
|
5550 | export { PlaceholderConfig }
|
5551 | export { PlaceholderConfig as PlaceholderConfig_alias_1 }
|
5552 | export { PlaceholderConfig as PlaceholderConfig_alias_2 }
|
5553 |
|
5554 | export declare type PlaceholderPluginAction = AddPlaceholderAction | RemovePlaceholderAction;
|
5555 |
|
5556 |
|
5557 |
|
5558 |
|
5559 |
|
5560 |
|
5561 |
|
5562 | declare abstract class PlainExtension<Options extends ValidOptions = EmptyShape> extends Extension<Options> {
|
5563 |
|
5564 | static get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.PlainExtensionConstructor;
|
5565 |
|
5566 | get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.PlainExtension;
|
5567 | }
|
5568 | export { PlainExtension }
|
5569 | export { PlainExtension as PlainExtension_alias_1 }
|
5570 | export { PlainExtension as PlainExtension_alias_2 }
|
5571 |
|
5572 | export { plainInputRule }
|
5573 |
|
5574 | export { PluginKey }
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 | declare class PluginsExtension extends PlainExtension<PluginsOptions> {
|
5588 | get name(): "plugins";
|
5589 | |
5590 |
|
5591 |
|
5592 | private plugins;
|
5593 | |
5594 |
|
5595 |
|
5596 | private managerPlugins;
|
5597 | |
5598 |
|
5599 |
|
5600 | private readonly applyStateHandlers;
|
5601 | |
5602 |
|
5603 |
|
5604 | private readonly initStateHandlers;
|
5605 | |
5606 |
|
5607 |
|
5608 | private readonly appendTransactionHandlers;
|
5609 | |
5610 |
|
5611 |
|
5612 | private readonly pluginKeys;
|
5613 | |
5614 |
|
5615 |
|
5616 | private readonly stateGetters;
|
5617 | |
5618 |
|
5619 |
|
5620 | onCreate(): void;
|
5621 | |
5622 |
|
5623 |
|
5624 |
|
5625 | createPlugin(): CreateExtensionPlugin<void>;
|
5626 | |
5627 |
|
5628 |
|
5629 | private extractExtensionPlugins;
|
5630 | private readonly getPluginStateCreator;
|
5631 | |
5632 |
|
5633 |
|
5634 | private updatePlugins;
|
5635 | private readonly getStateByName;
|
5636 | |
5637 |
|
5638 |
|
5639 |
|
5640 | private updateExtensionStore;
|
5641 | |
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 |
|
5647 |
|
5648 |
|
5649 |
|
5650 | private updateExtensionPlugins;
|
5651 | |
5652 |
|
5653 |
|
5654 |
|
5655 | private dispatchPluginUpdate;
|
5656 | }
|
5657 | export { PluginsExtension }
|
5658 | export { PluginsExtension as PluginsExtension_alias_1 }
|
5659 | export { PluginsExtension as PluginsExtension_alias_2 }
|
5660 |
|
5661 | declare interface PluginsOptions {
|
5662 | |
5663 |
|
5664 |
|
5665 |
|
5666 | applyState?: Handler<(props: ApplyStateLifecycleProps) => void>;
|
5667 | |
5668 |
|
5669 |
|
5670 |
|
5671 | appendTransaction?: Handler<(props: AppendLifecycleProps) => void>;
|
5672 | }
|
5673 | export { PluginsOptions }
|
5674 | export { PluginsOptions as PluginsOptions_alias_1 }
|
5675 | export { PluginsOptions as PluginsOptions_alias_2 }
|
5676 |
|
5677 | export { PosProps }
|
5678 |
|
5679 | export { Predicate }
|
5680 |
|
5681 | export { PredicateProps }
|
5682 |
|
5683 | export { preserveSelection }
|
5684 |
|
5685 | export { Primitive }
|
5686 |
|
5687 | export { PrimitiveSelection }
|
5688 |
|
5689 |
|
5690 |
|
5691 |
|
5692 | declare type PrioritizedKeyBindings = KeyBindings | KeyBindingsTuple;
|
5693 | export { PrioritizedKeyBindings }
|
5694 | export { PrioritizedKeyBindings as PrioritizedKeyBindings_alias_1 }
|
5695 | export { PrioritizedKeyBindings as PrioritizedKeyBindings_alias_2 }
|
5696 |
|
5697 | export { Promisable }
|
5698 |
|
5699 | export { ProsemirrorAttributes }
|
5700 |
|
5701 | export { ProsemirrorCommandFunction }
|
5702 |
|
5703 | export { ProsemirrorKeyBindings }
|
5704 |
|
5705 | export { ProsemirrorNode }
|
5706 |
|
5707 | export { ProsemirrorNodeProps }
|
5708 |
|
5709 | export { prosemirrorNodeToDom }
|
5710 |
|
5711 | export { prosemirrorNodeToHtml }
|
5712 |
|
5713 | export { ProsemirrorPlugin }
|
5714 |
|
5715 | export { randomFloat }
|
5716 |
|
5717 | export { randomInt }
|
5718 |
|
5719 | export { range }
|
5720 |
|
5721 | export { rangeHasMark }
|
5722 |
|
5723 | export { RangeProps }
|
5724 |
|
5725 | export { ReadonlyDeep }
|
5726 |
|
5727 | export { RegExpProps }
|
5728 |
|
5729 | export { REMIRROR_WEBVIEW_NAME }
|
5730 |
|
5731 | export { RemirrorContentType }
|
5732 |
|
5733 | export { RemirrorError }
|
5734 |
|
5735 | export { RemirrorErrorOptions }
|
5736 |
|
5737 | declare type RemirrorEventListener<Extension extends AnyExtension> = (params: RemirrorEventListenerProps<Extension>) => void;
|
5738 | export { RemirrorEventListener }
|
5739 | export { RemirrorEventListener as RemirrorEventListener_alias_1 }
|
5740 | export { RemirrorEventListener as RemirrorEventListener_alias_2 }
|
5741 |
|
5742 | declare interface RemirrorEventListenerProps<Extension extends AnyExtension> extends EditorStateProps, Remirror.ListenerProperties<Extension>, EditorViewProps {
|
5743 | |
5744 |
|
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 |
|
5750 |
|
5751 |
|
5752 |
|
5753 |
|
5754 |
|
5755 | tr?: Transaction;
|
5756 | |
5757 |
|
5758 |
|
5759 |
|
5760 |
|
5761 |
|
5762 |
|
5763 |
|
5764 | transactions?: readonly Transaction[];
|
5765 | |
5766 |
|
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 |
|
5772 |
|
5773 | internalUpdate: boolean;
|
5774 | |
5775 |
|
5776 |
|
5777 |
|
5778 | firstRender: boolean;
|
5779 | |
5780 |
|
5781 |
|
5782 | previousState: EditorState;
|
5783 | |
5784 |
|
5785 |
|
5786 | createStateFromContent: CreateStateFromContent;
|
5787 | }
|
5788 | export { RemirrorEventListenerProps }
|
5789 | export { RemirrorEventListenerProps as RemirrorEventListenerProps_alias_1 }
|
5790 | export { RemirrorEventListenerProps as RemirrorEventListenerProps_alias_2 }
|
5791 |
|
5792 | export { RemirrorIdentifier }
|
5793 |
|
5794 | export { RemirrorIdentifierShape }
|
5795 |
|
5796 | export { RemirrorJSON }
|
5797 |
|
5798 |
|
5799 |
|
5800 |
|
5801 |
|
5802 |
|
5803 |
|
5804 |
|
5805 |
|
5806 |
|
5807 |
|
5808 |
|
5809 |
|
5810 |
|
5811 |
|
5812 |
|
5813 |
|
5814 |
|
5815 |
|
5816 |
|
5817 |
|
5818 |
|
5819 |
|
5820 |
|
5821 |
|
5822 |
|
5823 |
|
5824 |
|
5825 |
|
5826 |
|
5827 |
|
5828 |
|
5829 |
|
5830 |
|
5831 |
|
5832 |
|
5833 |
|
5834 |
|
5835 |
|
5836 |
|
5837 |
|
5838 |
|
5839 |
|
5840 |
|
5841 |
|
5842 |
|
5843 |
|
5844 |
|
5845 |
|
5846 |
|
5847 | declare class RemirrorManager<Extension extends AnyExtension> {
|
5848 | #private;
|
5849 | |
5850 |
|
5851 |
|
5852 | static create<Extension extends AnyExtension>(extensions: Extension[] | ExtensionTemplate<Extension>, settings?: Remirror.ManagerSettings): RemirrorManager<Extension | BuiltinPreset>;
|
5853 | |
5854 |
|
5855 |
|
5856 |
|
5857 |
|
5858 | get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.Manager;
|
5859 | |
5860 |
|
5861 |
|
5862 | get destroyed(): boolean;
|
5863 | |
5864 |
|
5865 |
|
5866 |
|
5867 | get mounted(): boolean;
|
5868 | |
5869 |
|
5870 |
|
5871 |
|
5872 |
|
5873 |
|
5874 |
|
5875 |
|
5876 |
|
5877 |
|
5878 |
|
5879 |
|
5880 |
|
5881 |
|
5882 |
|
5883 |
|
5884 |
|
5885 |
|
5886 |
|
5887 |
|
5888 |
|
5889 |
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 |
|
5895 |
|
5896 |
|
5897 |
|
5898 |
|
5899 |
|
5900 |
|
5901 |
|
5902 | get output(): FrameworkOutput<Extension> | undefined;
|
5903 | |
5904 |
|
5905 |
|
5906 |
|
5907 |
|
5908 | get frameworkAttached(): boolean;
|
5909 | |
5910 |
|
5911 |
|
5912 | get extensions(): ReadonlyArray<GetExtensions<Extension>>;
|
5913 | |
5914 |
|
5915 |
|
5916 |
|
5917 |
|
5918 | get stringHandlers(): NamedStringHandlers;
|
5919 | |
5920 |
|
5921 |
|
5922 | get store(): Remirror.ManagerStore<Extension>;
|
5923 | |
5924 |
|
5925 |
|
5926 | get extensionStore(): Remirror.ExtensionStore;
|
5927 | |
5928 |
|
5929 |
|
5930 |
|
5931 |
|
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 | get tr(): Transaction;
|
5938 | |
5939 |
|
5940 |
|
5941 | get nodes(): Record<this['~N'], NodeExtensionSpec>;
|
5942 | |
5943 |
|
5944 |
|
5945 | get marks(): Record<this['~M'], MarkExtensionSpec>;
|
5946 | |
5947 |
|
5948 |
|
5949 |
|
5950 | get schema(): EditorSchema;
|
5951 | |
5952 |
|
5953 |
|
5954 | get extensionTags(): Readonly<CombinedTags<GetNameUnion<Extension>>>;
|
5955 | |
5956 |
|
5957 |
|
5958 | get view(): EditorView;
|
5959 | |
5960 |
|
5961 |
|
5962 | get settings(): Remirror.ManagerSettings;
|
5963 | |
5964 |
|
5965 |
|
5966 | get document(): Document;
|
5967 | |
5968 |
|
5969 |
|
5970 |
|
5971 |
|
5972 |
|
5973 |
|
5974 | private constructor();
|
5975 | /**
|
5976 | * Loops through all extensions to set up the lifecycle handlers.
|
5977 | */
|
5978 | private setupLifecycleHandlers;
|
5979 | /**
|
5980 | * Set the string handler to use for a given name.
|
5981 | *
|
5982 | * This allows users to set the string handler
|
5983 | */
|
5984 | private setStringHandler;
|
5985 | /**
|
5986 | * Set the manager value for the provided key. This is used by extensions to
|
5987 | * add data to the manager.
|
5988 | */
|
5989 | private setStoreKey;
|
5990 | /**
|
5991 | * Get the manager value for the provided key. This is used by extensions to
|
5992 | * get data from the manager.
|
5993 | */
|
5994 | private getStoreKey;
|
5995 | /**
|
5996 | * A method to set values in the extension store which is made available to
|
5997 | * extension.
|
5998 | *
|
5999 | * **NOTE** This method should only be used in the `onCreate` extension method
|
6000 | * or it will throw an error.
|
6001 | */
|
6002 | private setExtensionStore;
|
6003 | /**
|
6004 | * Create the initial store.
|
6005 | */
|
6006 | private createExtensionStore;
|
6007 | /**
|
6008 | * A state getter method which is passed into the params.
|
6009 | */
|
6010 | private readonly getState;
|
6011 | /**
|
6012 | * Stores the editor view on the manager
|
6013 | *
|
6014 | * @param view - the editor view
|
6015 | */
|
6016 | addView(view: EditorView): this;
|
6017 | /**
|
6018 | * Attach a framework to the manager.
|
6019 | */
|
6020 | attachFramework(framework: BaseFramework<Extension>, updateHandler: (props: StateUpdateLifecycleProps) => void): void;
|
6021 | /**
|
6022 | * Create an empty document for the editor based on the current schema.
|
6023 | *
|
6024 | * This automatically looks at the supported content for the doc and the
|
6025 | * available nodes which fulfil that content in order to create a document
|
6026 | * with only the minimal required content.
|
6027 | *
|
6028 | * This can be used in conjunction with the create state to reset the current
|
6029 | * value of the editor.
|
6030 | */
|
6031 | createEmptyDoc(): ProsemirrorNode;
|
6032 | /**
|
6033 | * Create the editor state from content passed to this extension manager.
|
6034 | */
|
6035 | createState(props?: CreateEditorStateProps): EditorState_2;
|
6036 | /**
|
6037 | * Add a handler to the manager.
|
6038 | *
|
6039 | * Currently the only event that can be listened to is the `destroy` event.
|
6040 | */
|
6041 | addHandler<Key extends keyof ManagerEvents>(event: Key, cb: ManagerEvents[Key]): Unsubscribe;
|
6042 | /**
|
6043 | * Update the state of the view and trigger the `onStateUpdate` lifecycle
|
6044 | * method as well.
|
6045 | */
|
6046 | private readonly updateState;
|
6047 | /**
|
6048 | * This method should be called by the view layer every time the state is
|
6049 | * updated.
|
6050 | *
|
6051 | * An example usage of this is within the collaboration extension.
|
6052 | */
|
6053 | onStateUpdate(props: Omit<StateUpdateLifecycleProps, 'firstUpdate'>): void;
|
6054 | /**
|
6055 | * Get the extension instance matching the provided constructor from the
|
6056 | * manager.
|
6057 | *
|
6058 | * This will throw an error if non existent.
|
6059 | */
|
6060 | getExtension<ExtensionConstructor extends AnyExtensionConstructor>(Constructor: ExtensionConstructor): InstanceType<ExtensionConstructor>;
|
6061 | /**
|
6062 | * Determines in an extension is present by providing the desired
|
6063 | * `Constructor`.
|
6064 | *
|
6065 | * This method can be used as a safer alternative to getExtension which
|
6066 | * will throw an error if the constructor doesn't exist within the
|
6067 | * extension created by this extension.
|
6068 | */
|
6069 | hasExtension<ExtensionConstructor extends AnyExtensionConstructor>(Constructor: ExtensionConstructor): boolean;
|
6070 | /**
|
6071 | * Make a clone of the manager.
|
6072 | *
|
6073 | * @internalremarks What about the state stored in the extensions and presets,
|
6074 | * does this need to be recreated as well?
|
6075 | */
|
6076 | clone(): RemirrorManager<Extension>;
|
6077 | /**
|
6078 | * Recreate the manager with new settings and extensions
|
6079 | */
|
6080 | recreate<ExtraExtension extends AnyExtension>(extensions?: ExtraExtension[], settings?: Remirror.ManagerSettings): RemirrorManager<Extension | ExtraExtension>;
|
6081 | /**
|
6082 | * This method should be called to destroy the manager and remove the view.
|
6083 | */
|
6084 | destroy(): void;
|
6085 | /**
|
6086 | * Check whether the manager includes the names or constructors provided for
|
6087 | * the preset and extensions.
|
6088 | *
|
6089 | * Returns true if all are included, returns false otherwise.
|
6090 | */
|
6091 | includes(mustIncludeList: Array<AnyExtensionConstructor | string>): boolean;
|
6092 | }
|
6093 |
|
6094 | declare interface RemirrorManager<Extension extends AnyExtension> {
|
6095 | /**
|
6096 | * The constructor for the [[`RemirrorManager`]].
|
6097 | */
|
6098 | constructor: RemirrorManagerConstructor;
|
6099 | /**
|
6100 | * Pseudo type property which contains the recursively extracted `Extension`
|
6101 | * stored by this manager.
|
6102 | *
|
6103 | * @internal
|
6104 | */
|
6105 | ['~E']: Extension;
|
6106 | /**
|
6107 | * `AllNames`
|
6108 | *
|
6109 | * Get all the names of the extensions within this editor.
|
6110 | *
|
6111 | * @internal
|
6112 | */
|
6113 | ['~AN']: GetNameUnion<Extension> extends never ? string : GetNameUnion<Extension>;
|
6114 | /**
|
6115 | * `NodeNames`
|
6116 | *
|
6117 | * Type inference hack for node extension names. This is the only way I know
|
6118 | * to store types on a class.
|
6119 | *
|
6120 | * @internal
|
6121 | */
|
6122 | ['~N']: GetNodeNameUnion<Extension> extends never ? string : GetNodeNameUnion<Extension>;
|
6123 | /**
|
6124 | * `MarkNames`
|
6125 | *
|
6126 | * Type inference hack for mark extension names. This is the only way I know
|
6127 | * to store types on a class.
|
6128 | *
|
6129 | * @internal
|
6130 | */
|
6131 | ['~M']: GetMarkNameUnion<Extension> extends never ? string : GetMarkNameUnion<Extension>;
|
6132 | /**
|
6133 | * `PlainNames`
|
6134 | *
|
6135 | * Type inference hack for all the plain extension names. This is the only way
|
6136 | * I know to store types on a class.
|
6137 | *
|
6138 | * @internal
|
6139 | */
|
6140 | ['~P']: GetPlainNameUnion<Extension> extends never ? string : GetPlainNameUnion<Extension>;
|
6141 | }
|
6142 | export { RemirrorManager }
|
6143 | export { RemirrorManager as RemirrorManager_alias_1 }
|
6144 | export { RemirrorManager as RemirrorManager_alias_2 }
|
6145 |
|
6146 | declare interface RemirrorManagerConstructor extends Function {
|
6147 | create<Extension extends AnyExtension>(extension: Extension[], settings?: Remirror.ManagerSettings): RemirrorManager<Extension | BuiltinPreset>;
|
6148 | }
|
6149 |
|
6150 | export { RemirrorMessage }
|
6151 |
|
6152 | export { RemoveAnnotation }
|
6153 |
|
6154 | export { RemoveAnnotations }
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 | declare type RemoveAny<Extension> = Extension extends Extension ? AnyExtension extends Extension ? never : Extension : never;
|
6163 | export { RemoveAny }
|
6164 | export { RemoveAny as RemoveAny_alias_1 }
|
6165 | export { RemoveAny as RemoveAny_alias_2 }
|
6166 |
|
6167 | export { RemoveFlavoring }
|
6168 |
|
6169 |
|
6170 |
|
6171 |
|
6172 | declare type RemoveHelper<Type> = Type extends Helper<infer T> ? T : Type;
|
6173 |
|
6174 | declare type RemoveHelpers<Type extends Record<string, AnyFunction>> = {
|
6175 | [Key in keyof Type]: (...args: Parameters<Type[Key]>) => RemoveHelper<ReturnType<Type[Key]>>;
|
6176 | };
|
6177 |
|
6178 | export { removeMark }
|
6179 |
|
6180 | export { RemoveMarkProps }
|
6181 |
|
6182 | export { removeNodeAfter }
|
6183 |
|
6184 | export { removeNodeAtPosition }
|
6185 |
|
6186 | export { removeNodeBefore }
|
6187 |
|
6188 | declare interface RemovePlaceholderAction {
|
6189 | type: ActionType.REMOVE_PLACEHOLDER;
|
6190 | id: string;
|
6191 | }
|
6192 |
|
6193 | export { Replace }
|
6194 |
|
6195 | export { replaceNodeAtPosition }
|
6196 |
|
6197 | export { replaceText }
|
6198 |
|
6199 | export { ReplaceTextProps }
|
6200 |
|
6201 | export { RequireAtLeastOne }
|
6202 |
|
6203 | export { RequireExactlyOne }
|
6204 |
|
6205 | export { ResolvedPos }
|
6206 |
|
6207 | export { ResolvedPosProps }
|
6208 |
|
6209 | export { SchemaAttributes }
|
6210 |
|
6211 | export { SchemaAttributesObject }
|
6212 |
|
6213 |
|
6214 |
|
6215 |
|
6216 |
|
6217 |
|
6218 |
|
6219 |
|
6220 |
|
6221 |
|
6222 |
|
6223 |
|
6224 |
|
6225 |
|
6226 |
|
6227 |
|
6228 |
|
6229 |
|
6230 |
|
6231 |
|
6232 |
|
6233 |
|
6234 |
|
6235 |
|
6236 |
|
6237 |
|
6238 |
|
6239 |
|
6240 |
|
6241 |
|
6242 |
|
6243 |
|
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 |
|
6253 |
|
6254 |
|
6255 | declare class SchemaExtension extends PlainExtension {
|
6256 | get name(): "schema";
|
6257 | |
6258 |
|
6259 |
|
6260 |
|
6261 |
|
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 |
|
6267 |
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 | private readonly dynamicAttributes;
|
6274 | |
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 | onCreate(): void;
|
6280 | |
6281 |
|
6282 |
|
6283 |
|
6284 | createPlugin(): CreateExtensionPlugin;
|
6285 | |
6286 |
|
6287 |
|
6288 | private addSchema;
|
6289 | |
6290 |
|
6291 |
|
6292 |
|
6293 |
|
6294 |
|
6295 |
|
6296 |
|
6297 |
|
6298 |
|
6299 |
|
6300 |
|
6301 | private checkAndUpdateDynamicNodes;
|
6302 | |
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 |
|
6313 |
|
6314 | private checkAndUpdateDynamicMarks;
|
6315 | |
6316 |
|
6317 |
|
6318 | private gatherExtraAttributes;
|
6319 | }
|
6320 | export { SchemaExtension }
|
6321 | export { SchemaExtension as SchemaExtension_alias_1 }
|
6322 | export { SchemaExtension as SchemaExtension_alias_2 }
|
6323 |
|
6324 | export { SchemaJSON }
|
6325 |
|
6326 | export { SchemaProps }
|
6327 |
|
6328 | export { schemaToJSON }
|
6329 |
|
6330 | export { SELECTED_NODE_CLASS_NAME }
|
6331 |
|
6332 | export { SELECTED_NODE_CLASS_SELECTOR }
|
6333 |
|
6334 | export { Selection_2 as Selection }
|
6335 |
|
6336 | export { SelectionProps }
|
6337 |
|
6338 | export { set }
|
6339 |
|
6340 | export { setBlockType }
|
6341 |
|
6342 | export { SetOptional }
|
6343 |
|
6344 | export { SetRequired }
|
6345 |
|
6346 | export { SetReturnType }
|
6347 |
|
6348 | export { setStyle }
|
6349 |
|
6350 | declare interface SetupExtensionProps {
|
6351 | extension: AnyExtension;
|
6352 | nodeNames: string[];
|
6353 | markNames: string[];
|
6354 | plainNames: string[];
|
6355 | store: Remirror.ExtensionStore;
|
6356 | handlers: ManagerLifecycleHandlers;
|
6357 | }
|
6358 |
|
6359 | declare function setUploadPlaceholderAction(tr: Transaction_2, action: PlaceholderPluginAction): Transaction_2;
|
6360 | export { setUploadPlaceholderAction }
|
6361 | export { setUploadPlaceholderAction as setUploadPlaceholderAction_alias_1 }
|
6362 | export { setUploadPlaceholderAction as setUploadPlaceholderAction_alias_2 }
|
6363 | export { setUploadPlaceholderAction as setUploadPlaceholderAction_alias_3 }
|
6364 |
|
6365 | export { shallowClone }
|
6366 |
|
6367 | export { Shape }
|
6368 |
|
6369 |
|
6370 |
|
6371 |
|
6372 | declare type ShortcutMap = Record<NamedShortcut, string>;
|
6373 | export { ShortcutMap }
|
6374 | export { ShortcutMap as ShortcutMap_alias_1 }
|
6375 | export { ShortcutMap as ShortcutMap_alias_2 }
|
6376 |
|
6377 | export { ShouldSkipFunction }
|
6378 |
|
6379 | export { ShouldSkipProps }
|
6380 |
|
6381 | export { shouldUseDomEnvironment }
|
6382 |
|
6383 | export { Simplify }
|
6384 |
|
6385 | export { SkippableInputRule }
|
6386 |
|
6387 | export { Slice }
|
6388 |
|
6389 | export { SnakeCase }
|
6390 |
|
6391 | export { snakeCase }
|
6392 |
|
6393 | export { sort }
|
6394 |
|
6395 | export { spaceCase }
|
6396 |
|
6397 | export { startCase }
|
6398 |
|
6399 | export { startPositionOfParent }
|
6400 |
|
6401 | export { STATE_OVERRIDE }
|
6402 |
|
6403 | export { StateJSON }
|
6404 |
|
6405 | declare interface StateUpdateLifecycleProps extends EditorStateProps {
|
6406 | |
6407 |
|
6408 |
|
6409 | previousState: EditorState;
|
6410 | |
6411 |
|
6412 |
|
6413 |
|
6414 |
|
6415 | firstUpdate: boolean;
|
6416 | |
6417 |
|
6418 |
|
6419 |
|
6420 |
|
6421 |
|
6422 |
|
6423 |
|
6424 |
|
6425 |
|
6426 |
|
6427 |
|
6428 | tr?: Transaction;
|
6429 | |
6430 |
|
6431 |
|
6432 |
|
6433 |
|
6434 |
|
6435 |
|
6436 |
|
6437 | transactions?: readonly Transaction[];
|
6438 | }
|
6439 | export { StateUpdateLifecycleProps }
|
6440 | export { StateUpdateLifecycleProps as StateUpdateLifecycleProps_alias_1 }
|
6441 |
|
6442 | export { Static }
|
6443 |
|
6444 | export { StaticKey }
|
6445 |
|
6446 | export { StaticKeyList }
|
6447 |
|
6448 | declare interface StaticKeysProps<Options extends Shape = EmptyShape> {
|
6449 | |
6450 |
|
6451 |
|
6452 | staticKeys: StaticKeyList<Options>;
|
6453 | }
|
6454 |
|
6455 | export { StaticShape }
|
6456 |
|
6457 | export { StrictReplace }
|
6458 |
|
6459 | export { StringHandler }
|
6460 |
|
6461 | export { StringHandlerOptions }
|
6462 |
|
6463 | export { StringHandlerProps }
|
6464 |
|
6465 | export { Stringified }
|
6466 |
|
6467 | export { StringKey }
|
6468 |
|
6469 |
|
6470 |
|
6471 |
|
6472 |
|
6473 |
|
6474 |
|
6475 |
|
6476 |
|
6477 |
|
6478 |
|
6479 |
|
6480 | declare class SuggestExtension extends PlainExtension<SuggestOptions> {
|
6481 | get name(): "suggest";
|
6482 | |
6483 |
|
6484 |
|
6485 |
|
6486 |
|
6487 |
|
6488 | onCreate(): void;
|
6489 | |
6490 |
|
6491 |
|
6492 | createExternalPlugins(): ProsemirrorPlugin[];
|
6493 | |
6494 |
|
6495 |
|
6496 |
|
6497 | onAddCustomHandler: AddCustomHandler<SuggestOptions>;
|
6498 | |
6499 |
|
6500 |
|
6501 |
|
6502 |
|
6503 |
|
6504 |
|
6505 | getSuggestState(state?: EditorState): Helper<SuggestState>;
|
6506 | |
6507 |
|
6508 |
|
6509 | getSuggestMethods(): Helper<Pick<SuggestState, 'addIgnored' | 'clearIgnored' | 'removeIgnored' | 'ignoreNextExit' | 'setMarkRemoved' | 'findMatchAtPosition' | 'findNextTextSelection' | 'setLastChangeFromAppend'>>;
|
6510 | |
6511 |
|
6512 |
|
6513 |
|
6514 |
|
6515 |
|
6516 | isSuggesterActive(name: string | string[]): Helper<boolean>;
|
6517 | }
|
6518 | export { SuggestExtension }
|
6519 | export { SuggestExtension as SuggestExtension_alias_1 }
|
6520 | export { SuggestExtension as SuggestExtension_alias_2 }
|
6521 |
|
6522 | declare interface SuggestOptions {
|
6523 | |
6524 |
|
6525 |
|
6526 | suggester: CustomHandler<Suggester>;
|
6527 | }
|
6528 | export { SuggestOptions }
|
6529 | export { SuggestOptions as SuggestOptions_alias_1 }
|
6530 | export { SuggestOptions as SuggestOptions_alias_2 }
|
6531 |
|
6532 |
|
6533 |
|
6534 |
|
6535 |
|
6536 |
|
6537 |
|
6538 |
|
6539 |
|
6540 | declare class TagsExtension extends PlainExtension {
|
6541 | get name(): "tags";
|
6542 | |
6543 |
|
6544 |
|
6545 | private allTags;
|
6546 | |
6547 |
|
6548 |
|
6549 | private plainTags;
|
6550 | |
6551 |
|
6552 |
|
6553 | private markTags;
|
6554 | |
6555 |
|
6556 |
|
6557 | private nodeTags;
|
6558 | |
6559 |
|
6560 |
|
6561 |
|
6562 | onCreate(): void;
|
6563 | |
6564 |
|
6565 |
|
6566 | private resetTags;
|
6567 | |
6568 |
|
6569 |
|
6570 | private updateTagForExtension;
|
6571 | }
|
6572 | export { TagsExtension }
|
6573 | export { TagsExtension as TagsExtension_alias_1 }
|
6574 | export { TagsExtension as TagsExtension_alias_2 }
|
6575 |
|
6576 | export { take }
|
6577 |
|
6578 | export { textBetween }
|
6579 |
|
6580 | export { TextProps }
|
6581 |
|
6582 | export { throttle }
|
6583 |
|
6584 | export { ThrottledFunction }
|
6585 |
|
6586 |
|
6587 |
|
6588 |
|
6589 |
|
6590 |
|
6591 |
|
6592 | export declare function throwIfNameNotUnique(props: IsNameUniqueProps): void;
|
6593 |
|
6594 | export { toggleBlockItem }
|
6595 |
|
6596 | export { ToggleBlockItemProps }
|
6597 |
|
6598 |
|
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 |
|
6604 |
|
6605 |
|
6606 |
|
6607 |
|
6608 |
|
6609 |
|
6610 |
|
6611 |
|
6612 |
|
6613 |
|
6614 | declare function toggleMark(props: ToggleMarkProps): CommandFunction;
|
6615 | export { toggleMark }
|
6616 | export { toggleMark as toggleMark_alias_1 }
|
6617 |
|
6618 | export declare interface ToggleMarkProps extends MarkTypeProps, Partial<AttributesProps> {
|
6619 | |
6620 |
|
6621 |
|
6622 | range?: FromToProps;
|
6623 | |
6624 |
|
6625 |
|
6626 | selection?: PrimitiveSelection;
|
6627 | }
|
6628 |
|
6629 | export { toggleWrap }
|
6630 |
|
6631 | export { toString_2 as toString }
|
6632 |
|
6633 | export { Transaction }
|
6634 |
|
6635 | export { TransactionProps }
|
6636 |
|
6637 | export { TransactionTransformer }
|
6638 |
|
6639 |
|
6640 |
|
6641 |
|
6642 |
|
6643 |
|
6644 |
|
6645 |
|
6646 |
|
6647 |
|
6648 |
|
6649 |
|
6650 |
|
6651 |
|
6652 | export declare function transformExtensions<RawExtensions extends AnyExtension>(initialExtensions: readonly RawExtensions[], settings: Remirror.ManagerSettings): ExtensionTransformation<RawExtensions>;
|
6653 |
|
6654 | declare interface TriggerChangeProps {
|
6655 | |
6656 |
|
6657 |
|
6658 |
|
6659 |
|
6660 | triggerChange?: boolean;
|
6661 | }
|
6662 | export { TriggerChangeProps }
|
6663 | export { TriggerChangeProps as TriggerChangeProps_alias_1 }
|
6664 | export { TriggerChangeProps as TriggerChangeProps_alias_2 }
|
6665 |
|
6666 | export { TrStateProps }
|
6667 |
|
6668 | export { TsConfigJson }
|
6669 |
|
6670 | export { TupleOf }
|
6671 |
|
6672 | export { TupleUnion }
|
6673 |
|
6674 | export { TupleValue }
|
6675 |
|
6676 | export { TypedArray }
|
6677 |
|
6678 | declare interface UiAnnotation {
|
6679 | __uiAnnotation?: never;
|
6680 | }
|
6681 |
|
6682 | declare type UiCommandFunction = CommandFunction & UiAnnotation;
|
6683 | export { UiCommandFunction }
|
6684 | export { UiCommandFunction as UiCommandFunction_alias_1 }
|
6685 | export { UiCommandFunction as UiCommandFunction_alias_2 }
|
6686 |
|
6687 |
|
6688 |
|
6689 |
|
6690 |
|
6691 |
|
6692 | declare type UiCommandNames<Extension extends AnyExtension> = StringKey<ConditionalPick<{
|
6693 | [P in keyof UnionToIntersection<GetDecoratedUiCommands<Extension>>]: keyof UnionToIntersection<GetDecoratedUiCommands<Extension>>[P] extends '__uiAnnotation' ? true : false;
|
6694 | }, true>>;
|
6695 | export { UiCommandNames }
|
6696 | export { UiCommandNames as UiCommandNames_alias_1 }
|
6697 | export { UiCommandNames as UiCommandNames_alias_2 }
|
6698 |
|
6699 | export { UndefinedFlipPartialAndRequired }
|
6700 |
|
6701 | export { UndefinedPickPartial }
|
6702 |
|
6703 | export { UnionToIntersection }
|
6704 |
|
6705 | export { uniqueArray }
|
6706 |
|
6707 | export { uniqueBy }
|
6708 |
|
6709 | export { uniqueId }
|
6710 |
|
6711 | export { UnknownShape }
|
6712 |
|
6713 |
|
6714 |
|
6715 |
|
6716 |
|
6717 |
|
6718 |
|
6719 |
|
6720 |
|
6721 |
|
6722 |
|
6723 |
|
6724 |
|
6725 |
|
6726 |
|
6727 |
|
6728 |
|
6729 |
|
6730 |
|
6731 |
|
6732 | declare type UnpackedExtension<Extension extends AnyExtension[] | (() => AnyExtension[])> = UnpackedReturnType<Extension>[number];
|
6733 | export { UnpackedExtension }
|
6734 | export { UnpackedExtension as UnpackedExtension_alias_1 }
|
6735 | export { UnpackedExtension as UnpackedExtension_alias_2 }
|
6736 |
|
6737 | /**
|
6738 | * Extract the function return type if the generic type is a function, otherwise
|
6739 | *
|
6740 | * @internal
|
6741 | *
|
6742 | * @example
|
6743 | *
|
6744 | * ```ts
|
6745 | * type A = () => string
|
6746 | * type B = UnpackedReturnType<A>
|
6747 | *
|
6748 | *
|
6749 | * type C = string
|
6750 | * type D = UnpackedReturnType<A>
|
6751 | *
|
6752 | * ```
|
6753 | */
|
6754 | declare type UnpackedReturnType<MaybeFunction> = MaybeFunction extends (...args: any[]) => infer Returned ? Returned : MaybeFunction;
|
6755 |
|
6756 | export { unset }
|
6757 |
|
6758 | declare type UpdatableViewProps = 'attributes' | 'editable';
|
6759 | export { UpdatableViewProps }
|
6760 | export { UpdatableViewProps as UpdatableViewProps_alias_1 }
|
6761 | export { UpdatableViewProps as UpdatableViewProps_alias_2 }
|
6762 |
|
6763 | declare type UpdatableViewPropsObject = {
|
6764 | [Key in UpdatableViewProps]: DirectEditorProps[Key];
|
6765 | };
|
6766 | export { UpdatableViewPropsObject }
|
6767 | export { UpdatableViewPropsObject as UpdatableViewPropsObject_alias_1 }
|
6768 |
|
6769 | export { updateMark }
|
6770 |
|
6771 | export { UpdateMarkProps }
|
6772 |
|
6773 | /**
|
6774 | * @internal
|
6775 | */
|
6776 | declare type UpdateReason = 'set' | 'reset';
|
6777 | export { UpdateReason }
|
6778 | export { UpdateReason as UpdateReason_alias_1 }
|
6779 |
|
6780 | declare interface UpdateReasonProps {
|
6781 | /**
|
6782 | * Describes what triggered an update.
|
6783 | *
|
6784 | * - `set` - the change was triggered by an update in some properties
|
6785 | * - `reset` - the user has specifically requested to reset all properties to
|
6786 | * their initial defaults
|
6787 | * - `init` - the update is happening when the preset is being It will receive
|
6788 | * all the items as changes.
|
6789 | */
|
6790 | reason: UpdateReason;
|
6791 | }
|
6792 | export { UpdateReasonProps }
|
6793 | export { UpdateReasonProps as UpdateReasonProps_alias_1 }
|
6794 |
|
6795 | declare interface UpdateStateProps extends Partial<TransactionProps>, EditorStateProps, TriggerChangeProps {
|
6796 | /**
|
6797 | * When the state updates are not controlled and it was a transaction that
|
6798 | * caused the state to be updated this value captures all the transaction
|
6799 | * updates caused by prosemirror plugins hook state methods like
|
6800 | * `filterTransactions` and `appendTransactions`.
|
6801 | *
|
6802 | * This is for advanced users only.
|
6803 | */
|
6804 | transactions?: readonly Transaction[];
|
6805 | }
|
6806 | export { UpdateStateProps }
|
6807 | export { UpdateStateProps as UpdateStateProps_alias_1 }
|
6808 | export { UpdateStateProps as UpdateStateProps_alias_2 }
|
6809 |
|
6810 | declare interface UploadContext {
|
6811 | set: (key: string, value: unknown) => void;
|
6812 | get: (key: string) => unknown;
|
6813 | addListener: (listener: UploadContextListener) => () => void;
|
6814 | }
|
6815 | export { UploadContext }
|
6816 | export { UploadContext as UploadContext_alias_1 }
|
6817 | export { UploadContext as UploadContext_alias_2 }
|
6818 | export { UploadContext as UploadContext_alias_3 }
|
6819 |
|
6820 | declare type UploadContextListener = (values: Record<string, unknown>) => void;
|
6821 |
|
6822 | /**
|
6823 | * `UploadExtension` handle the file upload process.
|
6824 | */
|
6825 | declare class UploadExtension extends PlainExtension<DecorationsOptions_2> {
|
6826 | get name(): "upload";
|
6827 | /**
|
6828 | * Create the extension plugin for inserting decorations into the editor.
|
6829 | */
|
6830 | createExternalPlugins(): ProsemirrorPlugin_2[];
|
6831 | }
|
6832 | export { UploadExtension }
|
6833 | export { UploadExtension as UploadExtension_alias_1 }
|
6834 | export { UploadExtension as UploadExtension_alias_2 }
|
6835 | export { UploadExtension as UploadExtension_alias_3 }
|
6836 |
|
6837 | /**
|
6838 | * Insert a file into the editor and upload it.
|
6839 | */
|
6840 | declare function uploadFile<NodeAttributes extends AbstractNodeAttributes>({ file, pos, view, fileType, uploadHandler, }: UploadFileProps<NodeAttributes>): void;
|
6841 | export { uploadFile }
|
6842 | export { uploadFile as uploadFile_alias_1 }
|
6843 | export { uploadFile as uploadFile_alias_2 }
|
6844 | export { uploadFile as uploadFile_alias_3 }
|
6845 |
|
6846 | declare type UploadFileHandler<NodeAttributes> = () => FileUploader<NodeAttributes>;
|
6847 | export { UploadFileHandler }
|
6848 | export { UploadFileHandler as UploadFileHandler_alias_1 }
|
6849 | export { UploadFileHandler as UploadFileHandler_alias_2 }
|
6850 | export { UploadFileHandler as UploadFileHandler_alias_3 }
|
6851 |
|
6852 | export declare interface UploadFileProps<NodeAttributes extends AbstractNodeAttributes = object> {
|
6853 | file: File;
|
6854 | pos: number | undefined;
|
6855 | view: EditorView_2;
|
6856 | fileType: NodeType_2;
|
6857 | uploadHandler: UploadFileHandler<NodeAttributes>;
|
6858 | }
|
6859 |
|
6860 | declare interface UploadPlaceholderPayload<NodeAttributes extends AbstractNodeAttributes> {
|
6861 | context: UploadContext;
|
6862 | fileUploader: FileUploader<NodeAttributes>;
|
6863 | }
|
6864 | export { UploadPlaceholderPayload }
|
6865 | export { UploadPlaceholderPayload as UploadPlaceholderPayload_alias_1 }
|
6866 | export { UploadPlaceholderPayload as UploadPlaceholderPayload_alias_2 }
|
6867 | export { UploadPlaceholderPayload as UploadPlaceholderPayload_alias_3 }
|
6868 |
|
6869 | declare interface UploadPlaceholderPluginData {
|
6870 | set: DecorationSet_2;
|
6871 | payloads: Map<string, any>;
|
6872 | }
|
6873 |
|
6874 | export { UseDefault }
|
6875 |
|
6876 | export { ValidOptions }
|
6877 |
|
6878 | export { Value }
|
6879 |
|
6880 | export { ValueOf }
|
6881 |
|
6882 | export { values }
|
6883 |
|
6884 | declare interface WidgetPlaceholder<Data = any> extends BasePlaceholder, DataProps<Data> {
|
6885 | /**
|
6886 | * Declare this as a widget tracker.
|
6887 | *
|
6888 | * Widget trackers support adding custom components to the created dom
|
6889 | * element.
|
6890 | */
|
6891 | type: 'widget';
|
6892 | /**
|
6893 | * Widget trackers only support fixed positions.
|
6894 | */
|
6895 | pos: number;
|
6896 | /**
|
6897 | * Called the first time this widget decoration is added to the dom.
|
6898 | */
|
6899 | createElement?(view: EditorView, pos: number): HTMLElement;
|
6900 | /**
|
6901 | * Called whenever the position tracker updates with the new position.
|
6902 | */
|
6903 | onUpdate?(view: EditorView, pos: number, element: HTMLElement, data: any): void;
|
6904 | /**
|
6905 | * Called when the widget decoration is removed from the dom.
|
6906 | */
|
6907 | onDestroy?(view: EditorView, element: HTMLElement): void;
|
6908 | }
|
6909 | export { WidgetPlaceholder }
|
6910 | export { WidgetPlaceholder as WidgetPlaceholder_alias_1 }
|
6911 | export { WidgetPlaceholder as WidgetPlaceholder_alias_2 }
|
6912 |
|
6913 | declare type WithBase<Type extends BasePlaceholder> = MakeRequired<Type, keyof BasePlaceholder> & {
|
6914 | id: unknown;
|
6915 | };
|
6916 |
|
6917 | export { within }
|
6918 |
|
6919 | /**
|
6920 | * A type with a name property.
|
6921 | */
|
6922 | declare type WithName<Type> = Type & {
|
6923 | name: string;
|
6924 | };
|
6925 |
|
6926 | export { wrapIn }
|
6927 |
|
6928 | export { Writable }
|
6929 |
|
6930 | export { Writeable }
|
6931 |
|
6932 | export { ZERO_WIDTH_SPACE_CHAR }
|
6933 |
|
6934 | export { }
|
6935 |
|
6936 | declare global {
|
6937 | namespace Remirror {
|
6938 | /**
|
6939 | * A global type which allows setting additional options on the exclude.
|
6940 | */
|
6941 | interface ExcludeOptions {}
|
6942 |
|
6943 | /**
|
6944 | * A global type which allows additional default settings to be added to the
|
6945 | * editor.
|
6946 | */
|
6947 | interface BaseExtensionOptions {}
|
6948 | }
|
6949 | }
|
6950 |
|
6951 | /**
|
6952 | * An interface for creating custom plugins in your `remirror` editor.
|
6953 | */
|
6954 | export interface CreateExtensionPlugin<PluginState = any>
|
6955 | extends Pick<
|
6956 | PluginSpec<PluginState>,
|
6957 | 'props' | 'state' | 'key' | 'view' | 'filterTransaction' | 'appendTransaction'
|
6958 | > {
|
6959 | /**
|
6960 | Additional properties are allowed on plugin specs, which can be
|
6961 | read via [`Plugin.spec`](https://prosemirror.net/docs/ref/#state.Plugin.spec).
|
6962 | */
|
6963 | [key: string]: any;
|
6964 | }
|
6965 |
|
6966 | /**
|
6967 | * The type of arguments acceptable for the focus parameter.
|
6968 | *
|
6969 | * - Can be a prosemirror selection
|
6970 | * - A range of `{ from: number; to: number }`
|
6971 | * - A single position with a `number`
|
6972 | * - A string of `'start' | 'end'`
|
6973 | * - `true` which sets the focus to the current position or start.
|
6974 | */
|
6975 | export type FocusType = PrimitiveSelection | boolean;
|
6976 |
|
6977 |
|
6978 | declare global {
|
6979 | namespace Remirror {
|
6980 | interface ManagerStore<Extension extends AnyExtension> {
|
6981 | /**
|
6982 | * The attributes to be added to the prosemirror editor.
|
6983 | */
|
6984 | attributes: ProsemirrorAttributes;
|
6985 | }
|
6986 |
|
6987 | interface ExtensionStore {
|
6988 | /**
|
6989 | * Triggers a recalculation of the `view.dom` attributes for each
|
6990 | * extension and notifies the parent UI once done.
|
6991 | *
|
6992 | * This will also dispatch an update to the state automatically. However
|
6993 | * you can disable this by setting `triggerUpdate` to `false`.
|
6994 | *
|
6995 | * By not triggering an update the new value may not be capture by the view layer, e.g. `React`.
|
6996 | *
|
6997 | * @param triggerUpdate - defaults to true
|
6998 | */
|
6999 | updateAttributes: (triggerUpdate?: boolean) => void;
|
7000 | }
|
7001 |
|
7002 | interface ExcludeOptions {
|
7003 | /**
|
7004 | * Whether to use the attributes provided by this extension
|
7005 | *
|
7006 | * @defaultValue undefined
|
7007 | */
|
7008 | attributes?: boolean;
|
7009 | }
|
7010 |
|
7011 | interface BaseExtension {
|
7012 | /**
|
7013 | * A list of class names to add to the main editor element.
|
7014 | */
|
7015 | classNames?: ClassName[];
|
7016 |
|
7017 | /**
|
7018 | * Allows the extension to modify the attributes for the Prosemirror editor
|
7019 | * dom element.
|
7020 | *
|
7021 | * @remarks
|
7022 | *
|
7023 | * Sometimes an extension will need to make a change to the attributes of the
|
7024 | * editor itself. For example a placeholder may need to do some work to make
|
7025 | * the editor more accessible by setting the `aria-placeholder` value to match
|
7026 | * the value of the placeholder.
|
7027 | *
|
7028 | * @alpha
|
7029 | */
|
7030 | createAttributes?(): ProsemirrorAttributes;
|
7031 | }
|
7032 |
|
7033 | interface AllExtensions {
|
7034 | attributes: AttributesExtension;
|
7035 | }
|
7036 | }
|
7037 | }
|
7038 |
|
7039 |
|
7040 | declare global {
|
7041 | namespace Remirror {
|
7042 | /**
|
7043 | * UX options for the command which can be extended.
|
7044 | */
|
7045 | interface CommandDecoratorOptions<Options extends Shape = Shape>
|
7046 | extends CommandUiDecoratorOptions {
|
7047 | /**
|
7048 | * A function which can be used to override whether a command is already
|
7049 | * active for the current selection.
|
7050 | */
|
7051 | active?: (options: Options, store: ExtensionStore) => boolean;
|
7052 | }
|
7053 | }
|
7054 | }
|
7055 |
|
7056 |
|
7057 | declare global {
|
7058 | namespace Remirror {
|
7059 | interface ManagerSettings {
|
7060 | /**
|
7061 | * The options that can be passed into the built in options.
|
7062 | */
|
7063 | builtin?: GetStaticAndDynamic<BuiltinOptions>;
|
7064 | }
|
7065 |
|
7066 | /**
|
7067 | * The builtin preset.
|
7068 | */
|
7069 | type Builtin = BuiltinPreset;
|
7070 |
|
7071 | /**
|
7072 | * The union of every extension available via the remirror codebase.
|
7073 | */
|
7074 | type Extensions = ValueOf<AllExtensions>;
|
7075 | }
|
7076 | }
|
7077 |
|
7078 |
|
7079 | declare global {
|
7080 | namespace Remirror {
|
7081 | interface ManagerStore<Extension extends AnyExtension> {
|
7082 | /**
|
7083 | * Get the forced updates from the provided transaction.
|
7084 | */
|
7085 | getForcedUpdates: (tr: Transaction) => ForcedUpdateMeta;
|
7086 |
|
7087 | /**
|
7088 | * Enables the use of custom commands created by extensions which extend
|
7089 | * the functionality of your editor in an expressive way.
|
7090 | *
|
7091 | * @remarks
|
7092 | *
|
7093 | * Commands are synchronous and immediately dispatched. This means that
|
7094 | * they can be used to create menu items when the functionality you need
|
7095 | * is already available by the commands.
|
7096 | *
|
7097 | * ```ts
|
7098 | * if (commands.toggleBold.enabled()) {
|
7099 | * commands.toggleBold();
|
7100 | * }
|
7101 | * ```
|
7102 | */
|
7103 | commands: CommandsFromExtensions<Extension>;
|
7104 |
|
7105 | /**
|
7106 | * Chainable commands for composing functionality together in quaint and
|
7107 | * beautiful ways
|
7108 | *
|
7109 | * @remarks
|
7110 | *
|
7111 | * You can use this property to create expressive and complex commands
|
7112 | * that build up the transaction until it can be run.
|
7113 | *
|
7114 | * The way chainable commands work is by adding multiple steps to a shared
|
7115 | * transaction which is then dispatched when the `run` command is called.
|
7116 | * This requires making sure that commands within your code use the `tr`
|
7117 | * that is provided rather than the `state.tr` property. `state.tr`
|
7118 | * creates a new transaction which is not shared by the other steps in a
|
7119 | * chainable command.
|
7120 | *
|
7121 | * The aim is to make as many commands as possible chainable as explained
|
7122 | * [here](https://github.com/remirror/remirror/issues/418#issuecomment-666922209).
|
7123 | *
|
7124 | * There are certain commands that can't be made chainable.
|
7125 | *
|
7126 | * - undo
|
7127 | * - redo
|
7128 | *
|
7129 | * ```ts
|
7130 | * chain
|
7131 | * .toggleBold()
|
7132 | * .insertText('Hi')
|
7133 | * .setSelection('all')
|
7134 | * .run();
|
7135 | * ```
|
7136 | *
|
7137 | * The `run()` method ends the chain and dispatches the command.
|
7138 | */
|
7139 | chain: ChainedFromExtensions<Extension>;
|
7140 | }
|
7141 |
|
7142 | interface BaseExtension {
|
7143 | /**
|
7144 | * `ExtensionCommands`
|
7145 | *
|
7146 | * This pseudo property makes it easier to infer Generic types of this
|
7147 | * class.
|
7148 | *
|
7149 | * @internal
|
7150 | */
|
7151 | ['~C']: this['createCommands'] extends AnyFunction
|
7152 | ? ReturnType<this['createCommands']>
|
7153 | : EmptyShape;
|
7154 |
|
7155 | /**
|
7156 | * @experimental
|
7157 | *
|
7158 | * Stores all the command names for this decoration that have been added
|
7159 | * as decorators to the extension instance. This is used by the
|
7160 | * `CommandsExtension` to pick the commands and store meta data attached
|
7161 | * to each command.
|
7162 | *
|
7163 | * @internal
|
7164 | */
|
7165 | decoratedCommands?: Record<string, CommandDecoratorOptions>;
|
7166 |
|
7167 | /**
|
7168 | * Create and register commands for that can be called within the editor.
|
7169 | *
|
7170 | * These are typically used to create menu's actions and as a direct
|
7171 | * response to user actions.
|
7172 | *
|
7173 | * @remarks
|
7174 | *
|
7175 | * The `createCommands` method should return an object with each key being
|
7176 | * unique within the editor. To ensure that this is the case it is
|
7177 | * recommended that the keys of the command are namespaced with the name
|
7178 | * of the extension.
|
7179 | *
|
7180 | * ```ts
|
7181 | * import { ExtensionFactory } from '@remirror/core';
|
7182 | *
|
7183 | * const MyExtension = ExtensionFactory.plain({
|
7184 | * name: 'myExtension',
|
7185 | * version: '1.0.0',
|
7186 | * createCommands() {
|
7187 | * return {
|
7188 | * haveFun() {
|
7189 | * return ({ state, dispatch }) => {
|
7190 | * if (dispatch) {
|
7191 | * dispatch(tr.insertText('Have fun!'));
|
7192 | * }
|
7193 | *
|
7194 | * return true;
|
7195 | * }
|
7196 | * },
|
7197 | * }
|
7198 | * }
|
7199 | * })
|
7200 | * ```
|
7201 | *
|
7202 | * The actions available in this case would be `undoHistory` and
|
7203 | * `redoHistory`. It is unlikely that any other extension would override
|
7204 | * these commands.
|
7205 | *
|
7206 | * Another benefit of commands is that they are picked up by typescript
|
7207 | * and can provide code completion for consumers of the extension.
|
7208 | */
|
7209 | createCommands?(): ExtensionCommandReturn;
|
7210 | }
|
7211 |
|
7212 | interface ExtensionStore {
|
7213 | /**
|
7214 | * A property containing all the available commands in the editor.
|
7215 | *
|
7216 | * This should only be accessed after the `onView` lifecycle method
|
7217 | * otherwise it will throw an error. If you want to use it in the
|
7218 | * `createCommands` function then make sure it is used within the returned
|
7219 | * function scope and not in the outer scope.
|
7220 | */
|
7221 | commands: CommandsFromExtensions<Extensions | (AnyExtension & { _T: false })>;
|
7222 |
|
7223 | /**
|
7224 | * A method that returns an object with all the chainable commands
|
7225 | * available to be run.
|
7226 | *
|
7227 | * @remarks
|
7228 | *
|
7229 | * Each chainable command mutates the states transaction so after running
|
7230 | * all your commands. you should dispatch the desired transaction.
|
7231 | *
|
7232 | * This should only be called when the view has been initialized (i.e.)
|
7233 | * within the `createCommands` method calls.
|
7234 | *
|
7235 | * ```ts
|
7236 | * import { ExtensionFactory } from '@remirror/core';
|
7237 | *
|
7238 | * const MyExtension = ExtensionFactory.plain({
|
7239 | * name: 'myExtension',
|
7240 | * version: '1.0.0',
|
7241 | * createCommands: () => {
|
7242 | *
|
7243 | * methods.
|
7244 | * const chain = this.store.chain;
|
7245 | *
|
7246 | * return {
|
7247 | *
|
7248 | * haveFun() {
|
7249 | * return ({ state, dispatch }) =>
|
7250 | * this.store.chain.insertText('fun!').run(); ✅
|
7251 | * },
|
7252 | * }
|
7253 | * }
|
7254 | * })
|
7255 | * ```
|
7256 | *
|
7257 | * This should only be accessed after the `EditorView` has been fully
|
7258 | * attached to the `RemirrorManager`.
|
7259 | *
|
7260 | * The chain can also be called as a function with a custom `tr`
|
7261 | * parameter. This allows you to provide a custom transaction to use
|
7262 | * within the chainable commands.
|
7263 | *
|
7264 | * Use the command at the beginning of the command chain to override the
|
7265 | * shared transaction.
|
7266 | *
|
7267 | * There are times when you want to be sure of the transaction which is
|
7268 | * being updated.
|
7269 | *
|
7270 | * To restore the previous transaction call the `restore` chained method.
|
7271 | *
|
7272 | * @param tr - the transaction to set
|
7273 | */
|
7274 | chain: ChainedFromExtensions<Extensions | (AnyExtension & { _T: false })>;
|
7275 | }
|
7276 |
|
7277 | interface AllExtensions {
|
7278 | commands: CommandsExtension;
|
7279 | }
|
7280 |
|
7281 | /**
|
7282 | * The command names for all core extensions.
|
7283 | */
|
7284 | type AllCommandNames = LiteralUnion<CommandNames<Remirror.Extensions>, string>;
|
7285 |
|
7286 | /**
|
7287 | * The command names for all core extensions.
|
7288 | */
|
7289 | type AllUiCommandNames = LiteralUnion<UiCommandNames<Remirror.Extensions>, string>;
|
7290 | }
|
7291 | }
|
7292 |
|
7293 |
|
7294 | declare global {
|
7295 | namespace Remirror {
|
7296 | interface ExtensionStore {
|
7297 | /**
|
7298 | * Create delayed command which automatically adds a placeholder to the
|
7299 | * document while the delayed command is being run and also automatically
|
7300 | * removes it once it has completed.
|
7301 | */
|
7302 | createPlaceholderCommand<Value = any>(
|
7303 | props: DelayedPlaceholderCommandProps<Value>,
|
7304 | ): DelayedCommand<Value>;
|
7305 | }
|
7306 |
|
7307 | interface BaseExtension {
|
7308 | /**
|
7309 | * Create a decoration set which adds decorations to your editor. The
|
7310 | * first parameter is the `EditorState`.
|
7311 | *
|
7312 | * This can be used in combination with the `onApplyState` handler which
|
7313 | * can map the decoration.
|
7314 | *
|
7315 | * @param state - the editor state which was passed in.
|
7316 | */
|
7317 | createDecorations?(state: EditorState): DecorationSet;
|
7318 | }
|
7319 |
|
7320 | interface AllExtensions {
|
7321 | decorations: DecorationsExtension;
|
7322 | }
|
7323 | }
|
7324 | }
|
7325 |
|
7326 |
|
7327 | declare global {
|
7328 | namespace Remirror {
|
7329 | interface ManagerStore<Extension extends AnyExtension> {
|
7330 | /**
|
7331 | * The helpers provided by the extensions used.
|
7332 | */
|
7333 | helpers: HelpersFromExtensions<Extension>;
|
7334 |
|
7335 | /**
|
7336 | * Check which nodes and marks are active under the current user
|
7337 | * selection.
|
7338 | *
|
7339 | * ```ts
|
7340 | * const { active } = manager.store;
|
7341 | *
|
7342 | * return active.bold() ? 'bold' : 'regular';
|
7343 | * ```
|
7344 | */
|
7345 | active: ActiveFromExtensions<Extension>;
|
7346 |
|
7347 | /**
|
7348 | * Get the attributes for the named node or mark from the current user
|
7349 | * selection.
|
7350 | *
|
7351 | * ```ts
|
7352 | * const { attrs } = manager.store;
|
7353 | *
|
7354 | * attrs.heading();
|
7355 | * ```
|
7356 | */
|
7357 | attrs: AttrsFromExtensions<Extension>;
|
7358 | }
|
7359 |
|
7360 | interface BaseExtension {
|
7361 | /**
|
7362 | * `ExtensionHelpers`
|
7363 | *
|
7364 | * This pseudo property makes it easier to infer Generic types of this
|
7365 | * class.
|
7366 | *
|
7367 | * @internal
|
7368 | */
|
7369 | ['~H']: this['createHelpers'] extends AnyFunction
|
7370 | ? ReturnType<this['createHelpers']>
|
7371 | : EmptyShape;
|
7372 |
|
7373 | /**
|
7374 | * @experimental
|
7375 | *
|
7376 | * Stores all the helpers that have been added via decorators to the
|
7377 | * extension instance. This is used by the `HelpersExtension` to pick the
|
7378 | * helpers.
|
7379 | *
|
7380 | * @internal
|
7381 | */
|
7382 | decoratedHelpers?: Record<string, HelperDecoratorOptions>;
|
7383 |
|
7384 | /**
|
7385 | * A helper method is a function that takes in arguments and returns a
|
7386 | * value depicting the state of the editor specific to this extension.
|
7387 | *
|
7388 | * @remarks
|
7389 | *
|
7390 | * Unlike commands they can return anything and may not effect the
|
7391 | * behavior of the editor.
|
7392 | *
|
7393 | * Below is an example which should provide some idea on how to add
|
7394 | * helpers to the app.
|
7395 | *
|
7396 | * ```tsx
|
7397 | *
|
7398 | * import { ExtensionFactory } from '@remirror/core';
|
7399 | *
|
7400 | * const MyBeautifulExtension = ExtensionFactory.plain({
|
7401 | * name: 'beautiful',
|
7402 | * createHelpers: () => ({
|
7403 | * checkBeautyLevel: () => 100
|
7404 | * }),
|
7405 | * })
|
7406 | * ```
|
7407 | *
|
7408 | * ```
|
7409 | *
|
7410 | * import { useRemirrorContext } from '@remirror/react';
|
7411 | *
|
7412 | * const MyEditor = () => {
|
7413 | * const { helpers } = useRemirrorContext({ autoUpdate: true });
|
7414 | *
|
7415 | * return helpers.beautiful.checkBeautyLevel() > 50
|
7416 | * ? (<span>😍</span>)
|
7417 | * : (<span>😢</span>);
|
7418 | * };
|
7419 | * ```
|
7420 | */
|
7421 | createHelpers?(): ExtensionHelperReturn;
|
7422 | }
|
7423 |
|
7424 | interface StringHandlers {
|
7425 | /**
|
7426 | * Register the plain `text` string handler which renders a text string
|
7427 | * inside a `<pre />`.
|
7428 | */
|
7429 | text: HelpersExtension;
|
7430 |
|
7431 | /**
|
7432 | * Register the html string handler, which converts a html string to a
|
7433 | * prosemirror node.
|
7434 | */
|
7435 | html: HelpersExtension;
|
7436 | }
|
7437 |
|
7438 | interface ExtensionStore {
|
7439 | /**
|
7440 | * Helper method to provide information about the content of the editor.
|
7441 | * Each extension can register its own helpers.
|
7442 | *
|
7443 | * This should only be accessed after the `onView` lifecycle method
|
7444 | * otherwise it will throw an error.
|
7445 | */
|
7446 | helpers: HelpersFromExtensions<Extensions>;
|
7447 |
|
7448 | /**
|
7449 | * Check which nodes and marks are active under the current user
|
7450 | * selection.
|
7451 | *
|
7452 | * ```ts
|
7453 | * const { active } = manager.store;
|
7454 | *
|
7455 | * return active.bold() ? 'bold' : 'regular';
|
7456 | * ```
|
7457 | */
|
7458 | active: ActiveFromExtensions<Extensions>;
|
7459 |
|
7460 | /**
|
7461 | * Get the attributes for the named node or mark from the current user
|
7462 | * selection.
|
7463 | *
|
7464 | * ```ts
|
7465 | * const { attrs } = manager.store;
|
7466 | *
|
7467 | * attrs.heading();
|
7468 | * ```
|
7469 | */
|
7470 | attrs: AttrsFromExtensions<Extensions>;
|
7471 | }
|
7472 |
|
7473 | interface ListenerProperties<Extension extends AnyExtension> {
|
7474 | helpers: HelpersFromExtensions<Extension>;
|
7475 | }
|
7476 |
|
7477 | interface AllExtensions {
|
7478 | helpers: HelpersExtension;
|
7479 | }
|
7480 | }
|
7481 |
|
7482 | /**
|
7483 | * The helpers name for all extension defined in the current project.
|
7484 | */
|
7485 | type AllHelperNames = LiteralUnion<HelperNames<Remirror.Extensions>, string>;
|
7486 | }
|
7487 |
|
7488 |
|
7489 | declare global {
|
7490 | namespace Remirror {
|
7491 | interface ExcludeOptions {
|
7492 | /**
|
7493 | * Whether to use the inputRules for this particular extension.
|
7494 | *
|
7495 | * @defaultValue undefined
|
7496 | */
|
7497 | inputRules?: boolean;
|
7498 | }
|
7499 |
|
7500 | interface ExtensionStore {
|
7501 | /**
|
7502 | * When called this will run through every `createInputRules` method on every
|
7503 | * extension to recreate input rules.
|
7504 | *
|
7505 | * @remarks
|
7506 | *
|
7507 | * Under the hood it updates the plugin which is used to insert the
|
7508 | * input rules into the editor. This causes the state to be updated and
|
7509 | * will cause a rerender in your ui framework.
|
7510 | */
|
7511 | rebuildInputRules: () => void;
|
7512 | }
|
7513 |
|
7514 | interface BaseExtension {
|
7515 | /**
|
7516 | * Register input rules which are activated if the regex matches as a user is
|
7517 | * typing.
|
7518 | *
|
7519 | * @param parameter - schema parameter with type included
|
7520 | */
|
7521 | createInputRules?(): InputRule[];
|
7522 | }
|
7523 |
|
7524 | interface AllExtensions {
|
7525 | inputRules: InputRulesExtension;
|
7526 | }
|
7527 | }
|
7528 | }
|
7529 |
|
7530 |
|
7531 | declare global {
|
7532 | namespace Remirror {
|
7533 | interface ExcludeOptions {
|
7534 | /**
|
7535 | * Whether to exclude keybindings support. This is not a recommended
|
7536 | * action and can break functionality.
|
7537 | *
|
7538 | * @defaultValue undefined
|
7539 | */
|
7540 | keymap?: boolean;
|
7541 | }
|
7542 |
|
7543 | interface ExtensionStore {
|
7544 | /**
|
7545 | * When called this will run through every `createKeymap` method on every
|
7546 | * extension to recreate the keyboard bindings.
|
7547 | *
|
7548 | * @remarks
|
7549 | *
|
7550 | * **NOTE** - This will not update keybinding for extensions that
|
7551 | * implement their own keybinding functionality (e.g. any plugin using
|
7552 | * Suggestions)
|
7553 | */
|
7554 | rebuildKeymap: () => void;
|
7555 | }
|
7556 |
|
7557 | interface BaseExtension {
|
7558 | /**
|
7559 | * Stores all the keybinding names and options for this decoration that
|
7560 | * have been added as decorators to the extension instance. This is used
|
7561 | * by the `KeymapExtension` to pick the commands and store metadata
|
7562 | * attached to each command.
|
7563 | *
|
7564 | * @internal
|
7565 | */
|
7566 | decoratedKeybindings?: Record<string, KeybindingDecoratorOptions>;
|
7567 |
|
7568 | /**
|
7569 | * Add keymap bindings for this extension.
|
7570 | *
|
7571 | * @param parameter - schema parameter with type included
|
7572 | */
|
7573 | createKeymap?(extractShortcutNames: (shortcut: string) => string[]): PrioritizedKeyBindings;
|
7574 | }
|
7575 |
|
7576 | interface AllExtensions {
|
7577 | keymap: KeymapExtension;
|
7578 | }
|
7579 | }
|
7580 | }
|
7581 |
|
7582 |
|
7583 | declare global {
|
7584 | namespace Remirror {
|
7585 | interface ManagerStore<Extension extends AnyExtension> {
|
7586 | /**
|
7587 | * Get the command metadata for the transaction.
|
7588 | * @internal
|
7589 | */
|
7590 | getCommandMeta(tr: Transaction): Metadata[];
|
7591 | }
|
7592 | interface AllExtensions {
|
7593 | meta: MetaExtension;
|
7594 | }
|
7595 | }
|
7596 | }
|
7597 |
|
7598 |
|
7599 | declare global {
|
7600 | namespace Remirror {
|
7601 | interface ManagerSettings {
|
7602 | /**
|
7603 | * Add custom node views to the manager which will take priority over the
|
7604 | * nodeViews provided by the extensions and plugins.
|
7605 | */
|
7606 | nodeViews?: Record<string, NodeViewMethod>;
|
7607 | }
|
7608 |
|
7609 | interface BaseExtension {
|
7610 | /**
|
7611 | * Registers one or multiple nodeViews for the extension.
|
7612 | *
|
7613 | * This is a shorthand way of registering a nodeView without the need to
|
7614 | * create a prosemirror plugin. It allows for the registration of one nodeView
|
7615 | * which has the same name as the extension.
|
7616 | *
|
7617 | * To register more than one you would need to use a custom plugin returned
|
7618 | * from the `plugin` method.
|
7619 | *
|
7620 | * @param parameter - schema parameter with type included
|
7621 | */
|
7622 | createNodeViews?(): NodeViewMethod | Record<string, NodeViewMethod>;
|
7623 | }
|
7624 |
|
7625 | interface AllExtensions {
|
7626 | nodeViews: NodeViewsExtension;
|
7627 | }
|
7628 | }
|
7629 | }
|
7630 |
|
7631 |
|
7632 | declare global {
|
7633 | namespace Remirror {
|
7634 | interface ExcludeOptions {
|
7635 | /**
|
7636 | * Whether to exclude the extension's pasteRules
|
7637 | *
|
7638 | * @defaultValue undefined
|
7639 | */
|
7640 | pasteRules?: boolean;
|
7641 | }
|
7642 |
|
7643 | interface BaseExtension {
|
7644 | /**
|
7645 | * Register paste rules for this extension.
|
7646 | *
|
7647 | * Paste rules are activated when text, images, or html is pasted into the
|
7648 | * editor.
|
7649 | */
|
7650 | createPasteRules?(): PasteRule[] | PasteRule;
|
7651 | }
|
7652 |
|
7653 | interface AllExtensions {
|
7654 | pasteRules: PasteRulesExtension;
|
7655 | }
|
7656 | }
|
7657 | }
|
7658 |
|
7659 |
|
7660 | declare global {
|
7661 | namespace Remirror {
|
7662 | interface ManagerSettings {
|
7663 | /**
|
7664 | * Add custom plugins to the manager while creating it.
|
7665 | *
|
7666 | * Plugins created via the manager are given priority over all extension
|
7667 | * based plugins. There's scope for adding a priority based model for
|
7668 | * inserting plugins, but it seems like a sane default until that's
|
7669 | * available.
|
7670 | */
|
7671 | plugins?: ProsemirrorPlugin[];
|
7672 | }
|
7673 |
|
7674 | interface ExtensionStore {
|
7675 | /**
|
7676 | * Retrieve the state for any given extension name. This will throw an
|
7677 | * error if the extension identified by that name doesn't implement the
|
7678 | * `createPlugin` method.
|
7679 | *
|
7680 | * @param name - the name of the extension
|
7681 | *
|
7682 | * @remarks
|
7683 | *
|
7684 | * ```ts
|
7685 | * const pluginState = getPluginState(extension.name);
|
7686 | * ```
|
7687 | */
|
7688 | getPluginState<State>(name: string): State;
|
7689 |
|
7690 | /**
|
7691 | * Add the new plugins. If previous plugins are provided then also remove
|
7692 | * the previous plugins.
|
7693 | *
|
7694 | * ```ts
|
7695 | * this.store.updatePlugins(this.createExternalPlugins(), this.externalPlugins);
|
7696 | * ```
|
7697 | *
|
7698 | * @param plugins - the plugins to add
|
7699 | * @param previousPlugins - the plugins to remove
|
7700 | */
|
7701 | updatePlugins(plugins: ProsemirrorPlugin[], previousPlugins?: ProsemirrorPlugin[]): void;
|
7702 |
|
7703 | /**
|
7704 | * Reruns the `createPlugin` and `createExternalPlugins` methods of the
|
7705 | * provided extension.
|
7706 | *
|
7707 | * This will also automatically update the state with the newly generated
|
7708 | * plugins by dispatching an update.
|
7709 | *
|
7710 | * ```ts
|
7711 | *
|
7712 | * this.store.updateExtensionPlugins(this);
|
7713 | * this.store.dispatchPluginUpdate();
|
7714 | * ```
|
7715 | *
|
7716 | * @param extension - the extension instance, constructor or name.
|
7717 | */
|
7718 | updateExtensionPlugins(extension: AnyExtension | AnyExtensionConstructor | string): void;
|
7719 |
|
7720 | /**
|
7721 | * Applies the store plugins to the state. If any have changed then it
|
7722 | * will be updated.
|
7723 | */
|
7724 | dispatchPluginUpdate(): void;
|
7725 | }
|
7726 |
|
7727 | interface ManagerStore<Extension extends AnyExtension> {
|
7728 | /**
|
7729 | * All of the plugins combined together from all sources
|
7730 | */
|
7731 | plugins: ProsemirrorPlugin[];
|
7732 |
|
7733 | /**
|
7734 | * Retrieve the state for a given extension name. This will throw an error
|
7735 | * if the extension doesn't exist.
|
7736 | *
|
7737 | * @param name - the name of the extension
|
7738 | */
|
7739 | getPluginState: <State>(name: GetNameUnion<Extension>) => State;
|
7740 |
|
7741 | /**
|
7742 | * All the plugin keys available to be used by plugins.
|
7743 | */
|
7744 | pluginKeys: Record<string, PluginKey>;
|
7745 | }
|
7746 |
|
7747 | interface ExcludeOptions {
|
7748 | /**
|
7749 | * Whether to exclude the extension's plugin
|
7750 | *
|
7751 | * @defaultValue undefined
|
7752 | */
|
7753 | plugins?: boolean;
|
7754 | }
|
7755 |
|
7756 | interface BaseExtension {
|
7757 | /**
|
7758 | * The plugin key for custom plugin created by this extension. This only
|
7759 | * exists when there is a valid `createPlugin` method on the extension.
|
7760 | *
|
7761 | * This can be used to set and retrieve metadata.
|
7762 | *
|
7763 | * ```ts
|
7764 | * const meta = tr.getMeta(this.pluginKey);
|
7765 | * ```
|
7766 | */
|
7767 | pluginKey: PluginKey;
|
7768 |
|
7769 | /**
|
7770 | * The plugin that was created by the `createPlugin` method. This only
|
7771 | * exists for extension which implement that method.
|
7772 | */
|
7773 | plugin: Plugin;
|
7774 |
|
7775 | /**
|
7776 | * The external plugins created by the `createExternalPlugins` method.
|
7777 | */
|
7778 | externalPlugins: Plugin[];
|
7779 |
|
7780 | /**
|
7781 | * Retrieve the state of the custom plugin for this extension. This will
|
7782 | * throw an error if the extension doesn't have a valid `createPlugin`
|
7783 | * method.
|
7784 | *
|
7785 | * @remarks
|
7786 | *
|
7787 | * ```ts
|
7788 | * const pluginState = this.getPluginState();
|
7789 | * ```
|
7790 | *
|
7791 | * This is only available after the initialize stage of the editor manager
|
7792 | * lifecycle.
|
7793 | *
|
7794 | * If you would like to use it before that e.g. in the decorations prop of
|
7795 | * the `createPlugin` method, you can call it with a current state which
|
7796 | * will be used to retrieve the plugin state.
|
7797 | *
|
7798 | * Please note that when using this in the decorations callback it is
|
7799 | * advisable to pass in the `state` argument in case the callback is
|
7800 | * called before the framework, or the view have been initialized.
|
7801 | */
|
7802 | getPluginState: <State>(state?: EditorState) => State;
|
7803 |
|
7804 | /**
|
7805 | * Create a custom plugin directly in the editor.
|
7806 | *
|
7807 | * @remarks
|
7808 | *
|
7809 | * A unique `key` is automatically applied to enable easier retrieval of
|
7810 | * the plugin state.
|
7811 | *
|
7812 | * ```ts
|
7813 | * import { CreateExtensionPlugin } from 'remirror';
|
7814 | *
|
7815 | * class MyExtension extends PlainExtension {
|
7816 | * get name() {
|
7817 | * return 'me' as const;
|
7818 | * }
|
7819 | *
|
7820 | * createPlugin(): CreateExtensionPlugin {
|
7821 | * return {
|
7822 | * props: {
|
7823 | * handleKeyDown: keydownHandler({
|
7824 | * Backspace: handler,
|
7825 | * 'Mod-Backspace': handler,
|
7826 | * Delete: handler,
|
7827 | * 'Mod-Delete': handler,
|
7828 | * 'Ctrl-h': handler,
|
7829 | * 'Alt-Backspace': handler,
|
7830 | * 'Ctrl-d': handler,
|
7831 | * 'Ctrl-Alt-Backspace': handler,
|
7832 | * 'Alt-Delete': handler,
|
7833 | * 'Alt-d': handler,
|
7834 | * }),
|
7835 | * decorations: state => {
|
7836 | * const pluginState = this.getPluginState(state);
|
7837 | * pluginState.setDeleted(false);
|
7838 | * return pluginState.decorationSet;
|
7839 | * },
|
7840 | * },
|
7841 | * }
|
7842 | * }
|
7843 | * }
|
7844 | * ```
|
7845 | */
|
7846 | createPlugin?(): CreateExtensionPlugin;
|
7847 |
|
7848 | /**
|
7849 | * Register third party plugins when this extension is placed into the
|
7850 | * editor.
|
7851 | *
|
7852 | * @remarks
|
7853 | *
|
7854 | * Some plugins (like the table plugin) consume several different plugins,
|
7855 | * creator method allows you to return a list of plugins you'd like to
|
7856 | * support.
|
7857 | */
|
7858 | createExternalPlugins?(): ProsemirrorPlugin[];
|
7859 | }
|
7860 |
|
7861 | interface AllExtensions {
|
7862 | plugins: PluginsExtension;
|
7863 | }
|
7864 | }
|
7865 | }
|
7866 |
|
7867 |
|
7868 | declare global {
|
7869 | namespace Remirror {
|
7870 | interface BaseExtension {
|
7871 | /**
|
7872 | * Allows the extension to create an extra attributes array that will be
|
7873 | * added to the extra attributes.
|
7874 | *
|
7875 | * For example the `@remirror/extension-bidi` adds a `dir` attribute to
|
7876 | * all node extensions which allows them to automatically infer whether
|
7877 | * the text direction should be right-to-left, or left-to-right.
|
7878 | */
|
7879 | createSchemaAttributes?(): IdentifierSchemaAttributes[];
|
7880 | }
|
7881 | interface BaseExtensionOptions {
|
7882 | /**
|
7883 | * Inject additional attributes into the defined mark / node schema. This
|
7884 | * can only be used for `NodeExtensions` and `MarkExtensions`.
|
7885 | *
|
7886 | * @remarks
|
7887 | *
|
7888 | * Sometimes you need to add additional attributes to a node or mark. This
|
7889 | * property enables this without needing to create a new extension.
|
7890 | *
|
7891 | * This is only applied to the `MarkExtension` and `NodeExtension`.
|
7892 | *
|
7893 | * @defaultValue {}
|
7894 | */
|
7895 | extraAttributes?: Static<SchemaAttributes>;
|
7896 |
|
7897 | /**
|
7898 | * When true will disable extra attributes for this instance of the
|
7899 | * extension.
|
7900 | *
|
7901 | * @remarks
|
7902 | *
|
7903 | * This is only applied to the `MarkExtension` and `NodeExtension`.
|
7904 | *
|
7905 | * @defaultValue undefined
|
7906 | */
|
7907 | disableExtraAttributes?: Static<boolean>;
|
7908 |
|
7909 | /**
|
7910 | * An override for the mark spec object. This only applies for
|
7911 | * `MarkExtension`.
|
7912 | */
|
7913 | markOverride?: Static<MarkSpecOverride>;
|
7914 |
|
7915 | /**
|
7916 | * An override object for a node spec object. This only applies to the
|
7917 | * `NodeExtension`.
|
7918 | */
|
7919 | nodeOverride?: Static<NodeSpecOverride>;
|
7920 | }
|
7921 |
|
7922 | interface ManagerSettings {
|
7923 | /**
|
7924 | * Allows for setting extra attributes on multiple nodes and marks by
|
7925 | * their name or constructor. These attributes are automatically added and
|
7926 | * retrieved from from the dom by prosemirror.
|
7927 | *
|
7928 | * @remarks
|
7929 | *
|
7930 | * An example is shown below.
|
7931 | *
|
7932 | * ```ts
|
7933 | * import { RemirrorManager } from 'remirror';
|
7934 | *
|
7935 | * const managerSettings = {
|
7936 | * extraAttributes: [
|
7937 | * {
|
7938 | * identifiers: ['blockquote', 'heading'],
|
7939 | * attributes: { id: 'id', alignment: '0', },
|
7940 | * }, {
|
7941 | * identifiers: ['mention', 'codeBlock'],
|
7942 | * attributes: { 'userId': { default: null } },
|
7943 | * },
|
7944 | * ]
|
7945 | * };
|
7946 | *
|
7947 | * const manager = RemirrorManager.create([], { extraAttributes })
|
7948 | * ```
|
7949 | */
|
7950 | extraAttributes?: IdentifierSchemaAttributes[];
|
7951 |
|
7952 | /**
|
7953 | * Overrides for the mark.
|
7954 | */
|
7955 | markOverride?: Record<string, MarkSpecOverride>;
|
7956 |
|
7957 | /**
|
7958 | * Overrides for the nodes.
|
7959 | */
|
7960 | nodeOverride?: Record<string, NodeSpecOverride>;
|
7961 |
|
7962 | /**
|
7963 | * Perhaps you don't need extra attributes at all in the editor. This
|
7964 | * allows you to disable extra attributes when set to true.
|
7965 | *
|
7966 | * @defaultValue undefined
|
7967 | */
|
7968 | disableExtraAttributes?: boolean;
|
7969 |
|
7970 | /**
|
7971 | * Setting this to a value will override the default behaviour of the
|
7972 | * `RemirrorManager`. It overrides the created schema and ignores the
|
7973 | * specs created by all extensions within your editor.
|
7974 | *
|
7975 | * @remarks
|
7976 | *
|
7977 | * This is an advanced option and should only be used in cases where there
|
7978 | * is a deeper understanding of `Prosemirror`. By setting this, please
|
7979 | * note that a lot of functionality just won't work which is powered by
|
7980 | * the `extraAttributes`.
|
7981 | */
|
7982 | schema?: EditorSchema;
|
7983 |
|
7984 | /**
|
7985 | * The name of the default block node. This node will be given a higher
|
7986 | * priority when being added to the schema.
|
7987 | *
|
7988 | * By default this is undefined and the default block node is assigned
|
7989 | * based on the extension priorities.
|
7990 | *
|
7991 | * @defaultValue undefined
|
7992 | */
|
7993 | defaultBlockNode?: string;
|
7994 | }
|
7995 |
|
7996 | interface ManagerStore<Extension extends AnyExtension> {
|
7997 | /**
|
7998 | * The nodes to place on the schema.
|
7999 | */
|
8000 | nodes: Record<
|
8001 | GetNodeNameUnion<Extension> extends never ? string : GetNodeNameUnion<Extension>,
|
8002 | NodeExtensionSpec
|
8003 | >;
|
8004 |
|
8005 | /**
|
8006 | * The marks to be added to the schema.
|
8007 | */
|
8008 | marks: Record<
|
8009 | GetMarkNameUnion<Extension> extends never ? string : GetMarkNameUnion<Extension>,
|
8010 | MarkExtensionSpec
|
8011 | >;
|
8012 |
|
8013 | /**
|
8014 | * The schema created by this extension manager.
|
8015 | */
|
8016 | schema: EditorSchema;
|
8017 |
|
8018 | /**
|
8019 | * The name of the default block node. This is used by all internal
|
8020 | * extension when toggling block nodes. It can also be used in other
|
8021 | * cases.
|
8022 | *
|
8023 | * This can be updated via the manager settings when first creating the
|
8024 | * editor.
|
8025 | *
|
8026 | * @defaultValue 'paragraph'
|
8027 | */
|
8028 | defaultBlockNode: string;
|
8029 | }
|
8030 |
|
8031 | interface MarkExtension {
|
8032 | /**
|
8033 | * Provides access to the `MarkExtensionSpec`.
|
8034 | */
|
8035 | spec: MarkExtensionSpec;
|
8036 | }
|
8037 |
|
8038 | interface NodeExtension {
|
8039 | /**
|
8040 | * Provides access to the `NodeExtensionSpec`.
|
8041 | */
|
8042 | spec: NodeExtensionSpec;
|
8043 | }
|
8044 |
|
8045 | interface ExtensionStore {
|
8046 | /**
|
8047 | * The Prosemirror schema being used for the current editor.
|
8048 | *
|
8049 | * @remarks
|
8050 | *
|
8051 | * The value is created when the manager initializes. So it can be used in
|
8052 | * `createCommands`, `createHelpers`, `createKeymap` and most of the
|
8053 | * creator methods.
|
8054 | */
|
8055 | schema: EditorSchema;
|
8056 | }
|
8057 |
|
8058 | interface StaticExtensionOptions {
|
8059 | /**
|
8060 | * When true will disable extra attributes for all instances of this
|
8061 | * extension.
|
8062 | *
|
8063 | * @defaultValue false
|
8064 | */
|
8065 | readonly disableExtraAttributes?: boolean;
|
8066 | }
|
8067 |
|
8068 | interface AllExtensions {
|
8069 | schema: SchemaExtension;
|
8070 | }
|
8071 | }
|
8072 | }
|
8073 |
|
8074 |
|
8075 | declare global {
|
8076 | namespace Remirror {
|
8077 | interface ExcludeOptions {
|
8078 | /**
|
8079 | * Whether to exclude the suggesters plugin configuration for the
|
8080 | * extension.
|
8081 | *
|
8082 | * @defaultValue undefined
|
8083 | */
|
8084 | suggesters?: boolean;
|
8085 | }
|
8086 |
|
8087 | interface BaseExtension {
|
8088 | /**
|
8089 | * Create suggesters which respond to an activation `char` or regex
|
8090 | * pattern within the editor instance. The onChange handler provided is
|
8091 | * called with the data around the matching text.
|
8092 | *
|
8093 | * @remarks
|
8094 | *
|
8095 | * Suggesters are a powerful way of building up the editors
|
8096 | * functionality. They can support `@` mentions, `#` tagging, `/` special
|
8097 | * command keys which trigger action menus and much more.
|
8098 | */
|
8099 | createSuggesters?(): Suggester[] | Suggester;
|
8100 | }
|
8101 |
|
8102 | interface AllExtensions {
|
8103 | suggest: SuggestExtension;
|
8104 | }
|
8105 |
|
8106 | interface ExtensionStore {
|
8107 | /**
|
8108 | * Add a suggester.
|
8109 | */
|
8110 | addSuggester(suggester: Suggester): void;
|
8111 |
|
8112 | /**
|
8113 | * Remove a suggester.
|
8114 | */
|
8115 | removeSuggester(suggester: Suggester | string): void;
|
8116 | }
|
8117 |
|
8118 | interface AllExtensions {
|
8119 | suggest: SuggestExtension;
|
8120 | }
|
8121 | }
|
8122 | }
|
8123 |
|
8124 |
|
8125 | declare global {
|
8126 | namespace Remirror {
|
8127 | interface ManagerSettings {
|
8128 | /**
|
8129 | * Add extra tags to the extensions by name. This can be used to add
|
8130 | * behavior traits to certain extensions.
|
8131 | *
|
8132 | * Please note this will change the schema since the tags are added to the
|
8133 | * node and mark groups.
|
8134 | *
|
8135 | * ```ts
|
8136 | * RemirrorManager.create(
|
8137 | * [],
|
8138 | * { extraTags: { bold: [ExtensionTag.Awesome] } }
|
8139 | * );
|
8140 | * ```
|
8141 | */
|
8142 | extraTags?: Record<string, ExtensionTagType[]>;
|
8143 | }
|
8144 |
|
8145 | interface BaseExtension {
|
8146 | /**
|
8147 | * The generated tags for this extension are added here. Do not add this
|
8148 | * property to your extensions as it will be overridden.
|
8149 | */
|
8150 | tags: ExtensionTagType[];
|
8151 |
|
8152 | /**
|
8153 | * Dynamically create tags for the extension.
|
8154 | *
|
8155 | * Tags are a helpful tool for categorizing the behavior of an extension.
|
8156 | * This behavior is later grouped in the `Manager` and passed to the
|
8157 | * `extensionStore`. Tags can be used by commands that need to remove all
|
8158 | * formatting and use the tag to identify which registered extensions are
|
8159 | * formatters.
|
8160 | *
|
8161 | * @remarks
|
8162 | *
|
8163 | * Tags are also automatically added to the node and mark extensions as a
|
8164 | * group when they are found there.
|
8165 | *
|
8166 | * There are internally defined tags but it's also possible to define any
|
8167 | * custom string as a tag. See [[`ExtensionTag`]].
|
8168 | */
|
8169 | createTags?(): ExtensionTagType[];
|
8170 | }
|
8171 | type A = UseDefault<never, string>;
|
8172 |
|
8173 | interface ManagerStore<Extension extends AnyExtension> {
|
8174 | /**
|
8175 | * All the tags provided by the configured extensions.
|
8176 | */
|
8177 | tags: Readonly<
|
8178 | CombinedTags<GetNameUnion<Extension> extends never ? string : GetNameUnion<Extension>>
|
8179 | >;
|
8180 |
|
8181 | /**
|
8182 | * All the plain extension tags provided for the editor.
|
8183 | */
|
8184 | plainTags: Readonly<
|
8185 | CombinedTags<
|
8186 | GetPlainNameUnion<Extension> extends never ? string : GetPlainNameUnion<Extension>
|
8187 | >
|
8188 | >;
|
8189 |
|
8190 | /**
|
8191 | * All the node extension tags provided for the editor.
|
8192 | */
|
8193 | nodeTags: Readonly<
|
8194 | CombinedTags<
|
8195 | GetNodeNameUnion<Extension> extends never ? string : GetNodeNameUnion<Extension>
|
8196 | >
|
8197 | >;
|
8198 |
|
8199 | /**
|
8200 | * All the mark extension tags provided for the editor.
|
8201 | */
|
8202 | markTags: Readonly<
|
8203 | CombinedTags<
|
8204 | GetMarkNameUnion<Extension> extends never ? string : GetMarkNameUnion<Extension>
|
8205 | >
|
8206 | >;
|
8207 | }
|
8208 |
|
8209 | interface ExtensionStore {
|
8210 | /**
|
8211 | * All the tags provided by the configured extensions.
|
8212 | */
|
8213 | tags: CombinedTags;
|
8214 |
|
8215 | /**
|
8216 | * All the plain extension tags provided for the editor.
|
8217 | */
|
8218 | plainTags: CombinedTags;
|
8219 |
|
8220 | /**
|
8221 | * All the node extension tags provided for the editor.
|
8222 | */
|
8223 | nodeTags: CombinedTags;
|
8224 |
|
8225 | /**
|
8226 | * All the mark extension tags provided for the editor.
|
8227 | */
|
8228 | markTags: CombinedTags;
|
8229 | }
|
8230 |
|
8231 | interface BaseExtensionOptions {
|
8232 | /**
|
8233 | * Add extra tags to the extension.
|
8234 | *
|
8235 | * Tags can be used to unlock certain behavioural traits for nodes and
|
8236 | * marks.
|
8237 | *
|
8238 | * Please note this will change the schema since the tags are added to the
|
8239 | * node and mark groups.
|
8240 | */
|
8241 | extraTags?: ExtensionTagType[];
|
8242 | }
|
8243 |
|
8244 | interface AllExtensions {
|
8245 | tags: TagsExtension;
|
8246 | }
|
8247 | }
|
8248 | }
|
8249 |
|
8250 |
|
8251 | declare global {
|
8252 | namespace Remirror {
|
8253 | /**
|
8254 | * A utility type for all the globally available extension names. This is
|
8255 | * mainly used to provide autocompletion.
|
8256 | */
|
8257 | type NameUnion = LiteralUnion<GetNameUnion<Extensions>, string>;
|
8258 |
|
8259 | /**
|
8260 | * A utility type for all the globally available plain extension names. This
|
8261 | * is mainly used to provide autocompletion.
|
8262 | */
|
8263 | type PlainNameUnion = LiteralUnion<GetPlainNameUnion<Extensions>, string>;
|
8264 |
|
8265 | /**
|
8266 | * A utility type for all the globally available node extension names. This
|
8267 | * is mainly used to provide autocompletion.
|
8268 | */
|
8269 | type NodeNameUnion = LiteralUnion<GetNodeNameUnion<Extensions>, string>;
|
8270 |
|
8271 | /**
|
8272 | * A utility type for all the globally available mark extension names. This
|
8273 | * is mainly used to provide autocompletion.
|
8274 | */
|
8275 | type MarkNameUnion = LiteralUnion<GetMarkNameUnion<Extensions>, string>;
|
8276 | }
|
8277 | }
|
8278 |
|
8279 |
|
8280 | declare global {
|
8281 | /**
|
8282 | * This namespace is global and you can use declaration merging to extend and
|
8283 | * create new types used by the `remirror` project.
|
8284 | *
|
8285 | * @remarks
|
8286 | *
|
8287 | * The following would add `MyCustomType` to the `Remirror` namespace. Please
|
8288 | * note that this can only be used for types and interfaces.
|
8289 | *
|
8290 | * ```ts
|
8291 | * declare global {
|
8292 | * namespace Remirror {
|
8293 | * type MyCustomType = 'look-at-me';
|
8294 | * }
|
8295 | * }
|
8296 | * ```
|
8297 | */
|
8298 | namespace Remirror {
|
8299 | /**
|
8300 | * This interface stores all the currently installed extensions. As a result
|
8301 | * it can be used to set the default loaded extensions to include all
|
8302 | * available within `node_modules`. By extending this extension in the
|
8303 | * global `Remirror` namespace the key is ignored but the value is used to
|
8304 | * form the union type in the `chain`, `commands`, `helpers` properties on
|
8305 | * the `Remirror.ExtensionStore` interface.
|
8306 | *
|
8307 | * This is useful for extensions being able to reuse the work of other
|
8308 | * extension.
|
8309 | */
|
8310 | interface AllExtensions {}
|
8311 |
|
8312 | /**
|
8313 | * This is the global interface for adding extra methods and properties to
|
8314 | * all [[`Extension`]]s using declaration merging.
|
8315 | *
|
8316 | * @remarks
|
8317 | *
|
8318 | * The following will add `newOption` to the expected options. This is the
|
8319 | * way that extensions which add new functionality to the editor can request
|
8320 | * configuration options.
|
8321 | *
|
8322 | * ```ts
|
8323 | * declare global {
|
8324 | * namespace Remirror {
|
8325 | * interface ExtensionFactoryProps {
|
8326 | * newOption?: string;
|
8327 | * }
|
8328 | * }
|
8329 | * }
|
8330 | * ```
|
8331 | */
|
8332 | interface BaseExtension {}
|
8333 |
|
8334 | interface NodeExtension {}
|
8335 | interface MarkExtension {}
|
8336 |
|
8337 | /**
|
8338 | * An override to for the `AnyExtension` type. If you're extension adds a
|
8339 | * new property to the `Extension` that is deeply nested or very complex it
|
8340 | * can break the `AnyExtension` implementation from being compatible with
|
8341 | * all valid extensions.
|
8342 | *
|
8343 | * The keys you provide on this override replace the default `AnyExtension`
|
8344 | * types include unsafe properties that need to be simplified.
|
8345 | *
|
8346 | * An example is the `constructor` property which makes it impossible to
|
8347 | * find a common interface between extensions with different settings and
|
8348 | * properties. By setting the `constructor` to a much simpler override all
|
8349 | * `Extension`'s are now assignable to the `AnyExtension type again.`
|
8350 | */
|
8351 | interface AnyExtensionOverrides extends AnyBaseClassOverrides {
|
8352 | constructor: AnyExtensionConstructor;
|
8353 | ['~C']: ExtensionCommandReturn;
|
8354 | ['~H']: ExtensionHelperReturn;
|
8355 | ['~E']: AnyExtension;
|
8356 | }
|
8357 | }
|
8358 | }
|
8359 |
|
8360 | /* eslint-enable @typescript-eslint/member-ordering */
|
8361 |
|
8362 | // Make the abstract extension available but only as a type.
|
8363 | export type { Extension };
|
8364 |
|
8365 |
|
8366 | declare global {
|
8367 | namespace Remirror {
|
8368 | interface ListenerProperties<Extension extends AnyExtension> {}
|
8369 | }
|
8370 | }
|
8371 |
|
8372 |
|
8373 | declare global {
|
8374 | namespace Remirror {
|
8375 | |
8376 |
|
8377 |
|
8378 | interface ManagerSettings extends Partial<CustomDocumentProps> {
|
8379 | |
8380 |
|
8381 |
|
8382 | priority?: Record<string, ExtensionPriority>;
|
8383 |
|
8384 | |
8385 |
|
8386 |
|
8387 |
|
8388 | exclude?: ExcludeOptions;
|
8389 |
|
8390 | |
8391 |
|
8392 |
|
8393 |
|
8394 |
|
8395 |
|
8396 |
|
8397 |
|
8398 |
|
8399 |
|
8400 |
|
8401 |
|
8402 |
|
8403 |
|
8404 |
|
8405 |
|
8406 |
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 |
|
8414 |
|
8415 |
|
8416 |
|
8417 |
|
8418 |
|
8419 |
|
8420 | onError?: InvalidContentHandler;
|
8421 |
|
8422 | |
8423 |
|
8424 |
|
8425 |
|
8426 |
|
8427 |
|
8428 |
|
8429 |
|
8430 |
|
8431 |
|
8432 | stringHandler?: keyof Remirror.StringHandlers | StringHandler;
|
8433 |
|
8434 | |
8435 |
|
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 | defaultSelection?: 'start' | 'end' | 'all';
|
8441 | }
|
8442 |
|
8443 | |
8444 |
|
8445 |
|
8446 |
|
8447 |
|
8448 |
|
8449 |
|
8450 |
|
8451 | interface ManagerStore<Extension extends AnyExtension> {
|
8452 | |
8453 |
|
8454 |
|
8455 | view: EditorView;
|
8456 | }
|
8457 |
|
8458 | interface ExtensionStore {
|
8459 | |
8460 |
|
8461 |
|
8462 | manager: AnyRemirrorManager;
|
8463 |
|
8464 | |
8465 |
|
8466 |
|
8467 | readonly extensions: AnyExtension[];
|
8468 |
|
8469 | |
8470 |
|
8471 |
|
8472 | readonly phase: ManagerPhase;
|
8473 |
|
8474 | |
8475 |
|
8476 |
|
8477 |
|
8478 | readonly view: EditorView;
|
8479 |
|
8480 | |
8481 |
|
8482 |
|
8483 | currentState: EditorState;
|
8484 |
|
8485 | |
8486 |
|
8487 |
|
8488 | previousState?: EditorState;
|
8489 |
|
8490 | |
8491 |
|
8492 |
|
8493 |
|
8494 | readonly document: Document;
|
8495 |
|
8496 | |
8497 |
|
8498 |
|
8499 | readonly managerSettings: ManagerSettings;
|
8500 |
|
8501 | |
8502 |
|
8503 |
|
8504 | nodeNames: readonly string[];
|
8505 |
|
8506 | |
8507 |
|
8508 |
|
8509 | markNames: readonly string[];
|
8510 |
|
8511 | |
8512 |
|
8513 |
|
8514 | plainNames: readonly string[];
|
8515 |
|
8516 | |
8517 |
|
8518 |
|
8519 |
|
8520 | readonly stringHandlers: NamedStringHandlers;
|
8521 |
|
8522 | |
8523 |
|
8524 |
|
8525 | readonly isMounted: () => boolean;
|
8526 |
|
8527 | |
8528 |
|
8529 |
|
8530 | readonly getState: () => EditorState;
|
8531 |
|
8532 | |
8533 |
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 |
|
8540 | readonly updateState: (state: EditorState) => void;
|
8541 |
|
8542 | |
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 |
|
8548 | readonly getExtension: <ExtensionConstructor extends AnyExtensionConstructor>(
|
8549 | Constructor: ExtensionConstructor,
|
8550 | ) => InstanceType<ExtensionConstructor>;
|
8551 |
|
8552 | |
8553 |
|
8554 |
|
8555 | getStoreKey: <Key extends ManagerStoreKeys>(key: Key) => AnyManagerStore[Key];
|
8556 |
|
8557 | |
8558 |
|
8559 |
|
8560 | setStoreKey: <Key extends ManagerStoreKeys>(key: Key, value: AnyManagerStore[Key]) => void;
|
8561 |
|
8562 | |
8563 |
|
8564 |
|
8565 |
|
8566 |
|
8567 |
|
8568 |
|
8569 |
|
8570 |
|
8571 |
|
8572 |
|
8573 |
|
8574 |
|
8575 |
|
8576 | setExtensionStore: <Key extends keyof ExtensionStore>(
|
8577 | key: Key,
|
8578 | value: ExtensionStore[Key],
|
8579 | ) => void;
|
8580 |
|
8581 | |
8582 |
|
8583 |
|
8584 |
|
8585 |
|
8586 | setStringHandler: (name: keyof StringHandlers, handler: StringHandler) => void;
|
8587 | }
|
8588 | }
|
8589 | }
|
8590 |
|
8591 |
|
8592 | declare global {
|
8593 | namespace Remirror {
|
8594 | interface AllExtensions {
|
8595 | upload: UploadExtension;
|
8596 | }
|
8597 | }
|
8598 | }
|