UNPKG

1.75 kBTypeScriptView Raw
1import type { NodeViewMethod } from '@remirror/core-types';
2import { PlainExtension } from '../extension';
3import type { CreateExtensionPlugin } from '../types';
4/**
5 * This extension allows others extension to add the `createNodeView` method
6 * for creating nodeViews which alter how the dom is rendered for the node.
7 *
8 * @remarks
9 *
10 * This is an example of adding custom functionality to an extension via the
11 * `ExtensionParameterMethods`.
12 *
13 * @category Builtin Extension
14 */
15export declare class NodeViewsExtension extends PlainExtension {
16 get name(): "nodeViews";
17 createPlugin(): CreateExtensionPlugin;
18}
19declare global {
20 namespace Remirror {
21 interface ManagerSettings {
22 /**
23 * Add custom node views to the manager which will take priority over the
24 * nodeViews provided by the extensions and plugins.
25 */
26 nodeViews?: Record<string, NodeViewMethod>;
27 }
28 interface BaseExtension {
29 /**
30 * Registers one or multiple nodeViews for the extension.
31 *
32 * This is a shorthand way of registering a nodeView without the need to
33 * create a prosemirror plugin. It allows for the registration of one nodeView
34 * which has the same name as the extension.
35 *
36 * To register more than one you would need to use a custom plugin returned
37 * from the `plugin` method.
38 *
39 * @param parameter - schema parameter with type included
40 */
41 createNodeViews?(): NodeViewMethod | Record<string, NodeViewMethod>;
42 }
43 interface AllExtensions {
44 nodeViews: NodeViewsExtension;
45 }
46 }
47}