@marduke182/prosemirror-test-utils
Advanced tools
Comparing version 0.0.1-beta.126 to 0.0.1-beta.127
import { ExtractMarks, ExtractNodes } from '@marduke182/prosemirror-utils'; | ||
import { Node, Schema } from 'prosemirror-model'; | ||
interface Tag { | ||
name: string; | ||
pos: number; | ||
} | ||
export interface NodeWithTags<S extends Schema> { | ||
node: Node<S>; | ||
tags: Tag[]; | ||
tags: Map<string, number>; | ||
} | ||
@@ -11,0 +7,0 @@ declare type Content<S extends Schema> = NodeWithTags<S> | string; |
@@ -67,6 +67,3 @@ "use strict"; | ||
at = match.index + match[0].length; | ||
tags.push({ | ||
pos: pos, | ||
name: match[1], | ||
}); | ||
tags.push([match[1], pos]); | ||
match = regex.exec(text); | ||
@@ -119,7 +116,6 @@ } | ||
// Need to remap tags position based on current pos | ||
var updatedTags = childTags.map(function (tag) { return ({ | ||
name: tag.name, | ||
pos: tag.pos + pos + 1, | ||
}); }); | ||
tags.push.apply(tags, __spread(updatedTags)); | ||
tags.push.apply(tags, __spread(Array.from(childTags.entries()).map(function (_a) { | ||
var _b = __read(_a, 2), name = _b[0], tagPos = _b[1]; | ||
return [name, tagPos + pos + 1]; | ||
}))); | ||
content.push(node); | ||
@@ -138,3 +134,3 @@ // Update position with current one. | ||
return { | ||
tags: tags, | ||
tags: new Map(tags), | ||
node: nodeType.create(attrs, content), | ||
@@ -206,3 +202,3 @@ }; | ||
var node; | ||
var tags; | ||
var tags = []; | ||
if (typeof realContent === 'string') { | ||
@@ -217,7 +213,8 @@ var _a = getTagsFromTextNode(realContent), text = _a.text, newTags = _a.tags; | ||
else { | ||
(node = realContent.node, tags = realContent.tags); | ||
(node = realContent.node); | ||
tags = Array.from(realContent.tags.entries()); | ||
} | ||
if (mark.type.isInSet(node.marks)) { | ||
return { | ||
tags: tags, | ||
tags: new Map(tags), | ||
node: node, | ||
@@ -227,3 +224,3 @@ }; | ||
return { | ||
tags: tags, | ||
tags: new Map(tags), | ||
node: node.mark(mark.addToSet(node.marks)), | ||
@@ -230,0 +227,0 @@ }; |
import { ExtractMarks, ExtractNodes } from '@marduke182/prosemirror-utils'; | ||
import { Node, Schema } from 'prosemirror-model'; | ||
interface Tag { | ||
name: string; | ||
pos: number; | ||
} | ||
export interface NodeWithTags<S extends Schema> { | ||
node: Node<S>; | ||
tags: Tag[]; | ||
tags: Map<string, number>; | ||
} | ||
@@ -11,0 +7,0 @@ declare type Content<S extends Schema> = NodeWithTags<S> | string; |
@@ -65,6 +65,3 @@ var __assign = (this && this.__assign) || function () { | ||
at = match.index + match[0].length; | ||
tags.push({ | ||
pos: pos, | ||
name: match[1], | ||
}); | ||
tags.push([match[1], pos]); | ||
match = regex.exec(text); | ||
@@ -117,7 +114,6 @@ } | ||
// Need to remap tags position based on current pos | ||
var updatedTags = childTags.map(function (tag) { return ({ | ||
name: tag.name, | ||
pos: tag.pos + pos + 1, | ||
}); }); | ||
tags.push.apply(tags, __spread(updatedTags)); | ||
tags.push.apply(tags, __spread(Array.from(childTags.entries()).map(function (_a) { | ||
var _b = __read(_a, 2), name = _b[0], tagPos = _b[1]; | ||
return [name, tagPos + pos + 1]; | ||
}))); | ||
content.push(node); | ||
@@ -136,3 +132,3 @@ // Update position with current one. | ||
return { | ||
tags: tags, | ||
tags: new Map(tags), | ||
node: nodeType.create(attrs, content), | ||
@@ -204,3 +200,3 @@ }; | ||
var node; | ||
var tags; | ||
var tags = []; | ||
if (typeof realContent === 'string') { | ||
@@ -215,7 +211,8 @@ var _a = getTagsFromTextNode(realContent), text = _a.text, newTags = _a.tags; | ||
else { | ||
(node = realContent.node, tags = realContent.tags); | ||
(node = realContent.node); | ||
tags = Array.from(realContent.tags.entries()); | ||
} | ||
if (mark.type.isInSet(node.marks)) { | ||
return { | ||
tags: tags, | ||
tags: new Map(tags), | ||
node: node, | ||
@@ -225,3 +222,3 @@ }; | ||
return { | ||
tags: tags, | ||
tags: new Map(tags), | ||
node: node.mark(mark.addToSet(node.marks)), | ||
@@ -228,0 +225,0 @@ }; |
{ | ||
"name": "@marduke182/prosemirror-test-utils", | ||
"version": "0.0.1-beta.126+ce21b0d", | ||
"version": "0.0.1-beta.127+c44ea2b", | ||
"main": "./dist/commonjs/index.js", | ||
@@ -10,3 +10,3 @@ "module": "./dist/esm/index.js", | ||
"dependencies": { | ||
"@marduke182/prosemirror-utils": "^0.0.1-beta.126+ce21b0d", | ||
"@marduke182/prosemirror-utils": "^0.0.1-beta.127+c44ea2b", | ||
"@types/prosemirror-model": "^1.7.2", | ||
@@ -18,3 +18,3 @@ "prosemirror-model": "^1.9.1" | ||
}, | ||
"gitHead": "ce21b0d1b73426a665a518b7861c715231c65230" | ||
"gitHead": "c44ea2b7f4c2bf061e9ba2bd1134c2c3981a03a2" | ||
} |
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 not supported yet
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 not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
492785
1073