UNPKG

287 kBTypeScriptView Raw
1import { __INTERNAL_REMIRROR_IDENTIFIER_KEY__ } from '@remirror/core-constants';
2import { AcceptUndefined } from '@remirror/core-types';
3import { AnchorHeadProps } from '@remirror/core-types';
4import { And } from '@remirror/core-types';
5import { AnyConstructor } from '@remirror/core-types';
6import { AnyFunction } from '@remirror/core-types';
7import { applyClonedTransaction } from '@remirror/core-utils';
8import { ApplySchemaAttributes } from '@remirror/core-types';
9import { areSchemasCompatible } from '@remirror/core-utils';
10import { areStatesEqual } from '@remirror/core-utils';
11import { Array1 } from '@remirror/core-types';
12import { Array2 } from '@remirror/core-types';
13import { Array3 } from '@remirror/core-types';
14import { assert } from '@remirror/core-helpers';
15import { assertGet } from '@remirror/core-helpers';
16import { Asyncify } from '@remirror/core-types';
17import { AsyncReturnType } from '@remirror/core-types';
18import { atDocEnd } from '@remirror/core-utils';
19import { atDocStart } from '@remirror/core-utils';
20import { AttributesProps } from '@remirror/core-types';
21import { Brand } from '@remirror/core-types';
22import { callIfDefined } from '@remirror/core-helpers';
23import { CamelCase } from '@remirror/core-types';
24import { camelCase } from '@remirror/core-helpers';
25import { canInsertNode } from '@remirror/core-utils';
26import { capitalCase } from '@remirror/core-helpers';
27import { capitalize } from '@remirror/core-helpers';
28import { Cast } from '@remirror/core-helpers';
29import { chainableEditorState } from '@remirror/core-utils';
30import { chainCommands } from '@remirror/core-utils';
31import { chainKeyBindingCommands } from '@remirror/core-utils';
32import { clamp } from '@remirror/core-helpers';
33import { Class } from '@remirror/core-types';
34import { ClassName } from '@remirror/core-helpers';
35import { cleanupOS } from '@remirror/core-helpers';
36import { clone } from '@remirror/core-helpers';
37import { cloneTransaction } from '@remirror/core-utils';
38import { CommandFunction } from '@remirror/core-types';
39import { CommandFunctionProps } from '@remirror/core-types';
40import { composeTransactionSteps } from '@remirror/core-utils';
41import { ConditionalExcept } from '@remirror/core-types';
42import { ConditionalKeys } from '@remirror/core-types';
43import { ConditionalPick } from '@remirror/core-types';
44import { ConditionalReturnKeys } from '@remirror/core-types';
45import { ConditionalReturnPick } from '@remirror/core-types';
46import { constantCase } from '@remirror/core-helpers';
47import { containsAttributes } from '@remirror/core-utils';
48import { containsNodesOfType } from '@remirror/core-utils';
49import { convertCommand } from '@remirror/core-utils';
50import { convertPixelsToDomUnit } from '@remirror/core-utils';
51import { Coords } from '@remirror/core-types';
52import { CoreIcon } from '@remirror/icons';
53import { createDocumentNode } from '@remirror/core-utils';
54import { CreateDocumentNodeProps } from '@remirror/core-utils';
55import { CustomDocumentProps } from '@remirror/core-utils';
56import { CustomHandler } from '@remirror/core-types';
57import { CustomHandlerKey } from '@remirror/core-types';
58import { CustomHandlerKeyList } from '@remirror/core-types';
59import { CustomHandlerShape } from '@remirror/core-types';
60import { cx } from '@remirror/core-helpers';
61import { debounce } from '@remirror/core-helpers';
62import { DebouncedFunction } from '@remirror/core-helpers';
63import { Decoration } from '@remirror/core-types';
64import { DecorationSet } from '@remirror/core-types';
65import { DecorationSet as DecorationSet_2 } from '@remirror/pm/view';
66import { deepMerge } from '@remirror/core-helpers';
67import { DeepPartial } from '@remirror/core-types';
68import { DeepString } from '@remirror/core-types';
69import { DefaultDocNodeOptions } from '@remirror/core-utils';
70import { defaultImport } from '@remirror/core-helpers';
71import { DelimiterCase } from '@remirror/core-types';
72import { Diff } from '@remirror/core-types';
73import type { DirectEditorProps } from '@remirror/pm/view';
74import { DispatchFunction } from '@remirror/core-types';
75import { Dispose } from '@remirror/core-types';
76import { DOM_SIZE_UNITS } from '@remirror/core-utils';
77import { DOMCompatibleAttributes } from '@remirror/core-types';
78import { DOMOutputSpec } from '@remirror/core-types';
79import { DomSizeUnit } from '@remirror/core-utils';
80import { Dynamic } from '@remirror/core-types';
81import { DynamicAttributeCreator } from '@remirror/core-types';
82import { DynamicKey } from '@remirror/core-types';
83import { DynamicKeyList } from '@remirror/core-types';
84import { DynamicShape } from '@remirror/core-types';
85import { EditorSchema } from '@remirror/core-types';
86import { EditorState } from '@remirror/core-types';
87import { EditorState as EditorState_2 } from '@remirror/pm/state';
88import { EditorStateProps } from '@remirror/core-types';
89import { EditorView } from '@remirror/core-types';
90import { EditorView as EditorView_2 } from '@remirror/pm/view';
91import { EditorViewProps } from '@remirror/core-types';
92import { EMPTY_ARRAY } from '@remirror/core-constants';
93import { EMPTY_NODE } from '@remirror/core-constants';
94import { EMPTY_PARAGRAPH_NODE } from '@remirror/core-constants';
95import { EmptyShape } from '@remirror/core-types';
96import { endPositionOfParent } from '@remirror/core-utils';
97import { Entries } from '@remirror/core-types';
98import { entries } from '@remirror/core-helpers';
99import { Entry } from '@remirror/core-types';
100import { environment } from '@remirror/core-utils';
101import { ErrorConstant } from '@remirror/core-constants';
102import { Except } from '@remirror/core-types';
103import { ExtensionPriority } from '@remirror/core-constants';
104import { ExtensionTag } from '@remirror/core-constants';
105import { ExtensionTagType } from '@remirror/core-constants';
106import { extractPixelSize } from '@remirror/core-utils';
107import { findBlockNodes } from '@remirror/core-utils';
108import { findChildren } from '@remirror/core-utils';
109import { findChildrenByAttribute } from '@remirror/core-utils';
110import { findChildrenByMark } from '@remirror/core-utils';
111import { findChildrenByNode } from '@remirror/core-utils';
112import { findElementAtPosition } from '@remirror/core-utils';
113import { findInlineNodes } from '@remirror/core-utils';
114import { findMatches } from '@remirror/core-helpers';
115import { findNodeAtPosition } from '@remirror/core-utils';
116import { findNodeAtSelection } from '@remirror/core-utils';
117import { findParentNode } from '@remirror/core-utils';
118import { findParentNodeOfType } from '@remirror/core-utils';
119import { findPositionOfNodeAfter } from '@remirror/core-utils';
120import { findPositionOfNodeBefore } from '@remirror/core-utils';
121import { FindProsemirrorNodeResult } from '@remirror/core-utils';
122import { findSelectedNodeOfType } from '@remirror/core-utils';
123import { findTextNodes } from '@remirror/core-utils';
124import { FixedLengthArray } from '@remirror/core-types';
125import { flattenArray } from '@remirror/core-helpers';
126import { Flavor } from '@remirror/core-types';
127import { Flavoring } from '@remirror/core-types';
128import { FlipPartialAndRequired } from '@remirror/core-types';
129import { format } from '@remirror/core-helpers';
130import { Fragment } from '@remirror/core-types';
131import { FragmentStringHandlerOptions } from '@remirror/core-utils';
132import { freeze } from '@remirror/core-helpers';
133import { FromToProps } from '@remirror/core-types';
134import { Get } from '@remirror/core-types';
135import { get } from '@remirror/core-helpers';
136import { GetAcceptUndefined } from '@remirror/core-types';
137import { getActiveNode } from '@remirror/core-utils';
138import { GetAttributes } from '@remirror/core-types';
139import { GetAttributesProps } from '@remirror/core-types';
140import { getChangedNodeRanges } from '@remirror/core-utils';
141import { getChangedNodes } from '@remirror/core-utils';
142import { getChangedRanges } from '@remirror/core-utils';
143import { GetConstructorProps } from '@remirror/core-types';
144import { getCursor } from '@remirror/core-utils';
145import { GetCustomHandler } from '@remirror/core-types';
146import { getDefaultBlockNode } from '@remirror/core-utils';
147import { getDefaultDocNode } from '@remirror/core-utils';
148import { getDocRange } from '@remirror/core-utils';
149import { getDocument } from '@remirror/core-utils';
150import { GetDynamic } from '@remirror/core-types';
151import { GetFixed } from '@remirror/core-types';
152import { GetFixedCustomHandler } from '@remirror/core-types';
153import { GetFixedDynamic } from '@remirror/core-types';
154import { GetFixedProps } from '@remirror/core-types';
155import { GetFixedStatic } from '@remirror/core-types';
156import { GetFlippedStatic } from '@remirror/core-types';
157import { getFontSize } from '@remirror/core-utils';
158import { GetHandler } from '@remirror/core-types';
159import { getInvalidContent } from '@remirror/core-utils';
160import { getLazyArray } from '@remirror/core-helpers';
161import { GetMappedCustomHandler } from '@remirror/core-types';
162import { GetMappedHandler } from '@remirror/core-types';
163import { getMarkAttributes } from '@remirror/core-utils';
164import { GetMarkRange } from '@remirror/core-utils';
165import { getMarkRange } from '@remirror/core-utils';
166import { getMarkRanges } from '@remirror/core-utils';
167import { getMarkType } from '@remirror/core-utils';
168import { getMatchString } from '@remirror/core-utils';
169import { getNodeType } from '@remirror/core-utils';
170import { GetPartialDynamic } from '@remirror/core-types';
171import { getRemirrorJSON } from '@remirror/core-utils';
172import { GetRequiredKeys } from '@remirror/core-types';
173import { getSelectedGroup } from '@remirror/core-utils';
174import { getSelectedWord } from '@remirror/core-utils';
175import { getShortcutSymbols } from '@remirror/core-utils';
176import { GetStatic } from '@remirror/core-types';
177import { GetStaticAndDynamic } from '@remirror/core-types';
178import { getStyle } from '@remirror/core-utils';
179import { getTextContentFromSlice } from '@remirror/core-utils';
180import { getTextSelection } from '@remirror/core-utils';
181import { Handler } from '@remirror/core-types';
182import { HandlerKey } from '@remirror/core-types';
183import { HandlerKeyList } from '@remirror/core-types';
184import { HandlerShape } from '@remirror/core-types';
185import { hasOwnProperty } from '@remirror/core-helpers';
186import { hasTransactionChanged } from '@remirror/core-utils';
187import { htmlToProsemirrorNode } from '@remirror/core-utils';
188import { I18nFormatter } from '@remirror/core-types';
189import { IfEmpty } from '@remirror/core-types';
190import { IfHasRequiredProperties } from '@remirror/core-types';
191import { IfMatches } from '@remirror/core-types';
192import { IfNoRequiredProperties } from '@remirror/core-types';
193import { includes } from '@remirror/core-helpers';
194import { IndexUnionFromTuple } from '@remirror/core-types';
195import { InputRule } from '@remirror/core-types';
196import { InvalidContentBlock } from '@remirror/core-utils';
197import { InvalidContentHandler } from '@remirror/core-utils';
198import { InvalidContentHandlerProps } from '@remirror/core-utils';
199import { invariant } from '@remirror/core-helpers';
200import { isAllSelection } from '@remirror/core-utils';
201import { isAndroidOS } from '@remirror/core-helpers';
202import { isArray } from '@remirror/core-helpers';
203import { isBoolean } from '@remirror/core-helpers';
204import { isChrome } from '@remirror/core-utils';
205import { isClass } from '@remirror/core-helpers';
206import { isDate } from '@remirror/core-helpers';
207import { isDefaultBlockNode } from '@remirror/core-utils';
208import { isDefaultDocNode } from '@remirror/core-utils';
209import { isDirectInstanceOf } from '@remirror/core-helpers';
210import { isDocNode } from '@remirror/core-utils';
211import { isDocNodeEmpty } from '@remirror/core-utils';
212import { isDomNode } from '@remirror/core-utils';
213import { isEditorSchema } from '@remirror/core-utils';
214import { isEditorState } from '@remirror/core-utils';
215import { isElementDomNode } from '@remirror/core-utils';
216import { isEmptyArray } from '@remirror/core-helpers';
217import { isEmptyBlockNode } from '@remirror/core-utils';
218import { isEmptyObject } from '@remirror/core-helpers';
219import { isEndOfTextBlock } from '@remirror/core-utils';
220import { isEqual } from '@remirror/core-helpers';
221import { isError } from '@remirror/core-helpers';
222import { isFunction } from '@remirror/core-helpers';
223import { isIdentifierOfType } from '@remirror/core-utils';
224import { isInstanceOf } from '@remirror/core-helpers';
225import { isInteger } from '@remirror/core-helpers';
226import { isJSONPrimitive } from '@remirror/core-helpers';
227import { isMap } from '@remirror/core-helpers';
228import { isMarkActive } from '@remirror/core-utils';
229import { isMarkType } from '@remirror/core-utils';
230import { isNativePromise } from '@remirror/core-helpers';
231import { isNodeActive } from '@remirror/core-utils';
232import { isNodeOfType } from '@remirror/core-utils';
233import { isNodeSelection } from '@remirror/core-utils';
234import { isNodeType } from '@remirror/core-utils';
235import { isNonEmptyArray } from '@remirror/core-helpers';
236import { isNull } from '@remirror/core-helpers';
237import { isNullOrUndefined } from '@remirror/core-helpers';
238import { isNumber } from '@remirror/core-helpers';
239import { isObject } from '@remirror/core-helpers';
240import { isPlainObject } from '@remirror/core-helpers';
241import { isPrimitive } from '@remirror/core-helpers';
242import { isPromise } from '@remirror/core-helpers';
243import { isProsemirrorFragment } from '@remirror/core-utils';
244import { isProsemirrorMark } from '@remirror/core-utils';
245import { isProsemirrorNode } from '@remirror/core-utils';
246import { isRegExp } from '@remirror/core-helpers';
247import { isRemirrorJSON } from '@remirror/core-utils';
248import { isRemirrorType } from '@remirror/core-utils';
249import { isResolvedPos } from '@remirror/core-utils';
250import { isSafari } from '@remirror/core-utils';
251import { isSafeInteger } from '@remirror/core-helpers';
252import { isSelection } from '@remirror/core-utils';
253import { isSelectionEmpty } from '@remirror/core-utils';
254import { isSet } from '@remirror/core-helpers';
255import { isStartOfDoc } from '@remirror/core-utils';
256import { isStartOfTextBlock } from '@remirror/core-utils';
257import { isString } from '@remirror/core-helpers';
258import { isSymbol } from '@remirror/core-helpers';
259import { isTextDomNode } from '@remirror/core-utils';
260import { isTextSelection } from '@remirror/core-utils';
261import { isTransaction } from '@remirror/core-utils';
262import { isUndefined } from '@remirror/core-helpers';
263import { IterableElement } from '@remirror/core-types';
264import { joinStyles } from '@remirror/core-utils';
265import { JsonArray } from '@remirror/core-types';
266import { JsonObject } from '@remirror/core-types';
267import { JsonPrimitive } from '@remirror/core-types';
268import { JsonValue } from '@remirror/core-types';
269import { KebabCase } from '@remirror/core-types';
270import { kebabCase } from '@remirror/core-helpers';
271import { KeepPartialProperties } from '@remirror/core-types';
272import { KeyBindingCommandFunction } from '@remirror/core-types';
273import { KeyBindingNames } from '@remirror/core-types';
274import { KeyBindingProps } from '@remirror/core-types';
275import { KeyBindings } from '@remirror/core-types';
276import { keys } from '@remirror/core-helpers';
277import { last } from '@remirror/core-helpers';
278import { LEAF_NODE_REPLACING_CHARACTER } from '@remirror/core-constants';
279import { lift } from '@remirror/core-utils';
280import { Listable } from '@remirror/core-types';
281import { Literal } from '@remirror/core-types';
282import { LiteralUnion } from '@remirror/core-types';
283import { MakeNullable } from '@remirror/core-types';
284import { MakeOptional } from '@remirror/core-types';
285import { MakeReadonly } from '@remirror/core-types';
286import { MakeRequired } from '@remirror/core-types';
287import { MakeUndefined } from '@remirror/core-types';
288import { ManagerPhase } from '@remirror/core-constants';
289import { Mapping } from '@remirror/core-types';
290import { Mark } from '@remirror/core-types';
291import { Mark as Mark_2 } from '@remirror/pm/model';
292import { markEqualsType } from '@remirror/core-utils';
293import { MarkExtensionSpec } from '@remirror/core-types';
294import { markInputRule } from '@remirror/core-utils';
295import { MarkSpecOverride } from '@remirror/core-types';
296import { MarkType } from '@remirror/core-types';
297import { MarkTypeProps } from '@remirror/core-types';
298import { MarkTypesProps } from '@remirror/core-types';
299import { MarkWithAttributes } from '@remirror/core-types';
300import { MarkWithAttributesProps } from '@remirror/core-types';
301import { Merge } from '@remirror/core-types';
302import { mergeDOMRects } from '@remirror/core-utils';
303import { MergeExclusive } from '@remirror/core-types';
304import { mergeKeyBindings } from '@remirror/core-utils';
305import { mergeProsemirrorKeyBindings } from '@remirror/core-utils';
306import { MinArray } from '@remirror/core-types';
307import { mutateTag } from '@remirror/core-constants';
308import { NamedShortcut } from '@remirror/core-constants';
309import { NamedStringHandlers } from '@remirror/core-utils';
310import { NodeExtensionSpec } from '@remirror/core-types';
311import { nodeInputRule } from '@remirror/core-utils';
312import { NodeMarkOptions } from '@remirror/core-types';
313import { NodeSpecOverride } from '@remirror/core-types';
314import { NodeStringHandlerOptions } from '@remirror/core-utils';
315import { NodeType } from '@remirror/core-types';
316import { NodeType as NodeType_2 } from '@remirror/pm/model';
317import { NodeTypeProps } from '@remirror/core-types';
318import { NodeTypesProps } from '@remirror/core-types';
319import { NodeView } from '@remirror/core-types';
320import { NodeViewMethod } from '@remirror/core-types';
321import { NodeWithAttributes } from '@remirror/core-types';
322import { NodeWithAttributesProps } from '@remirror/core-types';
323import { NodeWithPosition } from '@remirror/core-utils';
324import { NON_BREAKING_SPACE_CHAR } from '@remirror/core-constants';
325import { nonChainable } from '@remirror/core-utils';
326import { NonChainableCommandFunction } from '@remirror/core-types';
327import { NonNullableShape } from '@remirror/core-types';
328import { noop } from '@remirror/core-helpers';
329import { NULL_CHARACTER } from '@remirror/core-constants';
330import { Nullable } from '@remirror/core-types';
331import { object } from '@remirror/core-helpers';
332import { ObjectMark } from '@remirror/core-types';
333import { ObservableLike } from '@remirror/core-types';
334import { omit } from '@remirror/core-helpers';
335import { omitExtraAttributes } from '@remirror/core-utils';
336import { omitUndefined } from '@remirror/core-helpers';
337import { Opaque } from '@remirror/core-types';
338import { OptionalMarkProps } from '@remirror/core-types';
339import { OptionalProsemirrorNodeProps } from '@remirror/core-types';
340import { PackageJson } from '@remirror/core-types';
341import { ParsedDomSize } from '@remirror/core-utils';
342import { parseSizeUnit } from '@remirror/core-utils';
343import { PartialDeep } from '@remirror/core-types';
344import { PartialWithRequiredKeys } from '@remirror/core-types';
345import { PascalCase } from '@remirror/core-types';
346import { pascalCase } from '@remirror/core-helpers';
347import { pathCase } from '@remirror/core-helpers';
348import { pick } from '@remirror/core-helpers';
349import { PickPartial } from '@remirror/core-types';
350import { PickRequired } from '@remirror/core-types';
351import { plainInputRule } from '@remirror/core-utils';
352import { Plugin as Plugin_2 } from '@remirror/pm/state';
353import { PluginKey } from '@remirror/core-types';
354import type { PluginSpec } from '@remirror/pm/state';
355import { PosProps } from '@remirror/core-types';
356import { Predicate } from '@remirror/core-types';
357import { PredicateProps } from '@remirror/core-types';
358import { preserveSelection } from '@remirror/core-utils';
359import { Primitive } from '@remirror/core-types';
360import { PrimitiveSelection } from '@remirror/core-types';
361import { Promisable } from '@remirror/core-types';
362import { ProsemirrorAttributes } from '@remirror/core-types';
363import { ProsemirrorCommandFunction } from '@remirror/core-types';
364import { ProsemirrorKeyBindings } from '@remirror/core-types';
365import { ProsemirrorNode } from '@remirror/core-types';
366import { ProsemirrorNodeProps } from '@remirror/core-types';
367import { prosemirrorNodeToDom } from '@remirror/core-utils';
368import { prosemirrorNodeToHtml } from '@remirror/core-utils';
369import { ProsemirrorPlugin } from '@remirror/core-types';
370import { ProsemirrorPlugin as ProsemirrorPlugin_2 } from '@remirror/pm';
371import { randomFloat } from '@remirror/core-helpers';
372import { randomInt } from '@remirror/core-helpers';
373import { range } from '@remirror/core-helpers';
374import { rangeHasMark } from '@remirror/core-utils';
375import { RangeProps } from '@remirror/core-types';
376import { ReadonlyDeep } from '@remirror/core-types';
377import { RegExpProps } from '@remirror/core-types';
378import { REMIRROR_WEBVIEW_NAME } from '@remirror/core-constants';
379import { RemirrorContentType } from '@remirror/core-types';
380import { RemirrorError } from '@remirror/core-helpers';
381import { RemirrorErrorOptions } from '@remirror/core-helpers';
382import { RemirrorIdentifier } from '@remirror/core-constants';
383import { RemirrorIdentifierShape } from '@remirror/core-types';
384import { RemirrorJSON } from '@remirror/core-types';
385import { RemirrorMessage } from '@remirror/core-types';
386import { RemoveAnnotation } from '@remirror/core-types';
387import { RemoveAnnotations } from '@remirror/core-types';
388import { RemoveFlavoring } from '@remirror/core-types';
389import { removeMark } from '@remirror/core-utils';
390import { RemoveMarkProps } from '@remirror/core-utils';
391import { removeNodeAfter } from '@remirror/core-utils';
392import { removeNodeAtPosition } from '@remirror/core-utils';
393import { removeNodeBefore } from '@remirror/core-utils';
394import { Replace } from '@remirror/core-types';
395import { replaceNodeAtPosition } from '@remirror/core-utils';
396import { replaceText } from '@remirror/core-utils';
397import { ReplaceTextProps } from '@remirror/core-utils';
398import { RequireAtLeastOne } from '@remirror/core-types';
399import { RequireExactlyOne } from '@remirror/core-types';
400import { ResolvedPos } from '@remirror/core-types';
401import { ResolvedPosProps } from '@remirror/core-types';
402import { SchemaAttributes } from '@remirror/core-types';
403import { SchemaAttributesObject } from '@remirror/core-types';
404import { SchemaJSON } from '@remirror/core-utils';
405import { SchemaProps } from '@remirror/core-types';
406import { schemaToJSON } from '@remirror/core-utils';
407import { SELECTED_NODE_CLASS_NAME } from '@remirror/core-constants';
408import { SELECTED_NODE_CLASS_SELECTOR } from '@remirror/core-constants';
409import { Selection as Selection_2 } from '@remirror/core-types';
410import { SelectionProps } from '@remirror/core-types';
411import { set } from '@remirror/core-helpers';
412import { setBlockType } from '@remirror/core-utils';
413import { SetOptional } from '@remirror/core-types';
414import { SetRequired } from '@remirror/core-types';
415import { SetReturnType } from '@remirror/core-types';
416import { setStyle } from '@remirror/core-utils';
417import { shallowClone } from '@remirror/core-helpers';
418import { Shape } from '@remirror/core-types';
419import { ShouldSkipFunction } from '@remirror/core-utils';
420import { ShouldSkipProps } from '@remirror/core-utils';
421import { shouldUseDomEnvironment } from '@remirror/core-utils';
422import { Simplify } from '@remirror/core-types';
423import { SkippableInputRule } from '@remirror/core-utils';
424import { Slice } from '@remirror/core-types';
425import { SnakeCase } from '@remirror/core-types';
426import { snakeCase } from '@remirror/core-helpers';
427import { sort } from '@remirror/core-helpers';
428import { spaceCase } from '@remirror/core-helpers';
429import { startCase } from '@remirror/core-helpers';
430import { startPositionOfParent } from '@remirror/core-utils';
431import { STATE_OVERRIDE } from '@remirror/core-constants';
432import { StateJSON } from '@remirror/core-types';
433import { Static } from '@remirror/core-types';
434import { StaticKey } from '@remirror/core-types';
435import { StaticKeyList } from '@remirror/core-types';
436import { StaticShape } from '@remirror/core-types';
437import { StrictReplace } from '@remirror/core-types';
438import { StringHandler } from '@remirror/core-utils';
439import { StringHandlerOptions } from '@remirror/core-utils';
440import { StringHandlerProps } from '@remirror/core-utils';
441import { Stringified } from '@remirror/core-types';
442import { StringKey } from '@remirror/core-types';
443import { Suggester } from '@remirror/pm/suggest';
444import { SuggestState } from '@remirror/pm/suggest';
445import { take } from '@remirror/core-helpers';
446import { textBetween } from '@remirror/core-utils';
447import { TextProps } from '@remirror/core-types';
448import { throttle } from '@remirror/core-helpers';
449import { ThrottledFunction } from '@remirror/core-helpers';
450import { toggleBlockItem } from '@remirror/core-utils';
451import { ToggleBlockItemProps } from '@remirror/core-utils';
452import { toggleWrap } from '@remirror/core-utils';
453import { toString as toString_2 } from '@remirror/core-helpers';
454import { Transaction } from '@remirror/core-types';
455import { Transaction as Transaction_2 } from '@remirror/pm/state';
456import { TransactionProps } from '@remirror/core-types';
457import { TransactionTransformer } from '@remirror/core-types';
458import { TrStateProps } from '@remirror/core-types';
459import { TsConfigJson } from '@remirror/core-types';
460import { TupleOf } from '@remirror/core-types';
461import { TupleUnion } from '@remirror/core-types';
462import { TupleValue } from '@remirror/core-types';
463import { TypedArray } from '@remirror/core-types';
464import { UndefinedFlipPartialAndRequired } from '@remirror/core-types';
465import { UndefinedPickPartial } from '@remirror/core-types';
466import { UnionToIntersection } from '@remirror/core-types';
467import { uniqueArray } from '@remirror/core-helpers';
468import { uniqueBy } from '@remirror/core-helpers';
469import { uniqueId } from '@remirror/core-helpers';
470import { UnknownShape } from '@remirror/core-types';
471import { unset } from '@remirror/core-helpers';
472import { Unsubscribe } from 'nanoevents';
473import { updateMark } from '@remirror/core-utils';
474import { UpdateMarkProps } from '@remirror/core-utils';
475import { UseDefault } from '@remirror/core-types';
476import { ValidOptions } from '@remirror/core-types';
477import { Value } from '@remirror/core-types';
478import { ValueOf } from '@remirror/core-types';
479import { values } from '@remirror/core-helpers';
480import { within } from '@remirror/core-helpers';
481import { wrapIn } from '@remirror/core-utils';
482import { Writable } from '@remirror/core-types';
483import { Writeable } from '@remirror/core-types';
484import { ZERO_WIDTH_SPACE_CHAR } from '@remirror/core-constants';
485
486export { __INTERNAL_REMIRROR_IDENTIFIER_KEY__ }
487
488/**
489 * Any `ProsemirrorNode` can use the `uploadFile` function in this file as long
490 * as its attributes implement this interface.
491 */
492declare interface AbstractNodeAttributes {
493 id?: any;
494 error?: string | null;
495}
496
497export { AcceptUndefined }
498
499export declare enum ActionType {
500 ADD_PLACEHOLDER = 0,
501 REMOVE_PLACEHOLDER = 1
502}
503
504/**
505 * The type which gets the active methods from the provided extensions.
506 */
507declare 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>;
508export { ActiveFromExtensions }
509export { ActiveFromExtensions as ActiveFromExtensions_alias_1 }
510export { ActiveFromExtensions as ActiveFromExtensions_alias_2 }
511
512declare type AddCustomHandler<Options extends ValidOptions> = (props: Partial<GetCustomHandler<Options>>) => Dispose | undefined;
513export { AddCustomHandler }
514export { AddCustomHandler as AddCustomHandler_alias_1 }
515
516declare type AddFrameworkHandler<Extension extends AnyExtension> = <Key extends keyof FrameworkEvents<Extension>>(event: Key, cb: FrameworkEvents<Extension>[Key]) => Unsubscribe;
517export { AddFrameworkHandler }
518export { AddFrameworkHandler as AddFrameworkHandler_alias_1 }
519
520declare type AddHandler<Options extends ValidOptions> = <Key extends keyof GetHandler<Options>>(key: Key, method: GetHandler<Options>[Key]) => Dispose;
521export { AddHandler }
522export { AddHandler as AddHandler_alias_1 }
523
524/**
525 * TODO see if this is needed or remove.
526 */
527export declare type AddHandlers<Options extends ValidOptions> = (props: Partial<GetHandler<Options>>) => Dispose;
528
529declare interface AddPlaceholderAction {
530 type: ActionType.ADD_PLACEHOLDER;
531 id: string;
532 payload: any;
533 pos: number;
534}
535
536export { AnchorHeadProps }
537
538export { And }
539
540export declare type AnyBaseClassConstructor = Replace<BaseClassConstructor<any, any>, {
541 new (...args: any[]): AnyFunction;
542}>;
543
544export declare interface AnyBaseClassOverrides {
545 addCustomHandler: AnyFunction;
546 addHandler: AnyFunction;
547 clone: AnyFunction;
548}
549
550export { AnyConstructor }
551
552/**
553 * The type which is applicable to any extension instance.
554 *
555 * **NOTE** `& object` forces VSCode to use the name `AnyExtension` rather than
556 * print out `Replace<Extension<Shape>, Remirror.AnyExtensionOverrides>`
557 */
558declare type AnyExtension = Replace<Extension<Shape>, Remirror.AnyExtensionOverrides> & object;
559export { AnyExtension }
560export { AnyExtension as AnyExtension_alias_1 }
561export { AnyExtension as AnyExtension_alias_2 }
562
563/**
564 * The type which is applicable to any extension instance.
565 */
566declare type AnyExtensionConstructor = Replace<ExtensionConstructor<any>, {
567 new (...args: any[]): AnyExtension;
568}>;
569export { AnyExtensionConstructor }
570export { AnyExtensionConstructor as AnyExtensionConstructor_alias_1 }
571export { AnyExtensionConstructor as AnyExtensionConstructor_alias_2 }
572
573export { AnyFunction }
574
575declare type AnyManagerStore = Remirror.ManagerStore<any>;
576export { AnyManagerStore }
577export { AnyManagerStore as AnyManagerStore_alias_1 }
578export { AnyManagerStore as AnyManagerStore_alias_2 }
579
580/**
581 * The type for any potential MarkExtension.
582 */
583declare type AnyMarkExtension = Replace<MarkExtension<Shape>, Remirror.AnyExtensionOverrides> & object;
584export { AnyMarkExtension }
585export { AnyMarkExtension as AnyMarkExtension_alias_1 }
586export { AnyMarkExtension as AnyMarkExtension_alias_2 }
587
588/**
589 * The type for any potential NodeExtension.
590 */
591declare type AnyNodeExtension = Replace<NodeExtension<Shape>, Remirror.AnyExtensionOverrides> & object;
592export { AnyNodeExtension }
593export { AnyNodeExtension as AnyNodeExtension_alias_1 }
594export { AnyNodeExtension as AnyNodeExtension_alias_2 }
595
596/**
597 * The type for any potential PlainExtension.
598 */
599declare type AnyPlainExtension = Replace<PlainExtension<Shape>, Remirror.AnyExtensionOverrides> & object;
600export { AnyPlainExtension }
601export { AnyPlainExtension as AnyPlainExtension_alias_1 }
602export { AnyPlainExtension as AnyPlainExtension_alias_2 }
603
604declare 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 /** @internal */
617 ['~E']: AnyExtension;
618 /** @internal */
619 ['~AN']: string;
620 /** @internal */
621 ['~N']: string;
622 /** @internal */
623 ['~M']: string;
624 /** @internal */
625 ['~P']: string;
626}>>;
627export { AnyRemirrorManager }
628export { AnyRemirrorManager as AnyRemirrorManager_alias_1 }
629export { AnyRemirrorManager as AnyRemirrorManager_alias_2 }
630
631declare interface AppendLifecycleProps extends EditorStateProps {
632 /**
633 * Update this transaction in order to append.
634 */
635 tr: Transaction;
636 /**
637 * The previous state.
638 */
639 previousState: EditorState;
640 /**
641 * The transactions that have already been applied.
642 */
643 transactions: readonly Transaction[];
644}
645export { AppendLifecycleProps }
646export { AppendLifecycleProps as AppendLifecycleProps_alias_1 }
647
648export { applyClonedTransaction }
649
650/**
651 * Apply the provided mark type and attributes.
652 *
653 * @param markType - the mark to apply.
654 * @param attrs - the attributes to set on the applied mark.
655 * @param selectionPoint - optionally specify where the mark should be applied.
656 * Defaults to the current selection.
657 */
658export declare function applyMark(type: string | MarkType, attrs?: ProsemirrorAttributes, selectionPoint?: PrimitiveSelection): CommandFunction;
659
660export { ApplySchemaAttributes }
661
662declare interface ApplyStateLifecycleProps extends EditorStateProps {
663 /**
664 * The original transaction which caused this state update.
665 */
666 tr: Transaction;
667 /**
668 * The previous state.
669 */
670 previousState: EditorState;
671}
672export { ApplyStateLifecycleProps }
673export { ApplyStateLifecycleProps as ApplyStateLifecycleProps_alias_1 }
674
675export { areSchemasCompatible }
676
677export { areStatesEqual }
678
679export { Array1 }
680
681export { Array2 }
682
683export { Array3 }
684
685export { assert }
686
687export { assertGet }
688
689export { Asyncify }
690
691export { AsyncReturnType }
692
693export { atDocEnd }
694
695export { atDocStart }
696
697declare type AttributePropFunction<Extension extends AnyExtension> = (params: RemirrorEventListenerProps<Extension>) => Record<string, string>;
698export { AttributePropFunction }
699export { AttributePropFunction as AttributePropFunction_alias_1 }
700export { AttributePropFunction as AttributePropFunction_alias_2 }
701
702/**
703 * This extension allows others extension to add the `createAttributes` method
704 * for adding attributes to the prosemirror dom element.
705 *
706 * @remarks
707 *
708 * Use this to include all the dynamically generated attributes provided by each
709 * extension. High priority extensions have preference over the lower priority
710 * extensions.
711 *
712 * @category Builtin Extension
713 */
714declare class AttributesExtension extends PlainExtension {
715 get name(): "attributes";
716 private attributeList;
717 private attributeObject;
718 /**
719 * Create the attributes object on initialization.
720 *
721 * @internal
722 */
723 onCreate(): void;
724 private readonly updateAttributes;
725 private transformAttributes;
726}
727export { AttributesExtension }
728export { AttributesExtension as AttributesExtension_alias_1 }
729export { AttributesExtension as AttributesExtension_alias_2 }
730
731export { AttributesProps }
732
733/**
734 * The type which gets the attributes for the provided node or mark. It returns
735 * undefined if the node / mark is not active.
736 */
737declare 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>;
738export { AttrsFromExtensions }
739export { AttrsFromExtensions as AttrsFromExtensions_alias_1 }
740export { AttrsFromExtensions as AttrsFromExtensions_alias_2 }
741
742export declare abstract class BaseClass<Options extends ValidOptions = EmptyShape, DefaultStaticOptions extends Shape = EmptyShape> {
743 /**
744 * The default options for this extension.
745 *
746 * TODO see if this can be cast to something other than any and allow
747 * composition.
748 */
749 static readonly defaultOptions: any;
750 /**
751 * The static keys for this class.
752 */
753 static readonly staticKeys: string[];
754 /**
755 * The event handler keys.
756 */
757 static readonly handlerKeys: string[];
758 /**
759 * Customize the way the handler should behave.
760 */
761 static handlerKeyOptions: Partial<Record<string, HandlerKeyOptions> & {
762 [GENERAL_OPTIONS]?: HandlerKeyOptions;
763 }>;
764 /**
765 * The custom keys.
766 */
767 static readonly customHandlerKeys: string[];
768 /**
769 * This is not for external use. It is purely here for TypeScript inference of
770 * the generic `Options` type parameter.
771 *
772 * @internal
773 */
774 ['~O']: Options & DefaultStaticOptions;
775 /**
776 * This identifies this as a `Remirror` object. .
777 * @internal
778 */
779 abstract readonly [__INTERNAL_REMIRROR_IDENTIFIER_KEY__]: RemirrorIdentifier;
780 /**
781 * The unique name of this extension.
782 *
783 * @remarks
784 *
785 * Every extension **must** have a name. The name should have a distinct type
786 * to allow for better type inference for end users. By convention the name
787 * should be `camelCased` and unique within your editor instance.
788 *
789 * ```ts
790 * class SimpleExtension extends Extension {
791 * get name() {
792 * return 'simple' as const;
793 * }
794 * }
795 * ```
796 */
797 abstract get name(): string;
798 /**
799 * The options for this extension.
800 *
801 * @remarks
802 *
803 * Options are composed of Static, Dynamic, Handlers and ObjectHandlers.
804 *
805 * - `Static` - set at instantiation by the constructor.
806 * - `Dynamic` - optionally set at instantiation by the constructor and also
807 * set during the runtime.
808 * - `Handlers` - can only be set during the runtime.
809 * - `ObjectHandlers` - Can only be set during the runtime of the extension.
810 */
811 get options(): RemoveAnnotations<GetFixed<Options> & DefaultStaticOptions>;
812 /**
813 * Get the dynamic keys for this extension.
814 */
815 get dynamicKeys(): string[];
816 /**
817 * The options that this instance was created with, merged with all the
818 * default options.
819 */
820 get initialOptions(): RemoveAnnotations<GetFixed<Options> & DefaultStaticOptions>;
821 /**
822 * The initial options at creation (used to reset).
823 */
824 private readonly _initialOptions;
825 /**
826 * All the dynamic keys supported by this extension.
827 */
828 private readonly _dynamicKeys;
829 /**
830 * Private instance of the extension options.
831 */
832 private _options;
833 /**
834 * The mapped function handlers.
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 * // BAD ❌
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
974export declare interface BaseClass<Options extends ValidOptions, DefaultStaticOptions extends Shape = EmptyShape> {
975 constructor: BaseClassConstructor<Options, DefaultStaticOptions>;
976}
977
978export 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
1037declare 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}
1055export { BaseExtensionOptions }
1056export { BaseExtensionOptions as BaseExtensionOptions_alias_1 }
1057
1058declare 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}
1076export { BaseFramework }
1077export { BaseFramework as BaseFramework_alias_1 }
1078export { BaseFramework as BaseFramework_alias_2 }
1079
1080declare 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
1096export { Brand }
1097
1098declare interface BuiltinOptions extends SuggestOptions, KeymapOptions, DecorationsOptions, InputRulesOptions {
1099}
1100export { BuiltinOptions }
1101export { BuiltinOptions as BuiltinOptions_alias_1 }
1102export { BuiltinOptions as BuiltinOptions_alias_2 }
1103
1104declare type BuiltinPreset = TagsExtension | SchemaExtension | AttributesExtension | PluginsExtension | InputRulesExtension | PasteRulesExtension | NodeViewsExtension | SuggestExtension | CommandsExtension | HelpersExtension | KeymapExtension | DocChangedExtension | UploadExtension | DecorationsExtension;
1105export { BuiltinPreset }
1106export { BuiltinPreset as BuiltinPreset_alias_1 }
1107export { 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 */
1130declare function builtinPreset(options?: GetStaticAndDynamic<BuiltinOptions>): BuiltinPreset[];
1131export { builtinPreset }
1132export { builtinPreset as builtinPreset_alias_1 }
1133export { builtinPreset as builtinPreset_alias_2 }
1134
1135export { callIfDefined }
1136
1137export { CamelCase }
1138
1139export { camelCase }
1140
1141export { canInsertNode }
1142
1143export { capitalCase }
1144
1145export { capitalize }
1146
1147export { Cast }
1148
1149declare 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
1159export { chainableEditorState }
1160
1161export { chainCommands }
1162
1163declare interface ChainedCommandProps {
1164 /**
1165 * Dispatches the chained commands.
1166 *
1167 * ```ts
1168 * chain.insertText('hello').run();
1169 * ```
1170 *
1171 * This will run all commands in the chain regardless of whether a previous
1172 * command was not able to be run.
1173 *
1174 * If `exitEarly` is set to true the commands will stop running at the first
1175 * chainable command which doesn't return true.
1176 */
1177 run: (options?: {
1178 exitEarly?: boolean;
1179 }) => void;
1180 /**
1181 * Applies the updates to the transaction without dispatching the transaction.
1182 *
1183 * This can be used to update a transaction without applying the update.
1184 */
1185 tr: () => Transaction;
1186 /**
1187 * Check to see whether the command chain can be run. Returns true when the
1188 * command can be run.
1189 *
1190 * ```ts
1191 * if (chain.insertText('hello').enabled()) {
1192 * doSomething();
1193 * }
1194 * ```
1195 */
1196 enabled: () => boolean;
1197}
1198export { ChainedCommandProps }
1199export { ChainedCommandProps as ChainedCommandProps_alias_1 }
1200export { ChainedCommandProps as ChainedCommandProps_alias_2 }
1201
1202declare type ChainedFromExtensions<Extension extends AnyExtension, Chained extends ChainedIntersection<Extension> = ChainedIntersection<Extension>> = _ChainedFromExtensions<Extension, Chained> & ((tr: Transaction) => _ChainedFromExtensions<Extension, Chained>);
1203export { ChainedFromExtensions }
1204export { ChainedFromExtensions as ChainedFromExtensions_alias_1 }
1205export { ChainedFromExtensions as ChainedFromExtensions_alias_2 }
1206
1207declare 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
1211declare type ChainedIntersection<Extension extends AnyExtension> = UnionToIntersection<MapToChainedCommand<GetCommands<Extension> | GetDecoratedCommands<Extension>>>;
1212export { ChainedIntersection }
1213export { ChainedIntersection as ChainedIntersection_alias_1 }
1214export { ChainedIntersection as ChainedIntersection_alias_2 }
1215
1216export { chainKeyBindingCommands }
1217
1218/**
1219 * Highlights all the properties that have changed.
1220 */
1221declare type ChangedOptions<Options extends ValidOptions> = {
1222 [Key in keyof GetDynamic<Options>]: Changes<GetDynamic<Options>[Key]>;
1223};
1224export { ChangedOptions }
1225export { ChangedOptions as ChangedOptions_alias_1 }
1226
1227declare type Changes<Type> = {
1228 /**
1229 * Whether or not the value has changed.
1230 *
1231 * - `false` when no change occurred.
1232 */
1233 changed: false;
1234} | {
1235 /**
1236 * - `true` when a change occurred.
1237 */
1238 changed: true;
1239 /**
1240 * The previous value before the changed. This is only accessible when
1241 * `changed` is `true`.
1242 */
1243 previousValue: Type;
1244 /**
1245 * The latest value after the change. This is only accessible when
1246 * `changed` is `true`.
1247 */
1248 value: Type;
1249};
1250
1251export { clamp }
1252
1253export { Class }
1254
1255export { ClassName }
1256
1257export { cleanupOS }
1258
1259export { clone }
1260
1261export { cloneTransaction }
1262
1263/**
1264 * The shape of the tag data stored by the extension manager.
1265 *
1266 * This data can be used by other extensions to dynamically determine which
1267 * nodes should affected by commands / plugins / keys etc...
1268 */
1269declare type CombinedTags<Name extends string = string> = Record<ExtensionTagType, Name[]>;
1270export { CombinedTags }
1271export { CombinedTags as CombinedTags_alias_1 }
1272export { CombinedTags as CombinedTags_alias_2 }
1273
1274/**
1275 * A decorator which can be applied to top level methods on an extension to
1276 * identify them as commands. This can be used as a replacement for the
1277 * `createCommands` method.
1278 *
1279 * If you prefer not to use decorators, then you can continue using
1280 * `createCommands`. Internally the decorators are being used as they are better
1281 * for documentation purposes.
1282 *
1283 * For automated type inference methods that use this decorator must implement
1284 * the following type signature.
1285 *
1286 * ```ts
1287 * import { CommandFunction } from '@remirror/core';
1288 *
1289 * type Signature = (...args: any[]) => CommandFunction;
1290 * ```
1291 *
1292 * The following is an example of how this can be used within your extension.
1293 *
1294 * ```ts
1295 * import { command, CommandFunction } from '@remirror/core';
1296 *
1297 * class MyExtension {
1298 * get name() {
1299 * return 'my';
1300 * }
1301 *
1302 * @command()
1303 * myCommand(text: string): CommandFunction {
1304 * return ({ tr, dispatch }) => {
1305 * dispatch?.(tr.insertText('my command ' + text));
1306 * return true;
1307 * }
1308 * }
1309 * }
1310 * ```
1311 *
1312 * The above command can now be used within your editor instance.
1313 *
1314 * ```tsx
1315 * import { useRemirrorContext } from '@remirror/react';
1316 *
1317 * const MyEditorButton = () => {
1318 * const { commands } = useRemirrorContext();
1319 *
1320 * return <button onClick={() => commands.myCommand('hello')}>My Button</button>
1321 * }
1322 * ```
1323 *
1324 * @category Method Decorator
1325 */
1326declare function command<Extension extends AnyExtension>(options?: ChainableCommandDecoratorOptions<Required<GetOptions<Extension>>>): ExtensionDecorator<Extension, CommandFunction, void>;
1327
1328declare function command<Extension extends AnyExtension>(options: NonChainableCommandDecoratorOptions<Required<GetOptions<Extension>>>): ExtensionDecorator<Extension, NonChainableCommandFunction, void>;
1329export { command }
1330export { command as command_alias_1 }
1331export { command as command_alias_2 }
1332
1333declare type CommandDecoratorMessage = CommandDecoratorValue<string>;
1334export { CommandDecoratorMessage }
1335export { CommandDecoratorMessage as CommandDecoratorMessage_alias_1 }
1336export { CommandDecoratorMessage as CommandDecoratorMessage_alias_2 }
1337
1338declare interface CommandDecoratorMessageProps {
1339 /**
1340 * True when the command is enabled.
1341 */
1342 enabled: boolean;
1343 /**
1344 * True when the extension is active.
1345 */
1346 active: boolean;
1347 /**
1348 * Predefined attributes which can influence the returned value.
1349 */
1350 attrs: ProsemirrorAttributes | undefined;
1351 /**
1352 * A translation utility for translating a predefined string / or message
1353 * descriptor.
1354 */
1355 t: I18nFormatter;
1356}
1357export { CommandDecoratorMessageProps }
1358export { CommandDecoratorMessageProps as CommandDecoratorMessageProps_alias_1 }
1359export { CommandDecoratorMessageProps as CommandDecoratorMessageProps_alias_2 }
1360
1361declare type CommandDecoratorOptions<Options extends Shape = Shape> = ChainableCommandDecoratorOptions<Options> | NonChainableCommandDecoratorOptions<Options>;
1362export { CommandDecoratorOptions }
1363export { CommandDecoratorOptions as CommandDecoratorOptions_alias_1 }
1364export { CommandDecoratorOptions as CommandDecoratorOptions_alias_2 }
1365
1366declare type CommandDecoratorShortcut = string | {
1367 shortcut: string;
1368 attrs: ProsemirrorAttributes;
1369} | string[] | Array<{
1370 shortcut: string;
1371 attrs: ProsemirrorAttributes;
1372}>;
1373export { CommandDecoratorShortcut }
1374export { CommandDecoratorShortcut as CommandDecoratorShortcut_alias_1 }
1375export { CommandDecoratorShortcut as CommandDecoratorShortcut_alias_2 }
1376
1377/**
1378 * @typeParam Value - the value which should be returned from the function or
1379 * used directly.
1380 */
1381declare type CommandDecoratorValue<Value> = ((props: CommandDecoratorMessageProps) => Value) | Value;
1382export { CommandDecoratorValue }
1383export { CommandDecoratorValue as CommandDecoratorValue_alias_1 }
1384export { CommandDecoratorValue as CommandDecoratorValue_alias_2 }
1385
1386declare interface CommandExtensionMeta {
1387 forcedUpdates?: UpdatableViewProps[];
1388}
1389export { CommandExtensionMeta }
1390export { CommandExtensionMeta as CommandExtensionMeta_alias_1 }
1391export { CommandExtensionMeta as CommandExtensionMeta_alias_2 }
1392
1393export { CommandFunction }
1394
1395export { CommandFunctionProps }
1396
1397declare 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 */
1420declare type CommandNames<Extension extends AnyExtension> = StringKey<CommandsFromExtensions<Extension>>;
1421export { CommandNames }
1422export { CommandNames as CommandNames_alias_1 }
1423export { CommandNames as CommandNames_alias_2 }
1424
1425declare 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}
1439export { CommandOptions }
1440export { CommandOptions as CommandOptions_alias_1 }
1441export { 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 */
1453declare 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 * // Set to the end of the document.
1557 * commands.selectText('end');
1558 *
1559 * // Set the selection to the start of the document.
1560 * commands.selectText('start');
1561 *
1562 * // Select all the text in the document.
1563 * commands.selectText('all')
1564 *
1565 * // Select a range of text. It's up to you to make sure the selected
1566 * // range is valid.
1567 * commands.selectText({ from: 10, to: 15 });
1568 *
1569 * // Specify the anchor and range in the selection.
1570 * commands.selectText({ anchor: 10, head: 15 });
1571 *
1572 * // Set to a specific position.
1573 * commands.selectText(10);
1574 *
1575 * // Use a ProseMirror selection
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}
1836export { CommandsExtension }
1837export { CommandsExtension as CommandsExtension_alias_1 }
1838export { 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 */
1849declare type CommandsFromExtensions<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = UnionToIntersection<MapToUnchainedCommand<GetCommands<Expanded> | GetDecoratedCommands<Expanded>>>;
1850export { CommandsFromExtensions }
1851export { CommandsFromExtensions as CommandsFromExtensions_alias_1 }
1852export { 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 */
1858declare 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}
1896export { CommandShape }
1897export { CommandShape as CommandShape_alias_1 }
1898
1899declare 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}
1923export { CommandUiDecoratorOptions }
1924export { CommandUiDecoratorOptions as CommandUiDecoratorOptions_alias_1 }
1925export { CommandUiDecoratorOptions as CommandUiDecoratorOptions_alias_2 }
1926
1927declare 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}
1943export { CommandUiIcon }
1944export { CommandUiIcon as CommandUiIcon_alias_1 }
1945export { CommandUiIcon as CommandUiIcon_alias_2 }
1946
1947export { composeTransactionSteps }
1948
1949export { ConditionalExcept }
1950
1951export { ConditionalKeys }
1952
1953export { ConditionalPick }
1954
1955export { ConditionalReturnKeys }
1956
1957export { ConditionalReturnPick }
1958
1959export { 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 */
1965export declare type ConstructorProps<Options extends ValidOptions, DefaultStaticOptions extends Shape> = IfNoRequiredProperties<GetStatic<Options>, [
1966options?: GetConstructorProps<Options> & DefaultStaticOptions
1967], [
1968options: GetConstructorProps<Options> & DefaultStaticOptions
1969]>;
1970
1971export { containsAttributes }
1972
1973export { containsNodesOfType }
1974
1975export { convertCommand }
1976
1977export { convertPixelsToDomUnit }
1978
1979export { Coords }
1980
1981export { CoreIcon }
1982
1983export { createDocumentNode }
1984
1985export { CreateDocumentNodeProps }
1986
1987declare 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}
2019export { CreateEditorStateProps }
2020export { CreateEditorStateProps as CreateEditorStateProps_alias_1 }
2021export { CreateEditorStateProps as CreateEditorStateProps_alias_2 }
2022
2023/**
2024 * An interface for creating custom plugins in your `remirror` editor.
2025 */
2026declare 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}
2033export { CreateExtensionPlugin }
2034export { CreateExtensionPlugin as CreateExtensionPlugin_alias_1 }
2035
2036declare type CreateStateFromContent = (content: RemirrorContentType, selection?: PrimitiveSelection) => EditorState;
2037export { CreateStateFromContent }
2038export { CreateStateFromContent as CreateStateFromContent_alias_1 }
2039export { CreateStateFromContent as CreateStateFromContent_alias_2 }
2040
2041export declare function createUploadContext(): UploadContext;
2042
2043export declare function createUploadPlaceholderPlugin(): Plugin_2<UploadPlaceholderPluginData>;
2044
2045export { CustomDocumentProps }
2046
2047export { CustomHandler }
2048
2049export { CustomHandlerKey }
2050
2051export { CustomHandlerKeyList }
2052
2053declare interface CustomHandlerKeysProps<Options extends Shape = EmptyShape> {
2054 customHandlerKeys: CustomHandlerKeyList<Options>;
2055}
2056
2057/**
2058 * @internal
2059 */
2060declare type CustomHandlerMethod<Options extends ValidOptions> = <Key extends keyof GetCustomHandler<Options>>(key: Key, value: Required<GetCustomHandler<Options>>[Key]) => Dispose;
2061export { CustomHandlerMethod }
2062export { CustomHandlerMethod as CustomHandlerMethod_alias_1 }
2063
2064export { CustomHandlerShape }
2065
2066export { cx }
2067
2068declare interface DataProps<Data = any> {
2069 /**
2070 * The data to store for this placeholder.
2071 */
2072 data?: Data;
2073}
2074
2075export { debounce }
2076
2077export { DebouncedFunction }
2078
2079export { Decoration }
2080
2081declare type DecorationPlaceholder = WidgetPlaceholder | NodePlaceholder | InlinePlaceholder;
2082export { DecorationPlaceholder }
2083export { DecorationPlaceholder as DecorationPlaceholder_alias_1 }
2084export { DecorationPlaceholder as DecorationPlaceholder_alias_2 }
2085
2086declare 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}
2109export { DecorationPlaceholderMeta }
2110export { DecorationPlaceholderMeta as DecorationPlaceholderMeta_alias_1 }
2111export { DecorationPlaceholderMeta as DecorationPlaceholderMeta_alias_2 }
2112
2113export { 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 */
2122declare 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}
2248export { DecorationsExtension }
2249export { DecorationsExtension as DecorationsExtension_alias_1 }
2250export { DecorationsExtension as DecorationsExtension_alias_2 }
2251
2252declare 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}
2281export { DecorationsOptions }
2282export { DecorationsOptions as DecorationsOptions_alias_1 }
2283export { DecorationsOptions as DecorationsOptions_alias_2 }
2284
2285declare interface DecorationsOptions_2 {
2286}
2287
2288export { deepMerge }
2289
2290export { DeepPartial }
2291
2292export { DeepString }
2293
2294/**
2295 * The default named shortcuts used within `remirror`.
2296 */
2297declare const DEFAULT_SHORTCUTS: ShortcutMap;
2298export { DEFAULT_SHORTCUTS }
2299export { DEFAULT_SHORTCUTS as DEFAULT_SHORTCUTS_alias_1 }
2300export { DEFAULT_SHORTCUTS as DEFAULT_SHORTCUTS_alias_2 }
2301
2302export { 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 */
2309declare type DefaultExtensionOptions<Options extends ValidOptions> = DefaultOptions<Options, BaseExtensionOptions>;
2310export { DefaultExtensionOptions }
2311export { DefaultExtensionOptions as DefaultExtensionOptions_alias_1 }
2312export { DefaultExtensionOptions as DefaultExtensionOptions_alias_2 }
2313
2314export { 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 */
2321export declare type DefaultOptions<Options extends ValidOptions, DefaultStaticOptions extends Shape> = MakeUndefined<UndefinedFlipPartialAndRequired<GetStatic<Options>> & Partial<DefaultStaticOptions> & GetFixedDynamic<Options>, StringKey<GetAcceptUndefined<Options>>>;
2322
2323declare 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
2367declare interface DefaultPriorityProps {
2368 /**
2369 * The default priority for this extension.
2370 *
2371 * @defaultValue {}
2372 */
2373 defaultPriority?: ExtensionPriority;
2374}
2375
2376declare 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}
2405export { DelayedCommand }
2406export { 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 */
2423declare function delayedCommand<Value>({ immediate, promise, onDone, onFail, }: DelayedCommandProps<Value>): CommandFunction;
2424export { delayedCommand }
2425export { delayedCommand as delayedCommand_alias_1 }
2426
2427/**
2428 * The parameter that is passed into `DelayedCommand`s.
2429 */
2430declare 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
2455declare 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}
2477export { DelayedPlaceholderCommandProps }
2478export { DelayedPlaceholderCommandProps as DelayedPlaceholderCommandProps_alias_1 }
2479export { DelayedPlaceholderCommandProps as DelayedPlaceholderCommandProps_alias_2 }
2480
2481declare type DelayedPromiseCreator<Value> = (props: CommandFunctionProps) => Promise<Value>;
2482export { DelayedPromiseCreator }
2483export { DelayedPromiseCreator as DelayedPromiseCreator_alias_1 }
2484
2485declare type DelayedValue<Type> = Promise<Type> | (() => Promise<Type>);
2486export { DelayedValue }
2487export { DelayedValue as DelayedValue_alias_1 }
2488
2489export { DelimiterCase }
2490
2491export { Diff }
2492
2493export { DispatchFunction }
2494
2495export { Dispose }
2496
2497declare class DocChangedExtension extends PlainExtension<DocChangedOptions> {
2498 get name(): "docChanged";
2499 onStateUpdate(props: StateUpdateLifecycleProps): void;
2500}
2501export { DocChangedExtension }
2502export { DocChangedExtension as DocChangedExtension_alias_1 }
2503export { DocChangedExtension as DocChangedExtension_alias_2 }
2504
2505declare interface DocChangedOptions {
2506 docChanged?: Handler<(props: StateUpdateLifecycleProps) => void>;
2507}
2508export { DocChangedOptions }
2509export { DocChangedOptions as DocChangedOptions_alias_1 }
2510export { DocChangedOptions as DocChangedOptions_alias_2 }
2511
2512export { DOM_SIZE_UNITS }
2513
2514export { DOMCompatibleAttributes }
2515
2516export { DOMOutputSpec }
2517
2518export { DomSizeUnit }
2519
2520export { Dynamic }
2521
2522export { DynamicAttributeCreator }
2523
2524export { DynamicKey }
2525
2526export { DynamicKeyList }
2527
2528/**
2529 * Get the options from any constructor. Can be used for both presets and
2530 * extensions.
2531 */
2532declare type DynamicOptionsOfConstructor<Constructor extends AnyConstructor> = GetPartialDynamic<GetOptions<InstanceType<Constructor>>>;
2533export { DynamicOptionsOfConstructor }
2534export { DynamicOptionsOfConstructor as DynamicOptionsOfConstructor_alias_1 }
2535
2536export { DynamicShape }
2537
2538export { EditorSchema }
2539
2540export { EditorState }
2541
2542export { EditorStateProps }
2543
2544export { EditorView }
2545
2546export { EditorViewProps }
2547
2548export { EMPTY_ARRAY }
2549
2550export { EMPTY_NODE }
2551
2552export { EMPTY_PARAGRAPH_NODE }
2553
2554export { EmptyShape }
2555
2556export { endPositionOfParent }
2557
2558export { Entries }
2559
2560export { entries }
2561
2562export { Entry }
2563
2564export { environment }
2565
2566export { ErrorConstant }
2567
2568export { Except }
2569
2570declare interface ExcludeOptions extends Partial<Remirror.ExcludeOptions> {
2571}
2572export { ExcludeOptions }
2573export { 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 */
2627declare 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 * // BAD ❌
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 * // Update the value of the provided extension.
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 */
2891declare 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}
2908export { Extension }
2909export { Extension as Extension_alias_1 }
2910export { 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 */
2917declare function extension<Options extends Shape = EmptyShape>(options: ExtensionDecoratorOptions<Options>): <Type extends AnyExtensionConstructor>(ReadonlyConstructor: Type, context?: ClassDecoratorContext<Type> | undefined) => Type;
2918export { extension }
2919export { extension as extension_alias_1 }
2920export { extension as extension_alias_2 }
2921
2922declare type ExtensionCommandFunction = (...args: any[]) => CommandFunction;
2923export { ExtensionCommandFunction }
2924export { ExtensionCommandFunction as ExtensionCommandFunction_alias_1 }
2925
2926/**
2927 * The return signature for an extensions command method.
2928 */
2929declare interface ExtensionCommandReturn {
2930 [command: string]: ExtensionCommandFunction;
2931}
2932export { ExtensionCommandReturn }
2933export { ExtensionCommandReturn as ExtensionCommandReturn_alias_1 }
2934
2935declare 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}
2944export { ExtensionConstructor }
2945export { ExtensionConstructor as ExtensionConstructor_alias_1 }
2946export { 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 */
2952declare type ExtensionConstructorProps<Options extends ValidOptions> = ConstructorProps<Options, BaseExtensionOptions>;
2953export { ExtensionConstructorProps }
2954export { ExtensionConstructorProps as ExtensionConstructorProps_alias_1 }
2955export { ExtensionConstructorProps as ExtensionConstructorProps_alias_2 }
2956
2957declare type ExtensionDecorator<Extension extends AnyExtension, Fn, Return> = (method: AnyFunction<Fn>, context: ClassMethodDecoratorContext<Extension, AnyFunction<Fn>>) => Return;
2958
2959declare 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>;
2960export { ExtensionDecoratorOptions }
2961export { ExtensionDecoratorOptions as ExtensionDecoratorOptions_alias_1 }
2962export { ExtensionDecoratorOptions as ExtensionDecoratorOptions_alias_2 }
2963
2964/**
2965 * The return signature for an extensions helper method.
2966 */
2967declare interface ExtensionHelperReturn {
2968 [helper: string]: AnyFunction;
2969}
2970export { ExtensionHelperReturn }
2971export { ExtensionHelperReturn as ExtensionHelperReturn_alias_1 }
2972
2973declare interface ExtensionListProps<Extension extends AnyExtension = AnyExtension> {
2974 /**
2975 * The extensions property.
2976 */
2977 readonly extensions: readonly Extension[];
2978}
2979export { ExtensionListProps }
2980export { ExtensionListProps as ExtensionListProps_alias_1 }
2981export { ExtensionListProps as ExtensionListProps_alias_2 }
2982
2983export { 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 */
2989declare interface ExtensionStore extends Remirror.ExtensionStore {
2990}
2991export { ExtensionStore }
2992export { ExtensionStore as ExtensionStore_alias_1 }
2993
2994export { ExtensionTag }
2995
2996export { 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 */
3013declare type ExtensionTemplate<Extension extends AnyExtension> = () => Extension[];
3014export { ExtensionTemplate }
3015export { ExtensionTemplate as ExtensionTemplate_alias_1 }
3016
3017/**
3018 * This is the object shape that is returned from the combined transformation.
3019 */
3020export 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 */
3039export declare function extractLifecycleMethods(props: SetupExtensionProps): void;
3040
3041export { extractPixelSize }
3042
3043declare 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}
3067export { FileUploader }
3068export { FileUploader as FileUploader_alias_1 }
3069export { FileUploader as FileUploader_alias_2 }
3070export { FileUploader as FileUploader_alias_3 }
3071
3072export { findBlockNodes }
3073
3074export { findChildren }
3075
3076export { findChildrenByAttribute }
3077
3078export { findChildrenByMark }
3079
3080export { findChildrenByNode }
3081
3082export { findElementAtPosition }
3083
3084export { findInlineNodes }
3085
3086export { findMatches }
3087
3088export { findNodeAtPosition }
3089
3090export { findNodeAtSelection }
3091
3092export { findParentNode }
3093
3094export { findParentNodeOfType }
3095
3096export { findPositionOfNodeAfter }
3097
3098export { findPositionOfNodeBefore }
3099
3100export { FindProsemirrorNodeResult }
3101
3102export { findSelectedNodeOfType }
3103
3104export { findTextNodes }
3105
3106declare function findUploadPlaceholderPayload(state: EditorState_2, id: string): any | undefined;
3107export { findUploadPlaceholderPayload }
3108export { findUploadPlaceholderPayload as findUploadPlaceholderPayload_alias_1 }
3109export { findUploadPlaceholderPayload as findUploadPlaceholderPayload_alias_2 }
3110export { 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 */
3124declare function findUploadPlaceholderPos(state: EditorState_2, id: string): number | undefined;
3125export { findUploadPlaceholderPos }
3126export { findUploadPlaceholderPos as findUploadPlaceholderPos_alias_1 }
3127export { findUploadPlaceholderPos as findUploadPlaceholderPos_alias_2 }
3128export { findUploadPlaceholderPos as findUploadPlaceholderPos_alias_3 }
3129
3130export { FixedLengthArray }
3131
3132export { flattenArray }
3133
3134export { Flavor }
3135
3136export { Flavoring }
3137
3138export { 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 */
3149declare type FocusType = PrimitiveSelection | boolean;
3150export { FocusType }
3151export { FocusType as FocusType_alias_1 }
3152
3153/**
3154 * Provides the list of Prosemirror EditorView props that should be updated/
3155 */
3156declare type ForcedUpdateMeta = UpdatableViewProps[];
3157export { ForcedUpdateMeta }
3158export { ForcedUpdateMeta as ForcedUpdateMeta_alias_1 }
3159export { ForcedUpdateMeta as ForcedUpdateMeta_alias_2 }
3160
3161export { format }
3162
3163export { Fragment }
3164
3165export { 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 */
3178declare 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}
3359export { Framework }
3360export { Framework as Framework_alias_1 }
3361export { Framework as Framework_alias_2 }
3362
3363declare 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}
3380export { FrameworkEvents }
3381export { FrameworkEvents as FrameworkEvents_alias_1 }
3382
3383declare 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}
3398export { FrameworkOptions }
3399export { FrameworkOptions as FrameworkOptions_alias_1 }
3400export { FrameworkOptions as FrameworkOptions_alias_2 }
3401
3402/**
3403 * This is the base output that is created by a framework.
3404 */
3405declare 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}
3474export { FrameworkOutput }
3475export { FrameworkOutput as FrameworkOutput_alias_1 }
3476export { 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 */
3482declare 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}
3553export { FrameworkProps }
3554export { FrameworkProps as FrameworkProps_alias_1 }
3555export { FrameworkProps as FrameworkProps_alias_2 }
3556
3557export { freeze }
3558
3559export { FromToProps }
3560
3561declare const GENERAL_OPTIONS: "__ALL__";
3562
3563export { Get }
3564
3565export { get }
3566
3567export { GetAcceptUndefined }
3568
3569export { getActiveNode }
3570
3571export { GetAttributes }
3572
3573export { GetAttributesProps }
3574
3575export { getChangedNodeRanges }
3576
3577export { getChangedNodes }
3578
3579/**
3580 * Get the property changes and the next value from an update.
3581 */
3582export declare function getChangedOptions<Options extends ValidOptions>(props: GetChangedOptionsProps<Options>): GetChangeOptionsReturn<Options>;
3583
3584export 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
3599export { getChangedRanges }
3600
3601declare 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}
3633export { GetChangeOptionsReturn }
3634export { GetChangeOptionsReturn as GetChangeOptionsReturn_alias_1 }
3635
3636/**
3637 * Get the commands from a `RemirrorManager`, `Extension` or `Preset`.
3638 */
3639declare type GetCommands<Type extends {
3640 ['~C']: unknown;
3641}> = Type['~C'];
3642export { GetCommands }
3643export { GetCommands as GetCommands_alias_1 }
3644
3645/**
3646 * Get the constructor of an instance.
3647 */
3648declare type GetConstructor<Type extends {
3649 constructor: unknown;
3650}> = Type['constructor'];
3651export { GetConstructor }
3652export { GetConstructor as GetConstructor_alias_1 }
3653
3654export { GetConstructorProps }
3655
3656export { getCursor }
3657
3658export { 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 */
3670declare type GetDecoratedCommands<Type> = Type extends AnyExtension ? ConditionalPick<Type, AnyFunction<CommandFunction>> : never;
3671
3672declare type GetDecoratedHelpers<Type> = Type extends object ? RemoveHelpers<ConditionalReturnPick<Type, HelperAnnotation>> : never;
3673
3674declare type GetDecoratedUiCommands<Type> = Type extends AnyExtension ? ConditionalPick<Type, AnyFunction<UiCommandFunction>> : never;
3675
3676export { getDefaultBlockNode }
3677
3678export { getDefaultDocNode }
3679
3680export { getDocRange }
3681
3682export { getDocument }
3683
3684export { 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 */
3694declare type GetExtensions<Extension> = AnyExtension extends Extension ? AnyExtension : Extension extends AnyExtension ? // Now create the union of the provided extension and it's recursively
3695Extension | GetExtensions<Extension['~E']> : AnyExtension;
3696export { GetExtensions }
3697export { GetExtensions as GetExtensions_alias_1 }
3698export { GetExtensions as GetExtensions_alias_2 }
3699
3700export { GetFixed }
3701
3702export { GetFixedCustomHandler }
3703
3704export { GetFixedDynamic }
3705
3706export { GetFixedProps }
3707
3708export { GetFixedStatic }
3709
3710export { GetFlippedStatic }
3711
3712export { getFontSize }
3713
3714export { GetHandler }
3715
3716/**
3717 * Get the helpers provided by an from a `RemirrorManager`, `Extension` or
3718 * `Preset`.
3719 */
3720declare type GetHelpers<Type extends {
3721 ['~H']: unknown;
3722}> = Type['~H'];
3723export { GetHelpers }
3724export { GetHelpers as GetHelpers_alias_1 }
3725
3726export { getInvalidContent }
3727
3728export { getLazyArray }
3729
3730export { GetMappedCustomHandler }
3731
3732export { GetMappedHandler }
3733
3734export { 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 */
3745declare type GetMarkNameUnion<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = Expanded extends AnyMarkExtension ? Expanded['name'] : never;
3746export { GetMarkNameUnion }
3747export { GetMarkNameUnion as GetMarkNameUnion_alias_1 }
3748export { GetMarkNameUnion as GetMarkNameUnion_alias_2 }
3749
3750export { GetMarkRange }
3751
3752export { getMarkRange }
3753
3754export { getMarkRanges }
3755
3756export { getMarkType }
3757
3758export { getMatchString }
3759
3760/**
3761 * Get the names of all available extensions.
3762 */
3763declare type GetNameUnion<Extension extends AnyExtension> = GetExtensions<Extension>['name'];
3764export { GetNameUnion }
3765export { GetNameUnion as GetNameUnion_alias_1 }
3766export { 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 */
3777declare type GetNodeNameUnion<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = Expanded extends AnyNodeExtension ? Expanded['name'] : never;
3778export { GetNodeNameUnion }
3779export { GetNodeNameUnion as GetNodeNameUnion_alias_1 }
3780export { GetNodeNameUnion as GetNodeNameUnion_alias_2 }
3781
3782export { getNodeType }
3783
3784/**
3785 * Get the static extension settings.
3786 */
3787declare type GetOptions<Type extends {
3788 ['~O']: unknown;
3789}> = Type['~O'];
3790export { GetOptions }
3791export { GetOptions as GetOptions_alias_1 }
3792
3793export { 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 */
3804declare type GetPlainNameUnion<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = Expanded extends AnyPlainExtension ? Expanded['name'] : never;
3805export { GetPlainNameUnion }
3806export { GetPlainNameUnion as GetPlainNameUnion_alias_1 }
3807export { GetPlainNameUnion as GetPlainNameUnion_alias_2 }
3808
3809export { getRemirrorJSON }
3810
3811export { GetRequiredKeys }
3812
3813export { getSelectedGroup }
3814
3815export { getSelectedWord }
3816
3817export { getShortcutSymbols }
3818
3819export { GetStatic }
3820
3821export { GetStaticAndDynamic }
3822
3823export { getStyle }
3824
3825export { getTextContentFromSlice }
3826
3827declare 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
3836export { getTextSelection }
3837
3838/**
3839 * Shortcuts used within google docs.
3840 */
3841declare const GOOGLE_DOC_SHORTCUTS: ShortcutMap;
3842export { GOOGLE_DOC_SHORTCUTS }
3843export { GOOGLE_DOC_SHORTCUTS as GOOGLE_DOC_SHORTCUTS_alias_1 }
3844export { GOOGLE_DOC_SHORTCUTS as GOOGLE_DOC_SHORTCUTS_alias_2 }
3845
3846export { Handler }
3847
3848export { HandlerKey }
3849
3850export { HandlerKeyList }
3851
3852declare 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}
3875export { HandlerKeyOptions }
3876export { 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 */
3898declare 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
3920export { HandlerShape }
3921
3922export { hasOwnProperty }
3923
3924export { 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 */
3937declare function hasUploadingFile(state: EditorState_2): boolean;
3938export { hasUploadingFile }
3939export { hasUploadingFile as hasUploadingFile_alias_1 }
3940export { hasUploadingFile as hasUploadingFile_alias_2 }
3941export { hasUploadingFile as hasUploadingFile_alias_3 }
3942
3943/**
3944 * An annotation which marks decorated helper methods for an extension.
3945 */
3946declare type Helper<Type> = Type extends null | undefined ? Type : Type & HelperAnnotation;
3947export { Helper }
3948export { Helper as Helper_alias_1 }
3949export { 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 */
3996declare 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>;
3997export { helper }
3998export { helper as helper_alias_1 }
3999export { helper as helper_alias_2 }
4000
4001declare type HelperAnnotation = Flavoring<'HelperAnnotation'>;
4002export { HelperAnnotation }
4003export { HelperAnnotation as HelperAnnotation_alias_1 }
4004export { HelperAnnotation as HelperAnnotation_alias_2 }
4005
4006declare interface HelperDecoratorOptions {
4007}
4008export { HelperDecoratorOptions }
4009export { HelperDecoratorOptions as HelperDecoratorOptions_alias_1 }
4010export { HelperDecoratorOptions as HelperDecoratorOptions_alias_2 }
4011
4012/**
4013 * A function with a return signature annotated as a helper.
4014 */
4015declare type HelperFunction<Type extends HelperAnnotation = HelperAnnotation> = AnyFunction<Type>;
4016export { HelperFunction }
4017export { HelperFunction as HelperFunction_alias_1 }
4018export { HelperFunction as HelperFunction_alias_2 }
4019
4020/**
4021 * Utility type for pulling all the action names from a list
4022 */
4023declare type HelperNames<Extension extends AnyExtension> = StringKey<HelpersFromExtensions<Extension>>;
4024export { HelperNames }
4025export { HelperNames as HelperNames_alias_1 }
4026export { 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 */
4041declare 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}
4086export { HelpersExtension }
4087export { HelpersExtension as HelpersExtension_alias_1 }
4088export { 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 */
4099declare type HelpersFromExtensions<Extension extends AnyExtension, Expanded extends AnyExtension = GetExtensions<Extension>> = UnionToIntersection<MapHelpers<GetHelpers<Expanded> | GetDecoratedHelpers<Expanded>>>;
4100export { HelpersFromExtensions }
4101export { HelpersFromExtensions as HelpersFromExtensions_alias_1 }
4102export { HelpersFromExtensions as HelpersFromExtensions_alias_2 }
4103
4104export { htmlToProsemirrorNode }
4105
4106export { 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 */
4117declare type Identifiers = 'nodes' | 'marks' | 'all' | readonly string[] | IdentifiersObject;
4118export { Identifiers }
4119export { Identifiers as Identifiers_alias_1 }
4120export { Identifiers as Identifiers_alias_2 }
4121
4122/**
4123 * The interface for adding extra attributes to multiple node and mark
4124 * extensions.
4125 */
4126declare 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}
4143export { IdentifierSchemaAttributes }
4144export { IdentifierSchemaAttributes as IdentifierSchemaAttributes_alias_1 }
4145export { 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 */
4180declare 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}
4221export { IdentifiersObject }
4222export { IdentifiersObject as IdentifiersObject_alias_1 }
4223export { IdentifiersObject as IdentifiersObject_alias_2 }
4224
4225export { IfEmpty }
4226
4227export { IfHasRequiredProperties }
4228
4229export { IfMatches }
4230
4231export { IfNoRequiredProperties }
4232
4233declare const IGNORE = "__IGNORE__";
4234
4235export { includes }
4236
4237export { IndexUnionFromTuple }
4238
4239declare interface InlinePlaceholder<Data = any> extends BasePlaceholder, Partial<FromToProps>, DataProps<Data> {
4240 type: 'inline';
4241}
4242
4243export { 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 */
4256declare 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}
4276export { InputRulesExtension }
4277export { InputRulesExtension as InputRulesExtension_alias_1 }
4278export { InputRulesExtension as InputRulesExtension_alias_2 }
4279
4280declare 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}
4293export { InputRulesOptions }
4294export { InputRulesOptions as InputRulesOptions_alias_1 }
4295export { InputRulesOptions as InputRulesOptions_alias_2 }
4296
4297declare 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}
4318export { InsertNodeOptions }
4319export { InsertNodeOptions as InsertNodeOptions_alias_1 }
4320export { 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 */
4327declare function insertText(text: string, options?: InsertTextOptions): CommandFunction;
4328export { insertText }
4329export { insertText as insertText_alias_1 }
4330
4331export declare interface InsertTextOptions extends Partial<FromToProps> {
4332 /**
4333 * Marks can be added to the inserted text.
4334 */
4335 marks?: Record<string, ProsemirrorAttributes>;
4336}
4337
4338export { InvalidContentBlock }
4339
4340export { InvalidContentHandler }
4341
4342export { InvalidContentHandlerProps }
4343
4344export { invariant }
4345
4346export { isAllSelection }
4347
4348export { isAndroidOS }
4349
4350export { isArray }
4351
4352export { isBoolean }
4353
4354export { isChrome }
4355
4356export { isClass }
4357
4358export { isDate }
4359
4360export { isDefaultBlockNode }
4361
4362export { isDefaultDocNode }
4363
4364/**
4365 * Returns `true` when the provided value is a delayed value.
4366 */
4367declare function isDelayedValue<Type>(value: unknown): value is DelayedValue<Type>;
4368export { isDelayedValue }
4369export { isDelayedValue as isDelayedValue_alias_1 }
4370
4371export { isDirectInstanceOf }
4372
4373export { isDocNode }
4374
4375export { isDocNodeEmpty }
4376
4377export { isDomNode }
4378
4379export { isEditorSchema }
4380
4381export { isEditorState }
4382
4383export { isElementDomNode }
4384
4385export { isEmptyArray }
4386
4387export { isEmptyBlockNode }
4388
4389export { isEmptyObject }
4390
4391export { isEndOfTextBlock }
4392
4393export { isEqual }
4394
4395export { isError }
4396
4397/**
4398 * Determines if the passed value is an extension.
4399 *
4400 * @param value - the value to test
4401 */
4402declare function isExtension<Type extends AnyExtension = AnyExtension>(value: unknown): value is Type;
4403export { isExtension }
4404export { isExtension as isExtension_alias_1 }
4405export { 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 */
4412declare function isExtensionConstructor<Type extends AnyExtensionConstructor = AnyExtensionConstructor>(value: unknown): value is Type;
4413export { isExtensionConstructor }
4414export { isExtensionConstructor as isExtensionConstructor_alias_1 }
4415export { isExtensionConstructor as isExtensionConstructor_alias_2 }
4416
4417/**
4418 * Check if the provided string is an extension tag.
4419 */
4420declare function isExtensionTag(value: string): value is ExtensionTagType;
4421export { isExtensionTag }
4422export { isExtensionTag as isExtensionTag_alias_1 }
4423export { isExtensionTag as isExtensionTag_alias_2 }
4424
4425export { isFunction }
4426
4427export { isIdentifierOfType }
4428
4429export { isInstanceOf }
4430
4431export { isInteger }
4432
4433export { isJSONPrimitive }
4434
4435export { isMap }
4436
4437export { 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 */
4445declare function isMarkExtension<Type extends AnyMarkExtension = AnyMarkExtension>(value: unknown): value is Type;
4446export { isMarkExtension }
4447export { isMarkExtension as isMarkExtension_alias_1 }
4448export { isMarkExtension as isMarkExtension_alias_2 }
4449
4450export { isMarkType }
4451
4452export 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
4469export { isNativePromise }
4470
4471export { 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 */
4479declare function isNodeExtension<Type extends AnyNodeExtension = AnyNodeExtension>(value: unknown): value is Type;
4480export { isNodeExtension }
4481export { isNodeExtension as isNodeExtension_alias_1 }
4482export { isNodeExtension as isNodeExtension_alias_2 }
4483
4484export { isNodeOfType }
4485
4486export { isNodeSelection }
4487
4488export { isNodeType }
4489
4490export { isNonEmptyArray }
4491
4492export { isNull }
4493
4494export { isNullOrUndefined }
4495
4496export { isNumber }
4497
4498export { isObject }
4499
4500/**
4501 * Checks whether the provided value is a plain extension.
4502 *
4503 * @param value - the extension to check
4504 */
4505declare function isPlainExtension<Type extends AnyPlainExtension = AnyPlainExtension>(value: unknown): value is Type;
4506export { isPlainExtension }
4507export { isPlainExtension as isPlainExtension_alias_1 }
4508export { isPlainExtension as isPlainExtension_alias_2 }
4509
4510export { isPlainObject }
4511
4512export { isPrimitive }
4513
4514export { isPromise }
4515
4516export { isProsemirrorFragment }
4517
4518export { isProsemirrorMark }
4519
4520export { isProsemirrorNode }
4521
4522export { isRegExp }
4523
4524export { 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 */
4537declare function isRemirrorManager<Extension extends AnyExtension = AnyExtension>(value: unknown, mustIncludeList?: Array<AnyExtensionConstructor | string>): value is RemirrorManager<Extension>;
4538export { isRemirrorManager }
4539export { isRemirrorManager as isRemirrorManager_alias_1 }
4540export { isRemirrorManager as isRemirrorManager_alias_2 }
4541
4542export { isRemirrorType }
4543
4544export { isResolvedPos }
4545
4546export { isSafari }
4547
4548export { isSafeInteger }
4549
4550export { isSelection }
4551
4552export { isSelectionEmpty }
4553
4554export { isSet }
4555
4556export { isStartOfDoc }
4557
4558export { isStartOfTextBlock }
4559
4560export { isString }
4561
4562export { isSymbol }
4563
4564export { isTextDomNode }
4565
4566export { isTextSelection }
4567
4568export { isTransaction }
4569
4570export { isUndefined }
4571
4572export { IterableElement }
4573
4574export { joinStyles }
4575
4576export { JsonArray }
4577
4578export { JsonObject }
4579
4580export { JsonPrimitive }
4581
4582export { JsonValue }
4583
4584export { KebabCase }
4585
4586export { kebabCase }
4587
4588export { 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 */
4600declare function keyBinding<Extension extends AnyExtension>(options: KeybindingDecoratorOptions<Required<GetOptions<Extension>>>): (method: KeyBindingCommandFunction, context: ClassMethodDecoratorContext<Extension>) => KeyBindingCommandFunction;
4601export { keyBinding }
4602export { keyBinding as keyBinding_alias_1 }
4603export { keyBinding as keyBinding_alias_2 }
4604
4605export { KeyBindingCommandFunction }
4606
4607declare 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}
4629export { KeybindingDecoratorOptions }
4630export { KeybindingDecoratorOptions as KeybindingDecoratorOptions_alias_1 }
4631export { KeybindingDecoratorOptions as KeybindingDecoratorOptions_alias_2 }
4632
4633declare 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
4645export { KeyBindingNames }
4646
4647export { KeyBindingProps }
4648
4649export { KeyBindings }
4650
4651/**
4652 * KeyBindings as a tuple with priority and the keymap.
4653 */
4654declare type KeyBindingsTuple = [priority: ExtensionPriority, bindings: KeyBindings];
4655export { KeyBindingsTuple }
4656export { KeyBindingsTuple as KeyBindingsTuple_alias_1 }
4657export { KeyBindingsTuple as KeyBindingsTuple_alias_2 }
4658
4659declare type KeyboardShortcut = KeyboardShortcutValue | KeyboardShortcutFunction;
4660export { KeyboardShortcut }
4661export { KeyboardShortcut as KeyboardShortcut_alias_1 }
4662export { KeyboardShortcut as KeyboardShortcut_alias_2 }
4663
4664declare type KeyboardShortcutFunction<Options extends Shape = Shape> = (options: Options, store: Remirror.ExtensionStore) => KeyboardShortcut;
4665export { KeyboardShortcutFunction }
4666export { KeyboardShortcutFunction as KeyboardShortcutFunction_alias_1 }
4667export { KeyboardShortcutFunction as KeyboardShortcutFunction_alias_2 }
4668
4669declare type KeyboardShortcuts = keyof typeof keyboardShortcuts | ShortcutMap;
4670export { KeyboardShortcuts }
4671export { KeyboardShortcuts as KeyboardShortcuts_alias_1 }
4672export { KeyboardShortcuts as KeyboardShortcuts_alias_2 }
4673
4674declare const keyboardShortcuts: {
4675 default: ShortcutMap;
4676 googleDoc: ShortcutMap;
4677};
4678export { keyboardShortcuts }
4679export { keyboardShortcuts as keyboardShortcuts_alias_1 }
4680export { keyboardShortcuts as keyboardShortcuts_alias_2 }
4681
4682declare type KeyboardShortcutValue = Listable<LiteralUnion<'Enter' | 'ArrowDown' | 'ArrowUp' | 'ArrowLeft' | 'ArrowRight' | 'Escape' | 'Delete' | 'Backspace', string>>;
4683export { KeyboardShortcutValue }
4684export { KeyboardShortcutValue as KeyboardShortcutValue_alias_1 }
4685export { 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 */
4700declare 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}
4782export { KeymapExtension }
4783export { KeymapExtension as KeymapExtension_alias_1 }
4784export { KeymapExtension as KeymapExtension_alias_2 }
4785
4786declare 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 * //... Logic
4842 * return true;
4843 * },
4844 * }});
4845 * ```
4846 */
4847 keymap?: CustomHandler<PrioritizedKeyBindings>;
4848}
4849export { KeymapOptions }
4850export { KeymapOptions as KeymapOptions_alias_1 }
4851export { KeymapOptions as KeymapOptions_alias_2 }
4852
4853export { keys }
4854
4855export { last }
4856
4857export { 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 */
4912declare function legacyCommand<Extension extends AnyExtension>(options?: ChainableCommandDecoratorOptions<Required<GetOptions<Extension>>>): ExtensionDecorator<Extension, CommandFunction, void>;
4913
4914declare function legacyCommand<Extension extends AnyExtension>(options: NonChainableCommandDecoratorOptions<Required<GetOptions<Extension>>>): ExtensionDecorator<Extension, NonChainableCommandFunction, void>;
4915export { legacyCommand }
4916export { legacyCommand as legacyCommand_alias_1 }
4917export { 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 */
4965declare function legacyHelper(options?: HelperDecoratorOptions): <Extension extends AnyExtension, Type>(target: Extension, propertyKey: string, _descriptor: TypedPropertyDescriptor<AnyFunction<NonNullable<Type> extends HelperAnnotation ? Type : never>>) => void;
4966export { legacyHelper }
4967export { legacyHelper as legacyHelper_alias_1 }
4968export { 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 */
4982declare function legacyKeyBinding<Extension extends AnyExtension>(options: KeybindingDecoratorOptions<Required<GetOptions<Extension>>>): (target: Extension, propertyKey: string, _descriptor: TypedPropertyDescriptor<KeyBindingCommandFunction>) => void;
4983export { legacyKeyBinding }
4984export { legacyKeyBinding as legacyKeyBinding_alias_1 }
4985export { legacyKeyBinding as legacyKeyBinding_alias_2 }
4986
4987export { lift }
4988
4989export { Listable }
4990
4991declare 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}
5002export { ListenerProps }
5003export { ListenerProps as ListenerProps_alias_1 }
5004export { ListenerProps as ListenerProps_alias_2 }
5005
5006export { Literal }
5007
5008export { LiteralUnion }
5009
5010export { MakeNullable }
5011
5012export { MakeOptional }
5013
5014export { MakeReadonly }
5015
5016export { MakeRequired }
5017
5018export { MakeUndefined }
5019
5020declare 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}
5046export { ManagerEvents }
5047export { ManagerEvents as ManagerEvents_alias_1 }
5048export { ManagerEvents as ManagerEvents_alias_2 }
5049
5050export 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
5071export { ManagerPhase }
5072
5073declare type ManagerStoreKeys = keyof Remirror.ManagerStore<any>;
5074export { ManagerStoreKeys }
5075export { ManagerStoreKeys as ManagerStoreKeys_alias_1 }
5076export { 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 */
5082declare type MapHelpers<RawHelpers extends Record<string, AnyFunction>> = {
5083 [Helper in keyof RawHelpers]: RawHelpers[Helper];
5084};
5085export { MapHelpers }
5086export { MapHelpers as MapHelpers_alias_1 }
5087export { MapHelpers as MapHelpers_alias_2 }
5088
5089declare 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
5095export { Mapping }
5096
5097/**
5098 * A utility type which maps the chained commands.
5099 */
5100declare type MapToChainedCommand<RawCommands extends Record<string, AnyFunction>> = {
5101 [Command in keyof RawCommands]: ReturnType<RawCommands[Command]> extends NonChainableCommandFunction ? void : (...args: Parameters<RawCommands[Command]>) => any;
5102};
5103export { MapToChainedCommand }
5104export { MapToChainedCommand as MapToChainedCommand_alias_1 }
5105export { 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 */
5111declare type MapToUnchainedCommand<RawCommands extends Record<string, AnyFunction>> = {
5112 [Command in keyof RawCommands]: CommandShape<Parameters<RawCommands[Command]>>;
5113};
5114export { MapToUnchainedCommand }
5115export { MapToUnchainedCommand as MapToUnchainedCommand_alias_1 }
5116export { MapToUnchainedCommand as MapToUnchainedCommand_alias_2 }
5117
5118export { Mark }
5119
5120export { 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 */
5132declare 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
5168declare interface MarkExtension<Options extends ValidOptions = EmptyShape> extends Extension<Options>, Remirror.MarkExtension {
5169}
5170export { MarkExtension }
5171export { MarkExtension as MarkExtension_alias_1 }
5172export { MarkExtension as MarkExtension_alias_2 }
5173
5174export { MarkExtensionSpec }
5175
5176export { markInputRule }
5177
5178export { MarkSpecOverride }
5179
5180export { MarkType }
5181
5182export { MarkTypeProps }
5183
5184export { MarkTypesProps }
5185
5186export { MarkWithAttributes }
5187
5188export { MarkWithAttributesProps }
5189
5190export { Merge }
5191
5192export { mergeDOMRects }
5193
5194export { MergeExclusive }
5195
5196export { mergeKeyBindings }
5197
5198export { mergeProsemirrorKeyBindings }
5199
5200declare type Metadata = CommandMetadata | KeyBindingMetadata;
5201export { Metadata }
5202export { Metadata as Metadata_alias_1 }
5203export { 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 */
5216declare 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}
5237export { MetaExtension }
5238export { MetaExtension as MetaExtension_alias_1 }
5239export { MetaExtension as MetaExtension_alias_2 }
5240
5241declare 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}
5249export { MetaOptions }
5250export { MetaOptions as MetaOptions_alias_1 }
5251export { MetaOptions as MetaOptions_alias_2 }
5252
5253export { 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 * // Set the default value of all extensions to have a property `customSetting` with value `false`.
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 */
5285declare function mutateDefaultExtensionOptions(mutatorMethod: (defaultOptions: BaseExtensionOptions) => void): void;
5286export { mutateDefaultExtensionOptions }
5287export { mutateDefaultExtensionOptions as mutateDefaultExtensionOptions_alias_1 }
5288export { mutateDefaultExtensionOptions as mutateDefaultExtensionOptions_alias_2 }
5289
5290export { mutateTag }
5291
5292export { NamedShortcut }
5293
5294export { NamedStringHandlers }
5295
5296declare 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(); // Only toggleItalic would be run
5303 * ```
5304 */
5305 new: (tr?: Transaction) => ChainedFromExtensions<Extension, Chained>;
5306}
5307export { NewChainedCommandProps }
5308export { NewChainedCommandProps as NewChainedCommandProps_alias_1 }
5309export { 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 */
5319declare 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
5371declare interface NodeExtension<Options extends ValidOptions = EmptyShape> extends Extension<Options>, Remirror.NodeExtension {
5372}
5373export { NodeExtension }
5374export { NodeExtension as NodeExtension_alias_1 }
5375export { NodeExtension as NodeExtension_alias_2 }
5376
5377export { NodeExtensionSpec }
5378
5379export { nodeInputRule }
5380
5381export { NodeMarkOptions }
5382
5383declare 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
5396export { NodeSpecOverride }
5397
5398export { NodeStringHandlerOptions }
5399
5400export { NodeType }
5401
5402export { NodeTypeProps }
5403
5404export { NodeTypesProps }
5405
5406export { NodeView }
5407
5408export { 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 */
5421declare class NodeViewsExtension extends PlainExtension {
5422 get name(): "nodeViews";
5423 createPlugin(): CreateExtensionPlugin;
5424}
5425export { NodeViewsExtension }
5426export { NodeViewsExtension as NodeViewsExtension_alias_1 }
5427export { NodeViewsExtension as NodeViewsExtension_alias_2 }
5428
5429export { NodeWithAttributes }
5430
5431export { NodeWithAttributesProps }
5432
5433export { NodeWithPosition }
5434
5435export { NON_BREAKING_SPACE_CHAR }
5436
5437export { nonChainable }
5438
5439declare 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
5449export { NonChainableCommandFunction }
5450
5451export { NonNullableShape }
5452
5453export { noop }
5454
5455export { NULL_CHARACTER }
5456
5457export { Nullable }
5458
5459export { object }
5460
5461export { ObjectMark }
5462
5463export { ObservableLike }
5464
5465export { omit }
5466
5467export { omitExtraAttributes }
5468
5469export { omitUndefined }
5470
5471declare interface OnSetOptionsProps<Options extends ValidOptions> extends Pick<GetChangeOptionsReturn<Options>, 'changes' | 'pickChanged'>, UpdateReasonProps {
5472 /**
5473 * The initial options for the extension. Falls back to default options.
5474 */
5475 initialOptions: RemoveAnnotations<GetFixedDynamic<Options>>;
5476 /**
5477 * The next value of the properties after the update.This also includes values
5478 * which have not been changed.
5479 */
5480 options: RemoveAnnotations<GetFixedDynamic<Options>>;
5481}
5482export { OnSetOptionsProps }
5483export { OnSetOptionsProps as OnSetOptionsProps_alias_1 }
5484
5485export { Opaque }
5486
5487export { OptionalMarkProps }
5488
5489export { OptionalProsemirrorNodeProps }
5490
5491/**
5492 * Get the options from any constructor. Can be used for both presets and
5493 * extensions.
5494 */
5495declare type OptionsOfConstructor<Constructor extends AnyConstructor> = GetOptions<InstanceType<Constructor>>;
5496export { OptionsOfConstructor }
5497export { OptionsOfConstructor as OptionsOfConstructor_alias_1 }
5498
5499export { PackageJson }
5500
5501export { ParsedDomSize }
5502
5503export { parseSizeUnit }
5504
5505export { PartialDeep }
5506
5507export { PartialWithRequiredKeys }
5508
5509export { PascalCase }
5510
5511export { pascalCase }
5512
5513/**
5514 * This extension allows others extension to add the `createPasteRules` method
5515 * for automatically transforming pasted text which matches a certain regex
5516 * pattern in the dom.
5517 *
5518 * @category Builtin Extension
5519 */
5520declare class PasteRulesExtension extends PlainExtension {
5521 get name(): "pasteRules";
5522 createExternalPlugins(): ProsemirrorPlugin[];
5523 private generatePasteRulesPlugin;
5524}
5525export { PasteRulesExtension }
5526export { PasteRulesExtension as PasteRulesExtension_alias_1 }
5527export { PasteRulesExtension as PasteRulesExtension_alias_2 }
5528
5529declare interface PasteRulesOptions {
5530}
5531export { PasteRulesOptions }
5532export { PasteRulesOptions as PasteRulesOptions_alias_1 }
5533export { PasteRulesOptions as PasteRulesOptions_alias_2 }
5534
5535export { pathCase }
5536
5537export { pick }
5538
5539declare type PickChanged<Options extends ValidOptions> = <Key extends keyof GetFixedDynamic<Options>>(keys: Key[]) => Partial<Pick<GetFixedDynamic<Options>, Key>>;
5540export { PickChanged }
5541export { PickChanged as PickChanged_alias_1 }
5542
5543export { PickPartial }
5544
5545export { PickRequired }
5546
5547declare interface PlaceholderConfig extends TextProps {
5548 className: string;
5549}
5550export { PlaceholderConfig }
5551export { PlaceholderConfig as PlaceholderConfig_alias_1 }
5552export { PlaceholderConfig as PlaceholderConfig_alias_2 }
5553
5554export declare type PlaceholderPluginAction = AddPlaceholderAction | RemovePlaceholderAction;
5555
5556/**
5557 * Create a plain extension which doesn't directly map to Prosemirror nodes or
5558 * marks.
5559 *
5560 * Plain extensions are a great way to add custom behavior to your editor.
5561 */
5562declare abstract class PlainExtension<Options extends ValidOptions = EmptyShape> extends Extension<Options> {
5563 /** @internal */
5564 static get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.PlainExtensionConstructor;
5565 /** @internal */
5566 get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.PlainExtension;
5567}
5568export { PlainExtension }
5569export { PlainExtension as PlainExtension_alias_1 }
5570export { PlainExtension as PlainExtension_alias_2 }
5571
5572export { plainInputRule }
5573
5574export { PluginKey }
5575
5576/**
5577 * This extension allows others extension to add the `createPlugin` method using
5578 * Prosemirror Plugins.
5579 *
5580 * @remarks
5581 *
5582 * This is an example of adding custom functionality to an extension via the
5583 * `ExtensionParameterMethods`.
5584 *
5585 * @category Builtin Extension
5586 */
5587declare class PluginsExtension extends PlainExtension<PluginsOptions> {
5588 get name(): "plugins";
5589 /**
5590 * All plugins created by other extension as well.
5591 */
5592 private plugins;
5593 /**
5594 * The plugins added via the manager (for reference only).
5595 */
5596 private managerPlugins;
5597 /**
5598 * Called when the state is is being applied after an update.
5599 */
5600 private readonly applyStateHandlers;
5601 /**
5602 * Called when the state is first initialized.
5603 */
5604 private readonly initStateHandlers;
5605 /**
5606 * Handlers for the `onAppendTransaction` lifecycle method.
5607 */
5608 private readonly appendTransactionHandlers;
5609 /**
5610 * Store the plugin keys.
5611 */
5612 private readonly pluginKeys;
5613 /**
5614 * Store state getters for the extension.
5615 */
5616 private readonly stateGetters;
5617 /**
5618 * This extension is responsible for adding state to the editor.
5619 */
5620 onCreate(): void;
5621 /**
5622 * Create a plugin which adds the [[`onInitState`]] and [[`onApplyState`]]
5623 * lifecycle methods.
5624 */
5625 createPlugin(): CreateExtensionPlugin<void>;
5626 /**
5627 * Get all the plugins from the extension.
5628 */
5629 private extractExtensionPlugins;
5630 private readonly getPluginStateCreator;
5631 /**
5632 * Add or replace a plugin.
5633 */
5634 private updatePlugins;
5635 private readonly getStateByName;
5636 /**
5637 * Add the plugin specific properties and methods to the manager and extension
5638 * store.
5639 */
5640 private updateExtensionStore;
5641 /**
5642 * Reruns the `createPlugin` and `createExternalPlugins` methods of the
5643 * provided extension.
5644 *
5645 * ```ts
5646 * // From within an extension
5647 * this.store.updateExtensionPlugins(this);
5648 * ```
5649 */
5650 private updateExtensionPlugins;
5651 /**
5652 * Applies the store plugins to the state. If any have changed then it will be
5653 * updated.
5654 */
5655 private dispatchPluginUpdate;
5656}
5657export { PluginsExtension }
5658export { PluginsExtension as PluginsExtension_alias_1 }
5659export { PluginsExtension as PluginsExtension_alias_2 }
5660
5661declare interface PluginsOptions {
5662 /**
5663 * The event handler which can be used by hooks to listen to state updates
5664 * when they are being applied to the editor.
5665 */
5666 applyState?: Handler<(props: ApplyStateLifecycleProps) => void>;
5667 /**
5668 * The event handler which can be used by hooks to listen to intercept updates
5669 * to the transaction.
5670 */
5671 appendTransaction?: Handler<(props: AppendLifecycleProps) => void>;
5672}
5673export { PluginsOptions }
5674export { PluginsOptions as PluginsOptions_alias_1 }
5675export { PluginsOptions as PluginsOptions_alias_2 }
5676
5677export { PosProps }
5678
5679export { Predicate }
5680
5681export { PredicateProps }
5682
5683export { preserveSelection }
5684
5685export { Primitive }
5686
5687export { PrimitiveSelection }
5688
5689/**
5690 * `KeyBindings` as an object or prioritized tuple.
5691 */
5692declare type PrioritizedKeyBindings = KeyBindings | KeyBindingsTuple;
5693export { PrioritizedKeyBindings }
5694export { PrioritizedKeyBindings as PrioritizedKeyBindings_alias_1 }
5695export { PrioritizedKeyBindings as PrioritizedKeyBindings_alias_2 }
5696
5697export { Promisable }
5698
5699export { ProsemirrorAttributes }
5700
5701export { ProsemirrorCommandFunction }
5702
5703export { ProsemirrorKeyBindings }
5704
5705export { ProsemirrorNode }
5706
5707export { ProsemirrorNodeProps }
5708
5709export { prosemirrorNodeToDom }
5710
5711export { prosemirrorNodeToHtml }
5712
5713export { ProsemirrorPlugin }
5714
5715export { randomFloat }
5716
5717export { randomInt }
5718
5719export { range }
5720
5721export { rangeHasMark }
5722
5723export { RangeProps }
5724
5725export { ReadonlyDeep }
5726
5727export { RegExpProps }
5728
5729export { REMIRROR_WEBVIEW_NAME }
5730
5731export { RemirrorContentType }
5732
5733export { RemirrorError }
5734
5735export { RemirrorErrorOptions }
5736
5737declare type RemirrorEventListener<Extension extends AnyExtension> = (params: RemirrorEventListenerProps<Extension>) => void;
5738export { RemirrorEventListener }
5739export { RemirrorEventListener as RemirrorEventListener_alias_1 }
5740export { RemirrorEventListener as RemirrorEventListener_alias_2 }
5741
5742declare interface RemirrorEventListenerProps<Extension extends AnyExtension> extends EditorStateProps, Remirror.ListenerProperties<Extension>, EditorViewProps {
5743 /**
5744 * The original transaction which caused this state update.
5745 *
5746 * This allows for inspecting the reason behind the state change. When
5747 * undefined this means that the state was updated externally.
5748 *
5749 * If available:
5750 * - Metadata on the transaction can be inspected. `tr.getMeta`
5751 * - Was the change caused by added / removed content? `tr.docChanged`
5752 * - Was ths change caused by an updated selection? `tr.selectionSet`
5753 * - `tr.steps` can be inspected for further granularity.
5754 */
5755 tr?: Transaction;
5756 /**
5757 * When the state updates are not controlled and it was a transaction that
5758 * caused the state to be updated this value captures all the transaction
5759 * updates caused by prosemirror plugins hook state methods like
5760 * `filterTransactions` and `appendTransactions`.
5761 *
5762 * This is for advanced users only.
5763 */
5764 transactions?: readonly Transaction[];
5765 /**
5766 * A shorthand way of checking whether the update was triggered by editor
5767 * usage (internal) or overwriting the state.
5768 *
5769 * - `true` The update was triggered by a change in the prosemirror doc or an
5770 * update to the selection. In these cases `tr` will have a value.
5771 * - `false` The update was caused by a call to `setContent` or `resetContent`
5772 */
5773 internalUpdate: boolean;
5774 /**
5775 * True when this is the first render of the editor. This applies when the
5776 * editor is first attached to the DOM.
5777 */
5778 firstRender: boolean;
5779 /**
5780 * The previous state.
5781 */
5782 previousState: EditorState;
5783 /**
5784 * Manually create a new state object with the desired content.
5785 */
5786 createStateFromContent: CreateStateFromContent;
5787}
5788export { RemirrorEventListenerProps }
5789export { RemirrorEventListenerProps as RemirrorEventListenerProps_alias_1 }
5790export { RemirrorEventListenerProps as RemirrorEventListenerProps_alias_2 }
5791
5792export { RemirrorIdentifier }
5793
5794export { RemirrorIdentifierShape }
5795
5796export { RemirrorJSON }
5797
5798/**
5799 * The `Manager` has multiple hook phases which are able to hook into the
5800 * extension manager flow and add new functionality to the editor.
5801 *
5802 * The `ExtensionEventMethod`s
5803 *
5804 * - onCreate - when the extension manager is created and after the schema is
5805 * made available.
5806 * - onView - when the view has been received from the dom ref.
5807 */
5808/**
5809 * A class to manage the extensions and prosemirror interactions within the
5810 * editor.
5811 *
5812 * @remarks
5813 *
5814 * The RemirrorManager enables the lifecycle methods of the extensions by
5815 * calling each method in the distinct phases of the lifecycle.
5816 *
5817 * - `onCreate` - This happens when the manager is constructed. It calls on the
5818 * extension which have an `onCreate` method and allows them to do their work.
5819 *
5820 * For the built in methods, this is when the `SchemaExtension` creates the
5821 * Schema and when the `TagsExtension` combines the tags for the editor
5822 * instance.
5823 *
5824 * ```ts
5825 * const manager = Manager.create(() => [
5826 * new DocExtension(),
5827 * new TextExtension(),
5828 * new ParagraphExtension(),
5829 * ])
5830 * ```
5831 *
5832 * At this point all the `onCreate` methods have been called. Including the
5833 * `onCreate` for the `Schema`.
5834 *
5835 * - `onView` - This is called the framework instance connects the
5836 * `RemirrorManager` to the ProseMirror EditorView.
5837 *
5838 * ```ts
5839 * manager.addView(new EditorView(...))
5840 * manager.store.commands.insertText('Hello world');.
5841 * ```
5842 *
5843 * - [[`onStateUpdate`]] - This is the method called every time the ProseMirror
5844 * state changes. Both the extensions and the `Framework` listen to this event
5845 * and can provide updates in response.
5846 */
5847declare class RemirrorManager<Extension extends AnyExtension> {
5848 #private;
5849 /**
5850 * Create the manager for your `Remirror` editor.
5851 */
5852 static create<Extension extends AnyExtension>(extensions: Extension[] | ExtensionTemplate<Extension>, settings?: Remirror.ManagerSettings): RemirrorManager<Extension | BuiltinPreset>;
5853 /**
5854 * Identifies this as a `Manager`.
5855 *
5856 * @internal
5857 */
5858 get [__INTERNAL_REMIRROR_IDENTIFIER_KEY__](): RemirrorIdentifier.Manager;
5859 /**
5860 * Returns `true` if the manager has been destroyed.
5861 */
5862 get destroyed(): boolean;
5863 /**
5864 * `true` when the view has been added to the UI layer and the editor is
5865 * running.
5866 */
5867 get mounted(): boolean;
5868 /**
5869 * Retrieve the framework output.
5870 *
5871 * This be undefined if the manager hasn't been provided to a framework yet
5872 * the manager.
5873 *
5874 * With synchronous frameworks this means that it should only be accessed
5875 * after the manager has been applied to the editor creation function.
5876 *
5877 * For frameworks like React it is only available when the manager is provided
5878 * to the `Remirror` component and after the very first render. This means it
5879 * is available within the `onRef` callback.
5880 *
5881 * ```tsx
5882 * import React, { useEffect } from 'react';
5883 * import { useRemirror, Remirror } from '@remirror/react';
5884 *
5885 * const Editor = () => {
5886 * const { manager } = useRemirror();
5887 *
5888 * const callback = () => {
5889 * return manager.output; // ✅ This is fine.
5890 * }
5891 *
5892 * useEffect(() => {
5893 * log(manager.output); // ✅ This is also fine.
5894 * }, []);
5895 *
5896 * log(manager.output); // ❌ This will be undefined on the first render.
5897 *
5898 * return <Remirror manager={manager} />
5899 * }
5900 * ```
5901 */
5902 get output(): FrameworkOutput<Extension> | undefined;
5903 /**
5904 * Returns true when a framework is attached to the manager.
5905 *
5906 * This can be used to check if it is safe to call `manager.output`.
5907 */
5908 get frameworkAttached(): boolean;
5909 /**
5910 * The extensions stored by this manager
5911 */
5912 get extensions(): ReadonlyArray<GetExtensions<Extension>>;
5913 /**
5914 * The registered string handlers provided by the extensions.
5915 *
5916 * By default this includes `html` and `plainText`
5917 */
5918 get stringHandlers(): NamedStringHandlers;
5919 /**
5920 * Get the extension manager store which is accessible at initialization.
5921 */
5922 get store(): Remirror.ManagerStore<Extension>;
5923 /**
5924 * Provides access to the extension store.
5925 */
5926 get extensionStore(): Remirror.ExtensionStore;
5927 /**
5928 * Shorthand access to the active transaction from the manager. This is the
5929 * shared transaction available to all commands and should be used when you
5930 * need to make your commands chainable.
5931 *
5932 * If working with react and setting up your editor as a controlled component
5933 * then this is the preferred way to run custom commands, otherwise your
5934 * commands will end up being non-chainable and be overwritten by anything
5935 * that comes after.
5936 */
5937 get tr(): Transaction;
5938 /**
5939 * Returns the stored nodes
5940 */
5941 get nodes(): Record<this['~N'], NodeExtensionSpec>;
5942 /**
5943 * Returns the store marks.
5944 */
5945 get marks(): Record<this['~M'], MarkExtensionSpec>;
5946 /**
5947 * A shorthand method for retrieving the schema for this extension manager
5948 * from the data.
5949 */
5950 get schema(): EditorSchema;
5951 /**
5952 * A shorthand getter for retrieving the tags from the extension manager.
5953 */
5954 get extensionTags(): Readonly<CombinedTags<GetNameUnion<Extension>>>;
5955 /**
5956 * A shorthand way of retrieving the editor view.
5957 */
5958 get view(): EditorView;
5959 /**
5960 * Retrieve the settings used when creating the manager.
5961 */
5962 get settings(): Remirror.ManagerSettings;
5963 /**
5964 * The document to use for rendering and outputting HTML.
5965 */
5966 get document(): Document;
5967 /**
5968 * Creates the extension manager which is used to simplify the management of
5969 * the prosemirror editor.
5970 *
5971 * This is set to private to encourage using `RemirrorManager.create`
5972 * instead of the `new` keyword.
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
6094declare 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}
6142export { RemirrorManager }
6143export { RemirrorManager as RemirrorManager_alias_1 }
6144export { RemirrorManager as RemirrorManager_alias_2 }
6145
6146declare interface RemirrorManagerConstructor extends Function {
6147 create<Extension extends AnyExtension>(extension: Extension[], settings?: Remirror.ManagerSettings): RemirrorManager<Extension | BuiltinPreset>;
6148}
6149
6150export { RemirrorMessage }
6151
6152export { RemoveAnnotation }
6153
6154export { RemoveAnnotations }
6155
6156/**
6157 * Removes [[`AnyExtension`]] from an extension union. This can be used to make
6158 * typechecking stricter.
6159 *
6160 * @typeParam Extension - The union of extensions to remove [[`AnyExtension`]] from.
6161 */
6162declare type RemoveAny<Extension> = Extension extends Extension ? AnyExtension extends Extension ? never : Extension : never;
6163export { RemoveAny }
6164export { RemoveAny as RemoveAny_alias_1 }
6165export { RemoveAny as RemoveAny_alias_2 }
6166
6167export { RemoveFlavoring }
6168
6169/**
6170 * Remove the helper annotation.
6171 */
6172declare type RemoveHelper<Type> = Type extends Helper<infer T> ? T : Type;
6173
6174declare type RemoveHelpers<Type extends Record<string, AnyFunction>> = {
6175 [Key in keyof Type]: (...args: Parameters<Type[Key]>) => RemoveHelper<ReturnType<Type[Key]>>;
6176};
6177
6178export { removeMark }
6179
6180export { RemoveMarkProps }
6181
6182export { removeNodeAfter }
6183
6184export { removeNodeAtPosition }
6185
6186export { removeNodeBefore }
6187
6188declare interface RemovePlaceholderAction {
6189 type: ActionType.REMOVE_PLACEHOLDER;
6190 id: string;
6191}
6192
6193export { Replace }
6194
6195export { replaceNodeAtPosition }
6196
6197export { replaceText }
6198
6199export { ReplaceTextProps }
6200
6201export { RequireAtLeastOne }
6202
6203export { RequireExactlyOne }
6204
6205export { ResolvedPos }
6206
6207export { ResolvedPosProps }
6208
6209export { SchemaAttributes }
6210
6211export { SchemaAttributesObject }
6212
6213/**
6214 * This is the schema extension which creates the schema and provides extra
6215 * attributes as defined in the manager or the extension settings.
6216 *
6217 * @remarks
6218 *
6219 * The schema is the most important part of the remirror editor. This is the
6220 * extension responsible for creating it, injecting extra attributes and
6221 * managing the plugin which is responsible for making sure dynamically created
6222 * attributes are updated.
6223 *
6224 * In order to add extra attributes the following would work.
6225 *
6226 * ```ts
6227 * import { RemirrorManager } from 'remirror';
6228 * import uuid from 'uuid';
6229 * import hash from 'made-up-hasher';
6230 *
6231 * const manager = RemirrorManager.create([], {
6232 * extraAttributes: [
6233 * {
6234 * identifiers: 'nodes',
6235 * attributes: {
6236 * awesome: {
6237 * default: 'awesome',
6238 * parseDOM: (domNode) => domNode.getAttribute('data-awesome'),
6239 * toDOM: (attrs) => ([ 'data-awesome', attrs.awesome ])
6240 * },
6241 * },
6242 * },
6243 * { identifiers: ['paragraph'], attributes: { id: { default: () => uuid() } } },
6244 * { identifiers: ['bold'], attributes: { hash: (mark) => hash(JSON.stringify(mark.attrs)) } },
6245 * ],
6246 * })
6247 * ```
6248 *
6249 * It is an array of identifiers and attributes. Setting the default to a
6250 * function allows you to set up a dynamic attribute which is updated with the
6251 * synchronous function that you provide to it.
6252 *
6253 * @category Builtin Extension
6254 */
6255declare class SchemaExtension extends PlainExtension {
6256 get name(): "schema";
6257 /**
6258 * The dynamic attributes for each node and mark extension.
6259 *
6260 * The structure will look like the following.
6261 *
6262 * ```ts
6263 * {
6264 * paragraph: { id: () => uid(), hash: (node) => hash(node) },
6265 * bold: { random: () => Math.random(), created: () => Date.now() },
6266 * };
6267 * ```
6268 *
6269 * This object is used by the created plugin to listen for changes to the doc,
6270 * and check for new nodes and marks which haven't yet applied the dynamic
6271 * attribute and add the attribute.
6272 */
6273 private readonly dynamicAttributes;
6274 /**
6275 * This method is responsible for creating, configuring and adding the
6276 * `schema` to the editor. `Schema` is a special type in ProseMirror editors
6277 * and with `remirror` it's all just handled for you.
6278 */
6279 onCreate(): void;
6280 /**
6281 * This creates the plugin that is used to automatically create the dynamic
6282 * attributes defined in the extra attributes object.
6283 */
6284 createPlugin(): CreateExtensionPlugin;
6285 /**
6286 * Add the schema and nodes to the manager and extension store.
6287 */
6288 private addSchema;
6289 /**
6290 * Check the dynamic nodes to see if the provided node:
6291 *
6292 * - a) is dynamic and therefore can be updated.
6293 * - b) has just been created and does not yet have a value for the dynamic
6294 * node.
6295 *
6296 * @param node - the node
6297 * @param pos - the node's position
6298 * @param tr - the mutable ProseMirror transaction which is applied to create
6299 * the next editor state
6300 */
6301 private checkAndUpdateDynamicNodes;
6302 /**
6303 * Loop through the dynamic marks to see if the provided node:
6304 *
6305 * - a) is wrapped by a matching mark.
6306 * - b) has just been added and doesn't yet have the dynamic attribute
6307 * applied.
6308 *
6309 * @param node - the node
6310 * @param pos - the node's position
6311 * @param tr - the mutable ProseMirror transaction which is applied to create
6312 * the next editor state.
6313 */
6314 private checkAndUpdateDynamicMarks;
6315 /**
6316 * Gather all the extra attributes that have been added by extensions.
6317 */
6318 private gatherExtraAttributes;
6319}
6320export { SchemaExtension }
6321export { SchemaExtension as SchemaExtension_alias_1 }
6322export { SchemaExtension as SchemaExtension_alias_2 }
6323
6324export { SchemaJSON }
6325
6326export { SchemaProps }
6327
6328export { schemaToJSON }
6329
6330export { SELECTED_NODE_CLASS_NAME }
6331
6332export { SELECTED_NODE_CLASS_SELECTOR }
6333
6334export { Selection_2 as Selection }
6335
6336export { SelectionProps }
6337
6338export { set }
6339
6340export { setBlockType }
6341
6342export { SetOptional }
6343
6344export { SetRequired }
6345
6346export { SetReturnType }
6347
6348export { setStyle }
6349
6350declare interface SetupExtensionProps {
6351 extension: AnyExtension;
6352 nodeNames: string[];
6353 markNames: string[];
6354 plainNames: string[];
6355 store: Remirror.ExtensionStore;
6356 handlers: ManagerLifecycleHandlers;
6357}
6358
6359declare function setUploadPlaceholderAction(tr: Transaction_2, action: PlaceholderPluginAction): Transaction_2;
6360export { setUploadPlaceholderAction }
6361export { setUploadPlaceholderAction as setUploadPlaceholderAction_alias_1 }
6362export { setUploadPlaceholderAction as setUploadPlaceholderAction_alias_2 }
6363export { setUploadPlaceholderAction as setUploadPlaceholderAction_alias_3 }
6364
6365export { shallowClone }
6366
6367export { Shape }
6368
6369/**
6370 * A shortcut map which is used by the `KeymapExtension`.
6371 */
6372declare type ShortcutMap = Record<NamedShortcut, string>;
6373export { ShortcutMap }
6374export { ShortcutMap as ShortcutMap_alias_1 }
6375export { ShortcutMap as ShortcutMap_alias_2 }
6376
6377export { ShouldSkipFunction }
6378
6379export { ShouldSkipProps }
6380
6381export { shouldUseDomEnvironment }
6382
6383export { Simplify }
6384
6385export { SkippableInputRule }
6386
6387export { Slice }
6388
6389export { SnakeCase }
6390
6391export { snakeCase }
6392
6393export { sort }
6394
6395export { spaceCase }
6396
6397export { startCase }
6398
6399export { startPositionOfParent }
6400
6401export { STATE_OVERRIDE }
6402
6403export { StateJSON }
6404
6405declare interface StateUpdateLifecycleProps extends EditorStateProps {
6406 /**
6407 * The previous state.
6408 */
6409 previousState: EditorState;
6410 /**
6411 * When true, this lets you know that it is the first state update to happen.
6412 * This can be used to run an action that should only be run when the state is
6413 * first available.
6414 */
6415 firstUpdate: boolean;
6416 /**
6417 * The original transaction which caused this state update.
6418 *
6419 * This allows for inspecting the reason behind the state change.
6420 * When undefined this means that the state was updated externally.
6421 *
6422 * If available:
6423 * - Metadata on the transaction can be inspected. `tr.getMeta`
6424 * - Was the change caused by added / removed content? `tr.docChanged`
6425 * - Was ths change caused by an updated selection? `tr.selectionSet`
6426 * - `tr.steps` can be inspected for further granularity.
6427 */
6428 tr?: Transaction;
6429 /**
6430 * When the state updates are not controlled and it was a transaction that
6431 * caused the state to be updated this value captures all the transaction
6432 * updates caused by prosemirror plugins hook state methods like
6433 * `filterTransactions` and `appendTransactions`.
6434 *
6435 * This is for advanced users only, and I personally have never needed it.
6436 */
6437 transactions?: readonly Transaction[];
6438}
6439export { StateUpdateLifecycleProps }
6440export { StateUpdateLifecycleProps as StateUpdateLifecycleProps_alias_1 }
6441
6442export { Static }
6443
6444export { StaticKey }
6445
6446export { StaticKeyList }
6447
6448declare interface StaticKeysProps<Options extends Shape = EmptyShape> {
6449 /**
6450 * The list of all keys which are static and can only be set at the start.
6451 */
6452 staticKeys: StaticKeyList<Options>;
6453}
6454
6455export { StaticShape }
6456
6457export { StrictReplace }
6458
6459export { StringHandler }
6460
6461export { StringHandlerOptions }
6462
6463export { StringHandlerProps }
6464
6465export { Stringified }
6466
6467export { StringKey }
6468
6469/**
6470 * This extension allows others extension to add the `createSuggesters` method
6471 * for adding the prosemirror-suggest functionality to your editor.
6472 *
6473 * @remarks
6474 *
6475 * This is an example of adding custom functionality to an extension via the
6476 * `ExtensionParameterMethods`.
6477 *
6478 * @category Builtin Extension
6479 */
6480declare class SuggestExtension extends PlainExtension<SuggestOptions> {
6481 get name(): "suggest";
6482 /**
6483 * Create the `addSuggester` method and `removeSuggester` methods to the
6484 * extension store.
6485 *
6486 * This can be used by extensions to conditionally add suggestion support.
6487 */
6488 onCreate(): void;
6489 /**
6490 * Add the `prosemirror-suggest` plugin to the editor.
6491 */
6492 createExternalPlugins(): ProsemirrorPlugin[];
6493 /**
6494 * Allow additional `Suggesters` to be added to the editor. This can be used
6495 * by `React` to create hooks.
6496 */
6497 onAddCustomHandler: AddCustomHandler<SuggestOptions>;
6498 /**
6499 * Get the suggest plugin state.
6500 *
6501 * This may be removed at a later time.
6502 *
6503 * @experimental
6504 */
6505 getSuggestState(state?: EditorState): Helper<SuggestState>;
6506 /**
6507 * Get some helpful methods from the SuggestPluginState.
6508 */
6509 getSuggestMethods(): Helper<Pick<SuggestState, 'addIgnored' | 'clearIgnored' | 'removeIgnored' | 'ignoreNextExit' | 'setMarkRemoved' | 'findMatchAtPosition' | 'findNextTextSelection' | 'setLastChangeFromAppend'>>;
6510 /**
6511 * Check to see whether the provided name is the currently active
6512 * suggester.
6513 *
6514 * @param name - the name of the suggester to include
6515 */
6516 isSuggesterActive(name: string | string[]): Helper<boolean>;
6517}
6518export { SuggestExtension }
6519export { SuggestExtension as SuggestExtension_alias_1 }
6520export { SuggestExtension as SuggestExtension_alias_2 }
6521
6522declare interface SuggestOptions {
6523 /**
6524 * The custom handler which enables adding `suggesters`.
6525 */
6526 suggester: CustomHandler<Suggester>;
6527}
6528export { SuggestOptions }
6529export { SuggestOptions as SuggestOptions_alias_1 }
6530export { SuggestOptions as SuggestOptions_alias_2 }
6531
6532/**
6533 * Create the extension tags which are passed into each extensions method to
6534 * enable dynamically generated rules and commands.
6535 *
6536 * Tags on nodes and marks are automatically added to the schema as groups.
6537 *
6538 * @category Builtin Extension
6539 */
6540declare class TagsExtension extends PlainExtension {
6541 get name(): "tags";
6542 /**
6543 * Track the tags which have been applied to the extensions in this editor.
6544 */
6545 private allTags;
6546 /**
6547 * The tags for plain extensions.
6548 */
6549 private plainTags;
6550 /**
6551 * The tags for mark extensions.
6552 */
6553 private markTags;
6554 /**
6555 * The tags for node extensions.
6556 */
6557 private nodeTags;
6558 /**
6559 * Create the tags which are used to identify extension with particular
6560 * behavioral traits.
6561 */
6562 onCreate(): void;
6563 /**
6564 * Reset the tags to the empty object with empty arrays.
6565 */
6566 private resetTags;
6567 /**
6568 * Update the tags object for each extension.
6569 */
6570 private updateTagForExtension;
6571}
6572export { TagsExtension }
6573export { TagsExtension as TagsExtension_alias_1 }
6574export { TagsExtension as TagsExtension_alias_2 }
6575
6576export { take }
6577
6578export { textBetween }
6579
6580export { TextProps }
6581
6582export { throttle }
6583
6584export { ThrottledFunction }
6585
6586/**
6587 * Checks whether a given string is unique to the set. Add the name if it
6588 * doesn't already exist, or throw an error when `shouldThrow` is true.
6589 *
6590 * @param props - destructured params
6591 */
6592export declare function throwIfNameNotUnique(props: IsNameUniqueProps): void;
6593
6594export { toggleBlockItem }
6595
6596export { ToggleBlockItemProps }
6597
6598/**
6599 * A custom `toggleMark` function that works for the `remirror` codebase.
6600 *
6601 * Create a command function that toggles the given mark with the given
6602 * attributes. Will return `false` when the current selection doesn't support
6603 * that mark. This will remove the mark if any marks of that type exist in the
6604 * selection, or add it otherwise. If the selection is empty, this applies to
6605 * the [stored marks](#state.EditorState.storedMarks) instead of a range of the
6606 * document.
6607 *
6608 * The differences from the `prosemirror-commands` version.
6609 * - Acts on the transaction rather than the state to allow for commands to be
6610 * chained together.
6611 * - Uses the ONE parameter function signature for compatibility with remirror.
6612 * - Supports passing a custom range.
6613 */
6614declare function toggleMark(props: ToggleMarkProps): CommandFunction;
6615export { toggleMark }
6616export { toggleMark as toggleMark_alias_1 }
6617
6618export declare interface ToggleMarkProps extends MarkTypeProps, Partial<AttributesProps> {
6619 /**
6620 * @deprecated use `selection` property instead.
6621 */
6622 range?: FromToProps;
6623 /**
6624 * The selection point for toggling the chosen mark.
6625 */
6626 selection?: PrimitiveSelection;
6627}
6628
6629export { toggleWrap }
6630
6631export { toString_2 as toString }
6632
6633export { Transaction }
6634
6635export { TransactionProps }
6636
6637export { TransactionTransformer }
6638
6639/**
6640 * Transforms the unsorted array of presets and extension into presets and
6641 * sorted extensions. Handles uniqueness of extensions and automatically throws
6642 * an error when required extensions are missing.
6643 *
6644 * @internalremarks Currently matching by constructor - what if different
6645 * versions exist in the same app
6646 *
6647 * @param initialExtensions - the extensions to be transformed. This includes
6648 * the extension that are parents to other extensions.
6649 *
6650 * @returns the list of extension instances sorted by priority
6651 */
6652export declare function transformExtensions<RawExtensions extends AnyExtension>(initialExtensions: readonly RawExtensions[], settings: Remirror.ManagerSettings): ExtensionTransformation<RawExtensions>;
6653
6654declare interface TriggerChangeProps {
6655 /**
6656 * Whether or not to trigger this as a change and call any handlers.
6657 *
6658 * @defaultValue true
6659 */
6660 triggerChange?: boolean;
6661}
6662export { TriggerChangeProps }
6663export { TriggerChangeProps as TriggerChangeProps_alias_1 }
6664export { TriggerChangeProps as TriggerChangeProps_alias_2 }
6665
6666export { TrStateProps }
6667
6668export { TsConfigJson }
6669
6670export { TupleOf }
6671
6672export { TupleUnion }
6673
6674export { TupleValue }
6675
6676export { TypedArray }
6677
6678declare interface UiAnnotation {
6679 __uiAnnotation?: never;
6680}
6681
6682declare type UiCommandFunction = CommandFunction & UiAnnotation;
6683export { UiCommandFunction }
6684export { UiCommandFunction as UiCommandFunction_alias_1 }
6685export { UiCommandFunction as UiCommandFunction_alias_2 }
6686
6687/**
6688 * Utility type for pulling all the command names from a list.
6689 *
6690 * TODO - why doesn't this work.
6691 */
6692declare 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>>;
6695export { UiCommandNames }
6696export { UiCommandNames as UiCommandNames_alias_1 }
6697export { UiCommandNames as UiCommandNames_alias_2 }
6698
6699export { UndefinedFlipPartialAndRequired }
6700
6701export { UndefinedPickPartial }
6702
6703export { UnionToIntersection }
6704
6705export { uniqueArray }
6706
6707export { uniqueBy }
6708
6709export { uniqueId }
6710
6711export { UnknownShape }
6712
6713/**
6714 * Get the union extension type from an array of extensions or from a function that returns an array of extension.
6715 *
6716 * @example
6717 *
6718 * ```ts
6719 * const extensions = [new BoldExtension(), new ItalicExtension()];
6720 * type Extension = UnpackedExtension<typeof extensions>
6721 * // Extension = BoldExtension | ItalicExtension
6722 * ```
6723 *
6724 * @example
6725 *
6726 * ```ts
6727 * const extensions = () => [new BoldExtension(), new ItalicExtension()];
6728 * type Extension = UnpackedExtension<typeof extensions>
6729 * // Extension = BoldExtension | ItalicExtension
6730 * ```
6731 */
6732declare type UnpackedExtension<Extension extends AnyExtension[] | (() => AnyExtension[])> = UnpackedReturnType<Extension>[number];
6733export { UnpackedExtension }
6734export { UnpackedExtension as UnpackedExtension_alias_1 }
6735export { 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 * // B = string
6748 *
6749 * type C = string
6750 * type D = UnpackedReturnType<A>
6751 * // D = string
6752 * ```
6753 */
6754declare type UnpackedReturnType<MaybeFunction> = MaybeFunction extends (...args: any[]) => infer Returned ? Returned : MaybeFunction;
6755
6756export { unset }
6757
6758declare type UpdatableViewProps = 'attributes' | 'editable';
6759export { UpdatableViewProps }
6760export { UpdatableViewProps as UpdatableViewProps_alias_1 }
6761export { UpdatableViewProps as UpdatableViewProps_alias_2 }
6762
6763declare type UpdatableViewPropsObject = {
6764 [Key in UpdatableViewProps]: DirectEditorProps[Key];
6765};
6766export { UpdatableViewPropsObject }
6767export { UpdatableViewPropsObject as UpdatableViewPropsObject_alias_1 }
6768
6769export { updateMark }
6770
6771export { UpdateMarkProps }
6772
6773/**
6774 * @internal
6775 */
6776declare type UpdateReason = 'set' | 'reset';
6777export { UpdateReason }
6778export { UpdateReason as UpdateReason_alias_1 }
6779
6780declare 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}
6792export { UpdateReasonProps }
6793export { UpdateReasonProps as UpdateReasonProps_alias_1 }
6794
6795declare 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}
6806export { UpdateStateProps }
6807export { UpdateStateProps as UpdateStateProps_alias_1 }
6808export { UpdateStateProps as UpdateStateProps_alias_2 }
6809
6810declare interface UploadContext {
6811 set: (key: string, value: unknown) => void;
6812 get: (key: string) => unknown;
6813 addListener: (listener: UploadContextListener) => () => void;
6814}
6815export { UploadContext }
6816export { UploadContext as UploadContext_alias_1 }
6817export { UploadContext as UploadContext_alias_2 }
6818export { UploadContext as UploadContext_alias_3 }
6819
6820declare type UploadContextListener = (values: Record<string, unknown>) => void;
6821
6822/**
6823 * `UploadExtension` handle the file upload process.
6824 */
6825declare 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}
6832export { UploadExtension }
6833export { UploadExtension as UploadExtension_alias_1 }
6834export { UploadExtension as UploadExtension_alias_2 }
6835export { UploadExtension as UploadExtension_alias_3 }
6836
6837/**
6838 * Insert a file into the editor and upload it.
6839 */
6840declare function uploadFile<NodeAttributes extends AbstractNodeAttributes>({ file, pos, view, fileType, uploadHandler, }: UploadFileProps<NodeAttributes>): void;
6841export { uploadFile }
6842export { uploadFile as uploadFile_alias_1 }
6843export { uploadFile as uploadFile_alias_2 }
6844export { uploadFile as uploadFile_alias_3 }
6845
6846declare type UploadFileHandler<NodeAttributes> = () => FileUploader<NodeAttributes>;
6847export { UploadFileHandler }
6848export { UploadFileHandler as UploadFileHandler_alias_1 }
6849export { UploadFileHandler as UploadFileHandler_alias_2 }
6850export { UploadFileHandler as UploadFileHandler_alias_3 }
6851
6852export 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
6860declare interface UploadPlaceholderPayload<NodeAttributes extends AbstractNodeAttributes> {
6861 context: UploadContext;
6862 fileUploader: FileUploader<NodeAttributes>;
6863}
6864export { UploadPlaceholderPayload }
6865export { UploadPlaceholderPayload as UploadPlaceholderPayload_alias_1 }
6866export { UploadPlaceholderPayload as UploadPlaceholderPayload_alias_2 }
6867export { UploadPlaceholderPayload as UploadPlaceholderPayload_alias_3 }
6868
6869declare interface UploadPlaceholderPluginData {
6870 set: DecorationSet_2;
6871 payloads: Map<string, any>;
6872}
6873
6874export { UseDefault }
6875
6876export { ValidOptions }
6877
6878export { Value }
6879
6880export { ValueOf }
6881
6882export { values }
6883
6884declare 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}
6909export { WidgetPlaceholder }
6910export { WidgetPlaceholder as WidgetPlaceholder_alias_1 }
6911export { WidgetPlaceholder as WidgetPlaceholder_alias_2 }
6912
6913declare type WithBase<Type extends BasePlaceholder> = MakeRequired<Type, keyof BasePlaceholder> & {
6914 id: unknown;
6915};
6916
6917export { within }
6918
6919/**
6920 * A type with a name property.
6921 */
6922declare type WithName<Type> = Type & {
6923 name: string;
6924};
6925
6926export { wrapIn }
6927
6928export { Writable }
6929
6930export { Writeable }
6931
6932export { ZERO_WIDTH_SPACE_CHAR }
6933
6934export { }
6935
6936declare 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 */
6954export 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 */
6975export type FocusType = PrimitiveSelection | boolean;
6976
6977
6978declare 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
7040declare 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
7057declare 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
7079declare 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; // True return signifies that this command is enabled.
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 * // This will throw since it can only be called within the returned
7243 * methods.
7244 * const chain = this.store.chain; // ❌
7245 *
7246 * return {
7247 * // This is good 😋
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
7294declare 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
7327declare 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(); // => { id: 'i1238ha', level: 1 }
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 * // extension.ts
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 * // app.tsx
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(); // => { id: 'i1238ha', level: 1 }
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
7489declare 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
7531declare 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
7583declare 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
7599declare 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
7632declare 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
7660declare 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 * // From within an extension
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
7868declare 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
8075declare 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
8125declare 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
8251declare 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
8280declare 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.
8363export type { Extension };
8364
8365
8366declare global {
8367 namespace Remirror {
8368 interface ListenerProperties<Extension extends AnyExtension> {}
8369 }
8370}
8371
8372
8373declare global {
8374 namespace Remirror {
8375 /**
8376 * Settings which can be passed into the manager.
8377 */
8378 interface ManagerSettings extends Partial<CustomDocumentProps> {
8379 /**
8380 * Set the extension priority for extension's by their name.
8381 */
8382 priority?: Record<string, ExtensionPriority>;
8383
8384 /**
8385 * An object which excludes certain functionality from all extensions
8386 * within the manager.
8387 */
8388 exclude?: ExcludeOptions;
8389
8390 /**
8391 * The error handler which is called when the JSON passed is invalid.
8392 *
8393 * @remarks
8394 *
8395 * The following can be used to setup the `onError` handler on the the
8396 * manager.
8397 *
8398 * ```tsx
8399 * import React from 'react';
8400 * import { Remirror, InvalidContentHandler } from 'remirror';
8401 * import { Remirror, useManager } from '@remirror/react';
8402 * import { WysiwygPreset } from 'remirror/extensions';
8403 *
8404 * const Editor = () => {
8405 * const onError: InvalidContentHandler = useCallback(({ json, invalidContent, transformers }) => {
8406 * // Automatically remove all invalid nodes and marks.
8407 * return transformers.remove(json, invalidContent);
8408 * }, []);
8409 *
8410 * const manager = useManager(() => [new WysiwygPreset()], { onError });
8411 *
8412 * return (
8413 * <Remirror manager={manager}>
8414 * <div />
8415 * </Remirror>
8416 * );
8417 * };
8418 * ```
8419 */
8420 onError?: InvalidContentHandler;
8421
8422 /**
8423 * A function which transforms a string into a prosemirror node.
8424 *
8425 * @remarks
8426 *
8427 * Can be used to transform markdown / html or any other string format into a
8428 * prosemirror node.
8429 *
8430 * See [[`fromHTML`]] for an example of how this could work.
8431 */
8432 stringHandler?: keyof Remirror.StringHandlers | StringHandler;
8433
8434 /**
8435 * The default named selection. This is used when `manager.createState` is
8436 * called without providing a selection.
8437 *
8438 * @defaultValue 'end'
8439 */
8440 defaultSelection?: 'start' | 'end' | 'all';
8441 }
8442
8443 /**
8444 * Describes the object where the extension manager stores it's data.
8445 *
8446 * @remarks
8447 *
8448 * Since this is a global namespace, you can extend the store if your
8449 * extension is modifying the shape of the `Manager.store` property.
8450 */
8451 interface ManagerStore<Extension extends AnyExtension> {
8452 /**
8453 * The editor view stored by this instance.
8454 */
8455 view: EditorView;
8456 }
8457
8458 interface ExtensionStore {
8459 /**
8460 * Make the remirror manager available to the editor.
8461 */
8462 manager: AnyRemirrorManager;
8463
8464 /**
8465 * The list of all extensions included in the editor.
8466 */
8467 readonly extensions: AnyExtension[];
8468
8469 /**
8470 * The stage the manager is currently at.
8471 */
8472 readonly phase: ManagerPhase;
8473
8474 /**
8475 * The view available to extensions once `addView` has been called on the
8476 * `RemirrorManager` instance.
8477 */
8478 readonly view: EditorView;
8479
8480 /**
8481 * The latest state.
8482 */
8483 currentState: EditorState;
8484
8485 /**
8486 * The previous state. Will be undefined when the view is first created.
8487 */
8488 previousState?: EditorState;
8489
8490 /**
8491 * The root document to be used for the editor. This is mainly used for
8492 * non-browser environment.
8493 */
8494 readonly document: Document;
8495
8496 /**
8497 * The settings passed to the manager.
8498 */
8499 readonly managerSettings: ManagerSettings;
8500
8501 /**
8502 * The names of every node extension.
8503 */
8504 nodeNames: readonly string[];
8505
8506 /**
8507 * The names of every mark extension.
8508 */
8509 markNames: readonly string[];
8510
8511 /**
8512 * The names of every plain extension.
8513 */
8514 plainNames: readonly string[];
8515
8516 /**
8517 * The named string handlers which are supported by the current editor
8518 * implementation.
8519 */
8520 readonly stringHandlers: NamedStringHandlers;
8521
8522 /**
8523 * Return true when the editor view has been created.
8524 */
8525 readonly isMounted: () => boolean;
8526
8527 /**
8528 * A helper method for retrieving the state of the editor
8529 */
8530 readonly getState: () => EditorState;
8531
8532 /**
8533 * Allow extensions to trigger an update in the prosemirror state. This
8534 * should not be used often. It's here in case you need it in an
8535 * emergency.
8536 *
8537 * Internally it's used by the [[`PluginsExtension`]] to create a new
8538 * state when the plugins are updated at runtime.
8539 */
8540 readonly updateState: (state: EditorState) => void;
8541
8542 /**
8543 * Get the extension instance matching the provided constructor from the
8544 * manager.
8545 *
8546 * This will throw an error if not defined.
8547 */
8548 readonly getExtension: <ExtensionConstructor extends AnyExtensionConstructor>(
8549 Constructor: ExtensionConstructor,
8550 ) => InstanceType<ExtensionConstructor>;
8551
8552 /**
8553 * Get the value of a key from the manager store.
8554 */
8555 getStoreKey: <Key extends ManagerStoreKeys>(key: Key) => AnyManagerStore[Key];
8556
8557 /**
8558 * Update the store with a specific key.
8559 */
8560 setStoreKey: <Key extends ManagerStoreKeys>(key: Key, value: AnyManagerStore[Key]) => void;
8561
8562 /**
8563 * Set a value on the extension store. One of the design decisions in this `1.0.0`
8564 * version of `remirror` was to move away from passing elaborate arguments to each extension
8565 * method and allow extensions to interact with a store shared by all
8566 * extensions.
8567 *
8568 * The extension store object is immutable and will throw an error if updated directly.
8569 *
8570 * ```ts
8571 * class MyExtension extends PlainExtension {
8572 * get name() {}
8573 * }
8574 * ```
8575 */
8576 setExtensionStore: <Key extends keyof ExtensionStore>(
8577 key: Key,
8578 value: ExtensionStore[Key],
8579 ) => void;
8580
8581 /**
8582 * Set the string handler to use for a given name.
8583 *
8584 * This allows users to set the string handler
8585 */
8586 setStringHandler: (name: keyof StringHandlers, handler: StringHandler) => void;
8587 }
8588 }
8589}
8590
8591
8592declare global {
8593 namespace Remirror {
8594 interface AllExtensions {
8595 upload: UploadExtension;
8596 }
8597 }
8598}