@atlaskit/node-data-provider
Version:
Node data provider for @atlaskit/editor-core plugins and @atlaskit/renderer
23 lines (22 loc) • 1.08 kB
TypeScript
import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
import type { NodeDataProvider } from '../node-data-provider';
interface ProviderWithNodes {
/** The nodes that are supported by the provider. */
nodes: JSONNode[];
/** The provider that supports the nodes. */
provider: NodeDataProvider<JSONNode, unknown>;
}
/**
* Finds nodes in the document that are supported by the given providers, up to a maximum number of nodes.
* Uses iterative Depth-First Search (DFS) to traverse the document.
*
* @param doc The document to search for nodes.
* @param providers An array of providers with their maximum nodes to prefetch.
* @param maxNodesToVisit The maximum number of nodes to visit in the document.
* @returns An array of objects, each containing a provider and the nodes that are supported by that provider.
*/
export declare function findNodesToPrefetch(doc: JSONDocNode, providers: {
maxNodesToPrefetch: number;
provider: NodeDataProvider<JSONNode, unknown>;
}[], maxNodesToVisit: number): ProviderWithNodes[];
export {};