UNPKG

1.41 kBTypeScriptView Raw
1import { Mark, MarkSpec } from 'prosemirror-model';
2/**
3 * This annotation is purely for reference, & does _nothing_ given annotating
4 * `minLength` on an array of strings is not supported with our schema+spec
5 * generator.
6 *
7 * We're keeping it to signal that data consumer `sources` shouldn't be empty
8 * strings
9 *
10 * // @minLength 1
11 */
12declare type DataConsumerSource = string;
13export interface DataConsumerAttributes {
14 /**
15 * @minItems 1
16 */
17 sources: Array<DataConsumerSource>;
18}
19/**
20 * @name dataConsumer_mark
21 * @description This mark is used for metadata surrounding a node consuming data
22 * from a given source node
23 */
24export interface DataConsumerDefinition {
25 type: 'dataConsumer';
26 attrs: DataConsumerAttributes;
27}
28export interface DataConsumerMark extends Mark {
29 attrs: DataConsumerAttributes;
30}
31export declare const dataConsumer: MarkSpec;
32/**
33 * We want to ensure any "invalid ADF" doesn't get serialised, but the entire
34 * mark itself is not valid without a non-empty `sources`.
35 *
36 * We _almost could_ simply return `null` if sources length is < 0 & would fit
37 * the type signature of prosemirror-model's `fragment` but not `mark`'s toJSON.
38 *
39 * So we'll leave any extra transformation checks in
40 * `editor-json-transformer`(?)
41 */
42export declare const toJSON: (mark: Mark) => {
43 type: string;
44 attrs: {
45 [key: string]: any;
46 };
47};
48export {};