πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

prosemirror-transform

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-transform - npm Package Compare versions

Comparing version

to
1.4.0

6

CHANGELOG.md

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

## 1.4.0 (2022-03-21)
### New features
Node specs can now use the `definingForContent` and `definingAsContext` properties to opt in to specific parts of the existing `defining` behavior.
## 1.3.4 (2022-02-04)

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

2

package.json
{
"name": "prosemirror-transform",
"version": "1.3.4",
"version": "1.4.0",
"description": "ProseMirror document transformations",

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

@@ -142,2 +142,4 @@ // Mappable:: interface

// :: StepMap
// A StepMap that contains no changed ranges.
StepMap.empty = new StepMap([])

@@ -144,0 +146,0 @@

@@ -338,2 +338,6 @@ import {Fragment, Slice} from "prosemirror-model"

function definesContent(type) {
return type.spec.defining || type.spec.definingForContent
}
// :: (number, number, Slice) β†’ this

@@ -346,5 +350,5 @@ // Replace a range of the document with a given slice, using `from`,

// dropping fully covered parent nodes of the replaced region when
// they are marked [non-defining](#model.NodeSpec.defining), or
// they are marked [non-defining as context](#model.NodeSpec.definingAsContext), or
// including an open parent node from the slice that _is_ marked as
// [defining](#model.NodeSpec.defining).
// [defining its content](#model.NodeSpec.definingForContent).
//

@@ -376,3 +380,3 @@ // This is the method, for example, to handle paste. The similar

let spec = $from.node(d).type.spec
if (spec.defining || spec.isolating) break
if (spec.defining || spec.definingAsContext || spec.isolating) break
if (targetDepths.indexOf(d) > -1) preferredTarget = d

@@ -394,6 +398,8 @@ else if ($from.before(d) == pos) targetDepths.splice(1, 0, -d)

// that separated only by a non-defining textblock node, is defining.
if (preferredDepth > 0 && leftNodes[preferredDepth - 1].type.spec.defining &&
if (preferredDepth > 0 && definesContent(leftNodes[preferredDepth - 1].type) &&
$from.node(preferredTargetIndex).type != leftNodes[preferredDepth - 1].type)
preferredDepth -= 1
else if (preferredDepth >= 2 && leftNodes[preferredDepth - 1].isTextblock && leftNodes[preferredDepth - 2].type.spec.defining &&
else if (preferredDepth >= 2 &&
leftNodes[preferredDepth - 1].isTextblock &&
definesContent(leftNodes[preferredDepth - 2].type) &&
$from.node(preferredTargetIndex).type != leftNodes[preferredDepth - 2].type)

@@ -400,0 +406,0 @@ preferredDepth -= 2

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