@platecms/delta-cast-util-to-slate 1.20.1 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -13
- package/src/lib/handlers/blockContent/blockquote.ts +1 -1
- package/src/lib/handlers/blockContent/code.ts +1 -1
- package/src/lib/handlers/blockContent/heading.ts +1 -1
- package/src/lib/handlers/blockContent/list.ts +1 -1
- package/src/lib/handlers/blockContent/listItem.ts +1 -1
- package/src/lib/handlers/blockContent/paragraph.ts +1 -1
- package/src/lib/handlers/inlineContent/bold.ts +1 -1
- package/src/lib/handlers/inlineContent/castSuggestion.ts +1 -1
- package/src/lib/handlers/inlineContent/contentValue.ts +1 -1
- package/src/lib/handlers/inlineContent/externalLink.ts +1 -1
- package/src/lib/handlers/inlineContent/highlight.ts +1 -1
- package/src/lib/handlers/inlineContent/inlineCode.ts +1 -1
- package/src/lib/handlers/inlineContent/internalLink.ts +4 -4
- package/src/lib/handlers/inlineContent/italic.ts +1 -1
- package/src/lib/handlers/inlineContent/strikethrough.ts +1 -1
- package/src/lib/handlers/inlineContent/text.ts +1 -1
- package/src/lib/handlers/inlineContent/underline.ts +1 -1
- package/src/lib/index.spec.ts +2 -2
- package/src/lib/index.ts +1 -1
- package/src/lib/utils/handlers.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platecms/delta-cast-util-to-slate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"description": "Utility to convert CAST trees to Slate nodes.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,21 +17,14 @@
|
|
|
17
17
|
"src/**/*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@platecms/delta-cast": "1.
|
|
21
|
-
"@platecms/delta-castscript": "1.
|
|
22
|
-
"@platecms/delta-
|
|
23
|
-
"@platecms/delta-
|
|
24
|
-
"@graphql-typed-document-node/core": "3.2.0",
|
|
20
|
+
"@platecms/delta-cast": "1.21.1",
|
|
21
|
+
"@platecms/delta-castscript": "1.21.1",
|
|
22
|
+
"@platecms/delta-plate-resource-notation": "1.21.1",
|
|
23
|
+
"@platecms/delta-types": "1.21.1",
|
|
25
24
|
"class-transformer": "0.5.1",
|
|
26
|
-
"graphql": "16.11.0",
|
|
27
25
|
"reflect-metadata": "0.2.2",
|
|
28
26
|
"slate": "0.118.0",
|
|
29
27
|
"tslib": "2.8.1",
|
|
30
|
-
"zwitch": "2.0.4"
|
|
31
|
-
"@apollo/client": "3.13.9",
|
|
32
|
-
"defu": "6.1.4",
|
|
33
|
-
"axios": "1.11.0",
|
|
34
|
-
"uuid": "11.1.0",
|
|
35
|
-
"@faker-js/faker": "9.9.0"
|
|
28
|
+
"zwitch": "2.0.4"
|
|
36
29
|
}
|
|
37
30
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Blockquote } from "@platecms/delta-cast";
|
|
2
|
-
import { BlockquoteElement } from "@platecms/delta-
|
|
2
|
+
import { BlockquoteElement } from "@platecms/delta-types";
|
|
3
3
|
import { handleBlockContent } from "../../utils/handlers";
|
|
4
4
|
|
|
5
5
|
export default function blockquote(node: Blockquote): BlockquoteElement {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Code, InlineContent } from "@platecms/delta-cast";
|
|
2
|
-
import { CodeElement } from "@platecms/delta-
|
|
2
|
+
import { CodeElement } from "@platecms/delta-types";
|
|
3
3
|
import { handleBlockContent } from "../../utils/handlers";
|
|
4
4
|
|
|
5
5
|
export default function code(node: Code): CodeElement {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Heading } from "@platecms/delta-cast";
|
|
2
2
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
3
|
-
import { DeltaElement } from "@platecms/delta-
|
|
3
|
+
import { DeltaElement } from "@platecms/delta-types";
|
|
4
4
|
|
|
5
5
|
export default function heading(node: Heading): DeltaElement {
|
|
6
6
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { List } from "@platecms/delta-cast";
|
|
2
|
-
import { ListElement, ListItemElement } from "@platecms/delta-
|
|
2
|
+
import { ListElement, ListItemElement } from "@platecms/delta-types";
|
|
3
3
|
import { all } from "./../../index";
|
|
4
4
|
|
|
5
5
|
export default function list(node: List): ListElement {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
2
|
-
import { DeltaElement } from "@platecms/delta-
|
|
2
|
+
import { DeltaElement } from "@platecms/delta-types";
|
|
3
3
|
import { ListItem } from "@platecms/delta-cast";
|
|
4
4
|
|
|
5
5
|
export default function listItem(node: ListItem): DeltaElement {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Paragraph } from "@platecms/delta-cast";
|
|
2
2
|
import { handleBlockContent } from "../../utils/handlers";
|
|
3
|
-
import { DeltaElement } from "@platecms/delta-
|
|
3
|
+
import { DeltaElement } from "@platecms/delta-types";
|
|
4
4
|
|
|
5
5
|
export default function paragraph(node: Paragraph): DeltaElement {
|
|
6
6
|
return handleBlockContent(node);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bold } from "@platecms/delta-cast";
|
|
2
2
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
3
|
-
import { DeltaLeaf } from "@platecms/delta-
|
|
3
|
+
import { DeltaLeaf } from "@platecms/delta-types";
|
|
4
4
|
|
|
5
5
|
export default function bold(node: Bold, state: Omit<DeltaLeaf, "text"> = {}): DeltaLeaf[] {
|
|
6
6
|
return resolveCustomTextNodes(node.children, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CastSuggestion } from "@platecms/delta-cast";
|
|
2
|
-
import { Suggestion } from "@platecms/delta-
|
|
2
|
+
import { Suggestion } from "@platecms/delta-types";
|
|
3
3
|
import { toPlaintext } from "@platecms/delta-cast-util-to-plaintext";
|
|
4
4
|
|
|
5
5
|
export default function castSuggestion(node: CastSuggestion): Suggestion {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InterpolatedContentValue } from "@platecms/delta-cast";
|
|
2
|
-
import { ContentValueElement } from "@platecms/delta-
|
|
2
|
+
import { ContentValueElement } from "@platecms/delta-types";
|
|
3
3
|
|
|
4
4
|
export default function contentValue(node: InterpolatedContentValue): ContentValueElement {
|
|
5
5
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExternalLink } from "@platecms/delta-cast";
|
|
2
2
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
3
|
-
import { LinkElement } from "@platecms/delta-
|
|
3
|
+
import { LinkElement } from "@platecms/delta-types";
|
|
4
4
|
|
|
5
5
|
export default function externalLink(node: ExternalLink): LinkElement {
|
|
6
6
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Highlight } from "@platecms/delta-cast";
|
|
2
2
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
3
|
-
import { DeltaLeaf } from "@platecms/delta-
|
|
3
|
+
import { DeltaLeaf } from "@platecms/delta-types";
|
|
4
4
|
|
|
5
5
|
export default function highlight(node: Highlight, state: Omit<DeltaLeaf, "text"> = {}): DeltaLeaf[] {
|
|
6
6
|
return resolveCustomTextNodes(node.children, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InlineCode } from "@platecms/delta-cast";
|
|
2
2
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
3
|
-
import { DeltaLeaf } from "@platecms/delta-
|
|
3
|
+
import { DeltaLeaf } from "@platecms/delta-types";
|
|
4
4
|
|
|
5
5
|
export default function inlineCode(node: InlineCode, state: Omit<DeltaLeaf, "text"> = {}): DeltaLeaf[] {
|
|
6
6
|
return resolveCustomTextNodes([{ type: "text", value: node.value }], {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { InternalLink } from "@platecms/delta-cast";
|
|
2
2
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
3
|
-
import { LinkElement } from "@platecms/delta-
|
|
3
|
+
import { LinkElement } from "@platecms/delta-types";
|
|
4
4
|
import { InvalidPrnError, PRN } from "@platecms/delta-plate-resource-notation";
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
function isExperienceComponentPlacementPrn(prn: string): boolean {
|
|
7
7
|
try {
|
|
8
|
-
return PRN.fromString(prn).resourceType === "
|
|
8
|
+
return PRN.fromString(prn).resourceType === "experience-component-placement";
|
|
9
9
|
} catch (error) {
|
|
10
10
|
if (error instanceof InvalidPrnError) {
|
|
11
11
|
return false;
|
|
@@ -23,7 +23,7 @@ export default function internalLink(node: InternalLink): LinkElement {
|
|
|
23
23
|
target: node.target,
|
|
24
24
|
internal: {
|
|
25
25
|
prn: node.prn,
|
|
26
|
-
anchor:
|
|
26
|
+
anchor: isExperienceComponentPlacementPrn(node.prn),
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Italic } from "@platecms/delta-cast";
|
|
2
2
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
3
|
-
import { DeltaLeaf } from "@platecms/delta-
|
|
3
|
+
import { DeltaLeaf } from "@platecms/delta-types";
|
|
4
4
|
|
|
5
5
|
export default function italic(node: Italic, state: Omit<DeltaLeaf, "text"> = {}): DeltaLeaf[] {
|
|
6
6
|
return resolveCustomTextNodes(node.children, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Strikethrough } from "@platecms/delta-cast";
|
|
2
2
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
3
|
-
import { DeltaLeaf } from "@platecms/delta-
|
|
3
|
+
import { DeltaLeaf } from "@platecms/delta-types";
|
|
4
4
|
|
|
5
5
|
export default function strikethrough(node: Strikethrough, state: Omit<DeltaLeaf, "text"> = {}): DeltaLeaf[] {
|
|
6
6
|
return resolveCustomTextNodes(node.children, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Underline } from "@platecms/delta-cast";
|
|
2
2
|
import { resolveCustomTextNodes } from "../../utils/handlers";
|
|
3
|
-
import { DeltaLeaf } from "@platecms/delta-
|
|
3
|
+
import { DeltaLeaf } from "@platecms/delta-types";
|
|
4
4
|
|
|
5
5
|
export default function underline(node: Underline, state: Omit<DeltaLeaf, "text"> = {}): DeltaLeaf[] {
|
|
6
6
|
return resolveCustomTextNodes(node.children, {
|
package/src/lib/index.spec.ts
CHANGED
|
@@ -330,7 +330,7 @@ describe("nested nodes", () => {
|
|
|
330
330
|
"internalLink",
|
|
331
331
|
{
|
|
332
332
|
url: "https://www.google.com#anchor-name",
|
|
333
|
-
prn: "prn:text:org-id:cms:
|
|
333
|
+
prn: "prn:text:org-id:cms:experience-component-placement:1",
|
|
334
334
|
},
|
|
335
335
|
[c("text", "Hello, world!")],
|
|
336
336
|
),
|
|
@@ -347,7 +347,7 @@ describe("nested nodes", () => {
|
|
|
347
347
|
],
|
|
348
348
|
target: undefined,
|
|
349
349
|
internal: {
|
|
350
|
-
prn: "prn:text:org-id:cms:
|
|
350
|
+
prn: "prn:text:org-id:cms:experience-component-placement:1",
|
|
351
351
|
anchor: true,
|
|
352
352
|
},
|
|
353
353
|
},
|
package/src/lib/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import blockquote from "./handlers/blockContent/blockquote";
|
|
|
11
11
|
import highlight from "./handlers/inlineContent/highlight";
|
|
12
12
|
import inlineCode from "./handlers/inlineContent/inlineCode";
|
|
13
13
|
import externalLink from "./handlers/inlineContent/externalLink";
|
|
14
|
-
import { DeltaElement } from "@platecms/delta-
|
|
14
|
+
import { DeltaElement } from "@platecms/delta-types";
|
|
15
15
|
import internalLink from "./handlers/inlineContent/internalLink";
|
|
16
16
|
import castSuggestion from "./handlers/inlineContent/castSuggestion";
|
|
17
17
|
|
|
@@ -7,7 +7,7 @@ import italic from "../handlers/inlineContent/italic";
|
|
|
7
7
|
import strikethrough from "../handlers/inlineContent/strikethrough";
|
|
8
8
|
import underline from "../handlers/inlineContent/underline";
|
|
9
9
|
import inlineCode from "../handlers/inlineContent/inlineCode";
|
|
10
|
-
import { DeltaElement, DeltaLeaf } from "@platecms/delta-
|
|
10
|
+
import { DeltaElement, DeltaLeaf } from "@platecms/delta-types";
|
|
11
11
|
import internalLink from "../handlers/inlineContent/internalLink";
|
|
12
12
|
import externalLink from "../handlers/inlineContent/externalLink";
|
|
13
13
|
import castSuggestion from "../handlers/inlineContent/castSuggestion";
|