prosemirror-view 1.24.0-beta.1 → 1.24.0-beta.2

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  import { EditorState, Transaction, Selection, Plugin } from 'prosemirror-state';
2
- import { Mark, Node as Node$1, ParseRule, Slice, ResolvedPos, DOMParser, DOMSerializer } from 'prosemirror-model';
2
+ import { Mark, Node, ParseRule, Slice, ResolvedPos, DOMParser, DOMSerializer } from 'prosemirror-model';
3
3
  import { Mapping } from 'prosemirror-transform';
4
4
 
5
- declare type DOMNode = Node;
5
+ declare type DOMNode = InstanceType<typeof window.Node>;
6
6
 
7
7
  declare type WidgetConstructor = ((view: EditorView, getPos: () => number | undefined) => DOMNode) | DOMNode;
8
8
  /**
@@ -147,7 +147,7 @@ interface DecorationSource {
147
147
  Map the set of decorations in response to a change in the
148
148
  document.
149
149
  */
150
- map: (mapping: Mapping, node: Node$1) => DecorationSource;
150
+ map: (mapping: Mapping, node: Node) => DecorationSource;
151
151
  }
152
152
  /**
153
153
  A collection of [decorations](https://prosemirror.net/docs/ref/#view.Decoration), organized in such
@@ -160,7 +160,7 @@ declare class DecorationSet implements DecorationSource {
160
160
  Create a set of decorations, using the structure of the given
161
161
  document.
162
162
  */
163
- static create(doc: Node$1, decorations: Decoration[]): DecorationSet;
163
+ static create(doc: Node, decorations: Decoration[]): DecorationSet;
164
164
  /**
165
165
  Find all decorations in this set which touch the given range
166
166
  (including decorations that start or end directly at the
@@ -169,13 +169,13 @@ declare class DecorationSet implements DecorationSource {
169
169
  considered. When `predicate` isn't given, all decorations are
170
170
  assumed to match.
171
171
  */
172
- find(start?: number, end?: number, predicate?: (spec: any) => boolean): readonly Decoration[];
172
+ find(start?: number, end?: number, predicate?: (spec: any) => boolean): Decoration[];
173
173
  private findInner;
174
174
  /**
175
175
  Map the set of decorations in response to a change in the
176
176
  document.
177
177
  */
178
- map(mapping: Mapping, doc: Node$1, options?: {
178
+ map(mapping: Mapping, doc: Node, options?: {
179
179
  /**
180
180
  When given, this function will be called for each decoration
181
181
  that gets dropped as a result of the mapping, passing the
@@ -188,7 +188,7 @@ declare class DecorationSet implements DecorationSource {
188
188
  producing a new set. Needs access to the current document to
189
189
  create the appropriate tree structure.
190
190
  */
191
- add(doc: Node$1, decorations: Decoration[]): DecorationSet;
191
+ add(doc: Node, decorations: Decoration[]): DecorationSet;
192
192
  private addInner;
193
193
  /**
194
194
  Create a new set that contains the decorations in this set, minus
@@ -246,7 +246,7 @@ interface NodeView {
246
246
  view has a `contentDOM` property (or no `dom` property), updating
247
247
  its child nodes will be handled by ProseMirror.
248
248
  */
249
- update?: (node: Node$1, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean;
249
+ update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean;
250
250
  /**
251
251
  Can be used to override the way the node's selected status (as a
252
252
  node selection) is displayed.
@@ -294,11 +294,11 @@ declare class ViewDesc {
294
294
  dom: DOMNode;
295
295
  contentDOM: HTMLElement | null;
296
296
  dirty: number;
297
- node: Node$1 | null;
297
+ node: Node | null;
298
298
  constructor(parent: ViewDesc | undefined, children: ViewDesc[], dom: DOMNode, contentDOM: HTMLElement | null);
299
299
  matchesWidget(widget: Decoration): boolean;
300
300
  matchesMark(mark: Mark): boolean;
301
- matchesNode(node: Node$1, outerDeco: readonly Decoration[], innerDeco: DecorationSource): boolean;
301
+ matchesNode(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource): boolean;
302
302
  matchesHack(nodeName: string): boolean;
303
303
  parseRule(): ParseRule | null;
304
304
  stopEvent(event: Event): boolean;
@@ -536,7 +536,7 @@ declare class EditorView {
536
536
  */
537
537
  dispatch(tr: Transaction): void;
538
538
  }
539
- declare type NodeViewConstructor = (node: Node$1, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[], innerDecorations: DecorationSource) => NodeView;
539
+ declare type NodeViewConstructor = (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[], innerDecorations: DecorationSource) => NodeView;
540
540
  /**
541
541
  Props are configuration values that can be passed to an editor view
542
542
  or included in a plugin. This interface lists the supported props.
@@ -583,7 +583,7 @@ interface EditorProps {
583
583
  Called for each node around a click, from the inside out. The
584
584
  `direct` flag will be true for the inner node.
585
585
  */
586
- handleClickOn?: (view: EditorView, pos: number, node: Node$1, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
586
+ handleClickOn?: (view: EditorView, pos: number, node: Node, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
587
587
  /**
588
588
  Called when the editor is clicked, after `handleClickOn` handlers
589
589
  have been called.
@@ -592,7 +592,7 @@ interface EditorProps {
592
592
  /**
593
593
  Called for each node around a double click.
594
594
  */
595
- handleDoubleClickOn?: (view: EditorView, pos: number, node: Node$1, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
595
+ handleDoubleClickOn?: (view: EditorView, pos: number, node: Node, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
596
596
  /**
597
597
  Called when the editor is double-clicked, after `handleDoubleClickOn`.
598
598
  */
@@ -600,7 +600,7 @@ interface EditorProps {
600
600
  /**
601
601
  Called for each node around a triple click.
602
602
  */
603
- handleTripleClickOn?: (view: EditorView, pos: number, node: Node$1, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
603
+ handleTripleClickOn?: (view: EditorView, pos: number, node: Node, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
604
604
  /**
605
605
  Called when the editor is triple-clicked, after `handleTripleClickOn`.
606
606
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-view",
3
- "version": "1.24.0-beta.1",
3
+ "version": "1.24.0-beta.2",
4
4
  "description": "ProseMirror's view component",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
package/src/decoration.ts CHANGED
@@ -283,7 +283,7 @@ export class DecorationSet implements DecorationSource {
283
283
  /// `start` and `end` are omitted, all decorations in the set are
284
284
  /// considered. When `predicate` isn't given, all decorations are
285
285
  /// assumed to match.
286
- find(start?: number, end?: number, predicate?: (spec: any) => boolean): readonly Decoration[] {
286
+ find(start?: number, end?: number, predicate?: (spec: any) => boolean): Decoration[] {
287
287
  let result: Decoration[] = []
288
288
  this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate)
289
289
  return result
package/src/dom.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as browser from "./browser"
2
2
 
3
- export type DOMNode = Node
4
- export type DOMSelection = Selection
3
+ export type DOMNode = InstanceType<typeof window.Node>
4
+ export type DOMSelection = InstanceType<typeof window.Selection>
5
5
 
6
6
  export const domIndex = function(node: Node) {
7
7
  for (var index = 0;; index++) {