New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-view

Package Overview
Dependencies
Maintainers
1
Versions
287
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-view - npm Package Compare versions

Comparing version

to
1.15.6

10

CHANGELOG.md

@@ -0,1 +1,11 @@

## 1.15.6 (2020-09-03)
### Bug fixes
Fix issue where the DOM selection could end up in an invalid state after a keyboard cursor motion event that had no effect.
Fix an issue where some types of drop events would fail to select the dropped content.
Work around Safari issues when pressing shift-down with the cursor before an uneditable element.
## 1.15.5 (2020-08-25)

@@ -2,0 +12,0 @@

2

package.json
{
"name": "prosemirror-view",
"version": "1.15.5",
"version": "1.15.6",
"description": "ProseMirror's view component",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

import {Selection, NodeSelection, TextSelection} from "prosemirror-state"
import browser from "./browser"
import {domIndex, selectionCollapsed} from "./dom"
import {selectionToDOM} from "./selection"

@@ -164,2 +165,7 @@ function moveSelectionBlock(state, dir) {

view.domObserver.setCurSelection()
let {state} = view
// If no state update ends up happening, reset the selection.
setTimeout(() => {
if (view.state == state) selectionToDOM(view)
}, 50)
}

@@ -212,8 +218,9 @@

// Issue #867 / https://bugs.chromium.org/p/chromium/issues/detail?id=903821
// In which Chrome does really wrong things when the down arrow is
// pressed when the cursor is directly at the start of a textblock and
// has an uneditable node after it
function chromeDownArrowBug(view) {
if (!browser.chrome || view.state.selection.$head.parentOffset > 0) return
// Issue #867 / #1090 / https://bugs.chromium.org/p/chromium/issues/detail?id=903821
// In which Safari (and at some point in the past, Chrome) does really
// wrong things when the down arrow is pressed when the cursor is
// directly at the start of a textblock and has an uneditable node
// after it
function safariDownArrowBug(view) {
if (!browser.safari || view.state.selection.$head.parentOffset > 0) return
let {focusNode, focusOffset} = view.root.getSelection()

@@ -259,3 +266,3 @@ if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 &&

} else if (code == 40) { // Down arrow
return chromeDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodesRight(view)
return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodesRight(view)
} else if (mods == (browser.mac ? "m" : "c") &&

@@ -262,0 +269,0 @@ (code == 66 || code == 73 || code == 89 || code == 90)) { // Mod-[biyz]

@@ -627,6 +627,9 @@ import {Selection, NodeSelection, TextSelection} from "prosemirror-state"

if (isNode && NodeSelection.isSelectable(slice.content.firstChild) &&
$pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild))
$pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) {
tr.setSelection(new NodeSelection($pos))
else
tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(tr.mapping.map(insertPos))))
} else {
let end = tr.mapping.map(insertPos)
tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo)
tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)))
}
view.focus()

@@ -633,0 +636,0 @@ view.dispatch(tr.setMeta("uiEvent", "drop"))

@@ -365,3 +365,3 @@ import {DOMSerializer, Fragment, Mark} from "prosemirror-model"

let prev = anchorDOM.node.childNodes[anchorDOM.offset - 1]
if (prev && prev.nodeName == "BR") geckoKludge = true
if (prev && (prev.nodeName == "BR" || prev.contentEditable == "false")) geckoKludge = true
}

@@ -368,0 +368,0 @@ // Selection.extend can be used to create an 'inverted' selection

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