@measured/puck 0.21.0-canary.eb8ea5ce → 0.21.0-canary.ece26d91
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/{Editor-DR57V55X.mjs → Editor-O447AVCX.mjs} +17 -7
- package/dist/{Render-6Q5WP25Y.mjs → Render-OFE6QLI2.mjs} +8 -4
- package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-ONhOkrvf.d.mts} +1 -27
- package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-ONhOkrvf.d.ts} +1 -27
- package/dist/chunk-2Q4PACDA.mjs +111 -0
- package/dist/chunk-62AAYNXG.mjs +63 -0
- package/dist/chunk-BSDEIOEK.mjs +706 -0
- package/dist/chunk-CSSRLPHM.mjs +11 -0
- package/dist/{chunk-OPXWLTPM.mjs → chunk-DAQLMM2T.mjs} +1377 -2795
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/{chunk-YZQENDBP.mjs → chunk-NLUHDYVR.mjs} +2 -123
- package/dist/chunk-PLXSMBAA.mjs +53 -0
- package/dist/chunk-QAWJTCV5.mjs +33 -0
- package/dist/chunk-QBGM4ELA.mjs +528 -0
- package/dist/{chunk-MSIUWPEI.mjs → chunk-QBJ2LDJB.mjs} +36 -20
- package/dist/chunk-T3WX7XJ6.mjs +132 -0
- package/dist/{chunk-CF5XA6LF.mjs → chunk-V5I7CVLT.mjs} +1 -1
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/{chunk-A7EMVTSK.mjs → chunk-Y656T6AQ.mjs} +13 -7
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-BEMDJKDS.mjs +93 -0
- package/dist/index-BEoNHRI1.d.ts +116 -0
- package/dist/index-DfxZ7tZF.d.mts +116 -0
- package/dist/index.d.mts +9 -125
- package/dist/index.d.ts +9 -125
- package/dist/index.js +1002 -775
- package/dist/index.mjs +14 -5
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +908 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-JU3A7Y4L.mjs +57 -0
- package/dist/loaded-N3FYGF2Y.mjs +57 -0
- package/dist/loaded-OBY7OMS6.mjs +60 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/no-external.d.mts +3 -1
- package/dist/no-external.d.ts +3 -1
- package/dist/no-external.js +1002 -775
- package/dist/no-external.mjs +14 -5
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.mjs +6 -3
- package/dist/walk-tree-CdriEzFJ.d.mts +29 -0
- package/dist/walk-tree-DHbAZ4wF.d.ts +29 -0
- package/package.json +7 -2
- package/dist/chunk-GQ457KMA.mjs +0 -199
|
@@ -1,18 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PuckRichText
|
|
3
|
+
} from "./chunk-V5I7CVLT.mjs";
|
|
1
4
|
import {
|
|
2
5
|
EditorInner,
|
|
3
|
-
LoadedRichTextMenu
|
|
6
|
+
LoadedRichTextMenu
|
|
7
|
+
} from "./chunk-2Q4PACDA.mjs";
|
|
8
|
+
import "./chunk-CSSRLPHM.mjs";
|
|
9
|
+
import "./chunk-BSDEIOEK.mjs";
|
|
10
|
+
import "./chunk-PLXSMBAA.mjs";
|
|
11
|
+
import "./chunk-62AAYNXG.mjs";
|
|
12
|
+
import "./chunk-QAWJTCV5.mjs";
|
|
13
|
+
import {
|
|
4
14
|
useAppStore,
|
|
5
15
|
useAppStoreApi
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
} from "./chunk-DAQLMM2T.mjs";
|
|
17
|
+
import "./chunk-QBGM4ELA.mjs";
|
|
18
|
+
import "./chunk-T3WX7XJ6.mjs";
|
|
19
|
+
import "./chunk-Y2EFNT5P.mjs";
|
|
20
|
+
import "./chunk-NLUHDYVR.mjs";
|
|
11
21
|
import {
|
|
12
22
|
__spreadProps,
|
|
13
23
|
__spreadValues,
|
|
14
24
|
init_react_import
|
|
15
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
16
26
|
|
|
17
27
|
// components/RichTextEditor/components/Editor.tsx
|
|
18
28
|
init_react_import();
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PuckRichText
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-V5I7CVLT.mjs";
|
|
4
4
|
import {
|
|
5
|
-
get_class_name_factory_default,
|
|
6
|
-
init_react_import,
|
|
7
5
|
styles_module_default
|
|
8
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CSSRLPHM.mjs";
|
|
7
|
+
import {
|
|
8
|
+
get_class_name_factory_default
|
|
9
|
+
} from "./chunk-Y2EFNT5P.mjs";
|
|
10
|
+
import {
|
|
11
|
+
init_react_import
|
|
12
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
9
13
|
|
|
10
14
|
// components/RichTextEditor/components/Render.tsx
|
|
11
15
|
init_react_import();
|
|
@@ -819,30 +819,4 @@ type PuckAction = {
|
|
|
819
819
|
recordHistory?: boolean;
|
|
820
820
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
|
821
821
|
|
|
822
|
-
type
|
|
823
|
-
migrateDynamicZonesForComponent?: {
|
|
824
|
-
[ComponentName in keyof UserConfig["components"]]: (props: WithId<UserGenerics<UserConfig>["UserProps"][ComponentName]>, zones: Record<string, Content>) => ComponentData["props"];
|
|
825
|
-
};
|
|
826
|
-
};
|
|
827
|
-
declare function migrate<UserConfig extends Config = Config>(data: Data, config?: UserConfig, migrationOptions?: MigrationOptions<UserConfig>): Data;
|
|
828
|
-
|
|
829
|
-
type PropTransform<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
|
830
|
-
[ComponentName in keyof Components]: (props: Components[ComponentName] & {
|
|
831
|
-
[key: string]: any;
|
|
832
|
-
}) => Components[ComponentName];
|
|
833
|
-
} & {
|
|
834
|
-
root: (props: RootProps & {
|
|
835
|
-
[key: string]: any;
|
|
836
|
-
}) => RootProps;
|
|
837
|
-
}>;
|
|
838
|
-
declare function transformProps<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Components, RootProps>, config?: Config): Data;
|
|
839
|
-
|
|
840
|
-
declare function resolveAllData<Components extends DefaultComponents = DefaultComponents, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Components, RootProps>>;
|
|
841
|
-
|
|
842
|
-
type WalkTreeOptions = {
|
|
843
|
-
parentId: string;
|
|
844
|
-
propName: string;
|
|
845
|
-
};
|
|
846
|
-
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
847
|
-
|
|
848
|
-
export { type RootData as $, type AppState as A, type FieldRenderFunctions as B, type Config as C, type DropZoneProps as D, type ItemWithId as E, type Fields as F, type ArrayState as G, type History as H, type IframeConfig as I, type SlotComponent as J, type PuckComponent as K, type ComponentConfigExtensions as L, type Metadata as M, type RootConfig as N, type Overrides as O, type Permissions as P, type DefaultComponents as Q, type RootDataWithProps as R, type Slot as S, type ExtractConfigParams as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ConfigParams as X, type ComponentConfigParams as Y, type BaseData as Z, type RootDataWithoutProps as _, type ComponentData as a, type ComponentDataOptionalId as a0, type MappedItem as a1, type ComponentDataMap as a2, type Content as a3, type PuckMetadata as a4, type ComponentMetadata as a5, type FieldMetadata as a6, type BaseField as a7, type TextField as a8, type NumberField as a9, type TextareaField as aa, type SelectField as ab, type RadioField as ac, type ArrayField as ad, type ObjectField as ae, type Adaptor as af, type ExternalFieldWithAdaptor as ag, type CacheOpts as ah, type ExternalField as ai, type CustomFieldRender as aj, type CustomField as ak, type SlotField as al, type PuckContext as am, type DefaultRootFieldProps as an, type DefaultRootRenderProps as ao, type DefaultRootProps as ap, type DefaultComponentProps as aq, type WithId as ar, type WithPuckProps as as, type AsFieldProps as at, type WithChildren as au, type ExtractField as av, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type FieldTransforms as g, type RichtextField as h, type Field as i, type FieldProps as j, type Data as k, type OnAction as l, migrate as m, type InitialHistory as n, type ItemSelector as o, type RichText as p, type Direction as q, resolveAllData as r, type DragAxis as s, transformProps as t, type Viewport as u, type FieldTransformFnParams as v, walkTree as w, type FieldTransformFn as x, overrideKeys as y, type OverrideKey as z };
|
|
822
|
+
export { type BaseData as $, type AppState as A, type FieldTransformFn as B, type Config as C, type Data as D, overrideKeys as E, type Fields as F, type OverrideKey as G, type History as H, type IframeConfig as I, type FieldRenderFunctions as J, type ItemWithId as K, type ArrayState as L, type Metadata as M, type SlotComponent as N, type OnAction as O, type PrivateAppState as P, type PuckComponent as Q, type RootData as R, type Slot as S, type ComponentConfigExtensions as T, type UserGenerics as U, type Viewports as V, type WithId as W, type RootConfig as X, type ExtractConfigParams as Y, type ConfigParams as Z, type ComponentConfigParams as _, type PuckAction as a, type RootDataWithoutProps as a0, type ComponentDataOptionalId as a1, type MappedItem as a2, type ComponentDataMap as a3, type PuckMetadata as a4, type ComponentMetadata as a5, type FieldMetadata as a6, type BaseField as a7, type TextField as a8, type NumberField as a9, type TextareaField as aa, type SelectField as ab, type RadioField as ac, type ArrayField as ad, type ObjectField as ae, type Adaptor as af, type ExternalFieldWithAdaptor as ag, type CacheOpts as ah, type ExternalField as ai, type CustomFieldRender as aj, type CustomField as ak, type SlotField as al, type PuckContext as am, type DefaultRootRenderProps as an, type DefaultRootProps as ao, type WithPuckProps as ap, type AsFieldProps as aq, type WithChildren as ar, type ExtractField as as, type Content as b, type ComponentData as c, type DefaultComponents as d, type DefaultComponentProps as e, type DefaultRootFieldProps as f, type Permissions as g, type RootDataWithProps as h, type ResolveDataTrigger as i, type Plugin as j, type Overrides as k, type UiState as l, type ComponentConfig as m, type FieldTransforms as n, type RichtextField as o, type Field as p, type FieldProps as q, type DropZoneProps as r, type InitialHistory as s, type ItemSelector as t, type WithSlotProps as u, type RichText as v, type Direction as w, type DragAxis as x, type Viewport as y, type FieldTransformFnParams as z };
|
|
@@ -819,30 +819,4 @@ type PuckAction = {
|
|
|
819
819
|
recordHistory?: boolean;
|
|
820
820
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
|
821
821
|
|
|
822
|
-
type
|
|
823
|
-
migrateDynamicZonesForComponent?: {
|
|
824
|
-
[ComponentName in keyof UserConfig["components"]]: (props: WithId<UserGenerics<UserConfig>["UserProps"][ComponentName]>, zones: Record<string, Content>) => ComponentData["props"];
|
|
825
|
-
};
|
|
826
|
-
};
|
|
827
|
-
declare function migrate<UserConfig extends Config = Config>(data: Data, config?: UserConfig, migrationOptions?: MigrationOptions<UserConfig>): Data;
|
|
828
|
-
|
|
829
|
-
type PropTransform<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
|
830
|
-
[ComponentName in keyof Components]: (props: Components[ComponentName] & {
|
|
831
|
-
[key: string]: any;
|
|
832
|
-
}) => Components[ComponentName];
|
|
833
|
-
} & {
|
|
834
|
-
root: (props: RootProps & {
|
|
835
|
-
[key: string]: any;
|
|
836
|
-
}) => RootProps;
|
|
837
|
-
}>;
|
|
838
|
-
declare function transformProps<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Components, RootProps>, config?: Config): Data;
|
|
839
|
-
|
|
840
|
-
declare function resolveAllData<Components extends DefaultComponents = DefaultComponents, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Components, RootProps>>;
|
|
841
|
-
|
|
842
|
-
type WalkTreeOptions = {
|
|
843
|
-
parentId: string;
|
|
844
|
-
propName: string;
|
|
845
|
-
};
|
|
846
|
-
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
847
|
-
|
|
848
|
-
export { type RootData as $, type AppState as A, type FieldRenderFunctions as B, type Config as C, type DropZoneProps as D, type ItemWithId as E, type Fields as F, type ArrayState as G, type History as H, type IframeConfig as I, type SlotComponent as J, type PuckComponent as K, type ComponentConfigExtensions as L, type Metadata as M, type RootConfig as N, type Overrides as O, type Permissions as P, type DefaultComponents as Q, type RootDataWithProps as R, type Slot as S, type ExtractConfigParams as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ConfigParams as X, type ComponentConfigParams as Y, type BaseData as Z, type RootDataWithoutProps as _, type ComponentData as a, type ComponentDataOptionalId as a0, type MappedItem as a1, type ComponentDataMap as a2, type Content as a3, type PuckMetadata as a4, type ComponentMetadata as a5, type FieldMetadata as a6, type BaseField as a7, type TextField as a8, type NumberField as a9, type TextareaField as aa, type SelectField as ab, type RadioField as ac, type ArrayField as ad, type ObjectField as ae, type Adaptor as af, type ExternalFieldWithAdaptor as ag, type CacheOpts as ah, type ExternalField as ai, type CustomFieldRender as aj, type CustomField as ak, type SlotField as al, type PuckContext as am, type DefaultRootFieldProps as an, type DefaultRootRenderProps as ao, type DefaultRootProps as ap, type DefaultComponentProps as aq, type WithId as ar, type WithPuckProps as as, type AsFieldProps as at, type WithChildren as au, type ExtractField as av, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type FieldTransforms as g, type RichtextField as h, type Field as i, type FieldProps as j, type Data as k, type OnAction as l, migrate as m, type InitialHistory as n, type ItemSelector as o, type RichText as p, type Direction as q, resolveAllData as r, type DragAxis as s, transformProps as t, type Viewport as u, type FieldTransformFnParams as v, walkTree as w, type FieldTransformFn as x, overrideKeys as y, type OverrideKey as z };
|
|
822
|
+
export { type BaseData as $, type AppState as A, type FieldTransformFn as B, type Config as C, type Data as D, overrideKeys as E, type Fields as F, type OverrideKey as G, type History as H, type IframeConfig as I, type FieldRenderFunctions as J, type ItemWithId as K, type ArrayState as L, type Metadata as M, type SlotComponent as N, type OnAction as O, type PrivateAppState as P, type PuckComponent as Q, type RootData as R, type Slot as S, type ComponentConfigExtensions as T, type UserGenerics as U, type Viewports as V, type WithId as W, type RootConfig as X, type ExtractConfigParams as Y, type ConfigParams as Z, type ComponentConfigParams as _, type PuckAction as a, type RootDataWithoutProps as a0, type ComponentDataOptionalId as a1, type MappedItem as a2, type ComponentDataMap as a3, type PuckMetadata as a4, type ComponentMetadata as a5, type FieldMetadata as a6, type BaseField as a7, type TextField as a8, type NumberField as a9, type TextareaField as aa, type SelectField as ab, type RadioField as ac, type ArrayField as ad, type ObjectField as ae, type Adaptor as af, type ExternalFieldWithAdaptor as ag, type CacheOpts as ah, type ExternalField as ai, type CustomFieldRender as aj, type CustomField as ak, type SlotField as al, type PuckContext as am, type DefaultRootRenderProps as an, type DefaultRootProps as ao, type WithPuckProps as ap, type AsFieldProps as aq, type WithChildren as ar, type ExtractField as as, type Content as b, type ComponentData as c, type DefaultComponents as d, type DefaultComponentProps as e, type DefaultRootFieldProps as f, type Permissions as g, type RootDataWithProps as h, type ResolveDataTrigger as i, type Plugin as j, type Overrides as k, type UiState as l, type ComponentConfig as m, type FieldTransforms as n, type RichtextField as o, type Field as p, type FieldProps as q, type DropZoneProps as r, type InitialHistory as s, type ItemSelector as t, type WithSlotProps as u, type RichText as v, type Direction as w, type DragAxis as x, type Viewport as y, type FieldTransformFnParams as z };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
styles_module_default
|
|
3
|
+
} from "./chunk-CSSRLPHM.mjs";
|
|
4
|
+
import {
|
|
5
|
+
LoadedRichTextMenuInner
|
|
6
|
+
} from "./chunk-BSDEIOEK.mjs";
|
|
7
|
+
import {
|
|
8
|
+
useAppStore,
|
|
9
|
+
useAppStoreApi
|
|
10
|
+
} from "./chunk-DAQLMM2T.mjs";
|
|
11
|
+
import {
|
|
12
|
+
get_class_name_factory_default
|
|
13
|
+
} from "./chunk-Y2EFNT5P.mjs";
|
|
14
|
+
import {
|
|
15
|
+
__spreadValues,
|
|
16
|
+
init_react_import
|
|
17
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
18
|
+
|
|
19
|
+
// components/RichTextEditor/components/EditorInner.tsx
|
|
20
|
+
init_react_import();
|
|
21
|
+
import {
|
|
22
|
+
memo,
|
|
23
|
+
useCallback
|
|
24
|
+
} from "react";
|
|
25
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
+
var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
|
|
27
|
+
var EditorInner = memo(
|
|
28
|
+
({
|
|
29
|
+
children,
|
|
30
|
+
menu,
|
|
31
|
+
readOnly = false,
|
|
32
|
+
field,
|
|
33
|
+
inline = false,
|
|
34
|
+
editor,
|
|
35
|
+
id
|
|
36
|
+
}) => {
|
|
37
|
+
const { initialHeight } = field;
|
|
38
|
+
const isActive = useAppStore(
|
|
39
|
+
(s) => {
|
|
40
|
+
var _a;
|
|
41
|
+
return ((_a = s.currentRichText) == null ? void 0 : _a.id) === id && inline === s.currentRichText.inline;
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
const appStoreApi = useAppStoreApi();
|
|
45
|
+
const handleHotkeyCapture = useCallback(
|
|
46
|
+
(event) => {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "i") {
|
|
49
|
+
event.stopPropagation();
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
(_b = editor == null ? void 0 : (_a = editor.commands).toggleItalic) == null ? void 0 : _b.call(_a);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
[editor]
|
|
55
|
+
);
|
|
56
|
+
const handleBlur = useCallback(
|
|
57
|
+
(e) => {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
const targetInMenu = !!((_b = (_a = e.relatedTarget) == null ? void 0 : _a.closest) == null ? void 0 : _b.call(
|
|
60
|
+
_a,
|
|
61
|
+
"[data-puck-rte-menu]"
|
|
62
|
+
));
|
|
63
|
+
if (e.relatedTarget && !targetInMenu) {
|
|
64
|
+
appStoreApi.setState({
|
|
65
|
+
currentRichText: null
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
[appStoreApi]
|
|
72
|
+
);
|
|
73
|
+
return /* @__PURE__ */ jsxs(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: getClassName({
|
|
77
|
+
editor: !inline,
|
|
78
|
+
inline,
|
|
79
|
+
isActive,
|
|
80
|
+
disabled: readOnly
|
|
81
|
+
}),
|
|
82
|
+
style: inline ? {} : { height: initialHeight != null ? initialHeight : 192, overflowY: "auto" },
|
|
83
|
+
onKeyDownCapture: handleHotkeyCapture,
|
|
84
|
+
onBlur: handleBlur,
|
|
85
|
+
children: [
|
|
86
|
+
!inline && /* @__PURE__ */ jsx("div", { className: getClassName("menu"), children: menu }),
|
|
87
|
+
children
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
EditorInner.displayName = "EditorInner";
|
|
94
|
+
|
|
95
|
+
// components/RichTextMenu/index.tsx
|
|
96
|
+
init_react_import();
|
|
97
|
+
import { lazy, Suspense } from "react";
|
|
98
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
99
|
+
var LoadedRichTextMenuFull = lazy(
|
|
100
|
+
() => import("./full-BEMDJKDS.mjs").then((m) => ({
|
|
101
|
+
default: m.LoadedRichTextMenuFull
|
|
102
|
+
}))
|
|
103
|
+
);
|
|
104
|
+
var LoadedRichTextMenu = (props) => {
|
|
105
|
+
return /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2(LoadedRichTextMenuInner, __spreadValues({}, props)), children: /* @__PURE__ */ jsx2(LoadedRichTextMenuFull, __spreadValues({}, props)) });
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
EditorInner,
|
|
110
|
+
LoadedRichTextMenu
|
|
111
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Heading1,
|
|
3
|
+
Heading2,
|
|
4
|
+
Heading3,
|
|
5
|
+
Heading4,
|
|
6
|
+
Heading5,
|
|
7
|
+
Heading6
|
|
8
|
+
} from "./chunk-DAQLMM2T.mjs";
|
|
9
|
+
import {
|
|
10
|
+
init_react_import
|
|
11
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
12
|
+
|
|
13
|
+
// components/RichTextMenu/controls/HeadingSelect/use-options.ts
|
|
14
|
+
init_react_import();
|
|
15
|
+
import { useMemo } from "react";
|
|
16
|
+
var optionNodes = {
|
|
17
|
+
h1: { label: "Heading 1", icon: Heading1 },
|
|
18
|
+
h2: { label: "Heading 2", icon: Heading2 },
|
|
19
|
+
h3: { label: "Heading 3", icon: Heading3 },
|
|
20
|
+
h4: { label: "Heading 4", icon: Heading4 },
|
|
21
|
+
h5: { label: "Heading 5", icon: Heading5 },
|
|
22
|
+
h6: { label: "Heading 6", icon: Heading6 }
|
|
23
|
+
};
|
|
24
|
+
var useHeadingOptions = (fieldOptions) => {
|
|
25
|
+
var _a;
|
|
26
|
+
let blockOptions = [];
|
|
27
|
+
if ((fieldOptions == null ? void 0 : fieldOptions.heading) !== false) {
|
|
28
|
+
if (!((_a = fieldOptions == null ? void 0 : fieldOptions.heading) == null ? void 0 : _a.levels)) {
|
|
29
|
+
blockOptions = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
30
|
+
} else {
|
|
31
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(1)) {
|
|
32
|
+
blockOptions.push("h1");
|
|
33
|
+
}
|
|
34
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(2)) {
|
|
35
|
+
blockOptions.push("h2");
|
|
36
|
+
}
|
|
37
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(3)) {
|
|
38
|
+
blockOptions.push("h3");
|
|
39
|
+
}
|
|
40
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(4)) {
|
|
41
|
+
blockOptions.push("h4");
|
|
42
|
+
}
|
|
43
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(5)) {
|
|
44
|
+
blockOptions.push("h5");
|
|
45
|
+
}
|
|
46
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(6)) {
|
|
47
|
+
blockOptions.push("h6");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return useMemo(
|
|
52
|
+
() => blockOptions.map((item) => ({
|
|
53
|
+
value: item,
|
|
54
|
+
label: optionNodes[item].label,
|
|
55
|
+
icon: optionNodes[item].icon
|
|
56
|
+
})),
|
|
57
|
+
[blockOptions]
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
useHeadingOptions
|
|
63
|
+
};
|