prosemirror-model
Advanced tools
Comparing version 1.10.1 to 1.11.0
@@ -0,1 +1,7 @@ | ||
## 1.11.0 (2020-07-08) | ||
### New features | ||
Resolved positions have a new convenience method, `posAtIndex`, which can resolve a depth and index to a position. | ||
## 1.10.1 (2020-07-08) | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "prosemirror-model", | ||
"version": "1.10.1", | ||
"version": "1.11.0", | ||
"description": "ProseMirror's document model", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -123,2 +123,12 @@ import {Mark} from "./mark" | ||
// :: (number, ?number) → number | ||
// Get the position at the given index in the parent node at the | ||
// given depth (which defaults to `this.depth`). | ||
posAtIndex(index, depth) { | ||
depth = this.resolveDepth(depth) | ||
let node = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1 | ||
for (let i = 0; i < index; i++) pos += node.child(i).nodeSize | ||
return pos | ||
} | ||
// :: () → [Mark] | ||
@@ -125,0 +135,0 @@ // Get the marks at this position, factoring in the surrounding |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
854712
9068