@haklex/rich-static-renderer 0.0.43 → 0.0.45
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/dist/engine/renderBuiltinNode.d.ts.map +1 -1
- package/dist/index.mjs +26 -11
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderBuiltinNode.d.ts","sourceRoot":"","sources":["../../src/engine/renderBuiltinNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderBuiltinNode.d.ts","sourceRoot":"","sources":["../../src/engine/renderBuiltinNode.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAmBrD,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,GAChC,SAAS,CAmMX"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { getVariantClass, allNodes, ColorSchemeProvider, RendererConfigProvider, FootnoteDefinitionsProvider, NestedContentRendererProvider, editorTheme } from "@haklex/rich-editor/static";
|
|
2
|
+
import { RendererWrapper, RubyRenderer, LinkFavicon, getVariantClass, allNodes, ColorSchemeProvider, RendererConfigProvider, FootnoteDefinitionsProvider, NestedContentRendererProvider, editorTheme } from "@haklex/rich-editor/static";
|
|
3
3
|
import { PortalThemeProvider } from "@haklex/rich-style-token";
|
|
4
4
|
import { createHeadlessEditor } from "@lexical/headless";
|
|
5
5
|
import { $getRoot } from "lexical";
|
|
6
|
-
import { isValidElement, cloneElement
|
|
6
|
+
import { createElement, isValidElement, cloneElement } from "react";
|
|
7
7
|
var tableWrapper = "_1v9yxw30";
|
|
8
8
|
var table = "_1v9yxw31";
|
|
9
9
|
var tableHead = "_1v9yxw32";
|
|
@@ -43,8 +43,7 @@ function renderBuiltinNode(node, key, children, headingSlugs) {
|
|
|
43
43
|
"a",
|
|
44
44
|
{
|
|
45
45
|
className: "rich-heading-anchor",
|
|
46
|
-
|
|
47
|
-
tabIndex: -1,
|
|
46
|
+
tabIndex: 0,
|
|
48
47
|
href: `#${slug}`
|
|
49
48
|
}
|
|
50
49
|
),
|
|
@@ -80,26 +79,32 @@ function renderBuiltinNode(node, key, children, headingSlugs) {
|
|
|
80
79
|
return /* @__PURE__ */ jsx("li", { className: cls, value: node.value, children }, key);
|
|
81
80
|
}
|
|
82
81
|
case "link":
|
|
83
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ jsxs(
|
|
84
83
|
"a",
|
|
85
84
|
{
|
|
86
85
|
className: "rich-link",
|
|
87
86
|
href: node.url,
|
|
88
|
-
target: node.target,
|
|
89
|
-
rel: node.rel,
|
|
90
|
-
children
|
|
87
|
+
target: node.target || "_blank",
|
|
88
|
+
rel: node.rel || "noopener",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx(LinkFavicon, { href: node.url }),
|
|
91
|
+
children
|
|
92
|
+
]
|
|
91
93
|
},
|
|
92
94
|
key
|
|
93
95
|
);
|
|
94
96
|
case "autolink":
|
|
95
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ jsxs(
|
|
96
98
|
"a",
|
|
97
99
|
{
|
|
98
100
|
className: "rich-link",
|
|
99
101
|
href: node.url,
|
|
100
102
|
target: "_blank",
|
|
101
|
-
rel: "noopener
|
|
102
|
-
children
|
|
103
|
+
rel: "noopener",
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsx(LinkFavicon, { href: node.url }),
|
|
106
|
+
children
|
|
107
|
+
]
|
|
103
108
|
},
|
|
104
109
|
key
|
|
105
110
|
);
|
|
@@ -155,6 +160,16 @@ function renderBuiltinNode(node, key, children, headingSlugs) {
|
|
|
155
160
|
}
|
|
156
161
|
case "spoiler":
|
|
157
162
|
return /* @__PURE__ */ jsx("span", { className: "rich-spoiler", role: "button", tabIndex: 0, children }, key);
|
|
163
|
+
case "ruby":
|
|
164
|
+
return createElement(RendererWrapper, {
|
|
165
|
+
key,
|
|
166
|
+
rendererKey: "Ruby",
|
|
167
|
+
defaultRenderer: RubyRenderer,
|
|
168
|
+
props: {
|
|
169
|
+
reading: node.reading ?? "",
|
|
170
|
+
children
|
|
171
|
+
}
|
|
172
|
+
});
|
|
158
173
|
case "code":
|
|
159
174
|
return /* @__PURE__ */ jsx("pre", { className: "rich-code-block", children: /* @__PURE__ */ jsx("code", { children }) }, key);
|
|
160
175
|
case "code-highlight":
|
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.45",
|
|
4
4
|
"description": "Headless SSR engine for Lexical rich content",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@lexical/headless": "^0.41.0",
|
|
19
|
-
"@haklex/rich-
|
|
20
|
-
"@haklex/rich-
|
|
19
|
+
"@haklex/rich-style-token": "0.0.45",
|
|
20
|
+
"@haklex/rich-editor": "0.0.45"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@lexical/code": "^0.41.0",
|