prosemirror-view 1.26.1 → 1.26.4

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,21 @@
1
+ ## 1.26.4 (2022-07-04)
2
+
3
+ ### Bug fixes
4
+
5
+ Avoid spurious type errors on `handleDOMEvents` by widening the type for unknown event objects.
6
+
7
+ ## 1.26.3 (2022-06-29)
8
+
9
+ ### Bug fixes
10
+
11
+ Work around a Safari bug where mutation records get delivered even though the observer wasn't observing when the mutations happened.
12
+
13
+ ## 1.26.2 (2022-06-22)
14
+
15
+ ### Bug fixes
16
+
17
+ Mark prosemirror.css as having side effects in package.json.
18
+
1
19
  ## 1.26.1 (2022-06-13)
2
20
 
3
21
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -444,7 +444,7 @@ function _posAtCoords(view, coords) {
444
444
  }
445
445
  }
446
446
 
447
- var elt = (view.root.elementFromPoint ? view.root : doc).elementFromPoint(coords.left, coords.top + 1);
447
+ var elt = (view.root.elementFromPoint ? view.root : doc).elementFromPoint(coords.left, coords.top);
448
448
  var pos;
449
449
 
450
450
  if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {
@@ -4724,7 +4724,11 @@ var DOMObserver = function () {
4724
4724
  }, {
4725
4725
  key: "start",
4726
4726
  value: function start() {
4727
- if (this.observer) this.observer.observe(this.view.dom, observeOptions);
4727
+ if (this.observer) {
4728
+ this.observer.takeRecords();
4729
+ this.observer.observe(this.view.dom, observeOptions);
4730
+ }
4731
+
4728
4732
  if (this.onCharData) this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData);
4729
4733
  this.connectSelection();
4730
4734
  }
package/dist/index.d.ts CHANGED
@@ -563,7 +563,7 @@ includes events that TypeScript's HTMLElementEventMap doesn't know
563
563
  about.
564
564
  */
565
565
  interface DOMEventMap extends HTMLElementEventMap {
566
- [event: string]: Event;
566
+ [event: string]: any;
567
567
  }
568
568
  /**
569
569
  Props are configuration values that can be passed to an editor view
package/dist/index.js CHANGED
@@ -367,7 +367,7 @@ function posAtCoords(view, coords) {
367
367
  ({ startContainer: node, startOffset: offset } = range);
368
368
  }
369
369
  let elt = (view.root.elementFromPoint ? view.root : doc)
370
- .elementFromPoint(coords.left, coords.top + 1);
370
+ .elementFromPoint(coords.left, coords.top);
371
371
  let pos;
372
372
  if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {
373
373
  let box = view.dom.getBoundingClientRect();
@@ -4234,8 +4234,10 @@ class DOMObserver {
4234
4234
  }
4235
4235
  }
4236
4236
  start() {
4237
- if (this.observer)
4237
+ if (this.observer) {
4238
+ this.observer.takeRecords();
4238
4239
  this.observer.observe(this.view.dom, observeOptions);
4240
+ }
4239
4241
  if (this.onCharData)
4240
4242
  this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData);
4241
4243
  this.connectSelection();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-view",
3
- "version": "1.26.1",
3
+ "version": "1.26.4",
4
4
  "description": "ProseMirror's view component",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "./style/prosemirror.css": "./style/prosemirror.css"
15
15
  },
16
- "sideEffects": false,
16
+ "sideEffects": ["./style/prosemirror.css"],
17
17
  "style": "style/prosemirror.css",
18
18
  "license": "MIT",
19
19
  "maintainers": [
package/src/domcoords.ts CHANGED
@@ -260,7 +260,7 @@ export function posAtCoords(view: EditorView, coords: {top: number, left: number
260
260
  }
261
261
 
262
262
  let elt = ((view.root as any).elementFromPoint ? view.root : doc)
263
- .elementFromPoint(coords.left, coords.top + 1) as HTMLElement
263
+ .elementFromPoint(coords.left, coords.top) as HTMLElement
264
264
  let pos
265
265
  if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {
266
266
  let box = view.dom.getBoundingClientRect()
@@ -84,8 +84,10 @@ export class DOMObserver {
84
84
  }
85
85
 
86
86
  start() {
87
- if (this.observer)
87
+ if (this.observer) {
88
+ this.observer.takeRecords()
88
89
  this.observer.observe(this.view.dom, observeOptions)
90
+ }
89
91
  if (this.onCharData)
90
92
  this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData)
91
93
  this.connectSelection()
package/src/index.ts CHANGED
@@ -512,7 +512,7 @@ type NodeViewSet = {[name: string]: NodeViewConstructor | MarkViewConstructor}
512
512
  /// includes events that TypeScript's HTMLElementEventMap doesn't know
513
513
  /// about.
514
514
  export interface DOMEventMap extends HTMLElementEventMap {
515
- [event: string]: Event
515
+ [event: string]: any
516
516
  }
517
517
 
518
518
  /// Props are configuration values that can be passed to an editor view