@haklex/rich-static-renderer 0.0.84 → 0.0.86
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export declare function renderBuiltinNode(node: any, key: string, children: ReactNode[] | null, headingSlugs: Map<string, number>,
|
|
2
|
+
export declare function renderBuiltinNode(node: any, key: string, children: ReactNode[] | null, headingSlugs: Map<string, number>, textContent?: string): ReactNode;
|
|
3
3
|
//# sourceMappingURL=renderBuiltinNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderBuiltinNode.d.ts","sourceRoot":"","sources":["../../src/engine/renderBuiltinNode.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAkCtD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAC5B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,
|
|
1
|
+
{"version":3,"file":"renderBuiltinNode.d.ts","sourceRoot":"","sources":["../../src/engine/renderBuiltinNode.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAkCtD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAC5B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,WAAW,CAAC,EAAE,MAAM,GACnB,SAAS,CAiNX"}
|
package/dist/index.mjs
CHANGED
|
@@ -52,7 +52,7 @@ function extractText(node) {
|
|
|
52
52
|
if (node.children) return node.children.map(extractText).join("");
|
|
53
53
|
return "";
|
|
54
54
|
}
|
|
55
|
-
function renderBuiltinNode(node, key, children, headingSlugs,
|
|
55
|
+
function renderBuiltinNode(node, key, children, headingSlugs, textContent) {
|
|
56
56
|
switch (node.type) {
|
|
57
57
|
case "root": {
|
|
58
58
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
@@ -63,7 +63,7 @@ function renderBuiltinNode(node, key, children, headingSlugs, _textContent) {
|
|
|
63
63
|
}
|
|
64
64
|
case "heading": {
|
|
65
65
|
const Tag = node.tag;
|
|
66
|
-
const text = extractText(node);
|
|
66
|
+
const text = textContent || extractText(node);
|
|
67
67
|
const baseSlug = textToSlug(text);
|
|
68
68
|
let slug = baseSlug;
|
|
69
69
|
if (baseSlug) {
|
|
@@ -370,14 +370,14 @@ function renderTree(node, editor, editorConfig, headingSlugs, key, blockId, buil
|
|
|
370
370
|
);
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
node.getTextContent ? node.getTextContent() : void 0;
|
|
373
|
+
const textContent = node.getTextContent ? node.getTextContent() : void 0;
|
|
374
374
|
const override = builtinNodeOverrides?.[serialized.type];
|
|
375
375
|
if (override) {
|
|
376
|
-
const defaultRenderer = () => renderBuiltinNode(serialized, nodeKey, children, headingSlugs);
|
|
376
|
+
const defaultRenderer = () => renderBuiltinNode(serialized, nodeKey, children, headingSlugs, textContent);
|
|
377
377
|
return applyBlockId(override(serialized, nodeKey, children, defaultRenderer), blockId, nodeKey);
|
|
378
378
|
}
|
|
379
379
|
return applyBlockId(
|
|
380
|
-
renderBuiltinNode(serialized, nodeKey, children, headingSlugs),
|
|
380
|
+
renderBuiltinNode(serialized, nodeKey, children, headingSlugs, textContent),
|
|
381
381
|
blockId,
|
|
382
382
|
nodeKey
|
|
383
383
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-static-renderer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
4
4
|
"description": "Headless SSR engine for Lexical rich content",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@lexical/code": "
|
|
24
|
-
"@lexical/headless": "^0.
|
|
23
|
+
"@lexical/code-core": "^0.42.0",
|
|
24
|
+
"@lexical/headless": "^0.42.0",
|
|
25
25
|
"lucide-react": "^0.577.0",
|
|
26
|
-
"@haklex/rich-editor": "0.0.
|
|
27
|
-
"@haklex/rich-style-token": "0.0.
|
|
26
|
+
"@haklex/rich-editor": "0.0.86",
|
|
27
|
+
"@haklex/rich-style-token": "0.0.86"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@lexical/extension": "^0.
|
|
31
|
-
"@lexical/link": "^0.
|
|
32
|
-
"@lexical/list": "^0.
|
|
33
|
-
"@lexical/rich-text": "^0.
|
|
34
|
-
"@lexical/table": "^0.
|
|
30
|
+
"@lexical/extension": "^0.42.0",
|
|
31
|
+
"@lexical/link": "^0.42.0",
|
|
32
|
+
"@lexical/list": "^0.42.0",
|
|
33
|
+
"@lexical/rich-text": "^0.42.0",
|
|
34
|
+
"@lexical/table": "^0.42.0",
|
|
35
35
|
"@types/react": "^19.2.14",
|
|
36
36
|
"@vanilla-extract/css": "^1.18.0",
|
|
37
37
|
"@vanilla-extract/vite-plugin": "^5.1.4",
|
|
38
|
-
"lexical": "^0.
|
|
38
|
+
"lexical": "^0.42.0",
|
|
39
39
|
"react": "^19.2.4",
|
|
40
40
|
"react-dom": "^19.2.4",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"vite-plugin-dts": "^4.5.4"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@lexical/extension": "^0.
|
|
47
|
-
"@lexical/link": "^0.
|
|
48
|
-
"@lexical/list": "^0.
|
|
49
|
-
"@lexical/rich-text": "^0.
|
|
50
|
-
"@lexical/table": "^0.
|
|
51
|
-
"lexical": "^0.
|
|
46
|
+
"@lexical/extension": "^0.42.0",
|
|
47
|
+
"@lexical/link": "^0.42.0",
|
|
48
|
+
"@lexical/list": "^0.42.0",
|
|
49
|
+
"@lexical/rich-text": "^0.42.0",
|
|
50
|
+
"@lexical/table": "^0.42.0",
|
|
51
|
+
"lexical": "^0.42.0",
|
|
52
52
|
"react": ">=19",
|
|
53
53
|
"react-dom": ">=19"
|
|
54
54
|
},
|