@measured/puck 0.21.0-canary.3aa27d1d → 0.21.0-canary.56be3202
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-CYTATURR.mjs +204 -0
- package/dist/Editor-F2LSS6SE.css +403 -0
- package/dist/Render-OFE6QLI2.mjs +55 -0
- package/dist/Render-QEMDIDQC.css +101 -0
- package/dist/{walk-tree-16XYcbNo.d.mts → actions-tsxxcX1z.d.mts} +29 -40
- package/dist/{walk-tree-16XYcbNo.d.ts → actions-tsxxcX1z.d.ts} +29 -40
- package/dist/chunk-72SA22GI.mjs +134 -0
- package/dist/chunk-CSSRLPHM.mjs +11 -0
- package/dist/chunk-M4QBB3JM.mjs +111 -0
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/chunk-MLTVJA2A.mjs +63 -0
- package/dist/chunk-MVJKIFF6.mjs +419 -0
- package/dist/chunk-NLUHDYVR.mjs +416 -0
- package/dist/chunk-NOJQSXRU.mjs +33 -0
- package/dist/{chunk-GFIVKP2H.mjs → chunk-PZ4SED7H.mjs} +6848 -9297
- package/dist/chunk-QBGM4ELA.mjs +528 -0
- package/dist/chunk-UNQOU2OI.mjs +53 -0
- package/dist/chunk-UUOBSXZR.mjs +1807 -0
- package/dist/chunk-V5I7CVLT.mjs +103 -0
- package/dist/chunk-V7333LON.mjs +708 -0
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-GZ4L3XCF.mjs +93 -0
- package/dist/index-Ca6V6NQD.d.ts +118 -0
- package/dist/index-mQvUCH3C.d.mts +118 -0
- package/dist/index.css +856 -458
- package/dist/index.d.mts +32 -129
- package/dist/index.d.ts +32 -129
- package/dist/index.js +11790 -9359
- package/dist/index.mjs +32 -14
- 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-2MNXXPJP.mjs +57 -0
- package/dist/loaded-6QT4HD2O.mjs +57 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/loaded-ZVPBQVNE.mjs +60 -0
- package/dist/no-external.css +988 -586
- package/dist/no-external.d.mts +4 -2
- package/dist/no-external.d.ts +4 -2
- package/dist/no-external.js +11793 -9359
- package/dist/no-external.mjs +34 -11
- package/dist/rsc.css +34 -26
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +249 -189
- package/dist/rsc.mjs +18 -9
- package/dist/walk-tree-Bh85NMeo.d.ts +29 -0
- package/dist/walk-tree-CDA3K5S3.d.mts +29 -0
- package/package.json +9 -4
- package/dist/chunk-SRDLYODX.mjs +0 -1245
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css/#css-module-data */
|
|
2
|
+
._RichTextEditor_1elol_1 .ProseMirror {
|
|
3
|
+
white-space: pre-wrap;
|
|
4
|
+
word-wrap: break-word;
|
|
5
|
+
cursor: text;
|
|
6
|
+
outline: none;
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
._RichTextEditor_1elol_1 .rich-text * {
|
|
10
|
+
white-space: pre-wrap;
|
|
11
|
+
user-select: auto;
|
|
12
|
+
-webkit-user-select: auto;
|
|
13
|
+
}
|
|
14
|
+
._RichTextEditor_1elol_1 .rich-text blockquote {
|
|
15
|
+
margin: 1em 0;
|
|
16
|
+
padding: 0 1em;
|
|
17
|
+
border-left: 4px solid var(--puck-color-grey-09);
|
|
18
|
+
}
|
|
19
|
+
._RichTextEditor_1elol_1 .rich-text code {
|
|
20
|
+
background-color: var(--puck-color-grey-11);
|
|
21
|
+
padding: 4px 8px;
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
}
|
|
24
|
+
._RichTextEditor_1elol_1 .rich-text p:empty::before {
|
|
25
|
+
content: "\a0";
|
|
26
|
+
}
|
|
27
|
+
._RichTextEditor_1elol_1 .rich-text pre code {
|
|
28
|
+
display: block;
|
|
29
|
+
padding: 8px 12px;
|
|
30
|
+
}
|
|
31
|
+
._RichTextEditor_1elol_1 .rich-text > *:first-child,
|
|
32
|
+
._RichTextEditor_1elol_1 .ProseMirror > *:first-child,
|
|
33
|
+
._RichTextEditor_1elol_1 .rich-text * p:first-of-type {
|
|
34
|
+
margin-top: 0;
|
|
35
|
+
}
|
|
36
|
+
._RichTextEditor_1elol_1 .rich-text > *:last-child,
|
|
37
|
+
._RichTextEditor_1elol_1 .ProseMirror > *:last-child,
|
|
38
|
+
._RichTextEditor_1elol_1 .rich-text * p:last-of-type {
|
|
39
|
+
margin-bottom: 0;
|
|
40
|
+
}
|
|
41
|
+
._RichTextEditor--editor_1elol_50 {
|
|
42
|
+
background: var(--puck-color-white);
|
|
43
|
+
border-width: 1px;
|
|
44
|
+
border-style: solid;
|
|
45
|
+
border-color: var(--puck-color-grey-09);
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
font-family: inherit;
|
|
51
|
+
font-size: var(--puck-font-size-xxs);
|
|
52
|
+
resize: vertical;
|
|
53
|
+
transition: border-color 50ms ease-in;
|
|
54
|
+
width: 100%;
|
|
55
|
+
max-width: 100%;
|
|
56
|
+
min-height: 128px;
|
|
57
|
+
}
|
|
58
|
+
._RichTextEditor--editor_1elol_50 .rich-text {
|
|
59
|
+
flex-grow: 1;
|
|
60
|
+
}
|
|
61
|
+
._RichTextEditor--editor_1elol_50 .rich-text:not(:has(.ProseMirror)),
|
|
62
|
+
._RichTextEditor--editor_1elol_50 .rich-text .ProseMirror {
|
|
63
|
+
height: 100%;
|
|
64
|
+
padding: 12px 15px;
|
|
65
|
+
}
|
|
66
|
+
._RichTextEditor--editor_1elol_50 .rich-text ul,
|
|
67
|
+
._RichTextEditor--editor_1elol_50 .rich-text ol {
|
|
68
|
+
padding-left: 24px;
|
|
69
|
+
}
|
|
70
|
+
._RichTextEditor--editor_1elol_50 .rich-text li {
|
|
71
|
+
line-height: 1.5;
|
|
72
|
+
}
|
|
73
|
+
._RichTextEditor--editor_1elol_50 .rich-text p {
|
|
74
|
+
margin-block: 12px;
|
|
75
|
+
}
|
|
76
|
+
._RichTextEditor--editor_1elol_50 .rich-text ul {
|
|
77
|
+
list-style: disc;
|
|
78
|
+
}
|
|
79
|
+
._RichTextEditor--editor_1elol_50 .rich-text ol {
|
|
80
|
+
list-style: decimal;
|
|
81
|
+
}
|
|
82
|
+
._RichTextEditor--editor_1elol_50:focus-within {
|
|
83
|
+
border-color: var(--puck-color-grey-05);
|
|
84
|
+
outline: 2px solid var(--puck-color-azure-05);
|
|
85
|
+
transition: none;
|
|
86
|
+
}
|
|
87
|
+
._RichTextEditor--editor_1elol_50._RichTextEditor--disabled_1elol_106 {
|
|
88
|
+
background: var(--puck-color-grey-11);
|
|
89
|
+
}
|
|
90
|
+
._RichTextEditor_1elol_1:not(:focus-within):not(._RichTextEditor--isActive_1elol_110) .ProseMirror ::selection {
|
|
91
|
+
background-color: transparent;
|
|
92
|
+
}
|
|
93
|
+
._RichTextEditor-menu_1elol_116 {
|
|
94
|
+
border-bottom: 1px solid var(--puck-color-grey-10);
|
|
95
|
+
position: sticky;
|
|
96
|
+
top: 0;
|
|
97
|
+
z-index: 1;
|
|
98
|
+
}
|
|
99
|
+
._RichTextEditor--disabled_1elol_106 ._RichTextEditor-menu_1elol_116 {
|
|
100
|
+
border-bottom: 1px solid var(--puck-color-grey-09);
|
|
101
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, CSSProperties, ReactNode, ElementType, JSX } from 'react';
|
|
1
|
+
import { ReactElement, CSSProperties, ReactNode, ElementType, Ref, JSX } from 'react';
|
|
2
2
|
import { EditorStateSnapshot, Editor, Extensions } from '@tiptap/react';
|
|
3
3
|
import { BlockquoteOptions } from '@tiptap/extension-blockquote';
|
|
4
4
|
import { BoldOptions } from '@tiptap/extension-bold';
|
|
@@ -80,7 +80,7 @@ declare const defaultEditorState: (ctx: EditorStateSnapshot, readOnly: boolean)
|
|
|
80
80
|
|
|
81
81
|
type RichTextSelector = (ctx: EditorStateSnapshot, readOnly: boolean) => Partial<Record<string, boolean>>;
|
|
82
82
|
type DefaultEditorState = ReturnType<typeof defaultEditorState>;
|
|
83
|
-
type EditorState<Selector extends RichTextSelector = RichTextSelector> = DefaultEditorState & Selector
|
|
83
|
+
type EditorState<Selector extends RichTextSelector = RichTextSelector> = DefaultEditorState & ReturnType<Selector> & Record<string, boolean | undefined>;
|
|
84
84
|
|
|
85
85
|
interface PuckRichTextOptions {
|
|
86
86
|
/**
|
|
@@ -223,14 +223,14 @@ interface RichtextField<UserSelector extends RichTextSelector = RichTextSelector
|
|
|
223
223
|
options?: Partial<PuckRichTextOptions>;
|
|
224
224
|
renderMenu?: (props: {
|
|
225
225
|
children: ReactNode;
|
|
226
|
-
editor: Editor;
|
|
227
|
-
editorState: EditorState<UserSelector
|
|
226
|
+
editor: Editor | null;
|
|
227
|
+
editorState: EditorState<UserSelector> | null;
|
|
228
228
|
readOnly: boolean;
|
|
229
229
|
}) => ReactNode;
|
|
230
230
|
renderInlineMenu?: (props: {
|
|
231
231
|
children: ReactNode;
|
|
232
|
-
editor: Editor;
|
|
233
|
-
editorState: EditorState<UserSelector
|
|
232
|
+
editor: Editor | null;
|
|
233
|
+
editorState: EditorState<UserSelector> | null;
|
|
234
234
|
readOnly: boolean;
|
|
235
235
|
}) => ReactNode;
|
|
236
236
|
tiptap?: {
|
|
@@ -347,6 +347,7 @@ type DropZoneProps = {
|
|
|
347
347
|
className?: string;
|
|
348
348
|
collisionAxis?: DragAxis;
|
|
349
349
|
as?: ElementType;
|
|
350
|
+
ref?: Ref<any>;
|
|
350
351
|
};
|
|
351
352
|
|
|
352
353
|
type PuckContext = {
|
|
@@ -531,6 +532,7 @@ interface FieldMetadata extends Metadata {
|
|
|
531
532
|
type ItemWithId = {
|
|
532
533
|
_arrayId: string;
|
|
533
534
|
_originalIndex: number;
|
|
535
|
+
_currentIndex: number;
|
|
534
536
|
};
|
|
535
537
|
type ArrayState = {
|
|
536
538
|
items: ItemWithId[];
|
|
@@ -541,6 +543,7 @@ type UiState = {
|
|
|
541
543
|
rightSideBarVisible: boolean;
|
|
542
544
|
leftSideBarWidth?: number | null;
|
|
543
545
|
rightSideBarWidth?: number | null;
|
|
546
|
+
mobilePanelExpanded?: boolean;
|
|
544
547
|
itemSelector: ItemSelector | null;
|
|
545
548
|
arrayState: Record<string, ArrayState | undefined>;
|
|
546
549
|
previewMode: "interactive" | "edit";
|
|
@@ -553,7 +556,7 @@ type UiState = {
|
|
|
553
556
|
isDragging: boolean;
|
|
554
557
|
viewports: {
|
|
555
558
|
current: {
|
|
556
|
-
width: number;
|
|
559
|
+
width: number | "100%";
|
|
557
560
|
height: number | "auto";
|
|
558
561
|
};
|
|
559
562
|
controlsVisible: boolean;
|
|
@@ -563,6 +566,9 @@ type UiState = {
|
|
|
563
566
|
focus?: string | null;
|
|
564
567
|
metadata?: Record<string, any>;
|
|
565
568
|
};
|
|
569
|
+
plugin: {
|
|
570
|
+
current: string | null;
|
|
571
|
+
};
|
|
566
572
|
};
|
|
567
573
|
type AppState<UserData extends Data = Data> = {
|
|
568
574
|
data: UserData;
|
|
@@ -606,6 +612,15 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
|
606
612
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
607
613
|
never
|
|
608
614
|
] ? False : True;
|
|
615
|
+
type RenderFunc<Props extends {
|
|
616
|
+
[key: string]: any;
|
|
617
|
+
} = {
|
|
618
|
+
children: ReactNode;
|
|
619
|
+
}> = (props: Props) => ReactElement;
|
|
620
|
+
type PluginInternal = Plugin & {
|
|
621
|
+
mobileOnly?: boolean;
|
|
622
|
+
desktopOnly?: boolean;
|
|
623
|
+
};
|
|
609
624
|
|
|
610
625
|
type MapFnParams<ThisField = Field> = {
|
|
611
626
|
value: any;
|
|
@@ -629,11 +644,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
629
644
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
630
645
|
}>;
|
|
631
646
|
|
|
632
|
-
type RenderFunc<Props extends {
|
|
633
|
-
[key: string]: any;
|
|
634
|
-
} = {
|
|
635
|
-
children: ReactNode;
|
|
636
|
-
}> = (props: Props) => ReactElement;
|
|
637
647
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
638
648
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
639
649
|
type OverridesGeneric<Shape extends {
|
|
@@ -705,7 +715,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
705
715
|
|
|
706
716
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
707
717
|
type Viewport = {
|
|
708
|
-
width: number;
|
|
718
|
+
width: number | "100%";
|
|
709
719
|
height?: number | "auto";
|
|
710
720
|
label?: string;
|
|
711
721
|
icon?: iconTypes | ReactNode;
|
|
@@ -725,8 +735,13 @@ type IframeConfig = {
|
|
|
725
735
|
};
|
|
726
736
|
type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
|
|
727
737
|
type Plugin<UserConfig extends Config = Config> = {
|
|
738
|
+
name?: string;
|
|
739
|
+
label?: string;
|
|
740
|
+
icon?: ReactNode;
|
|
741
|
+
render?: () => ReactElement;
|
|
728
742
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
729
743
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
744
|
+
mobilePanelHeight?: "toggle" | "min-content";
|
|
730
745
|
};
|
|
731
746
|
type History<D = any> = {
|
|
732
747
|
state: D;
|
|
@@ -819,30 +834,4 @@ type PuckAction = {
|
|
|
819
834
|
recordHistory?: boolean;
|
|
820
835
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
|
821
836
|
|
|
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 };
|
|
837
|
+
export { type ComponentConfigParams as $, type AppState as A, type FieldTransformFnParams as B, type Config as C, type Data as D, type FieldTransformFn as E, type Fields as F, overrideKeys as G, type History as H, type IframeConfig as I, type OverrideKey as J, type FieldRenderFunctions as K, type ItemWithId as L, type Metadata as M, type ArrayState as N, type OnAction as O, type PrivateAppState as P, type SlotComponent as Q, type RootData as R, type Slot as S, type PuckComponent as T, type UserGenerics as U, type Viewports as V, type WithId as W, type ComponentConfigExtensions as X, type RootConfig as Y, type ExtractConfigParams as Z, type ConfigParams as _, type PuckAction as a, type BaseData as a0, type RootDataWithoutProps as a1, type ComponentDataOptionalId as a2, type MappedItem as a3, type ComponentDataMap as a4, type PuckMetadata as a5, type ComponentMetadata as a6, type FieldMetadata as a7, type BaseField as a8, type TextField as a9, type NumberField as aa, type TextareaField as ab, type SelectField as ac, type RadioField as ad, type ArrayField as ae, type ObjectField as af, type Adaptor as ag, type ExternalFieldWithAdaptor as ah, type CacheOpts as ai, type ExternalField as aj, type CustomFieldRender as ak, type CustomField as al, type SlotField as am, type PuckContext as an, type DefaultRootRenderProps as ao, type DefaultRootProps as ap, type WithPuckProps as aq, type AsFieldProps as ar, type WithChildren as as, type ExtractField as at, 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 PluginInternal as u, type WithSlotProps as v, type RichText as w, type Direction as x, type DragAxis as y, type Viewport as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, CSSProperties, ReactNode, ElementType, JSX } from 'react';
|
|
1
|
+
import { ReactElement, CSSProperties, ReactNode, ElementType, Ref, JSX } from 'react';
|
|
2
2
|
import { EditorStateSnapshot, Editor, Extensions } from '@tiptap/react';
|
|
3
3
|
import { BlockquoteOptions } from '@tiptap/extension-blockquote';
|
|
4
4
|
import { BoldOptions } from '@tiptap/extension-bold';
|
|
@@ -80,7 +80,7 @@ declare const defaultEditorState: (ctx: EditorStateSnapshot, readOnly: boolean)
|
|
|
80
80
|
|
|
81
81
|
type RichTextSelector = (ctx: EditorStateSnapshot, readOnly: boolean) => Partial<Record<string, boolean>>;
|
|
82
82
|
type DefaultEditorState = ReturnType<typeof defaultEditorState>;
|
|
83
|
-
type EditorState<Selector extends RichTextSelector = RichTextSelector> = DefaultEditorState & Selector
|
|
83
|
+
type EditorState<Selector extends RichTextSelector = RichTextSelector> = DefaultEditorState & ReturnType<Selector> & Record<string, boolean | undefined>;
|
|
84
84
|
|
|
85
85
|
interface PuckRichTextOptions {
|
|
86
86
|
/**
|
|
@@ -223,14 +223,14 @@ interface RichtextField<UserSelector extends RichTextSelector = RichTextSelector
|
|
|
223
223
|
options?: Partial<PuckRichTextOptions>;
|
|
224
224
|
renderMenu?: (props: {
|
|
225
225
|
children: ReactNode;
|
|
226
|
-
editor: Editor;
|
|
227
|
-
editorState: EditorState<UserSelector
|
|
226
|
+
editor: Editor | null;
|
|
227
|
+
editorState: EditorState<UserSelector> | null;
|
|
228
228
|
readOnly: boolean;
|
|
229
229
|
}) => ReactNode;
|
|
230
230
|
renderInlineMenu?: (props: {
|
|
231
231
|
children: ReactNode;
|
|
232
|
-
editor: Editor;
|
|
233
|
-
editorState: EditorState<UserSelector
|
|
232
|
+
editor: Editor | null;
|
|
233
|
+
editorState: EditorState<UserSelector> | null;
|
|
234
234
|
readOnly: boolean;
|
|
235
235
|
}) => ReactNode;
|
|
236
236
|
tiptap?: {
|
|
@@ -347,6 +347,7 @@ type DropZoneProps = {
|
|
|
347
347
|
className?: string;
|
|
348
348
|
collisionAxis?: DragAxis;
|
|
349
349
|
as?: ElementType;
|
|
350
|
+
ref?: Ref<any>;
|
|
350
351
|
};
|
|
351
352
|
|
|
352
353
|
type PuckContext = {
|
|
@@ -531,6 +532,7 @@ interface FieldMetadata extends Metadata {
|
|
|
531
532
|
type ItemWithId = {
|
|
532
533
|
_arrayId: string;
|
|
533
534
|
_originalIndex: number;
|
|
535
|
+
_currentIndex: number;
|
|
534
536
|
};
|
|
535
537
|
type ArrayState = {
|
|
536
538
|
items: ItemWithId[];
|
|
@@ -541,6 +543,7 @@ type UiState = {
|
|
|
541
543
|
rightSideBarVisible: boolean;
|
|
542
544
|
leftSideBarWidth?: number | null;
|
|
543
545
|
rightSideBarWidth?: number | null;
|
|
546
|
+
mobilePanelExpanded?: boolean;
|
|
544
547
|
itemSelector: ItemSelector | null;
|
|
545
548
|
arrayState: Record<string, ArrayState | undefined>;
|
|
546
549
|
previewMode: "interactive" | "edit";
|
|
@@ -553,7 +556,7 @@ type UiState = {
|
|
|
553
556
|
isDragging: boolean;
|
|
554
557
|
viewports: {
|
|
555
558
|
current: {
|
|
556
|
-
width: number;
|
|
559
|
+
width: number | "100%";
|
|
557
560
|
height: number | "auto";
|
|
558
561
|
};
|
|
559
562
|
controlsVisible: boolean;
|
|
@@ -563,6 +566,9 @@ type UiState = {
|
|
|
563
566
|
focus?: string | null;
|
|
564
567
|
metadata?: Record<string, any>;
|
|
565
568
|
};
|
|
569
|
+
plugin: {
|
|
570
|
+
current: string | null;
|
|
571
|
+
};
|
|
566
572
|
};
|
|
567
573
|
type AppState<UserData extends Data = Data> = {
|
|
568
574
|
data: UserData;
|
|
@@ -606,6 +612,15 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
|
606
612
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
607
613
|
never
|
|
608
614
|
] ? False : True;
|
|
615
|
+
type RenderFunc<Props extends {
|
|
616
|
+
[key: string]: any;
|
|
617
|
+
} = {
|
|
618
|
+
children: ReactNode;
|
|
619
|
+
}> = (props: Props) => ReactElement;
|
|
620
|
+
type PluginInternal = Plugin & {
|
|
621
|
+
mobileOnly?: boolean;
|
|
622
|
+
desktopOnly?: boolean;
|
|
623
|
+
};
|
|
609
624
|
|
|
610
625
|
type MapFnParams<ThisField = Field> = {
|
|
611
626
|
value: any;
|
|
@@ -629,11 +644,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
629
644
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
630
645
|
}>;
|
|
631
646
|
|
|
632
|
-
type RenderFunc<Props extends {
|
|
633
|
-
[key: string]: any;
|
|
634
|
-
} = {
|
|
635
|
-
children: ReactNode;
|
|
636
|
-
}> = (props: Props) => ReactElement;
|
|
637
647
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
638
648
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
639
649
|
type OverridesGeneric<Shape extends {
|
|
@@ -705,7 +715,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
705
715
|
|
|
706
716
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
707
717
|
type Viewport = {
|
|
708
|
-
width: number;
|
|
718
|
+
width: number | "100%";
|
|
709
719
|
height?: number | "auto";
|
|
710
720
|
label?: string;
|
|
711
721
|
icon?: iconTypes | ReactNode;
|
|
@@ -725,8 +735,13 @@ type IframeConfig = {
|
|
|
725
735
|
};
|
|
726
736
|
type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
|
|
727
737
|
type Plugin<UserConfig extends Config = Config> = {
|
|
738
|
+
name?: string;
|
|
739
|
+
label?: string;
|
|
740
|
+
icon?: ReactNode;
|
|
741
|
+
render?: () => ReactElement;
|
|
728
742
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
729
743
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
744
|
+
mobilePanelHeight?: "toggle" | "min-content";
|
|
730
745
|
};
|
|
731
746
|
type History<D = any> = {
|
|
732
747
|
state: D;
|
|
@@ -819,30 +834,4 @@ type PuckAction = {
|
|
|
819
834
|
recordHistory?: boolean;
|
|
820
835
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
|
821
836
|
|
|
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 };
|
|
837
|
+
export { type ComponentConfigParams as $, type AppState as A, type FieldTransformFnParams as B, type Config as C, type Data as D, type FieldTransformFn as E, type Fields as F, overrideKeys as G, type History as H, type IframeConfig as I, type OverrideKey as J, type FieldRenderFunctions as K, type ItemWithId as L, type Metadata as M, type ArrayState as N, type OnAction as O, type PrivateAppState as P, type SlotComponent as Q, type RootData as R, type Slot as S, type PuckComponent as T, type UserGenerics as U, type Viewports as V, type WithId as W, type ComponentConfigExtensions as X, type RootConfig as Y, type ExtractConfigParams as Z, type ConfigParams as _, type PuckAction as a, type BaseData as a0, type RootDataWithoutProps as a1, type ComponentDataOptionalId as a2, type MappedItem as a3, type ComponentDataMap as a4, type PuckMetadata as a5, type ComponentMetadata as a6, type FieldMetadata as a7, type BaseField as a8, type TextField as a9, type NumberField as aa, type TextareaField as ab, type SelectField as ac, type RadioField as ad, type ArrayField as ae, type ObjectField as af, type Adaptor as ag, type ExternalFieldWithAdaptor as ah, type CacheOpts as ai, type ExternalField as aj, type CustomFieldRender as ak, type CustomField as al, type SlotField as am, type PuckContext as an, type DefaultRootRenderProps as ao, type DefaultRootProps as ap, type WithPuckProps as aq, type AsFieldProps as ar, type WithChildren as as, type ExtractField as at, 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 PluginInternal as u, type WithSlotProps as v, type RichText as w, type Direction as x, type DragAxis as y, type Viewport as z };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mapFields
|
|
3
|
+
} from "./chunk-NLUHDYVR.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__async,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues,
|
|
8
|
+
init_react_import
|
|
9
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
10
|
+
|
|
11
|
+
// components/ViewportControls/default-viewports.ts
|
|
12
|
+
init_react_import();
|
|
13
|
+
var defaultViewports = [
|
|
14
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
15
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
16
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
|
17
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
// lib/resolve-component-data.ts
|
|
21
|
+
init_react_import();
|
|
22
|
+
|
|
23
|
+
// lib/get-changed.ts
|
|
24
|
+
init_react_import();
|
|
25
|
+
import { deepEqual } from "fast-equals";
|
|
26
|
+
var getChanged = (newItem, oldItem) => {
|
|
27
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
|
28
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
|
29
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
|
30
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
31
|
+
[item]: !deepEqual(oldItemProps[item], newItemProps[item])
|
|
32
|
+
});
|
|
33
|
+
}, {}) : {};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// lib/resolve-component-data.ts
|
|
37
|
+
import { deepEqual as deepEqual2 } from "fast-equals";
|
|
38
|
+
var cache = { lastChange: {} };
|
|
39
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
40
|
+
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
41
|
+
const resolvedItem = __spreadValues({}, item);
|
|
42
|
+
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
43
|
+
const id = "id" in item.props ? item.props.id : "root";
|
|
44
|
+
if (shouldRunResolver) {
|
|
45
|
+
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
|
46
|
+
if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
|
|
47
|
+
return { node: resolved, didChange: false };
|
|
48
|
+
}
|
|
49
|
+
const changed = getChanged(item, oldItem);
|
|
50
|
+
if (onResolveStart) {
|
|
51
|
+
onResolveStart(item);
|
|
52
|
+
}
|
|
53
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
|
54
|
+
changed,
|
|
55
|
+
lastData: oldItem,
|
|
56
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
57
|
+
trigger
|
|
58
|
+
});
|
|
59
|
+
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
60
|
+
if (Object.keys(readOnly).length) {
|
|
61
|
+
resolvedItem.readOnly = readOnly;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
let itemWithResolvedChildren = yield mapFields(
|
|
65
|
+
resolvedItem,
|
|
66
|
+
{
|
|
67
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
68
|
+
const content = value;
|
|
69
|
+
return yield Promise.all(
|
|
70
|
+
content.map(
|
|
71
|
+
(childItem) => __async(null, null, function* () {
|
|
72
|
+
return (yield resolveComponentData(
|
|
73
|
+
childItem,
|
|
74
|
+
config,
|
|
75
|
+
metadata,
|
|
76
|
+
onResolveStart,
|
|
77
|
+
onResolveEnd,
|
|
78
|
+
trigger
|
|
79
|
+
)).node;
|
|
80
|
+
})
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
})
|
|
84
|
+
},
|
|
85
|
+
config
|
|
86
|
+
);
|
|
87
|
+
if (shouldRunResolver && onResolveEnd) {
|
|
88
|
+
onResolveEnd(resolvedItem);
|
|
89
|
+
}
|
|
90
|
+
cache.lastChange[id] = {
|
|
91
|
+
item,
|
|
92
|
+
resolved: itemWithResolvedChildren
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
node: itemWithResolvedChildren,
|
|
96
|
+
didChange: !deepEqual2(item, itemWithResolvedChildren)
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// store/default-app-state.ts
|
|
101
|
+
init_react_import();
|
|
102
|
+
var defaultAppState = {
|
|
103
|
+
data: { content: [], root: {}, zones: {} },
|
|
104
|
+
ui: {
|
|
105
|
+
leftSideBarVisible: true,
|
|
106
|
+
rightSideBarVisible: true,
|
|
107
|
+
arrayState: {},
|
|
108
|
+
itemSelector: null,
|
|
109
|
+
componentList: {},
|
|
110
|
+
isDragging: false,
|
|
111
|
+
previewMode: "edit",
|
|
112
|
+
viewports: {
|
|
113
|
+
current: {
|
|
114
|
+
width: defaultViewports[0].width,
|
|
115
|
+
height: defaultViewports[0].height || "auto"
|
|
116
|
+
},
|
|
117
|
+
options: [],
|
|
118
|
+
controlsVisible: true
|
|
119
|
+
},
|
|
120
|
+
field: { focus: null },
|
|
121
|
+
plugin: { current: null }
|
|
122
|
+
},
|
|
123
|
+
indexes: {
|
|
124
|
+
nodes: {},
|
|
125
|
+
zones: {}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
defaultViewports,
|
|
131
|
+
getChanged,
|
|
132
|
+
resolveComponentData,
|
|
133
|
+
defaultAppState
|
|
134
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_react_import
|
|
3
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
4
|
+
|
|
5
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css#css-module
|
|
6
|
+
init_react_import();
|
|
7
|
+
var styles_module_default = { "RichTextEditor": "_RichTextEditor_1elol_1", "RichTextEditor--editor": "_RichTextEditor--editor_1elol_50", "RichTextEditor--disabled": "_RichTextEditor--disabled_1elol_106", "RichTextEditor--isActive": "_RichTextEditor--isActive_1elol_110", "RichTextEditor-menu": "_RichTextEditor-menu_1elol_116" };
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
styles_module_default
|
|
11
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
styles_module_default
|
|
3
|
+
} from "./chunk-CSSRLPHM.mjs";
|
|
4
|
+
import {
|
|
5
|
+
LoadedRichTextMenuInner
|
|
6
|
+
} from "./chunk-V7333LON.mjs";
|
|
7
|
+
import {
|
|
8
|
+
useAppStore,
|
|
9
|
+
useAppStoreApi
|
|
10
|
+
} from "./chunk-UUOBSXZR.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-GZ4L3XCF.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
|
+
};
|