prosemirror-view 1.18.6 → 1.18.7

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,11 @@
1
+ ## 1.18.7 (2021-05-20)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug where clicking on a textblock that had a node-selected parent didn't set a cursor selection.
6
+
7
+ Fix a bug that caused a workaround for a Chrome Android issue to not work correctly, leading to bad cursor placement after some types of text input.
8
+
1
9
  ## 1.18.6 (2021-05-17)
2
10
 
3
11
  ### Bug fixes
package/dist/index.es.js CHANGED
@@ -377,7 +377,10 @@ function posAtCoords(view, coords) {
377
377
  if (!elt) { return null }
378
378
  }
379
379
  // Safari's caretRangeFromPoint returns nonsense when on a draggable element
380
- if (result.safari && elt.draggable) { node = offset = null; }
380
+ if (result.safari) {
381
+ for (var p = elt; node && p; p = parentNode(p))
382
+ { if (p.draggable) { node = offset = null; } }
383
+ }
381
384
  elt = targetKludge(elt, coords);
382
385
  if (node) {
383
386
  if (result.gecko && node.nodeType == 1) {
@@ -2719,7 +2722,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
2719
2722
  // Edge just doesn't move the cursor forward when you start typing
2720
2723
  // in an empty block or between br nodes.
2721
2724
  if (sel$2 && !(result.chrome && result.android && view.composing && sel$2.empty &&
2722
- (change.from != change.toB || view.lastAndroidDelete < Date.now() - 100) &&
2725
+ (change.start != change.endB || view.lastAndroidDelete < Date.now() - 100) &&
2723
2726
  (sel$2.head == chFrom || sel$2.head == tr.mapping.map(chTo) - 1) ||
2724
2727
  result.ie && sel$2.empty && sel$2.head == chFrom))
2725
2728
  { tr.setSelection(sel$2); }
@@ -3570,8 +3573,10 @@ var MouseDown = function MouseDown(view, pos, event, flushed) {
3570
3573
  var targetDesc = target ? view.docView.nearestDesc(target, true) : null;
3571
3574
  this.target = targetDesc ? targetDesc.dom : null;
3572
3575
 
3576
+ var ref = view.state;
3577
+ var selection = ref.selection;
3573
3578
  if (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
3574
- view.state.selection instanceof NodeSelection && targetPos == view.state.selection.from)
3579
+ selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
3575
3580
  { this.mightDrag = {node: targetNode,
3576
3581
  pos: targetPos,
3577
3582
  addAttr: this.target && !this.target.draggable,