Socket
Socket
Sign inDemoInstall

prosemirror-transform

Package Overview
Dependencies
Maintainers
1
Versions
71
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 1.0.4 to 1.0.5

CHANGELOG.md

2

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

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

@@ -30,3 +30,3 @@ import {Fragment, Slice} from "prosemirror-model"

}
return new ReplaceStep(from, to, fitted)
return fitted.size || from != to ? new ReplaceStep(from, to, fitted) : null
}

@@ -437,2 +437,5 @@

}
// Try to fit each possible depth of the slice into each possible
// target depth, starting with the preferred depths.
let preferredTargetIndex = targetDepths.indexOf(preferredTarget)

@@ -448,10 +451,9 @@ let leftNodes = [], preferredDepth = slice.openStart

// that separated only by a non-defining textblock node, is defining.
if (preferredDepth > 0 && leftNodes[preferredDepth - 1].type.spec.defining)
if (preferredDepth > 0 && leftNodes[preferredDepth - 1].type.spec.defining &&
$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 && leftNodes[preferredDepth - 2].type.spec.defining &&
$from.node(preferredTargetIndex).type != leftNodes[preferredDepth - 2].type)
preferredDepth -= 2
// Try to fit each possible depth of the slice into each possible
// target depth, starting with the preferred depths.
let preferredTargetIndex = targetDepths.indexOf(preferredTarget)
for (let j = slice.openStart; j >= 0; j--) {

@@ -458,0 +460,0 @@ let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1)

@@ -63,7 +63,9 @@ import {Slice, Fragment} from "prosemirror-model"

// :: (NodeRange, NodeType, ?Object) → ?[{type: NodeType, attrs: ?Object}]
// :: (NodeRange, NodeType, ?Object, ?NodeRange) → ?[{type: NodeType, attrs: ?Object}]
// Try to find a valid way to wrap the content in the given range in a
// node of the given type. May introduce extra nodes around and inside
// the wrapper node, if necessary. Returns null if no valid wrapping
// could be found.
// could be found. When `innerRange` is given, that range's content is
// used as the content to fit into the wrapping, instead of the
// content of `range`.
export function findWrapping(range, nodeType, attrs, innerRange = range) {

@@ -70,0 +72,0 @@ let around = findWrappingOutside(range, nodeType)

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