prosemirror-view
Advanced tools
Comparing version
@@ -0,1 +1,9 @@ | ||
## 1.15.7 (2020-09-11) | ||
### Bug fixes | ||
Fix an issue where, when inserting `<br>` nodes, Safari would briefly show the cursor before the inserted break, though the DOM selection had already been set after it. | ||
When dragging inside the editor, whether the operation copies or moves is now determined by the modifiers held on drop, not on drag start. | ||
## 1.15.6 (2020-09-03) | ||
@@ -2,0 +10,0 @@ |
{ | ||
"name": "prosemirror-view", | ||
"version": "1.15.6", | ||
"version": "1.15.7", | ||
"description": "ProseMirror's view component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -603,3 +603,4 @@ import {Selection, NodeSelection, TextSelection} from "prosemirror-state" | ||
brokenClipboardAPI ? null : e.dataTransfer.getData("text/html"), false, $mouse) | ||
if (view.someProp("handleDrop", f => f(view, e, slice || Slice.empty, dragging && dragging.move))) { | ||
let move = dragging && !e[dragCopyModifier] | ||
if (view.someProp("handleDrop", f => f(view, e, slice || Slice.empty, move))) { | ||
e.preventDefault() | ||
@@ -615,3 +616,3 @@ return | ||
let tr = view.state.tr | ||
if (dragging && dragging.move) tr.deleteSelection() | ||
if (move) tr.deleteSelection() | ||
@@ -618,0 +619,0 @@ let pos = tr.mapping.map(insertPos) |
@@ -355,3 +355,13 @@ import {DOMSerializer, Fragment, Mark} from "prosemirror-model" | ||
if (!force && | ||
let brKludge = false | ||
// On Firefox, using Selection.collapse to put the cursor after a | ||
// BR node for some reason doesn't always work (#1073). On Safari, | ||
// the cursor sometimes inexplicable visually lags behind its | ||
// reported position in such situations (#1092). | ||
if ((browser.gecko || browser.safari) && anchor == head) { | ||
let prev = anchorDOM.node.childNodes[anchorDOM.offset - 1] | ||
brKludge = prev && (prev.nodeName == "BR" || prev.contentEditable == "false") | ||
} | ||
if (!(force || brKludge && browser.safari) && | ||
isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset) && | ||
@@ -361,9 +371,2 @@ isEquivalentPosition(headDOM.node, headDOM.offset, domSel.focusNode, domSel.focusOffset)) | ||
// On Firefox, using Selection.collapse to put the cursor after a | ||
// BR node for some reason doesn't always work (#1073) | ||
let geckoKludge = false | ||
if (browser.gecko && anchor == head) { | ||
let prev = anchorDOM.node.childNodes[anchorDOM.offset - 1] | ||
if (prev && (prev.nodeName == "BR" || prev.contentEditable == "false")) geckoKludge = true | ||
} | ||
// Selection.extend can be used to create an 'inverted' selection | ||
@@ -373,3 +376,3 @@ // (one where the focus is before the anchor), but not all | ||
let domSelExtended = false | ||
if ((domSel.extend || anchor == head) && !geckoKludge) { | ||
if ((domSel.extend || anchor == head) && !brKludge) { | ||
domSel.collapse(anchorDOM.node, anchorDOM.offset) | ||
@@ -376,0 +379,0 @@ try { |
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
1475514
0.09%13862
0.06%