Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-view

Package Overview
Dependencies
Maintainers
1
Versions
284
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 1.3.4 to 1.3.5

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 1.3.5 (2018-06-20)
### Bug fixes
Use shared implementation of [`dropPoint`](https://prosemirror.net/docs/ref/#transform.dropPoint) to handle finding a drop position.
## 1.3.4 (2018-06-20)

@@ -2,0 +8,0 @@

4

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

@@ -22,3 +22,3 @@ "main": "dist/index.js",

"prosemirror-state": "^1.0.0",
"prosemirror-transform": "^1.0.0"
"prosemirror-transform": "^1.1.0"
},

@@ -25,0 +25,0 @@ "devDependencies": {

import {Selection, NodeSelection, TextSelection} from "prosemirror-state"
import {dropPoint} from "prosemirror-transform"

@@ -388,4 +389,2 @@ import browser from "./browser"

// there, they just don't work, and they are hard to test.
// FIXME when Mobile Safari fixes this, change this to a version
// range test
const brokenClipboardAPI = (browser.ie && browser.ie_version < 15) ||

@@ -458,19 +457,2 @@ (browser.ios && browser.safari_version < 11)

function dropPos(slice, $pos) {
if (!slice || !slice.content.size) return $pos.pos
let content = slice.content
for (let i = 0; i < slice.openStart; i++) content = content.firstChild.content
for (let pass = 1; pass <= (slice.openStart == 0 && slice.length ? 2 : 1); pass++) {
for (let d = $pos.depth; d >= 0; d--) {
let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1
let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0)
if (pass == 1
? $pos.node(d).canReplace(insertPos, insertPos, content)
: $pos.node(d).contentMatchAt(insertPos).findWrapping(content.firstChild))
return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1)
}
}
return $pos.pos
}
const dragCopyModifier = browser.mac ? "altKey" : "ctrlKey"

@@ -524,3 +506,4 @@

if (view.someProp("handleDrop", f => f(view, e, slice, dragging && dragging.move))) return
let insertPos = dropPos(slice, view.state.doc.resolve($mouse.pos))
let insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos
if (insertPos == null) insertPos = $mouse.pos

@@ -527,0 +510,0 @@ let tr = view.state.tr

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc