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.2.2 to 1.3.0

6

CHANGELOG.md

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

## 1.3.0 (2018-03-22)
### New features
`ContentMatch` objects now have an [`edgeCount`](https://prosemirror.net/docs/ref/#model.ContentMatch.edgeCount) property and an [`edge`](https://prosemirror.net/docs/ref/#model.ContentMatch.edge) method, providing direct access to the finite automaton structure.
## 1.2.2 (2018-03-15)

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

2

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

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

@@ -121,2 +121,18 @@ import {Fragment} from "./fragment"

// :: number
// The number of outgoing edges this node has in the finite
// automaton that describes the content expression.
get edgeCount() {
return this.next.length >> 1
}
// :: (number) → {type: NodeType, next: ContentMatch}
// Get the _n_th outgoing edge from this node in the finite
// automaton that describes the content expression.
edge(n) {
let i = n << 1
if (i > this.next.length) throw new RangeError(`There's no ${n}th edge in this content match`)
return {type: this.next[i], next: this.next[i + 1]}
}
toString() {

@@ -309,2 +325,5 @@ let seen = []

// Get the set of nodes reachable by null edges from `node`. Omit
// nodes with only a single null-out-edge, since they may lead to
// needless duplicated nodes.
function nullFrom(nfa, node) {

@@ -316,5 +335,7 @@ let result = []

function scan(node) {
let edges = nfa[node]
if (edges.length == 1 && !edges[0].term) return scan(edges[0].to)
result.push(node)
for (let a = nfa[node], i = 0; i < a.length; i++) {
let {term, to} = a[i]
for (let i = 0; i < edges.length; i++) {
let {term, to} = edges[i]
if (!term && result.indexOf(to) == -1) scan(to)

@@ -321,0 +342,0 @@ }

@@ -185,3 +185,3 @@ import {findDiffStart, findDiffEnd} from "./diff"

// :: (Node) → ?{a: number, b: number}
// :: (Fragment) → ?{a: number, b: number}
// Find the first position, searching from the end, at which this

@@ -188,0 +188,0 @@ // fragment and the given fragment differ, or `null` if they are the

@@ -477,2 +477,3 @@ import OrderedMap from "orderedmap"

let contentExprCache = Object.create(null)
for (let prop in this.nodes) {

@@ -482,3 +483,4 @@ if (prop in this.marks)

let type = this.nodes[prop], contentExpr = type.spec.content || "", markExpr = type.spec.marks
type.contentMatch = ContentMatch.parse(contentExpr, this.nodes)
type.contentMatch = contentExprCache[contentExpr] ||
(contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes))
type.inlineContent = type.contentMatch.inlineContent

@@ -485,0 +487,0 @@ type.markSet = markExpr == "_" ? null :

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