prosemirror-view
Advanced tools
Comparing version
@@ -0,1 +1,9 @@ | ||
## 1.17.7 (2021-02-22) | ||
### Bug fixes | ||
Fix an issue where the `ProseMirror-hideselection` element class would be briefly removed and then restored when moving from one invisible selection to another. | ||
Fix an issue where the cursor could end up on the wrong side of a widget with `side` < 0. | ||
## 1.17.6 (2021-02-11) | ||
@@ -2,0 +10,0 @@ |
{ | ||
"name": "prosemirror-view", | ||
"version": "1.17.6", | ||
"version": "1.17.7", | ||
"description": "ProseMirror's view component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -34,2 +34,7 @@ import {TextSelection, NodeSelection} from "prosemirror-state" | ||
function editorOwnsSelection(view) { | ||
return view.editable ? view.hasFocus() : | ||
hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom) | ||
} | ||
export function selectionToDOM(view, force) { | ||
@@ -39,4 +44,3 @@ let sel = view.state.selection | ||
if (view.editable ? !view.hasFocus() : | ||
!(hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom))) return | ||
if (!editorOwnsSelection(view)) return | ||
@@ -108,3 +112,6 @@ view.domObserver.disconnectSelection() | ||
doc.removeEventListener("selectionchange", view.hideSelectionGuard) | ||
view.dom.classList.remove("ProseMirror-hideselection") | ||
setTimeout(() => { | ||
if (!editorOwnsSelection(view) || view.state.selection.visible) | ||
view.dom.classList.remove("ProseMirror-hideselection") | ||
}, 20) | ||
} | ||
@@ -111,0 +118,0 @@ }) |
@@ -277,3 +277,4 @@ import {DOMSerializer, Fragment, Mark} from "prosemirror-model" | ||
let end = offset + child.size | ||
if (!child.domAtom && (side < 0 && !child.border ? end >= pos : end > pos)) | ||
if (!child.domAtom && (side < 0 && !child.border ? end >= pos : end > pos) && | ||
(end > pos || i + 1 >= this.children.length || !this.children[i + 1].beforePosition)) | ||
return child.domFromPos(pos - offset - child.border, side) | ||
@@ -280,0 +281,0 @@ offset = end |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1504275
0.16%14047
0.15%