prosemirror-view 1.24.0-beta.2 → 1.24.0-beta.3
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/dist/index.d.ts +10 -2
- package/package.json +1 -1
- package/src/README.md +2 -0
- package/src/index.ts +10 -1
package/dist/index.d.ts
CHANGED
|
@@ -538,6 +538,14 @@ declare class EditorView {
|
|
|
538
538
|
}
|
|
539
539
|
declare type NodeViewConstructor = (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[], innerDecorations: DecorationSource) => NodeView;
|
|
540
540
|
/**
|
|
541
|
+
Helper type that maps event names to event object types, but
|
|
542
|
+
includes events that TypeScript's HTMLElementEventMap doesn't know
|
|
543
|
+
about.
|
|
544
|
+
*/
|
|
545
|
+
interface DOMEventMap extends HTMLElementEventMap {
|
|
546
|
+
[event: string]: Event;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
541
549
|
Props are configuration values that can be passed to an editor view
|
|
542
550
|
or included in a plugin. This interface lists the supported props.
|
|
543
551
|
|
|
@@ -563,7 +571,7 @@ interface EditorProps {
|
|
|
563
571
|
default behavior).
|
|
564
572
|
*/
|
|
565
573
|
handleDOMEvents?: {
|
|
566
|
-
[event
|
|
574
|
+
[event in string]: (view: EditorView, event: DOMEventMap[event]) => boolean | void;
|
|
567
575
|
};
|
|
568
576
|
/**
|
|
569
577
|
Called when the editor receives a `keydown` event.
|
|
@@ -788,4 +796,4 @@ interface DirectEditorProps extends EditorProps {
|
|
|
788
796
|
dispatchTransaction?: (tr: Transaction) => void;
|
|
789
797
|
}
|
|
790
798
|
|
|
791
|
-
export { Decoration, DecorationAttrs, DecorationSet, DecorationSource, DirectEditorProps, EditorProps, EditorView, NodeView };
|
|
799
|
+
export { DOMEventMap, Decoration, DecorationAttrs, DecorationSet, DecorationSource, DirectEditorProps, EditorProps, EditorView, NodeView };
|
package/package.json
CHANGED
package/src/README.md
CHANGED
package/src/index.ts
CHANGED
|
@@ -498,6 +498,13 @@ function checkStateComponent(plugin: Plugin) {
|
|
|
498
498
|
type NodeViewConstructor = (node: Node, view: EditorView, getPos: () => number | undefined,
|
|
499
499
|
decorations: readonly Decoration[], innerDecorations: DecorationSource) => NodeView
|
|
500
500
|
|
|
501
|
+
/// Helper type that maps event names to event object types, but
|
|
502
|
+
/// includes events that TypeScript's HTMLElementEventMap doesn't know
|
|
503
|
+
/// about.
|
|
504
|
+
export interface DOMEventMap extends HTMLElementEventMap {
|
|
505
|
+
[event: string]: Event
|
|
506
|
+
}
|
|
507
|
+
|
|
501
508
|
/// Props are configuration values that can be passed to an editor view
|
|
502
509
|
/// or included in a plugin. This interface lists the supported props.
|
|
503
510
|
///
|
|
@@ -519,7 +526,9 @@ export interface EditorProps {
|
|
|
519
526
|
/// from such a function, you are responsible for calling
|
|
520
527
|
/// `preventDefault` yourself (or not, if you want to allow the
|
|
521
528
|
/// default behavior).
|
|
522
|
-
handleDOMEvents?: {
|
|
529
|
+
handleDOMEvents?: {
|
|
530
|
+
[event in string]: (view: EditorView, event: DOMEventMap[event]) => boolean | void
|
|
531
|
+
}
|
|
523
532
|
|
|
524
533
|
/// Called when the editor receives a `keydown` event.
|
|
525
534
|
handleKeyDown?: (view: EditorView, event: KeyboardEvent) => boolean | void
|