@prismicio/richtext
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.2
@@ -10,3 +10,3 @@ import { RichTextNodeType, RTAnyNode, RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node, RTParagraphNode, RTPreformattedNode, RTStrongNode, RTEmNode, RTListItemNode, RTOListItemNode, RTListNode, RTOListNode, RTImageNode, RTEmbedNode, RTLinkNode, RTLabelNode, RTSpanNode, RTNode, RichTextField } from '@prismicio/types'; | ||
*/ | ||
declare type RichTextFunctionSerializer<ReturnType> = (type: RichTextNodeType, node: RTAnyNode, text: string | undefined, children: ReturnType[], key: string) => ReturnType | null | undefined; | ||
declare type RichTextFunctionSerializer<ReturnType> = (type: typeof RichTextNodeType[keyof typeof RichTextNodeType], node: RTAnyNode, text: string | undefined, children: ReturnType[], key: string) => ReturnType | null | undefined; | ||
/** | ||
@@ -60,3 +60,3 @@ * Map serializer's tag function serializer, can be helpful for typing those handlers | ||
key: string; | ||
type: RichTextNodeType; | ||
type: typeof RichTextNodeType[keyof typeof RichTextNodeType]; | ||
text?: string; | ||
@@ -63,0 +63,0 @@ node: RTAnyNode; |
{ | ||
"name": "@prismicio/richtext", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"description": "A parser and serializer for Prismic's Rich Text format", | ||
@@ -45,9 +45,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@prismicio/types": "^0.1.15" | ||
"@prismicio/types": "^0.1.18" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.0.0", | ||
"@typescript-eslint/parser": "^5.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.5.0", | ||
"@typescript-eslint/parser": "^5.5.0", | ||
"ava": "^3.15.0", | ||
"eslint": "^8.0.0", | ||
"eslint": "^8.3.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
@@ -57,8 +57,8 @@ "eslint-plugin-prettier": "^4.0.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.4.1", | ||
"prettier-plugin-jsdoc": "^0.3.24", | ||
"prettier": "^2.5.0", | ||
"prettier-plugin-jsdoc": "^0.3.30", | ||
"siroc": "^0.16.0", | ||
"standard-version": "^9.3.1", | ||
"standard-version": "^9.3.2", | ||
"ts-eager": "^2.0.2", | ||
"typescript": "^4.4.4" | ||
"typescript": "^4.5.2" | ||
}, | ||
@@ -65,0 +65,0 @@ "engines": { |
@@ -130,2 +130,14 @@ import { | ||
// Sort spans using the following criteria: | ||
// | ||
// 1. By start index (ascending) | ||
// 2. If start indices are equal, by end index (descending) | ||
// | ||
// If start and end indices of more than one span are equal, use what | ||
// the API gives without modifications. | ||
// | ||
// Sorting using this algorithm ensures proper detection of child | ||
// spans. | ||
mutSpans.sort((a, b) => a.start - b.start || b.end - a.end); | ||
const children: TreeNode[] = []; | ||
@@ -140,3 +152,3 @@ | ||
const childSpans: RTInlineNode[] = []; | ||
for (let j = 0; j < mutSpans.length; j++) { | ||
for (let j = i; j < mutSpans.length; j++) { | ||
const siblingSpan = mutSpans[j]; | ||
@@ -143,0 +155,0 @@ |
@@ -34,3 +34,3 @@ import { | ||
export type RichTextFunctionSerializer<ReturnType> = ( | ||
type: RichTextNodeType, | ||
type: typeof RichTextNodeType[keyof typeof RichTextNodeType], | ||
node: RTAnyNode, | ||
@@ -138,3 +138,3 @@ text: string | undefined, | ||
key: string; | ||
type: RichTextNodeType; | ||
type: typeof RichTextNodeType[keyof typeof RichTextNodeType]; | ||
text?: string; | ||
@@ -141,0 +141,0 @@ node: RTAnyNode; |
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
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
82595
919
Updated@prismicio/types@^0.1.18