prosemirror-view 0.20.4 → 0.20.5

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/dom.js CHANGED
@@ -27,12 +27,14 @@ exports.isEquivalentPosition = function(node, off, targetNode, targetOff) {
27
27
  scanFor(node, off, targetNode, targetOff, 1))
28
28
  }
29
29
 
30
+ var atomElements = /^(img|br|input|textarea|hr)$/i
31
+
30
32
  function scanFor(node, off, targetNode, targetOff, dir) {
31
33
  for (;;) {
32
34
  if (node == targetNode && off == targetOff) { return true }
33
35
  if (off == (dir < 0 ? 0 : nodeSize(node))) {
34
36
  var parent = node.parentNode
35
- if (parent.nodeType != 1 || hasBlockDesc(node)) { return false }
37
+ if (parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName)) { return false }
36
38
  off = domIndex(node) + (dir < 0 ? 0 : 1)
37
39
  node = parent
38
40
  } else if (node.nodeType == 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-view",
3
- "version": "0.20.4",
3
+ "version": "0.20.5",
4
4
  "description": "ProseMirror's view component",
5
5
  "main": "dist/index.js",
6
6
  "style": "style/prosemirror.css",
package/src/dom.js CHANGED
@@ -27,12 +27,14 @@ exports.isEquivalentPosition = function(node, off, targetNode, targetOff) {
27
27
  scanFor(node, off, targetNode, targetOff, 1))
28
28
  }
29
29
 
30
+ const atomElements = /^(img|br|input|textarea|hr)$/i
31
+
30
32
  function scanFor(node, off, targetNode, targetOff, dir) {
31
33
  for (;;) {
32
34
  if (node == targetNode && off == targetOff) return true
33
35
  if (off == (dir < 0 ? 0 : nodeSize(node))) {
34
36
  let parent = node.parentNode
35
- if (parent.nodeType != 1 || hasBlockDesc(node)) return false
37
+ if (parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName)) return false
36
38
  off = domIndex(node) + (dir < 0 ? 0 : 1)
37
39
  node = parent
38
40
  } else if (node.nodeType == 1) {