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.0.9 to 1.0.10

2

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

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

@@ -27,6 +27,4 @@ import {Slice, Fragment, DOMParser, DOMSerializer} from "prosemirror-model"

if (firstChild && firstChild.nodeType == 1) {
let singleNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 && !slice.content.firstChild.isText
firstChild.setAttribute("data-pm-context", singleNode ? "none" : JSON.stringify(context))
}
if (firstChild && firstChild.nodeType == 1)
firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd} ${JSON.stringify(context)}`)

@@ -65,9 +63,7 @@ let text = view.someProp("clipboardTextSerializer", f => f(slice)) ||

}
slice = closeIsolatingStart(slice)
let contextNode = dom && dom.querySelector("[data-pm-context]")
let context = contextNode && contextNode.getAttribute("data-pm-context")
if (context == "none")
slice = new Slice(slice.content, 0, 0)
else if (context)
slice = addContext(slice, context)
let contextNode = dom && dom.querySelector("[data-pm-slice]")
let sliceData = contextNode && /^(\d+) (\d+) (.*)/.exec(contextNode.getAttribute("data-pm-slice"))
if (sliceData)
slice = addContext(new Slice(slice.content, Math.min(slice.openStart, +sliceData[1]),
Math.min(slice.openEnd, +sliceData[2])), sliceData[3])
else // HTML wasn't created by ProseMirror. Make sure top-level siblings are coherent

@@ -172,21 +168,1 @@ slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), false)

}
function closeIsolatingStart(slice) {
let closeTo = 0, frag = slice.content
for (let i = 1; i <= slice.openStart; i++) {
let node = frag.firstChild
if (node.type.spec.isolating) { closeTo = i; break }
frag = node.content
}
if (closeTo == 0) return slice
return new Slice(closeFragment(slice.content, closeTo, slice.openEnd), slice.openStart - closeTo, slice.openEnd)
}
function closeFragment(frag, n, openEnd) {
if (n == 0) return frag
let node = frag.firstChild
let content = closeFragment(node.content, n - 1, openEnd - 1)
let fill = node.contentMatchAt(0).fillBefore(node.content, openEnd <= 0)
return frag.replaceChild(0, node.copy(fill.append(content)))
}

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