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.2 to 1.3.3

10

CHANGELOG.md

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

## 1.3.3 (2018-06-15)
### Bug fixes
Fix arrow-left cursor motion from cursor wrapper (for example after a link).
Fix selection glitches when shift-selecting around widget decorations.
Fix issue where a parsing a code block from the editor DOM might drop newlines in the code.
## 1.3.2 (2018-06-15)

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

2

package.json
{
"name": "prosemirror-view",
"version": "1.3.2",
"version": "1.3.3",
"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} from "./dom"
import {domIndex, selectionCollapsed} from "./dom"

@@ -57,5 +57,5 @@ function moveSelectionBlock(state, dir) {

let sel = view.root.getSelection()
let node = sel.anchorNode, offset = sel.anchorOffset
let node = sel.focusNode, offset = sel.focusOffset
if (!node) return
let moveNode, moveOffset
let moveNode, moveOffset, force = false
for (;;) {

@@ -65,2 +65,5 @@ if (offset > 0) {

if (node.nodeType == 3 && node.nodeValue.charAt(offset - 1) == "\ufeff") {
// IE11's cursor will still be stuck when placed at the
// beginning of the cursor wrapper text node (#807)
if (browser.ie && browser.ie_version <= 11) force = true
moveNode = node

@@ -98,3 +101,4 @@ moveOffset = --offset

}
if (moveNode) setSel(view, sel, moveNode, moveOffset)
if (force) setSelFocus(view, sel, node, offset)
else if (moveNode) setSelFocus(view, sel, moveNode, moveOffset)
}

@@ -106,3 +110,3 @@

let sel = view.root.getSelection()
let node = sel.anchorNode, offset = sel.anchorOffset
let node = sel.focusNode, offset = sel.focusOffset
if (!node) return

@@ -140,3 +144,3 @@ let len = nodeLen(node)

}
if (moveNode) setSel(view, sel, moveNode, moveOffset)
if (moveNode) setSelFocus(view, sel, moveNode, moveOffset)
}

@@ -149,8 +153,12 @@

function setSel(view, sel, node, offset) {
let range = document.createRange()
range.setEnd(node, offset)
range.setStart(node, offset)
sel.removeAllRanges()
sel.addRange(range)
function setSelFocus(view, sel, node, offset) {
if (selectionCollapsed(sel)) {
let range = document.createRange()
range.setEnd(node, offset)
range.setStart(node, offset)
sel.removeAllRanges()
sel.addRange(range)
} else if (sel.extend) {
sel.extend(node, offset)
}
view.selectionReader.storeDOMState(view.selection)

@@ -157,0 +165,0 @@ }

@@ -562,6 +562,7 @@ import {DOMSerializer, Fragment, Mark} from "prosemirror-model"

// whether this is a problem
if (this.contentDOM && !this.contentLost)
return {node: this.node.type.name, attrs: this.node.attrs, contentElement: this.contentDOM}
else
return {node: this.node.type.name, attrs: this.node.attrs, getContent: () => this.contentDOM ? Fragment.empty : this.node.content}
let rule = {node: this.node.type.name, attrs: this.node.attrs}
if (this.node.type.spec.code) rule.preserveWhitespace = "full"
if (this.contentDOM && !this.contentLost) rule.contentElement = this.contentDOM
else rule.getContent = () => this.contentDOM ? Fragment.empty : this.node.content
return rule
}

@@ -568,0 +569,0 @@

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