@haklex/rich-ext-nested-doc 0.0.79 → 0.0.80
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,5 +1,7 @@
|
|
|
1
|
+
import { RichEditorVariant } from '@haklex/rich-editor/static';
|
|
1
2
|
import { SerializedEditorState } from 'lexical';
|
|
2
|
-
export declare function NestedDocRenderer({ value }: {
|
|
3
|
+
export declare function NestedDocRenderer({ value, variant, }: {
|
|
3
4
|
value: SerializedEditorState;
|
|
5
|
+
variant?: RichEditorVariant;
|
|
4
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
//# sourceMappingURL=NestedDocRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestedDocRenderer.d.ts","sourceRoot":"","sources":["../src/NestedDocRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NestedDocRenderer.d.ts","sourceRoot":"","sources":["../src/NestedDocRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAGvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAmB,GACpB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,2CAOA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestedDocStaticDecorator.d.ts","sourceRoot":"","sources":["../src/NestedDocStaticDecorator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAUrD,UAAU,6BAA6B;IACrC,YAAY,EAAE,qBAAqB,CAAC;CACrC;AAED,wBAAgB,wBAAwB,CAAC,EAAE,YAAY,EAAE,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"NestedDocStaticDecorator.d.ts","sourceRoot":"","sources":["../src/NestedDocStaticDecorator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAUrD,UAAU,6BAA6B;IACrC,YAAY,EAAE,qBAAqB,CAAC;CACrC;AAED,wBAAgB,wBAAwB,CAAC,EAAE,YAAY,EAAE,EAAE,6BAA6B,kDAwEvF"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { t as truncateEditorState, h as hasRenderableEditorState, d as dialogPopup, e as editOverlayRoot, r as rendererContent, p as previewSurface, N as NestedDocRenderer, a as previewEmpty, b as editOverlay, $ as $isNestedDocNode, c as dialogShell, f as dialogHeader, g as dialogHeaderLeft, i as dialogTitle, j as dialogHeaderRight, k as dialogHeaderCloseBtn, l as editorArea, m as dialogFooter, n as NestedDocNode } from "./transformer-
|
|
5
|
-
import { o, q, s } from "./transformer-
|
|
4
|
+
import { t as truncateEditorState, h as hasRenderableEditorState, d as dialogPopup, e as editOverlayRoot, r as rendererContent, p as previewSurface, N as NestedDocRenderer, a as previewEmpty, b as editOverlay, $ as $isNestedDocNode, c as dialogShell, f as dialogHeader, g as dialogHeaderLeft, i as dialogTitle, j as dialogHeaderRight, k as dialogHeaderCloseBtn, l as editorArea, m as dialogFooter, n as NestedDocNode } from "./transformer-Ccyy7neb.js";
|
|
5
|
+
import { o, q, s } from "./transformer-Ccyy7neb.js";
|
|
6
6
|
import { useColorScheme, editorTheme } from "@haklex/rich-editor";
|
|
7
7
|
import { getResolvedEditNodes } from "@haklex/rich-editor/nodes";
|
|
8
8
|
import { $getNodeByKey, $insertNodes, createEditor, createCommand, COMMAND_PRIORITY_EDITOR } from "lexical";
|
package/dist/static.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as NestedDocNode } from "./transformer-
|
|
2
|
-
import { o, $, q, N, s } from "./transformer-
|
|
1
|
+
import { n as NestedDocNode } from "./transformer-Ccyy7neb.js";
|
|
2
|
+
import { o, $, q, N, s } from "./transformer-Ccyy7neb.js";
|
|
3
3
|
const nestedDocNodes = [NestedDocNode];
|
|
4
4
|
export {
|
|
5
5
|
o as $createNestedDocNode,
|
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { extractTextContent as extractTextContent$1 } from "@haklex/rich-editor/commands";
|
|
5
|
-
import { useColorScheme, useRendererConfig, usePresentDialog, extractTextContent } from "@haklex/rich-editor/static";
|
|
5
|
+
import { useColorScheme, useRendererConfig, usePresentDialog, useVariant, extractTextContent } from "@haklex/rich-editor/static";
|
|
6
6
|
import { DecoratorNode } from "lexical";
|
|
7
7
|
import { useMemo, useCallback, createElement } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -28,10 +28,13 @@ var staticDialogPopup = "_1an6v8dk";
|
|
|
28
28
|
var staticDialogBody = "_1an6v8dl";
|
|
29
29
|
var previewSurface = "_1an6v8dm";
|
|
30
30
|
var previewEmpty = "_1an6v8dn";
|
|
31
|
-
function NestedDocRenderer({
|
|
31
|
+
function NestedDocRenderer({
|
|
32
|
+
value,
|
|
33
|
+
variant = "comment"
|
|
34
|
+
}) {
|
|
32
35
|
const theme = useColorScheme();
|
|
33
36
|
const rendererConfig = useRendererConfig();
|
|
34
|
-
return /* @__PURE__ */ jsx(RichRenderer, { rendererConfig, theme, value, variant
|
|
37
|
+
return /* @__PURE__ */ jsx(RichRenderer, { rendererConfig, theme, value, variant });
|
|
35
38
|
}
|
|
36
39
|
function truncateEditorState(state, maxNodes) {
|
|
37
40
|
const root = state.root;
|
|
@@ -78,11 +81,12 @@ function NestedDocStaticDecorator({ contentState }) {
|
|
|
78
81
|
};
|
|
79
82
|
return walk(firstChild).slice(0, 80);
|
|
80
83
|
}, [children]);
|
|
84
|
+
const contextVariant = useVariant();
|
|
81
85
|
const handleOpen = useCallback(async () => {
|
|
82
86
|
const present = presentDialogFromCtx ?? (await import("@haklex/rich-editor-ui")).presentDialog;
|
|
83
87
|
present({
|
|
84
88
|
title: title || void 0,
|
|
85
|
-
content: () => /* @__PURE__ */ jsx("div", { className: staticDialogBody, children: /* @__PURE__ */ jsx(NestedDocRenderer, { value: contentState }) }),
|
|
89
|
+
content: () => /* @__PURE__ */ jsx("div", { className: staticDialogBody, children: /* @__PURE__ */ jsx(NestedDocRenderer, { value: contentState, variant: contextVariant }) }),
|
|
86
90
|
className: staticDialogPopup,
|
|
87
91
|
portalClassName,
|
|
88
92
|
theme: colorScheme,
|
|
@@ -90,7 +94,7 @@ function NestedDocStaticDecorator({ contentState }) {
|
|
|
90
94
|
clickOutsideToDismiss: true,
|
|
91
95
|
sheet: "auto"
|
|
92
96
|
});
|
|
93
|
-
}, [colorScheme, contentState, portalClassName, presentDialogFromCtx, title]);
|
|
97
|
+
}, [colorScheme, contentState, portalClassName, presentDialogFromCtx, title, contextVariant]);
|
|
94
98
|
if (!hasPreview) {
|
|
95
99
|
return null;
|
|
96
100
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-ext-nested-doc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.80",
|
|
4
4
|
"description": "Nested document extension for haklex rich editor",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@haklex/rich-editor": "0.0.
|
|
29
|
-
"@haklex/rich-editor-ui": "0.0.
|
|
30
|
-
"@haklex/rich-static-renderer": "0.0.
|
|
31
|
-
"@haklex/rich-style-token": "0.0.
|
|
28
|
+
"@haklex/rich-editor": "0.0.80",
|
|
29
|
+
"@haklex/rich-editor-ui": "0.0.80",
|
|
30
|
+
"@haklex/rich-static-renderer": "0.0.80",
|
|
31
|
+
"@haklex/rich-style-token": "0.0.80"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@lexical/react": "^0.41.0",
|