@haklex/rich-compose 0.31.1 → 0.33.0
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/{compose-CCyeRK8c.js → compose-BC3hv8cT.js} +29 -18
- package/dist/core.mjs +1 -1
- package/dist/index.mjs +8 -7
- package/dist/litexml-html-preview-client.css +31 -19
- package/dist/litexml-html-preview-client.js +5175 -4884
- package/dist/style/embed.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +37 -37
|
@@ -112,11 +112,15 @@ function renderBuiltinNode(node, key, children, headingSlugs, textContent) {
|
|
|
112
112
|
})]
|
|
113
113
|
}, key);
|
|
114
114
|
}
|
|
115
|
-
case "list":
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
case "list": {
|
|
116
|
+
const Tag = node.listType === "number" ? "ol" : "ul";
|
|
117
|
+
const cls = node.listType === "number" ? shared$1("listOl") : node.listType === "check" ? `${shared$1("checklist")} ${shared$1("listUl")}` : shared$1("listUl");
|
|
118
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
119
|
+
className: cls,
|
|
120
|
+
start: node.start !== 1 ? node.start : void 0,
|
|
121
|
+
children
|
|
122
|
+
}, key);
|
|
123
|
+
}
|
|
120
124
|
case "listitem": {
|
|
121
125
|
const isChecklist = node.checked !== void 0;
|
|
122
126
|
const hasNestedList = node.children?.some((c) => c.type === "list");
|
|
@@ -154,11 +158,15 @@ function renderBuiltinNode(node, key, children, headingSlugs, textContent) {
|
|
|
154
158
|
})
|
|
155
159
|
}, key);
|
|
156
160
|
case "tablerow": return /* @__PURE__ */ jsx("tr", { children }, key);
|
|
157
|
-
case "tablecell":
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
case "tablecell": {
|
|
162
|
+
const CellTag = node.headerState ? "th" : "td";
|
|
163
|
+
const cls = node.headerState ? tableHead : tableCell;
|
|
164
|
+
return /* @__PURE__ */ jsx(CellTag, {
|
|
165
|
+
className: cls,
|
|
166
|
+
colSpan: node.colSpan > 1 ? node.colSpan : void 0,
|
|
167
|
+
children
|
|
168
|
+
}, key);
|
|
169
|
+
}
|
|
162
170
|
case "details": {
|
|
163
171
|
const summary = node.summary || "";
|
|
164
172
|
return /* @__PURE__ */ jsxs("details", {
|
|
@@ -363,7 +371,8 @@ function renderEditorToReact(value, nodes, builtinNodeOverrides) {
|
|
|
363
371
|
editorState.read(() => {
|
|
364
372
|
const root = $getRoot();
|
|
365
373
|
const headingSlugs = /* @__PURE__ */ new Map();
|
|
366
|
-
|
|
374
|
+
const children = root.getChildren().map((child, i) => renderTree(child, editor, editorConfig, headingSlugs, `ssr-${i}`, rawRootChildren?.[i]?.$?.blockId, builtinNodeOverrides));
|
|
375
|
+
content = /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
367
376
|
});
|
|
368
377
|
const renderNestedContent = (state) => {
|
|
369
378
|
const nestedEditor = createHeadlessEditor({
|
|
@@ -386,7 +395,8 @@ function renderEditorToReact(value, nodes, builtinNodeOverrides) {
|
|
|
386
395
|
nestedState.read(() => {
|
|
387
396
|
const root = $getRoot();
|
|
388
397
|
const headingSlugs = /* @__PURE__ */ new Map();
|
|
389
|
-
|
|
398
|
+
const ch = root.getChildren().map((child, i) => renderTree(child, nestedEditor, nestedEditorConfig, headingSlugs, `nested-${i}`, nestedRawChildren?.[i]?.$?.blockId, builtinNodeOverrides));
|
|
399
|
+
nested = /* @__PURE__ */ jsx(Fragment$1, { children: ch });
|
|
390
400
|
});
|
|
391
401
|
return nested;
|
|
392
402
|
};
|
|
@@ -570,13 +580,14 @@ function composeRenderer(opts) {
|
|
|
570
580
|
const builtinNodeOverrides = opts.builtinNodeOverrides;
|
|
571
581
|
function ComposedRenderer(props) {
|
|
572
582
|
const { theme, variant } = props;
|
|
583
|
+
const renderNested = useCallback((value, overrideVariant) => /* @__PURE__ */ jsx(ComposedRenderer, {
|
|
584
|
+
nested: true,
|
|
585
|
+
theme,
|
|
586
|
+
value,
|
|
587
|
+
variant: overrideVariant ?? variant
|
|
588
|
+
}), [theme, variant]);
|
|
573
589
|
return /* @__PURE__ */ jsx(NestedContentRendererProvider, {
|
|
574
|
-
value:
|
|
575
|
-
nested: true,
|
|
576
|
-
theme,
|
|
577
|
-
value,
|
|
578
|
-
variant: overrideVariant ?? variant
|
|
579
|
-
}), [theme, variant]),
|
|
590
|
+
value: renderNested,
|
|
580
591
|
children: /* @__PURE__ */ jsx(ComposedProviders, { children: /* @__PURE__ */ jsx(RichRenderer, {
|
|
581
592
|
as: props.as,
|
|
582
593
|
builtinNodeOverrides,
|
package/dist/core.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RichRenderer, i as mergeModules, n as wrapLazy, r as dedupNodes, t as composeRenderer } from "./compose-
|
|
1
|
+
import { a as RichRenderer, i as mergeModules, n as wrapLazy, r as dedupNodes, t as composeRenderer } from "./compose-BC3hv8cT.js";
|
|
2
2
|
export { RichRenderer, composeRenderer, dedupNodes, mergeModules, wrapLazy };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as RichRenderer, i as mergeModules, n as wrapLazy, r as dedupNodes, t as composeRenderer } from "./compose-
|
|
1
|
+
import { a as RichRenderer, i as mergeModules, n as wrapLazy, r as dedupNodes, t as composeRenderer } from "./compose-BC3hv8cT.js";
|
|
2
2
|
import { t as defineConfigurableModule } from "./configurable-module-Bur4JaI3.js";
|
|
3
3
|
import { Fragment, memo, useCallback, useMemo } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -60,13 +60,14 @@ function composeEditor(opts) {
|
|
|
60
60
|
function ComposedEditor(props) {
|
|
61
61
|
const { extraNodes: userExtraNodes, actions, children, theme, variant, ...rest } = props;
|
|
62
62
|
const mergedExtraNodes = useMemo(() => userExtraNodes ? dedupNodes([...allNodes, ...userExtraNodes]) : allNodes, [userExtraNodes]);
|
|
63
|
+
const renderNested = useCallback((value, overrideVariant) => /* @__PURE__ */ jsx(NestedRenderer, {
|
|
64
|
+
nested: true,
|
|
65
|
+
theme,
|
|
66
|
+
value,
|
|
67
|
+
variant: overrideVariant ?? variant
|
|
68
|
+
}), [theme, variant]);
|
|
63
69
|
return /* @__PURE__ */ jsx(NestedContentRendererProvider, {
|
|
64
|
-
value:
|
|
65
|
-
nested: true,
|
|
66
|
-
theme,
|
|
67
|
-
value,
|
|
68
|
-
variant: overrideVariant ?? variant
|
|
69
|
-
}), [theme, variant]),
|
|
70
|
+
value: renderNested,
|
|
70
71
|
children: /* @__PURE__ */ jsx(NestedEditorPluginsProvider, {
|
|
71
72
|
plugins: nestedEditorPlugins,
|
|
72
73
|
children: /* @__PURE__ */ jsx(ComposedProviders, { children: /* @__PURE__ */ jsx(ComposedEditorProviders, { children: /* @__PURE__ */ jsxs(RichEditor, {
|
|
@@ -5971,21 +5971,27 @@ figure.rich-image[data-layout="float-right"] {
|
|
|
5971
5971
|
--_1pymbyu0: 255, 0, 0;
|
|
5972
5972
|
}
|
|
5973
5973
|
._1pymbyu6 {
|
|
5974
|
-
--_1pymbyu0:
|
|
5974
|
+
--_1pymbyu0: 250, 36, 60;
|
|
5975
5975
|
}
|
|
5976
5976
|
._1pymbyu7 {
|
|
5977
|
-
--_1pymbyu0:
|
|
5977
|
+
--_1pymbyu0: 29, 185, 84;
|
|
5978
5978
|
}
|
|
5979
5979
|
._1pymbyu8 {
|
|
5980
|
-
--_1pymbyu0:
|
|
5980
|
+
--_1pymbyu0: 163, 163, 163;
|
|
5981
5981
|
}
|
|
5982
5982
|
._1pymbyu9 {
|
|
5983
|
-
--_1pymbyu0:
|
|
5983
|
+
--_1pymbyu0: 0, 161, 214;
|
|
5984
5984
|
}
|
|
5985
5985
|
._1pymbyua {
|
|
5986
|
-
--_1pymbyu0:
|
|
5986
|
+
--_1pymbyu0: 110, 84, 148;
|
|
5987
5987
|
}
|
|
5988
5988
|
._1pymbyub {
|
|
5989
|
+
--_1pymbyu0: 110, 84, 148;
|
|
5990
|
+
}
|
|
5991
|
+
._1pymbyuc {
|
|
5992
|
+
--_1pymbyu0: 139, 92, 246;
|
|
5993
|
+
}
|
|
5994
|
+
._1pymbyud {
|
|
5989
5995
|
display: inline-flex;
|
|
5990
5996
|
align-items: center;
|
|
5991
5997
|
gap: 8px;
|
|
@@ -5998,20 +6004,20 @@ figure.rich-image[data-layout="float-right"] {
|
|
|
5998
6004
|
padding-right: 14px;
|
|
5999
6005
|
font-family: var(--rc-font-family-sans);
|
|
6000
6006
|
}
|
|
6001
|
-
.
|
|
6007
|
+
._1pymbyue {
|
|
6002
6008
|
width: 8px;
|
|
6003
6009
|
height: 8px;
|
|
6004
6010
|
border-radius: 50%;
|
|
6005
6011
|
flex-shrink: 0;
|
|
6006
6012
|
background-color: rgb(var(--_1pymbyu0));
|
|
6007
6013
|
}
|
|
6008
|
-
.
|
|
6014
|
+
._1pymbyuf {
|
|
6009
6015
|
width: 1px;
|
|
6010
6016
|
height: 20px;
|
|
6011
6017
|
background-color: var(--rc-border);
|
|
6012
6018
|
flex-shrink: 0;
|
|
6013
6019
|
}
|
|
6014
|
-
.
|
|
6020
|
+
._1pymbyug {
|
|
6015
6021
|
flex: 1;
|
|
6016
6022
|
min-width: 0;
|
|
6017
6023
|
height: 100%;
|
|
@@ -6023,7 +6029,7 @@ figure.rich-image[data-layout="float-right"] {
|
|
|
6023
6029
|
padding: 0 14px;
|
|
6024
6030
|
outline: none;
|
|
6025
6031
|
}
|
|
6026
|
-
.
|
|
6032
|
+
._1pymbyug::placeholder {
|
|
6027
6033
|
color: color-mix(in srgb, var(--rc-text-secondary) 60%, transparent);
|
|
6028
6034
|
}._1kngc4r1 {
|
|
6029
6035
|
margin: 8px 0;
|
|
@@ -6158,21 +6164,27 @@ figure.rich-image[data-layout="float-right"] {
|
|
|
6158
6164
|
--_1kngc4r0: 255, 0, 0;
|
|
6159
6165
|
}
|
|
6160
6166
|
._1kngc4rh {
|
|
6161
|
-
--_1kngc4r0:
|
|
6167
|
+
--_1kngc4r0: 250, 36, 60;
|
|
6162
6168
|
}
|
|
6163
6169
|
._1kngc4ri {
|
|
6164
|
-
--_1kngc4r0:
|
|
6170
|
+
--_1kngc4r0: 29, 185, 84;
|
|
6165
6171
|
}
|
|
6166
6172
|
._1kngc4rj {
|
|
6167
|
-
--_1kngc4r0:
|
|
6173
|
+
--_1kngc4r0: 163, 163, 163;
|
|
6168
6174
|
}
|
|
6169
6175
|
._1kngc4rk {
|
|
6170
|
-
--_1kngc4r0:
|
|
6176
|
+
--_1kngc4r0: 0, 161, 214;
|
|
6171
6177
|
}
|
|
6172
6178
|
._1kngc4rl {
|
|
6173
|
-
--_1kngc4r0:
|
|
6179
|
+
--_1kngc4r0: 110, 84, 148;
|
|
6174
6180
|
}
|
|
6175
6181
|
._1kngc4rm {
|
|
6182
|
+
--_1kngc4r0: 110, 84, 148;
|
|
6183
|
+
}
|
|
6184
|
+
._1kngc4rn {
|
|
6185
|
+
--_1kngc4r0: 139, 92, 246;
|
|
6186
|
+
}
|
|
6187
|
+
._1kngc4ro {
|
|
6176
6188
|
display: inline-flex;
|
|
6177
6189
|
align-items: center;
|
|
6178
6190
|
gap: 8px;
|
|
@@ -6184,14 +6196,14 @@ figure.rich-image[data-layout="float-right"] {
|
|
|
6184
6196
|
user-select: none;
|
|
6185
6197
|
padding-right: 14px;
|
|
6186
6198
|
}
|
|
6187
|
-
.
|
|
6199
|
+
._1kngc4rp {
|
|
6188
6200
|
width: 8px;
|
|
6189
6201
|
height: 8px;
|
|
6190
6202
|
border-radius: 50%;
|
|
6191
6203
|
flex-shrink: 0;
|
|
6192
6204
|
background-color: rgb(var(--_1kngc4r0));
|
|
6193
6205
|
}
|
|
6194
|
-
.
|
|
6206
|
+
._1kngc4rq {
|
|
6195
6207
|
flex: 1;
|
|
6196
6208
|
min-width: 0;
|
|
6197
6209
|
font-size: var(--rc-font-size-md);
|
|
@@ -6202,17 +6214,17 @@ figure.rich-image[data-layout="float-right"] {
|
|
|
6202
6214
|
text-overflow: ellipsis;
|
|
6203
6215
|
white-space: nowrap;
|
|
6204
6216
|
}
|
|
6205
|
-
.
|
|
6217
|
+
._1kngc4rq:hover {
|
|
6206
6218
|
color: var(--rc-text);
|
|
6207
6219
|
text-decoration: underline;
|
|
6208
6220
|
}
|
|
6209
|
-
.
|
|
6221
|
+
._1kngc4rr {
|
|
6210
6222
|
display: flex;
|
|
6211
6223
|
justify-content: center;
|
|
6212
6224
|
margin: 8px 0;
|
|
6213
6225
|
width: 100%;
|
|
6214
6226
|
}
|
|
6215
|
-
.
|
|
6227
|
+
._1kngc4rs {
|
|
6216
6228
|
display: flex;
|
|
6217
6229
|
align-items: center;
|
|
6218
6230
|
justify-content: center;
|