@thomasfosterau/effect-richtext 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +48 -0
- package/README.md +117 -1
- package/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/commands/commands.d.ts +323 -0
- package/dist/commands/commands.js +722 -0
- package/dist/commands/internal.js +43 -0
- package/dist/commands/keymaps.d.ts +46 -0
- package/dist/commands/keymaps.js +64 -0
- package/dist/commands.d.ts +3 -0
- package/dist/commands.js +3 -0
- package/dist/compat/commands.d.ts +250 -0
- package/dist/compat/commands.js +275 -0
- package/dist/compat/internal/core.d.ts +20 -0
- package/dist/compat/internal/core.js +148 -0
- package/dist/compat/internal/props.js +82 -0
- package/dist/compat/keymap.d.ts +21 -0
- package/dist/compat/keymap.js +38 -0
- package/dist/compat/model.d.ts +893 -0
- package/dist/compat/model.js +1212 -0
- package/dist/compat/orderedmap.d.ts +74 -0
- package/dist/compat/orderedmap.js +124 -0
- package/dist/compat/schema-basic.d.ts +38 -0
- package/dist/compat/schema-basic.js +238 -0
- package/dist/compat/schema-list.d.ts +81 -0
- package/dist/compat/schema-list.js +156 -0
- package/dist/compat/state.d.ts +415 -0
- package/dist/compat/state.js +689 -0
- package/dist/compat/test-builder.d.ts +98 -0
- package/dist/compat/test-builder.js +197 -0
- package/dist/compat/transform.d.ts +458 -0
- package/dist/compat/transform.js +803 -0
- package/dist/compat/view.d.ts +411 -0
- package/dist/compat/view.js +409 -0
- package/dist/dropcursor.d.ts +46 -0
- package/dist/dropcursor.js +176 -0
- package/dist/extensions/defaults.d.ts +716 -0
- package/dist/extensions/defaults.js +209 -0
- package/dist/extensions/editor.d.ts +246 -0
- package/dist/extensions/editor.js +271 -0
- package/dist/extensions/extension.d.ts +375 -0
- package/dist/extensions/extension.js +233 -0
- package/dist/extensions.d.ts +4 -0
- package/dist/extensions.js +4 -0
- package/dist/gapcursor.d.ts +66 -0
- package/dist/gapcursor.js +273 -0
- package/dist/history.d.ts +178 -0
- package/dist/history.js +412 -0
- package/dist/html.d.ts +158 -0
- package/dist/html.js +164 -0
- package/dist/inputrules.d.ts +271 -0
- package/dist/inputrules.js +321 -0
- package/dist/internal/attempt.js +15 -0
- package/dist/internal/json.js +29 -0
- package/dist/keymap/keymap.d.ts +130 -0
- package/dist/keymap/keymap.js +159 -0
- package/dist/keymap.d.ts +2 -0
- package/dist/keymap.js +1 -0
- package/dist/markdown/errors.d.ts +23 -0
- package/dist/markdown/errors.js +26 -0
- package/dist/markdown/from_markdown.d.ts +185 -0
- package/dist/markdown/from_markdown.js +266 -0
- package/dist/markdown/schema.d.ts +522 -0
- package/dist/markdown/schema.js +292 -0
- package/dist/markdown/to_markdown.d.ts +251 -0
- package/dist/markdown/to_markdown.js +413 -0
- package/dist/markdown.d.ts +5 -0
- package/dist/markdown.js +5 -0
- package/dist/model/attrsCodec.js +48 -0
- package/dist/model/comparedeep.js +17 -0
- package/dist/model/content.d.ts +232 -0
- package/dist/model/content.js +630 -0
- package/dist/model/diff.js +66 -0
- package/dist/model/dom.d.ts +3 -0
- package/dist/model/errors.d.ts +90 -0
- package/dist/model/errors.js +76 -0
- package/dist/model/fragment.d.ts +131 -0
- package/dist/model/fragment.js +262 -0
- package/dist/model/from_dom.d.ts +299 -0
- package/dist/model/from_dom.js +618 -0
- package/dist/model/json.d.ts +37 -0
- package/dist/model/json.js +126 -0
- package/dist/model/mark.d.ts +73 -0
- package/dist/model/mark.js +121 -0
- package/dist/model/node.d.ts +267 -0
- package/dist/model/node.js +434 -0
- package/dist/model/replace.d.ts +78 -0
- package/dist/model/replace.js +207 -0
- package/dist/model/resolvedpos.d.ts +196 -0
- package/dist/model/resolvedpos.js +305 -0
- package/dist/model/schema.d.ts +740 -0
- package/dist/model/schema.js +451 -0
- package/dist/model/to_dom.d.ts +169 -0
- package/dist/model/to_dom.js +238 -0
- package/dist/model.d.ts +12 -0
- package/dist/model.js +12 -0
- package/dist/placeholder.d.ts +53 -0
- package/dist/placeholder.js +79 -0
- package/dist/reactive/observer.d.ts +54 -0
- package/dist/reactive/observer.js +61 -0
- package/dist/reactive/selectors.d.ts +22 -0
- package/dist/reactive/selectors.js +61 -0
- package/dist/reactive/stateref.d.ts +72 -0
- package/dist/reactive/stateref.js +71 -0
- package/dist/reactive/streams.d.ts +83 -0
- package/dist/reactive/streams.js +85 -0
- package/dist/reactive.d.ts +16 -0
- package/dist/reactive.js +26 -0
- package/dist/schema-basic.d.ts +448 -0
- package/dist/schema-basic.js +269 -0
- package/dist/schema-list/commands.d.ts +66 -0
- package/dist/schema-list/commands.js +203 -0
- package/dist/schema-list.d.ts +92 -0
- package/dist/schema-list.js +100 -0
- package/dist/state/errors.d.ts +39 -0
- package/dist/state/errors.js +32 -0
- package/dist/state/plugin.d.ts +232 -0
- package/dist/state/plugin.js +82 -0
- package/dist/state/selection.d.ts +297 -0
- package/dist/state/selection.js +486 -0
- package/dist/state/state.d.ts +212 -0
- package/dist/state/state.js +489 -0
- package/dist/state/transaction.d.ts +145 -0
- package/dist/state/transaction.js +195 -0
- package/dist/state.d.ts +6 -0
- package/dist/state.js +6 -0
- package/dist/test-builder.d.ts +3582 -0
- package/dist/test-builder.js +239 -0
- package/dist/transform/attr_step.d.ts +60 -0
- package/dist/transform/attr_step.js +105 -0
- package/dist/transform/errors.d.ts +50 -0
- package/dist/transform/errors.js +35 -0
- package/dist/transform/map.d.ts +182 -0
- package/dist/transform/map.js +280 -0
- package/dist/transform/mark.js +98 -0
- package/dist/transform/mark_set_step.js +69 -0
- package/dist/transform/mark_step.d.ts +113 -0
- package/dist/transform/mark_step.js +225 -0
- package/dist/transform/replace.d.ts +18 -0
- package/dist/transform/replace.js +381 -0
- package/dist/transform/replace_step.d.ts +109 -0
- package/dist/transform/replace_step.js +175 -0
- package/dist/transform/step.d.ts +157 -0
- package/dist/transform/step.js +168 -0
- package/dist/transform/structure.d.ts +89 -0
- package/dist/transform/structure.js +350 -0
- package/dist/transform/transform.d.ts +248 -0
- package/dist/transform/transform.js +373 -0
- package/dist/transform.d.ts +10 -0
- package/dist/transform.js +10 -0
- package/dist/view/browser.js +39 -0
- package/dist/view/capturekeys.js +282 -0
- package/dist/view/clipboard.d.ts +8 -0
- package/dist/view/clipboard.js +245 -0
- package/dist/view/decoration.d.ts +339 -0
- package/dist/view/decoration.js +566 -0
- package/dist/view/dom.d.ts +18 -0
- package/dist/view/dom.js +140 -0
- package/dist/view/domchange.js +295 -0
- package/dist/view/domcoords.d.ts +22 -0
- package/dist/view/domcoords.js +448 -0
- package/dist/view/domobserver.d.ts +47 -0
- package/dist/view/domobserver.js +328 -0
- package/dist/view/errors.d.ts +18 -0
- package/dist/view/errors.js +21 -0
- package/dist/view/input.d.ts +58 -0
- package/dist/view/input.js +704 -0
- package/dist/view/selection.js +198 -0
- package/dist/view/view.d.ts +699 -0
- package/dist/view/view.js +623 -0
- package/dist/view/viewdesc.d.ts +236 -0
- package/dist/view/viewdesc.js +1205 -0
- package/dist/view-css.d.ts +43 -0
- package/dist/view-css.js +124 -0
- package/dist/view.d.ts +6 -0
- package/dist/view.js +4 -0
- package/package.json +200 -4
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { ContentMatch } from "./content.js";
|
|
2
|
+
import { ModelError } from "./errors.js";
|
|
3
|
+
import { Fragment } from "./fragment.js";
|
|
4
|
+
import { Mark } from "./mark.js";
|
|
5
|
+
import { Node } from "./node.js";
|
|
6
|
+
import { Slice } from "./replace.js";
|
|
7
|
+
import { ResolvedPos } from "./resolvedpos.js";
|
|
8
|
+
import { AnySchema, Attrs } from "./schema.js";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Option from "effect/Option";
|
|
11
|
+
/**
|
|
12
|
+
* A DOM position whose document position should be recorded while
|
|
13
|
+
* parsing (see `ParseOptions.findPositions`).
|
|
14
|
+
*
|
|
15
|
+
* @since 0.1.0
|
|
16
|
+
* @category models
|
|
17
|
+
*/
|
|
18
|
+
export interface DOMPosition {
|
|
19
|
+
readonly node: globalThis.Node;
|
|
20
|
+
readonly offset: number;
|
|
21
|
+
pos?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* These are the options recognized by the
|
|
25
|
+
* [`parse`](#DOMParser.parse) and [`parseSlice`](#DOMParser.parseSlice)
|
|
26
|
+
* methods.
|
|
27
|
+
*
|
|
28
|
+
* @since 0.1.0
|
|
29
|
+
* @category models
|
|
30
|
+
*/
|
|
31
|
+
export interface ParseOptions<Sc extends AnySchema = AnySchema> {
|
|
32
|
+
/**
|
|
33
|
+
* By default, whitespace is collapsed as per HTML's rules. Pass
|
|
34
|
+
* `true` to preserve whitespace, but normalize newlines to spaces
|
|
35
|
+
* or, if available, line break replacements, and `"full"` to
|
|
36
|
+
* preserve whitespace entirely.
|
|
37
|
+
*/
|
|
38
|
+
readonly preserveWhitespace?: boolean | "full" | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* When given, the parser will, beside parsing the content, record
|
|
41
|
+
* the document positions of the given DOM positions. It will do so
|
|
42
|
+
* by writing to the objects, adding a `pos` property that holds the
|
|
43
|
+
* document position. DOM positions that are not in the parsed
|
|
44
|
+
* content will not be written to.
|
|
45
|
+
*/
|
|
46
|
+
readonly findPositions?: ReadonlyArray<DOMPosition> | undefined;
|
|
47
|
+
/** The child node index to start parsing from. */
|
|
48
|
+
readonly from?: number | undefined;
|
|
49
|
+
/** The child node index to stop parsing at. */
|
|
50
|
+
readonly to?: number | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* By default, the content is parsed into the schema's default top
|
|
53
|
+
* node type. You can pass this option to use the type and attributes
|
|
54
|
+
* from a different node as the top container.
|
|
55
|
+
*/
|
|
56
|
+
readonly topNode?: Node<Sc, any> | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Provide the starting content match that content parsed into the
|
|
59
|
+
* top node is matched against.
|
|
60
|
+
*/
|
|
61
|
+
readonly topMatch?: ContentMatch | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* A set of additional nodes to count as context when parsing, above
|
|
64
|
+
* the given top node.
|
|
65
|
+
*/
|
|
66
|
+
readonly context?: ResolvedPos<Sc> | undefined;
|
|
67
|
+
/** @internal */
|
|
68
|
+
readonly ruleFromNode?: ((node: globalThis.Node) => Omit<TagParseRule, "tag"> | null | undefined) | undefined;
|
|
69
|
+
/** @internal */
|
|
70
|
+
readonly topOpen?: boolean | undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Fields that may be present in both tag and style parse rules.
|
|
74
|
+
*
|
|
75
|
+
* @since 0.1.0
|
|
76
|
+
* @category models
|
|
77
|
+
*/
|
|
78
|
+
export interface GenericParseRule {
|
|
79
|
+
/**
|
|
80
|
+
* Can be used to change the order in which the parse rules in a
|
|
81
|
+
* schema are tried. Those with higher priority come first. Rules
|
|
82
|
+
* without a priority are counted as having priority 50. This
|
|
83
|
+
* property is only meaningful in a schema—when directly constructing
|
|
84
|
+
* a parser, the order of the rule array is used.
|
|
85
|
+
*/
|
|
86
|
+
readonly priority?: number | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* By default, when a rule matches an element or style, no further
|
|
89
|
+
* rules get a chance to match it. By setting this to `false`, you
|
|
90
|
+
* indicate that even when this rule matches, other rules that come
|
|
91
|
+
* after it should also run.
|
|
92
|
+
*/
|
|
93
|
+
readonly consuming?: boolean | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* When given, restricts this rule to only match when the current
|
|
96
|
+
* context—the parent nodes into which the content is being
|
|
97
|
+
* parsed—matches this expression. Should contain one or more node
|
|
98
|
+
* names or node group names followed by single or double slashes.
|
|
99
|
+
* For example `"paragraph/"` means the rule only matches when the
|
|
100
|
+
* parent node is a paragraph, `"blockquote/paragraph/"` restricts it
|
|
101
|
+
* to be in a paragraph that is inside a blockquote, and
|
|
102
|
+
* `"section//"` matches any position inside a section—a double slash
|
|
103
|
+
* matches any sequence of ancestor nodes. To allow multiple
|
|
104
|
+
* different contexts, they can be separated by a pipe (`|`)
|
|
105
|
+
* character, as in `"blockquote/|list_item/"`.
|
|
106
|
+
*/
|
|
107
|
+
readonly context?: string | undefined;
|
|
108
|
+
/** The name of the mark type to wrap the matched content in. */
|
|
109
|
+
readonly mark?: string | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* When true, ignore content that matches this rule. Any `<head>`,
|
|
112
|
+
* `<noscript>`, `<script>`, `<object>`, `<style>`, or `<title>` tags
|
|
113
|
+
* encountered are automatically ignored when no rules match them.
|
|
114
|
+
*/
|
|
115
|
+
readonly ignore?: boolean | undefined;
|
|
116
|
+
/** When true, finding an element that matches this rule will close the current node. */
|
|
117
|
+
readonly closeParent?: boolean | undefined;
|
|
118
|
+
/** When true, ignore the node that matches this rule, but do parse its content. */
|
|
119
|
+
readonly skip?: boolean | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Attributes for the node or mark created by this rule. When
|
|
122
|
+
* `getAttrs` is provided, it takes precedence.
|
|
123
|
+
*/
|
|
124
|
+
readonly attrs?: Attrs | undefined;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Parse rule targeting a DOM element.
|
|
128
|
+
*
|
|
129
|
+
* @since 0.1.0
|
|
130
|
+
* @category models
|
|
131
|
+
*/
|
|
132
|
+
export interface TagParseRule extends GenericParseRule {
|
|
133
|
+
/** A CSS selector describing the kind of DOM elements to match. */
|
|
134
|
+
readonly tag: string;
|
|
135
|
+
/**
|
|
136
|
+
* The namespace to match. Nodes are only matched when the namespace
|
|
137
|
+
* matches or this property is undefined.
|
|
138
|
+
*/
|
|
139
|
+
readonly namespace?: string | null | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* The name of the node type to create when this rule matches. Each
|
|
142
|
+
* rule should have either a `node`, `mark`, or `ignore` property
|
|
143
|
+
* (except when it appears in a node or mark spec, in which case the
|
|
144
|
+
* `node` or `mark` property will be derived from its position).
|
|
145
|
+
*/
|
|
146
|
+
readonly node?: string | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* A function used to compute the attributes for the node or mark
|
|
149
|
+
* created by this rule. Can also be used to describe further
|
|
150
|
+
* conditions the DOM element must match. When it returns `false`,
|
|
151
|
+
* the rule won't match. When it returns null or undefined, that is
|
|
152
|
+
* interpreted as an empty/default set of attributes.
|
|
153
|
+
*/
|
|
154
|
+
readonly getAttrs?: ((node: HTMLElement) => Attrs | false | null | undefined) | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* For rules that produce non-leaf nodes, by default the content of
|
|
157
|
+
* the DOM element is parsed as content of the node. If the child
|
|
158
|
+
* nodes are in a descendent node, this may be a CSS selector string
|
|
159
|
+
* that the parser must use to find the actual content element, or a
|
|
160
|
+
* function that returns the actual content element to the parser.
|
|
161
|
+
*/
|
|
162
|
+
readonly contentElement?: string | HTMLElement | ((node: HTMLElement) => HTMLElement) | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* Can be used to override the content of a matched node. When
|
|
165
|
+
* present, instead of parsing the node's child nodes, the result of
|
|
166
|
+
* this function is used.
|
|
167
|
+
*/
|
|
168
|
+
readonly getContent?: ((node: globalThis.Node, schema: AnySchema) => Fragment<any, any>) | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Controls whether whitespace should be preserved when parsing the
|
|
171
|
+
* content inside the matched element. `false` means whitespace may
|
|
172
|
+
* be collapsed, `true` means that whitespace should be preserved but
|
|
173
|
+
* newlines normalized to spaces, and `"full"` means that newlines
|
|
174
|
+
* should also be preserved.
|
|
175
|
+
*/
|
|
176
|
+
readonly preserveWhitespace?: boolean | "full" | undefined;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* A parse rule targeting a style property.
|
|
180
|
+
*
|
|
181
|
+
* @since 0.1.0
|
|
182
|
+
* @category models
|
|
183
|
+
*/
|
|
184
|
+
export interface StyleParseRule extends GenericParseRule {
|
|
185
|
+
/**
|
|
186
|
+
* A CSS property name to match. This rule will match inline styles
|
|
187
|
+
* that list that property. May also have the form
|
|
188
|
+
* `"property=value"`, in which case the rule only matches if the
|
|
189
|
+
* property's value exactly matches the given value. (For more
|
|
190
|
+
* complicated filters, use `getAttrs` and return false to indicate
|
|
191
|
+
* that the match failed.) Rules matching styles may only produce
|
|
192
|
+
* marks, not nodes.
|
|
193
|
+
*/
|
|
194
|
+
readonly style: string;
|
|
195
|
+
/** Makes `ParseRule` a discriminated union. */
|
|
196
|
+
readonly tag?: undefined;
|
|
197
|
+
/** Style rules can remove marks from the set of active marks. */
|
|
198
|
+
readonly clearMark?: ((mark: Mark<any, any>) => boolean) | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* A function used to compute the attributes for the node or mark
|
|
201
|
+
* created by this rule. Called with the style's value.
|
|
202
|
+
*/
|
|
203
|
+
readonly getAttrs?: ((node: string) => Attrs | false | null | undefined) | undefined;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* A value that describes how to parse a given DOM node or inline style
|
|
207
|
+
* as a node or mark.
|
|
208
|
+
*
|
|
209
|
+
* @since 0.1.0
|
|
210
|
+
* @category models
|
|
211
|
+
*/
|
|
212
|
+
export type ParseRule = TagParseRule | StyleParseRule;
|
|
213
|
+
/**
|
|
214
|
+
* The context against which a rule's `context` restriction is
|
|
215
|
+
* checked. Parsers pass their internal parse state; when matching
|
|
216
|
+
* rules directly, a context describing the top of a fresh parse is
|
|
217
|
+
* used by default.
|
|
218
|
+
*
|
|
219
|
+
* @since 0.1.0
|
|
220
|
+
* @category models
|
|
221
|
+
*/
|
|
222
|
+
export interface RuleContext {
|
|
223
|
+
matchesContext(context: string): boolean;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* A DOM parser represents a strategy for parsing DOM content into a
|
|
227
|
+
* document conforming to a given schema. Its behavior is defined by an
|
|
228
|
+
* array of [rules](#ParseRule).
|
|
229
|
+
*
|
|
230
|
+
* @since 0.1.0
|
|
231
|
+
* @category models
|
|
232
|
+
*/
|
|
233
|
+
export declare class DOMParser<Sc extends AnySchema = AnySchema> {
|
|
234
|
+
/** The schema into which the parser parses. */
|
|
235
|
+
readonly schema: Sc;
|
|
236
|
+
/** The set of parse rules that the parser uses, in order of precedence. */
|
|
237
|
+
readonly rules: ReadonlyArray<ParseRule>;
|
|
238
|
+
/** The tag rules of this parser, in order of precedence. */
|
|
239
|
+
readonly tags: ReadonlyArray<TagParseRule>;
|
|
240
|
+
/** The style rules of this parser, in order of precedence. */
|
|
241
|
+
readonly styles: ReadonlyArray<StyleParseRule>;
|
|
242
|
+
/** @internal */
|
|
243
|
+
readonly matchedStyles: ReadonlyArray<string>;
|
|
244
|
+
/** @internal */
|
|
245
|
+
readonly normalizeLists: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Create a parser that targets the given schema, using the given
|
|
248
|
+
* parsing rules.
|
|
249
|
+
*/
|
|
250
|
+
constructor(
|
|
251
|
+
/** The schema into which the parser parses. */
|
|
252
|
+
schema: Sc,
|
|
253
|
+
/** The set of parse rules that the parser uses, in order of precedence. */
|
|
254
|
+
rules: ReadonlyArray<ParseRule>);
|
|
255
|
+
/** Parse a document from the content of a DOM node. */
|
|
256
|
+
parse(dom: globalThis.Node, options?: ParseOptions<Sc>): Effect.Effect<Node<Sc>, ModelError>;
|
|
257
|
+
/** Like `parse`, but throws a `ModelError` on failure. */
|
|
258
|
+
parseUnsafe(dom: globalThis.Node, options?: ParseOptions<Sc>): Node<Sc>;
|
|
259
|
+
/**
|
|
260
|
+
* Parses the content of the given DOM node, like
|
|
261
|
+
* [`parse`](#DOMParser.parse), and takes the same set of options.
|
|
262
|
+
* But unlike that method, which produces a whole node, this one
|
|
263
|
+
* returns a slice that is open at the sides, meaning that the schema
|
|
264
|
+
* constraints aren't applied to the start of nodes to the left of
|
|
265
|
+
* the input and the end of nodes at the end.
|
|
266
|
+
*/
|
|
267
|
+
parseSlice(dom: globalThis.Node, options?: ParseOptions<Sc>): Effect.Effect<Slice<Sc>, ModelError>;
|
|
268
|
+
/** Like `parseSlice`, but throws a `ModelError` on failure. */
|
|
269
|
+
parseSliceUnsafe(dom: globalThis.Node, options?: ParseOptions<Sc>): Slice<Sc>;
|
|
270
|
+
/**
|
|
271
|
+
* Find the first tag rule (after `after`, when given) that matches
|
|
272
|
+
* the given DOM node in the given context. When the rule has a
|
|
273
|
+
* `getAttrs` function, the returned rule is a copy whose `attrs` hold
|
|
274
|
+
* the computed attributes.
|
|
275
|
+
*/
|
|
276
|
+
matchTag(dom: globalThis.Node, context?: RuleContext, after?: TagParseRule): Option.Option<TagParseRule>;
|
|
277
|
+
/** @internal */
|
|
278
|
+
matchTagOrNull(dom: globalThis.Node, context: RuleContext, after?: TagParseRule): TagParseRule | null;
|
|
279
|
+
/**
|
|
280
|
+
* Find the first style rule (after `after`, when given) that matches
|
|
281
|
+
* the given style property and value in the given context.
|
|
282
|
+
*/
|
|
283
|
+
matchStyle(prop: string, value: string, context?: RuleContext, after?: StyleParseRule): Option.Option<StyleParseRule>;
|
|
284
|
+
/** @internal */
|
|
285
|
+
matchStyleOrNull(prop: string, value: string, context: RuleContext, after?: StyleParseRule): StyleParseRule | null;
|
|
286
|
+
/**
|
|
287
|
+
* Gather the parse rules from a schema's node and mark specs,
|
|
288
|
+
* ordered by priority (and schema order for equal priorities). Rules
|
|
289
|
+
* without a `node`/`mark` get the name of the type they were defined
|
|
290
|
+
* on.
|
|
291
|
+
*/
|
|
292
|
+
static schemaRules(schema: AnySchema): ReadonlyArray<ParseRule>;
|
|
293
|
+
/**
|
|
294
|
+
* Construct a DOM parser using the parsing rules listed in a schema's
|
|
295
|
+
* node specs, reordered by priority. The parser is cached on the
|
|
296
|
+
* schema.
|
|
297
|
+
*/
|
|
298
|
+
static fromSchema<Sc extends AnySchema>(schema: Sc): DOMParser<Sc>;
|
|
299
|
+
}
|