prosemirror-view 1.25.0 → 1.26.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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.26.0 (2022-06-07)
2
+
3
+ ### New features
4
+
5
+ Export the `NodeViewConstructor` and `MarkViewConstructor` types. Include Node/MarkViewConstructor in doc template
6
+
1
7
  ## 1.25.0 (2022-06-01)
2
8
 
3
9
  ### New features
package/dist/index.d.ts CHANGED
@@ -536,7 +536,15 @@ declare class EditorView {
536
536
  */
537
537
  dispatch(tr: Transaction): void;
538
538
  }
539
+ /**
540
+ The type of function [provided](https://prosemirror.net/docs/ref/#view.ViewProps.nodeViews) to
541
+ create [node views](https://prosemirror.net/docs/ref/#view.NodeView).
542
+ */
539
543
  declare type NodeViewConstructor = (node: Node, view: EditorView, getPos: () => number, decorations: readonly Decoration[], innerDecorations: DecorationSource) => NodeView;
544
+ /**
545
+ The function types [used](https://prosemirror.net/docs/ref/#view.ViewProps.markViews) to create
546
+ mark views.
547
+ */
540
548
  declare type MarkViewConstructor = (mark: Mark, view: EditorView, inline: boolean) => {
541
549
  dom: HTMLElement;
542
550
  contentDOM?: HTMLElement;
@@ -812,4 +820,4 @@ interface DirectEditorProps extends EditorProps {
812
820
  dispatchTransaction?: (tr: Transaction) => void;
813
821
  }
814
822
 
815
- export { DOMEventMap, Decoration, DecorationAttrs, DecorationSet, DecorationSource, DirectEditorProps, EditorProps, EditorView, NodeView };
823
+ export { DOMEventMap, Decoration, DecorationAttrs, DecorationSet, DecorationSource, DirectEditorProps, EditorProps, EditorView, MarkViewConstructor, NodeView, NodeViewConstructor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-view",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "description": "ProseMirror's view component",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
package/src/README.md CHANGED
@@ -10,6 +10,10 @@ this module.
10
10
 
11
11
  @EditorProps
12
12
 
13
+ @NodeViewConstructor
14
+
15
+ @MarkViewConstructor
16
+
13
17
  @DirectEditorProps
14
18
 
15
19
  @NodeView
package/src/index.ts CHANGED
@@ -497,9 +497,14 @@ function checkStateComponent(plugin: Plugin) {
497
497
  throw new RangeError("Plugins passed directly to the view must not have a state component")
498
498
  }
499
499
 
500
- type NodeViewConstructor = (node: Node, view: EditorView, getPos: () => number,
501
- decorations: readonly Decoration[], innerDecorations: DecorationSource) => NodeView
502
- type MarkViewConstructor = (mark: Mark, view: EditorView, inline: boolean) => {dom: HTMLElement, contentDOM?: HTMLElement}
500
+ /// The type of function [provided](#view.ViewProps.nodeViews) to
501
+ /// create [node views](#view.NodeView).
502
+ export type NodeViewConstructor = (node: Node, view: EditorView, getPos: () => number,
503
+ decorations: readonly Decoration[], innerDecorations: DecorationSource) => NodeView
504
+
505
+ /// The function types [used](#view.ViewProps.markViews) to create
506
+ /// mark views.
507
+ export type MarkViewConstructor = (mark: Mark, view: EditorView, inline: boolean) => {dom: HTMLElement, contentDOM?: HTMLElement}
503
508
 
504
509
  type NodeViewSet = {[name: string]: NodeViewConstructor | MarkViewConstructor}
505
510