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

prosemirror-model

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-model - npm Package Compare versions

Comparing version 1.20.0 to 1.21.0

6

CHANGELOG.md

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

## 1.21.0 (2024-05-06)
### New features
The new `linebreakReplacement` property on node specs makes it possible to configure a node type that `setBlockType` will convert to and from line breaks when appropriate.
## 1.20.0 (2024-04-08)

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

@@ -1023,2 +1023,12 @@ import OrderedMap from 'orderedmap';

/**
A single inline node in a schema can be set to be a linebreak
equivalent. When converting between block types that support the
node and block types that don't but have
[`whitespace`](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) set to `"pre"`,
[`setBlockType`](https://prosemirror.net/docs/ref/#transform.Transform.setBlockType) will convert
between newline characters to or from linebreak nodes as
appropriate.
*/
linebreakReplacement?: boolean;
/**
Node specs may include arbitrary properties that can be read by

@@ -1142,2 +1152,8 @@ other code via [`NodeType.spec`](https://prosemirror.net/docs/ref/#model.NodeType.spec).

/**
The [linebreak
replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined
in this schema, if any.
*/
linebreakReplacement: NodeType | null;
/**
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).

@@ -1144,0 +1160,0 @@ */

2

package.json
{
"name": "prosemirror-model",
"version": "1.20.0",
"version": "1.21.0",
"description": "ProseMirror's document model",

@@ -5,0 +5,0 @@ "type": "module",

@@ -444,2 +444,11 @@ import OrderedMap from "orderedmap"

/// A single inline node in a schema can be set to be a linebreak
/// equivalent. When converting between block types that support the
/// node and block types that don't but have
/// [`whitespace`](#model.NodeSpec.whitespace) set to `"pre"`,
/// [`setBlockType`](#transform.Transform.setBlockType) will convert
/// between newline characters to or from linebreak nodes as
/// appropriate.
linebreakReplacement?: boolean
/// Node specs may include arbitrary properties that can be read by

@@ -534,2 +543,7 @@ /// other code via [`NodeType.spec`](#model.NodeType.spec).

/// The [linebreak
/// replacement](#model.NodeSpec.linebreakReplacement) node defined
/// in this schema, if any.
linebreakReplacement: NodeType | null = null
/// Construct a schema from a schema [specification](#model.SchemaSpec).

@@ -553,2 +567,7 @@ constructor(spec: SchemaSpec<Nodes, Marks>) {

;(type as any).inlineContent = type.contentMatch.inlineContent
if (type.spec.linebreakReplacement) {
if (this.linebreakReplacement) throw new RangeError("Multiple linebreak nodes defined")
if (!type.isInline || !type.isLeaf) throw new RangeError("Linebreak replacement nodes must be inline leaf nodes")
this.linebreakReplacement = type
}
type.markSet = markExpr == "_" ? null :

@@ -555,0 +574,0 @@ markExpr ? gatherMarks(this, markExpr.split(" ")) :

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

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