@erxes/ui 4.0.0-v2.0 → 4.0.0-v2.2
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/README.md +11 -8
- package/dist/base.css +17 -4
- package/dist/components/accordion.d.ts +6 -7
- package/dist/components/accordion.js +8 -13
- package/dist/components/alert-dialog.d.ts +12 -11
- package/dist/components/alert-dialog.js +26 -29
- package/dist/components/alert.js +2 -2
- package/dist/components/avatar.d.ts +7 -5
- package/dist/components/avatar.js +30 -19
- package/dist/components/background-gradient-animation.d.ts +2 -11
- package/dist/components/background-gradient-animation.js +21 -50
- package/dist/components/badge.d.ts +3 -2
- package/dist/components/badge.js +36 -21
- package/dist/components/breadcrumb.d.ts +6 -4
- package/dist/components/breadcrumb.js +18 -14
- package/dist/components/button.d.ts +15 -7
- package/dist/components/button.js +46 -23
- package/dist/components/calendar.js +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/chart-config.d.ts +4 -18
- package/dist/components/chart-config.js +1 -6
- package/dist/components/charts.d.ts +1 -1
- package/dist/components/charts.js +20 -28
- package/dist/components/checkbox.d.ts +2 -3
- package/dist/components/checkbox.js +4 -6
- package/dist/components/choicebox-group.d.ts +1 -1
- package/dist/components/choicebox-group.js +5 -9
- package/dist/components/collapsible.d.ts +5 -9
- package/dist/components/collapsible.js +8 -25
- package/dist/components/color-picker.js +9 -8
- package/dist/components/combobox.d.ts +6 -6
- package/dist/components/combobox.js +19 -18
- package/dist/components/command-bar.js +22 -19
- package/dist/components/command.d.ts +18 -8
- package/dist/components/command.js +62 -26
- package/dist/components/context-menu.d.ts +17 -29
- package/dist/components/context-menu.js +20 -66
- package/dist/components/copy-text.js +7 -11
- package/dist/components/date-picker.js +21 -18
- package/dist/components/date-text-input.js +3 -3
- package/dist/components/date-time-input.d.ts +12 -0
- package/dist/components/date-time-input.js +21 -0
- package/dist/components/dialog.d.ts +17 -12
- package/dist/components/dialog.js +36 -32
- package/dist/components/drag-handle.d.ts +2 -2
- package/dist/components/drag-handle.js +0 -1
- package/dist/components/dropdown-menu.d.ts +35 -16
- package/dist/components/dropdown-menu.js +78 -37
- package/dist/components/empty.js +2 -2
- package/dist/components/form.d.ts +15 -6
- package/dist/components/form.js +34 -17
- package/dist/components/hover-card.d.ts +6 -5
- package/dist/components/hover-card.js +18 -9
- package/dist/components/info-card.js +5 -6
- package/dist/components/input-group.d.ts +22 -0
- package/dist/components/input-group.js +42 -0
- package/dist/components/input.d.ts +11 -2
- package/dist/components/input.js +21 -8
- package/dist/components/kbd.js +2 -2
- package/dist/components/label.d.ts +3 -3
- package/dist/components/label.js +9 -6
- package/dist/components/multiselect.d.ts +21 -6
- package/dist/components/multiselect.js +81 -127
- package/dist/components/on-demand.d.ts +17 -0
- package/dist/components/on-demand.js +42 -0
- package/dist/components/popover.d.ts +18 -9
- package/dist/components/popover.js +38 -13
- package/dist/components/radio-group.d.ts +5 -5
- package/dist/components/radio-group.js +23 -29
- package/dist/components/resizable.d.ts +8 -21
- package/dist/components/resizable.js +5 -10
- package/dist/components/scroll-area.d.ts +12 -7
- package/dist/components/scroll-area.js +18 -18
- package/dist/components/select.d.ts +22 -14
- package/dist/components/select.js +90 -51
- package/dist/components/separator.d.ts +3 -3
- package/dist/components/separator.js +8 -12
- package/dist/components/sheet.d.ts +15 -11
- package/dist/components/sheet.js +66 -50
- package/dist/components/sidebar/context.js +4 -4
- package/dist/components/sidebar/group.d.ts +9 -8
- package/dist/components/sidebar/group.js +18 -13
- package/dist/components/sidebar/layout.d.ts +7 -2
- package/dist/components/sidebar/layout.js +11 -3
- package/dist/components/sidebar/menu-sub.d.ts +4 -3
- package/dist/components/sidebar/menu-sub.js +13 -13
- package/dist/components/sidebar/menu.d.ts +6 -6
- package/dist/components/sidebar/menu.js +28 -40
- package/dist/components/sidebar/panel.js +38 -21
- package/dist/components/sidebar/root.d.ts +1 -2
- package/dist/components/sidebar/root.js +7 -8
- package/dist/components/sidebar/trigger.js +1 -1
- package/dist/components/sidebar-tree-indicator.js +4 -4
- package/dist/components/skeleton.d.ts +7 -1
- package/dist/components/skeleton.js +18 -2
- package/dist/components/slider.d.ts +5 -5
- package/dist/components/slider.js +20 -11
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/spinner.js +24 -188
- package/dist/components/string-array.js +2 -2
- package/dist/components/switch.d.ts +2 -3
- package/dist/components/switch.js +6 -8
- package/dist/components/table.d.ts +14 -3
- package/dist/components/table.js +33 -9
- package/dist/components/tabs.d.ts +34 -8
- package/dist/components/tabs.js +96 -23
- package/dist/components/text-overflow.d.ts +8 -10
- package/dist/components/text-overflow.js +33 -39
- package/dist/components/textarea.d.ts +8 -1
- package/dist/components/textarea.js +24 -3
- package/dist/components/toaster.d.ts +1 -0
- package/dist/components/toaster.js +41 -20
- package/dist/components/toggle-group.d.ts +5 -3
- package/dist/components/toggle-group.js +11 -12
- package/dist/components/toggle.d.ts +3 -4
- package/dist/components/toggle.js +6 -6
- package/dist/components/tooltip.d.ts +7 -6
- package/dist/components/tooltip.js +18 -8
- package/dist/components/upload.d.ts +7 -2
- package/dist/components/upload.js +28 -7
- package/dist/components.css +325 -0
- package/dist/constants/CountryPhoneCodes.d.ts +1 -1
- package/dist/constants/CountryPhoneCodes.js +2 -2
- package/dist/federation.d.ts +13 -0
- package/dist/federation.js +28 -0
- package/dist/fonts.css +1 -1
- package/dist/hooks/use-confirm.js +17 -19
- package/dist/hooks/use-toast.d.ts +14 -16
- package/dist/hooks/use-toast.js +13 -108
- package/dist/index.d.ts +13 -8
- package/dist/index.js +11 -7
- package/dist/lib/cn-tables.d.ts +27 -0
- package/dist/lib/cn-tables.js +128 -0
- package/dist/lib/utils.d.ts +14 -2
- package/dist/lib/utils.js +14 -6
- package/dist/modules/attachments/attachment-media.js +56 -56
- package/dist/modules/blocks/components/BarcodeAttribute.js +11 -8
- package/dist/modules/blocks/components/BarcodeSizeSettings.js +5 -6
- package/dist/modules/blocks/components/BlockEditor.js +14 -4
- package/dist/modules/blocks/components/BlockEditorInlineContent.d.ts +26 -36
- package/dist/modules/blocks/components/BlockEditorInlineContent.js +2 -2
- package/dist/modules/blocks/components/BlockToolbar.d.ts +6 -0
- package/dist/modules/blocks/components/BlockToolbar.js +19 -4
- package/dist/modules/blocks/components/CustomFileBlock.d.ts +13 -39
- package/dist/modules/blocks/components/CustomFileBlock.js +8 -9
- package/dist/modules/blocks/components/CustomImageBlock.d.ts +28 -78
- package/dist/modules/blocks/components/CustomImageBlock.js +20 -99
- package/dist/modules/blocks/components/CustomVideoBlock.d.ts +26 -63
- package/dist/modules/blocks/components/CustomVideoBlock.js +10 -8
- package/dist/modules/blocks/components/DocumentPlaceholderBlock.d.ts +13 -39
- package/dist/modules/blocks/components/DocumentPlaceholderBlock.js +1 -2
- package/dist/modules/blocks/components/Editor.d.ts +1 -1
- package/dist/modules/blocks/components/Editor.js +5 -4
- package/dist/modules/blocks/components/FontFamilyButton.js +25 -21
- package/dist/modules/blocks/components/FontSizeButton.js +26 -22
- package/dist/modules/blocks/components/GalleryBlock.d.ts +7 -25
- package/dist/modules/blocks/components/GalleryBlock.js +2 -35
- package/dist/modules/blocks/components/GalleryBlockContent.js +8 -3
- package/dist/modules/blocks/components/GalleryBlockParts.js +23 -21
- package/dist/modules/blocks/components/GalleryExternalHtml.d.ts +2 -0
- package/dist/modules/blocks/components/GalleryExternalHtml.js +36 -0
- package/dist/modules/blocks/components/ImageExternalHtml.d.ts +2 -0
- package/dist/modules/blocks/components/ImageExternalHtml.js +51 -0
- package/dist/modules/blocks/components/ImageStyleButton.js +22 -18
- package/dist/modules/blocks/components/LazyEditor.d.ts +9 -0
- package/dist/modules/blocks/components/LazyEditor.js +14 -0
- package/dist/modules/blocks/components/MediaBlockWrapper.d.ts +24 -0
- package/dist/modules/blocks/components/MediaBlockWrapper.js +98 -0
- package/dist/modules/blocks/components/SlashMenu.js +2 -2
- package/dist/modules/blocks/components/SuggestionMenu.js +5 -6
- package/dist/modules/blocks/components/TableColorPicker.d.ts +1 -1
- package/dist/modules/blocks/components/TableColorPicker.js +20 -27
- package/dist/modules/blocks/components/TableHandleWithRemove.js +34 -50
- package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.d.ts +2 -2
- package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.js +3 -4
- package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.d.ts +2 -2
- package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.js +3 -4
- package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.d.ts +3 -0
- package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.js +8 -0
- package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuDropdown.js +1 -1
- package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.d.ts +2 -2
- package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.js +5 -16
- package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.d.ts +1 -1
- package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.js +24 -20
- package/dist/modules/blocks/constant/blockEditorSchema.d.ts +268 -653
- package/dist/modules/blocks/constant/blockEditorSchema.js +33 -41
- package/dist/modules/blocks/constant/galleryBlockConfig.d.ts +1 -2
- package/dist/modules/blocks/constant/imageBlockConfig.d.ts +46 -0
- package/dist/modules/blocks/constant/imageBlockConfig.js +39 -0
- package/dist/modules/blocks/constant/toolbar/editorUIComponents.d.ts +2 -3
- package/dist/modules/blocks/constant/toolbar/editorUIComponents.js +7 -9
- package/dist/modules/blocks/hooks/toolbar/useCodeActive.js +5 -7
- package/dist/modules/blocks/hooks/toolbar/useStringStyle.d.ts +9 -0
- package/dist/modules/blocks/hooks/toolbar/useStringStyle.js +27 -0
- package/dist/modules/blocks/hooks/useBlockEditor.d.ts +2 -0
- package/dist/modules/blocks/hooks/useBlockEditor.js +9 -3
- package/dist/modules/blocks/hooks/useEditorValue.d.ts +2 -1
- package/dist/modules/blocks/hooks/useEditorValue.js +8 -19
- package/dist/modules/blocks/types/TextEditor.d.ts +3 -1
- package/dist/modules/blocks/types/toolbar/ImageStyleOption.d.ts +1 -1
- package/dist/modules/blocks/utils/getSlashMenuItems.js +0 -15
- package/dist/modules/blocks/utils/parseBlocks.d.ts +3 -1
- package/dist/modules/blocks/utils/parseBlocks.js +14 -1
- package/dist/modules/display/components/EmailDisplay.js +26 -27
- package/dist/modules/display/components/PhoneDisplay.js +2 -2
- package/dist/modules/display/components/RelativeDateDisplay.d.ts +2 -2
- package/dist/modules/display/components/RelativeDateDisplay.js +7 -10
- package/dist/modules/filter/components/FilterBar.js +6 -6
- package/dist/modules/filter/components/FilterDialog.js +13 -20
- package/dist/modules/filter/components/FilterPopover.js +20 -28
- package/dist/modules/hotkey/components/PopoverScoped.d.ts +5 -4
- package/dist/modules/hotkey/components/PopoverScoped.js +5 -5
- package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +3 -3
- package/dist/modules/hotkey/hooks/useScopedHotkeys.js +15 -24
- package/dist/modules/icons/components/IconComponent.d.ts +1 -1
- package/dist/modules/icons/components/IconPicker.js +15 -14
- package/dist/modules/inputs/components/ContactFieldParts.js +13 -14
- package/dist/modules/inputs/components/EmailFieldForm.js +2 -3
- package/dist/modules/inputs/components/FullNameField.js +6 -4
- package/dist/modules/inputs/components/PhoneFieldForm.js +2 -1
- package/dist/modules/layout/components/AppLayout.js +18 -20
- package/dist/modules/layout/components/AppLayoutPageSlot.js +1 -1
- package/dist/modules/layout/components/AppLayoutResizeHandle.js +1 -1
- package/dist/modules/layout/components/Page.d.ts +6 -1
- package/dist/modules/layout/components/Page.js +11 -3
- package/dist/modules/layout/components/PageHeader.d.ts +10 -3
- package/dist/modules/layout/components/PageHeader.js +23 -5
- package/dist/modules/navigation-menu/components/NavigationMenu.js +12 -15
- package/dist/modules/pickers/EntityPicker.d.ts +30 -0
- package/dist/modules/pickers/EntityPicker.js +60 -0
- package/dist/modules/pickers/SelectMember.d.ts +41 -0
- package/dist/modules/pickers/SelectMember.js +122 -0
- package/dist/modules/pickers/members.d.ts +30 -0
- package/dist/modules/pickers/members.js +18 -0
- package/dist/modules/record-field/components/NumberField.d.ts +2 -2
- package/dist/modules/record-field/components/NumberField.js +22 -25
- package/dist/modules/record-field/components/TextField.d.ts +3 -3
- package/dist/modules/record-field/components/TextField.js +25 -28
- package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +3 -1
- package/dist/modules/record-field/meta-inputs/components/PhoneInput.js +18 -12
- package/dist/modules/record-table/components/CheckboxColumn.d.ts +4 -3
- package/dist/modules/record-table/components/CheckboxColumn.js +52 -35
- package/dist/modules/record-table/components/MoreColumn.js +4 -3
- package/dist/modules/record-table/components/RecordTable.d.ts +3 -2
- package/dist/modules/record-table/components/RecordTable.js +2 -1
- package/dist/modules/record-table/components/RecordTableCell.d.ts +6 -3
- package/dist/modules/record-table/components/RecordTableCell.js +17 -11
- package/dist/modules/record-table/components/RecordTableCellInline.d.ts +15 -4
- package/dist/modules/record-table/components/RecordTableCellInline.js +48 -24
- package/dist/modules/record-table/components/RecordTableColumnSelector.d.ts +1 -2
- package/dist/modules/record-table/components/RecordTableColumnSelector.js +48 -45
- package/dist/modules/record-table/components/RecordTableContainer.d.ts +8 -3
- package/dist/modules/record-table/components/RecordTableContainer.js +28 -16
- package/dist/modules/record-table/components/RecordTableCursor.js +4 -4
- package/dist/modules/record-table/components/RecordTableHead.d.ts +9 -4
- package/dist/modules/record-table/components/RecordTableHead.js +40 -34
- package/dist/modules/record-table/components/RecordTableHeader.js +24 -15
- package/dist/modules/record-table/components/RecordTableProvider.d.ts +30 -7
- package/dist/modules/record-table/components/RecordTableProvider.js +32 -22
- package/dist/modules/record-table/components/RecordTableRoot.d.ts +2 -1
- package/dist/modules/record-table/components/RecordTableRoot.js +7 -12
- package/dist/modules/record-table/components/RecordTableRow.d.ts +8 -1
- package/dist/modules/record-table/components/RecordTableRow.js +13 -12
- package/dist/modules/record-table/components/RecordTableRowList.d.ts +6 -1
- package/dist/modules/record-table/components/RecordTableRowList.js +28 -20
- package/dist/modules/record-table/components/RecordTableRowSkeleton.js +8 -12
- package/dist/modules/record-table/hooks/useColumnLayout.d.ts +2 -2
- package/dist/modules/record-table/hooks/useColumnLayout.js +8 -5
- package/dist/modules/record-table/hooks/useTablePreferences.d.ts +5 -5
- package/dist/modules/record-table/hooks/useTablePreferences.js +3 -3
- package/dist/modules/record-table/utils/columnLayout.d.ts +4 -4
- package/dist/modules/record-table/utils/columnLayout.js +7 -7
- package/dist/modules/record-table/utils/columnUtils.d.ts +3 -2
- package/dist/modules/record-table/utils/rowFields.d.ts +1 -0
- package/dist/modules/record-table/utils/rowFields.js +10 -9
- package/dist/state/sidebarPanelState.d.ts +5 -1
- package/dist/state/sidebarPanelState.js +4 -1
- package/dist/styles.css +3 -0
- package/dist/theme.css +104 -70
- package/dist/utils/file-storage.d.ts +1 -1
- package/dist/utils/plugin-runtime.d.ts +1 -1
- package/dist/utils/plugin-styles.d.ts +6 -0
- package/dist/utils/plugin-styles.js +53 -0
- package/dist/utils/record-timeline.d.ts +1 -1
- package/dist/utils/record-timeline.js +1 -1
- package/package.json +27 -22
- package/dist/components/multiselect-options.d.ts +0 -16
- package/dist/components/multiselect-options.js +0 -13
- package/dist/components/multiselect-parts.d.ts +0 -23
- package/dist/components/multiselect-parts.js +0 -62
- package/dist/components/multiselect-state.d.ts +0 -66
- package/dist/components/multiselect-state.js +0 -131
- package/dist/components/time-picker.d.ts +0 -10
- package/dist/components/time-picker.js +0 -33
- package/dist/components/toasts.d.ts +0 -21
- package/dist/components/toasts.js +0 -69
- package/dist/modules/blocks/hooks/toolbar/useFontFamily.d.ts +0 -2
- package/dist/modules/blocks/hooks/toolbar/useFontFamily.js +0 -24
- package/dist/modules/blocks/hooks/toolbar/useFontSize.d.ts +0 -2
- package/dist/modules/blocks/hooks/toolbar/useFontSize.js +0 -24
- package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.d.ts +0 -6
- package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.js +0 -0
- package/dist/modules/blocks/types/toolbar/FontFamily.d.ts +0 -5
- package/dist/modules/blocks/types/toolbar/FontFamily.js +0 -0
- package/dist/modules/blocks/types/toolbar/FontSize.d.ts +0 -5
- package/dist/modules/blocks/types/toolbar/FontSize.js +0 -0
- package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.d.ts +0 -4
- package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.js +0 -0
- package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.d.ts +0 -3
- package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.js +0 -0
- package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.d.ts +0 -2
- package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.js +0 -30
- package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.d.ts +0 -2
- package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.js +0 -41
- package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.d.ts +0 -9
- package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.js +0 -15
- package/dist/modules/hotkey/states/internal/pendingHotkeyState.d.ts +0 -4
- package/dist/modules/hotkey/states/internal/pendingHotkeyState.js +0 -4
|
@@ -1,64 +1,27 @@
|
|
|
1
|
-
export declare const customVideoBlock: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
values: readonly ["left", "center", "right", "justify"];
|
|
8
|
-
};
|
|
9
|
-
backgroundColor: {
|
|
10
|
-
default: "default";
|
|
11
|
-
};
|
|
12
|
-
name: {
|
|
13
|
-
default: "";
|
|
14
|
-
};
|
|
15
|
-
url: {
|
|
16
|
-
default: "";
|
|
17
|
-
};
|
|
18
|
-
caption: {
|
|
19
|
-
default: "";
|
|
20
|
-
};
|
|
21
|
-
showPreview: {
|
|
22
|
-
default: true;
|
|
23
|
-
};
|
|
24
|
-
previewWidth: {
|
|
25
|
-
default: undefined;
|
|
26
|
-
type: "number";
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
content: "none";
|
|
30
|
-
isFileBlock: true;
|
|
31
|
-
fileBlockAccept: string[];
|
|
1
|
+
export declare const customVideoBlock: (options?: Partial<{
|
|
2
|
+
icon: string;
|
|
3
|
+
}> | undefined) => import("@blocknote/core").BlockSpec<"video", {
|
|
4
|
+
textAlignment: {
|
|
5
|
+
default: "left";
|
|
6
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
32
7
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
default: true;
|
|
54
|
-
};
|
|
55
|
-
previewWidth: {
|
|
56
|
-
default: undefined;
|
|
57
|
-
type: "number";
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
content: "none";
|
|
61
|
-
isFileBlock: true;
|
|
62
|
-
fileBlockAccept: string[];
|
|
63
|
-
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
64
|
-
};
|
|
8
|
+
backgroundColor: {
|
|
9
|
+
default: "default";
|
|
10
|
+
};
|
|
11
|
+
name: {
|
|
12
|
+
default: "";
|
|
13
|
+
};
|
|
14
|
+
url: {
|
|
15
|
+
default: "";
|
|
16
|
+
};
|
|
17
|
+
caption: {
|
|
18
|
+
default: "";
|
|
19
|
+
};
|
|
20
|
+
showPreview: {
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
previewWidth: {
|
|
24
|
+
default: undefined;
|
|
25
|
+
type: "number";
|
|
26
|
+
};
|
|
27
|
+
}, "none">;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { MediaBlockWrapper } from "./MediaBlockWrapper.js";
|
|
1
2
|
import { getCloudflareStreamBase, parseVideoEmbedUrl } from "../../../utils/videoEmbed.js";
|
|
2
3
|
import { IconVideo } from "@tabler/icons-react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { FigureWithCaption,
|
|
5
|
-
import {
|
|
5
|
+
import { FigureWithCaption, VideoBlock, VideoToExternalHTML, createReactBlockSpec } from "@blocknote/react";
|
|
6
|
+
import { createVideoBlockConfig, videoParse } from "@blocknote/core";
|
|
6
7
|
// src/modules/blocks/components/CustomVideoBlock.tsx
|
|
8
|
+
const parseVideoElement = videoParse({});
|
|
7
9
|
const getVideoEmbedSource = (url) => {
|
|
8
10
|
const embed = parseVideoEmbedUrl(url);
|
|
9
11
|
const streamBase = getCloudflareStreamBase(url);
|
|
@@ -22,14 +24,12 @@ const EmbeddedVideo = ({ src, title }) => /* @__PURE__ */ jsx("iframe", {
|
|
|
22
24
|
contentEditable: false
|
|
23
25
|
});
|
|
24
26
|
const CustomVideoBlockContent = (props) => {
|
|
25
|
-
const fileEditor = useBlockNoteEditor();
|
|
26
27
|
const src = getVideoEmbedSource(props.block.props.url);
|
|
27
28
|
if (!src) return /* @__PURE__ */ jsx(VideoBlock, { ...props });
|
|
28
|
-
return /* @__PURE__ */ jsx(
|
|
29
|
+
return /* @__PURE__ */ jsx(MediaBlockWrapper, {
|
|
29
30
|
block: props.block,
|
|
30
|
-
editor: fileEditor,
|
|
31
|
-
buttonText: props.editor.dictionary.file_blocks.video.add_button_text,
|
|
32
31
|
buttonIcon: /* @__PURE__ */ jsx(IconVideo, { size: 24 }),
|
|
32
|
+
onResize: (previewWidth) => props.editor.updateBlock(props.block, { props: { previewWidth } }),
|
|
33
33
|
children: /* @__PURE__ */ jsx(EmbeddedVideo, {
|
|
34
34
|
src,
|
|
35
35
|
title: props.block.props.name
|
|
@@ -48,11 +48,13 @@ const ExternalVideoHtml = (props) => {
|
|
|
48
48
|
children: video
|
|
49
49
|
}) : video;
|
|
50
50
|
};
|
|
51
|
-
const customVideoBlock = createReactBlockSpec(
|
|
51
|
+
const customVideoBlock = createReactBlockSpec(createVideoBlockConfig, {
|
|
52
|
+
meta: { fileBlockAccept: ["video/*"] },
|
|
53
|
+
runsBefore: ["file"],
|
|
52
54
|
render: CustomVideoBlockContent,
|
|
53
55
|
toExternalHTML: ExternalVideoHtml,
|
|
54
56
|
parse: (element) => {
|
|
55
|
-
const video =
|
|
57
|
+
const video = parseVideoElement(element);
|
|
56
58
|
if (video) return video;
|
|
57
59
|
if (element.tagName === "IFRAME" && element.closest("figure")) return;
|
|
58
60
|
const iframe = element.tagName === "IFRAME" ? element : element.tagName === "FIGURE" ? element.querySelector("iframe") : null;
|
|
@@ -1,40 +1,14 @@
|
|
|
1
|
-
export declare const documentPlaceholderBlock: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
propSchema: {
|
|
5
|
-
documentId: {
|
|
6
|
-
default: string;
|
|
7
|
-
};
|
|
8
|
-
documentName: {
|
|
9
|
-
default: string;
|
|
10
|
-
};
|
|
11
|
-
documentCode: {
|
|
12
|
-
default: string;
|
|
13
|
-
};
|
|
14
|
-
documentPreview: {
|
|
15
|
-
default: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
content: 'none';
|
|
19
|
-
isFileBlock: false;
|
|
1
|
+
export declare const documentPlaceholderBlock: (options?: undefined) => import("@blocknote/core").BlockSpec<"documentPlaceholder", {
|
|
2
|
+
documentId: {
|
|
3
|
+
default: string;
|
|
20
4
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
default: string;
|
|
32
|
-
};
|
|
33
|
-
documentPreview: {
|
|
34
|
-
default: string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
content: 'none';
|
|
38
|
-
isFileBlock: false;
|
|
39
|
-
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
40
|
-
};
|
|
5
|
+
documentName: {
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
documentCode: {
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
documentPreview: {
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
}, "none">;
|
|
@@ -10,8 +10,7 @@ const documentPlaceholderBlockConfig = {
|
|
|
10
10
|
documentCode: { default: "" },
|
|
11
11
|
documentPreview: { default: "" }
|
|
12
12
|
},
|
|
13
|
-
content: "none"
|
|
14
|
-
isFileBlock: false
|
|
13
|
+
content: "none"
|
|
15
14
|
};
|
|
16
15
|
const DocumentPlaceholderBlockContent = ({ block }) => {
|
|
17
16
|
const { documentId, documentName, documentCode, documentPreview } = block.props;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { BlockEditorProps, IEditorProps } from "../types/TextEditor.js";
|
|
2
|
-
export declare const Editor: ({ onChange, initialContent, scope, className, isHTML, uploadFile, ...props }: Omit<BlockEditorProps, 'editor' | 'onChange'> & IEditorProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const Editor: ({ onChange, initialContent, scope, className, isHTML, uploadFile, label, variant, ...props }: Omit<BlockEditorProps, 'editor' | 'onChange'> & IEditorProps) => import("react").JSX.Element;
|
|
@@ -5,10 +5,11 @@ import { cn } from "../../../lib/utils.js";
|
|
|
5
5
|
import { parseBlocks } from "../utils/parseBlocks.js";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
// src/modules/blocks/components/Editor.tsx
|
|
8
|
-
const Editor = ({ onChange, initialContent, scope, className, isHTML = false, uploadFile, ...props }) => {
|
|
8
|
+
const Editor = ({ onChange, initialContent, scope, className, isHTML = false, uploadFile, label, variant = "outline", ...props }) => {
|
|
9
9
|
const editor = useBlockEditor({
|
|
10
10
|
initialContent: parseBlocks(initialContent ?? "") || void 0,
|
|
11
|
-
uploadFile
|
|
11
|
+
uploadFile,
|
|
12
|
+
label
|
|
12
13
|
});
|
|
13
14
|
const handleChange = useEditorValue({
|
|
14
15
|
editor,
|
|
@@ -17,8 +18,8 @@ const Editor = ({ onChange, initialContent, scope, className, isHTML = false, up
|
|
|
17
18
|
onChange
|
|
18
19
|
});
|
|
19
20
|
return /* @__PURE__ */ jsx(BlockEditor, {
|
|
20
|
-
variant
|
|
21
|
-
className: cn("min-w-0 w-full overflow-x-hidden overflow-y-auto h-28
|
|
21
|
+
variant,
|
|
22
|
+
className: cn("min-w-0 w-full overflow-x-hidden overflow-y-auto h-28 min-h-28", className),
|
|
22
23
|
...props,
|
|
23
24
|
editor,
|
|
24
25
|
onChange: handleChange
|
|
@@ -1,30 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useStringStyle } from "../hooks/toolbar/useStringStyle.js";
|
|
2
2
|
import { FONT_FAMILIES } from "../constant/toolbar/fontFamilies.js";
|
|
3
3
|
import { IconTypography } from "@tabler/icons-react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { useComponentsContext } from "@blocknote/react";
|
|
5
|
+
import { useComponentsContext, usePortalElement } from "@blocknote/react";
|
|
6
6
|
// src/modules/blocks/components/FontFamilyButton.tsx
|
|
7
7
|
const FontFamilyButton = () => {
|
|
8
8
|
const Components = useComponentsContext();
|
|
9
|
-
const
|
|
9
|
+
const portalElement = usePortalElement();
|
|
10
|
+
const { value: currentFont, isFileBlock, setValue: handleFontChange } = useStringStyle("fontFamily");
|
|
10
11
|
if (!Components || isFileBlock) return null;
|
|
11
|
-
return /* @__PURE__ */ jsxs(Components.Generic.Menu.Root, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
return /* @__PURE__ */ jsxs(Components.Generic.Menu.Root, {
|
|
13
|
+
portalElement,
|
|
14
|
+
children: [/* @__PURE__ */ jsx(Components.Generic.Menu.Trigger, { children: /* @__PURE__ */ jsx(Components.FormattingToolbar.Button, {
|
|
15
|
+
"data-test": "fontFamily",
|
|
16
|
+
className: "bn-button",
|
|
17
|
+
label: "Font",
|
|
18
|
+
mainTooltip: "Font Family",
|
|
19
|
+
icon: /* @__PURE__ */ jsx(IconTypography, { size: 16 })
|
|
20
|
+
}) }), /* @__PURE__ */ jsx(Components.Generic.Menu.Dropdown, {
|
|
21
|
+
className: "bn-menu-dropdown bn-drag-handle-menu",
|
|
22
|
+
children: FONT_FAMILIES.map((font) => /* @__PURE__ */ jsx(Components.Generic.Menu.Item, {
|
|
23
|
+
checked: currentFont === font.value,
|
|
24
|
+
onClick: () => handleFontChange(font.value),
|
|
25
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
26
|
+
className: "flex items-center gap-2 w-full font-(family-name:--font)",
|
|
27
|
+
style: { "--font": font.value },
|
|
28
|
+
children: font.name
|
|
29
|
+
})
|
|
30
|
+
}, font.value || "default"))
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
29
33
|
};
|
|
30
34
|
export { FontFamilyButton };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useStringStyle } from "../hooks/toolbar/useStringStyle.js";
|
|
2
2
|
import { IconTextSize } from "@tabler/icons-react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useComponentsContext } from "@blocknote/react";
|
|
4
|
+
import { useComponentsContext, usePortalElement } from "@blocknote/react";
|
|
5
5
|
// src/modules/blocks/components/FontSizeButton.tsx
|
|
6
6
|
const FONT_SIZES = [
|
|
7
7
|
8,
|
|
@@ -22,26 +22,30 @@ const FONT_SIZES = [
|
|
|
22
22
|
];
|
|
23
23
|
const FontSizeButton = () => {
|
|
24
24
|
const Components = useComponentsContext();
|
|
25
|
-
const
|
|
25
|
+
const portalElement = usePortalElement();
|
|
26
|
+
const { value: currentSize, isFileBlock, setValue: handleSizeChange } = useStringStyle("fontSize");
|
|
26
27
|
if (!Components || isFileBlock) return null;
|
|
27
|
-
return /* @__PURE__ */ jsxs(Components.Generic.Menu.Root, {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
return /* @__PURE__ */ jsxs(Components.Generic.Menu.Root, {
|
|
29
|
+
portalElement,
|
|
30
|
+
children: [/* @__PURE__ */ jsx(Components.Generic.Menu.Trigger, { children: /* @__PURE__ */ jsx(Components.FormattingToolbar.Button, {
|
|
31
|
+
"data-test": "fontSize",
|
|
32
|
+
className: "bn-button",
|
|
33
|
+
label: "Font Size",
|
|
34
|
+
mainTooltip: "Font Size",
|
|
35
|
+
icon: /* @__PURE__ */ jsx(IconTextSize, { size: 16 }),
|
|
36
|
+
children: currentSize || "Default"
|
|
37
|
+
}) }), /* @__PURE__ */ jsxs(Components.Generic.Menu.Dropdown, {
|
|
38
|
+
className: "bn-menu-dropdown bn-drag-handle-menu",
|
|
39
|
+
children: [/* @__PURE__ */ jsx(Components.Generic.Menu.Item, {
|
|
40
|
+
checked: !currentSize,
|
|
41
|
+
onClick: () => handleSizeChange(""),
|
|
42
|
+
children: "Default"
|
|
43
|
+
}), FONT_SIZES.map((size) => /* @__PURE__ */ jsxs(Components.Generic.Menu.Item, {
|
|
44
|
+
checked: currentSize === `${size}pt`,
|
|
45
|
+
onClick: () => handleSizeChange(`${size}pt`),
|
|
46
|
+
children: [size, " pt"]
|
|
47
|
+
}, size))]
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
46
50
|
};
|
|
47
51
|
export { FontSizeButton };
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
export declare const galleryBlock: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
propSchema: {
|
|
5
|
-
images: {
|
|
6
|
-
default: string;
|
|
7
|
-
};
|
|
8
|
-
columns: {
|
|
9
|
-
default: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
content: 'none';
|
|
1
|
+
export declare const galleryBlock: (options?: undefined) => import("@blocknote/core").BlockSpec<"gallery", {
|
|
2
|
+
images: {
|
|
3
|
+
default: string;
|
|
13
4
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
default: string;
|
|
19
|
-
};
|
|
20
|
-
columns: {
|
|
21
|
-
default: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
content: 'none';
|
|
25
|
-
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
26
|
-
};
|
|
5
|
+
columns: {
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
}, "none">;
|
|
@@ -1,41 +1,8 @@
|
|
|
1
|
-
import { readImage } from "../../../utils/core.js";
|
|
2
1
|
import { galleryBlockConfig } from "../constant/galleryBlockConfig.js";
|
|
3
|
-
import { keyGalleryImages, parseGalleryColumns, parseGalleryImages } from "../utils/galleryImages.js";
|
|
4
2
|
import { GalleryBlockContent } from "./GalleryBlockContent.js";
|
|
5
|
-
import {
|
|
3
|
+
import { GalleryExternalHtml } from "./GalleryExternalHtml.js";
|
|
6
4
|
import { createReactBlockSpec } from "@blocknote/react";
|
|
7
5
|
// src/modules/blocks/components/GalleryBlock.tsx
|
|
8
|
-
const EXTERNAL_IMAGE_STYLE = {
|
|
9
|
-
width: "100%",
|
|
10
|
-
aspectRatio: "1 / 1",
|
|
11
|
-
objectFit: "cover",
|
|
12
|
-
display: "block"
|
|
13
|
-
};
|
|
14
|
-
const GalleryExternalHTML = ({ block }) => {
|
|
15
|
-
const keyedImages = keyGalleryImages(parseGalleryImages(block.props.images));
|
|
16
|
-
const columns = parseGalleryColumns(block.props.columns);
|
|
17
|
-
return /* @__PURE__ */ jsx("div", {
|
|
18
|
-
className: "erxes-editor-gallery",
|
|
19
|
-
"data-columns": String(columns),
|
|
20
|
-
style: keyedImages.length > 0 ? {
|
|
21
|
-
display: "grid",
|
|
22
|
-
gridTemplateColumns: `repeat(${columns}, 1fr)`,
|
|
23
|
-
gap: "8px"
|
|
24
|
-
} : { display: "none" },
|
|
25
|
-
children: keyedImages.map(({ image, key }) => image.caption ? /* @__PURE__ */ jsxs("figure", {
|
|
26
|
-
style: { margin: 0 },
|
|
27
|
-
children: [/* @__PURE__ */ jsx("img", {
|
|
28
|
-
src: readImage(image.url),
|
|
29
|
-
alt: image.caption,
|
|
30
|
-
style: EXTERNAL_IMAGE_STYLE
|
|
31
|
-
}), /* @__PURE__ */ jsx("figcaption", { children: image.caption })]
|
|
32
|
-
}, key) : /* @__PURE__ */ jsx("img", {
|
|
33
|
-
src: readImage(image.url),
|
|
34
|
-
alt: "",
|
|
35
|
-
style: EXTERNAL_IMAGE_STYLE
|
|
36
|
-
}, key))
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
6
|
const parseGalleryElement = (element) => {
|
|
40
7
|
const images = [];
|
|
41
8
|
element.querySelectorAll("figure, img").forEach((el) => {
|
|
@@ -54,7 +21,7 @@ const parseGalleryElement = (element) => {
|
|
|
54
21
|
};
|
|
55
22
|
const galleryBlock = createReactBlockSpec(galleryBlockConfig, {
|
|
56
23
|
render: GalleryBlockContent,
|
|
57
|
-
toExternalHTML:
|
|
24
|
+
toExternalHTML: GalleryExternalHtml,
|
|
58
25
|
parse: (element) => element.tagName === "DIV" && element.classList.contains("erxes-editor-gallery") ? parseGalleryElement(element) : void 0
|
|
59
26
|
});
|
|
60
27
|
export { galleryBlock };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { cn } from "../../../lib/utils.js";
|
|
1
2
|
import { AttachmentPreview } from "../../attachments/attachment-media.js";
|
|
2
3
|
import { useGalleryUpload } from "../hooks/useGalleryUpload.js";
|
|
3
4
|
import { keyGalleryImages, parseGalleryColumns, parseGalleryImages } from "../utils/galleryImages.js";
|
|
4
5
|
import { GalleryColumnPicker, GalleryItem, GalleryNoUploadHandler, GalleryUploadButton } from "./GalleryBlockParts.js";
|
|
5
|
-
import { useRef } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useRef } from "react";
|
|
7
8
|
// src/modules/blocks/components/GalleryBlockContent.tsx
|
|
8
9
|
const GalleryEditBar = ({ block, editor, isEmpty, columns }) => {
|
|
9
10
|
const inputRef = useRef(null);
|
|
@@ -42,6 +43,11 @@ const GalleryEditBar = ({ block, editor, isEmpty, columns }) => {
|
|
|
42
43
|
]
|
|
43
44
|
});
|
|
44
45
|
};
|
|
46
|
+
const GRID_COLUMNS = {
|
|
47
|
+
2: "grid-cols-2",
|
|
48
|
+
3: "grid-cols-3",
|
|
49
|
+
4: "grid-cols-4"
|
|
50
|
+
};
|
|
45
51
|
const GalleryBlockContent = (props) => {
|
|
46
52
|
const { block, editor } = props;
|
|
47
53
|
const keyedImages = keyGalleryImages(parseGalleryImages(block.props.images));
|
|
@@ -62,8 +68,7 @@ const GalleryBlockContent = (props) => {
|
|
|
62
68
|
name: image.caption ?? ""
|
|
63
69
|
})),
|
|
64
70
|
renderThumbnails: (openPreview) => /* @__PURE__ */ jsx("div", {
|
|
65
|
-
className: "grid gap-2",
|
|
66
|
-
style: { gridTemplateColumns: `repeat(${columns}, 1fr)` },
|
|
71
|
+
className: cn("grid gap-2", GRID_COLUMNS[columns]),
|
|
67
72
|
children: keyedImages.map(({ image, key }, index) => /* @__PURE__ */ jsx(GalleryItem, {
|
|
68
73
|
image,
|
|
69
74
|
readonly,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button } from "../../../components/button.js";
|
|
2
2
|
import { Spinner } from "../../../components/spinner.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ToggleGroup } from "../../../components/toggle-group.js";
|
|
4
4
|
import { IconLayoutGrid, IconLoader2, IconPhoto, IconPlus, IconX } from "@tabler/icons-react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useResolveUrl } from "@blocknote/react";
|
|
@@ -21,25 +21,22 @@ const GalleryItem = ({ image, readonly, onRemove, onPreview }) => {
|
|
|
21
21
|
children: /* @__PURE__ */ jsx(Spinner, { size: "sm" })
|
|
22
22
|
}) : /* @__PURE__ */ jsx(Button, {
|
|
23
23
|
variant: "ghost",
|
|
24
|
+
size: "flush",
|
|
24
25
|
"aria-label": "Preview image",
|
|
25
|
-
className: "h-full w-full
|
|
26
|
+
className: "h-full w-full",
|
|
26
27
|
onClick: onPreview,
|
|
27
28
|
children: /* @__PURE__ */ jsx("img", {
|
|
28
29
|
src,
|
|
29
30
|
alt: image.caption ?? "",
|
|
30
|
-
|
|
31
|
-
width: "100%",
|
|
32
|
-
height: "100%",
|
|
33
|
-
objectFit: "cover",
|
|
34
|
-
display: "block"
|
|
35
|
-
},
|
|
31
|
+
className: "block size-full object-cover",
|
|
36
32
|
draggable: false
|
|
37
33
|
})
|
|
38
34
|
}),
|
|
39
35
|
!readonly && /* @__PURE__ */ jsx(Button, {
|
|
40
|
-
variant: "
|
|
36
|
+
variant: "overlay",
|
|
37
|
+
size: "icon",
|
|
41
38
|
"aria-label": "Remove image",
|
|
42
|
-
className: "absolute top-1 right-1
|
|
39
|
+
className: "absolute top-1 right-1 size-5 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 [&>svg]:size-3",
|
|
43
40
|
onMouseDown: (e) => e.preventDefault(),
|
|
44
41
|
onClick: onRemove,
|
|
45
42
|
children: /* @__PURE__ */ jsx(IconX, {})
|
|
@@ -65,9 +62,9 @@ const GalleryUploadButton = ({ uploading, empty, onClick }) => {
|
|
|
65
62
|
icon = /* @__PURE__ */ jsx(IconPhoto, { size: 15 });
|
|
66
63
|
}
|
|
67
64
|
return /* @__PURE__ */ jsxs(Button, {
|
|
68
|
-
variant: "
|
|
65
|
+
variant: "dashed",
|
|
69
66
|
disabled: uploading,
|
|
70
|
-
className: "flex-1 h-
|
|
67
|
+
className: "flex-1 h-9",
|
|
71
68
|
onMouseDown: (e) => e.preventDefault(),
|
|
72
69
|
onClick,
|
|
73
70
|
children: [icon, /* @__PURE__ */ jsx("span", { children: label })]
|
|
@@ -82,14 +79,19 @@ const GalleryColumnPicker = ({ columns, onChange }) => /* @__PURE__ */ jsxs("div
|
|
|
82
79
|
children: [/* @__PURE__ */ jsx(IconLayoutGrid, {
|
|
83
80
|
size: 14,
|
|
84
81
|
className: "text-muted-foreground"
|
|
85
|
-
}),
|
|
86
|
-
variant: "
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
children: n
|
|
93
|
-
|
|
82
|
+
}), /* @__PURE__ */ jsx(ToggleGroup, {
|
|
83
|
+
variant: "outline",
|
|
84
|
+
size: "sm",
|
|
85
|
+
value: [String(columns)],
|
|
86
|
+
onValueChange: ([next]) => {
|
|
87
|
+
if (next) onChange(Number(next));
|
|
88
|
+
},
|
|
89
|
+
children: COLUMN_OPTIONS.map((n) => /* @__PURE__ */ jsx(ToggleGroup.Item, {
|
|
90
|
+
value: String(n),
|
|
91
|
+
"aria-label": `${n} columns`,
|
|
92
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
93
|
+
children: n
|
|
94
|
+
}, n))
|
|
95
|
+
})]
|
|
94
96
|
});
|
|
95
97
|
export { GalleryColumnPicker, GalleryItem, GalleryNoUploadHandler, GalleryUploadButton };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { readImage } from "../../../utils/core.js";
|
|
2
|
+
import { keyGalleryImages, parseGalleryColumns, parseGalleryImages } from "../utils/galleryImages.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/modules/blocks/components/GalleryExternalHtml.tsx
|
|
5
|
+
const EXTERNAL_IMAGE_STYLE = {
|
|
6
|
+
width: "100%",
|
|
7
|
+
aspectRatio: "1 / 1",
|
|
8
|
+
objectFit: "cover",
|
|
9
|
+
display: "block"
|
|
10
|
+
};
|
|
11
|
+
const GalleryExternalHtml = ({ block }) => {
|
|
12
|
+
const keyedImages = keyGalleryImages(parseGalleryImages(block.props.images));
|
|
13
|
+
const columns = parseGalleryColumns(block.props.columns);
|
|
14
|
+
return /* @__PURE__ */ jsx("div", {
|
|
15
|
+
className: "erxes-editor-gallery",
|
|
16
|
+
"data-columns": String(columns),
|
|
17
|
+
style: keyedImages.length > 0 ? {
|
|
18
|
+
display: "grid",
|
|
19
|
+
gridTemplateColumns: `repeat(${columns}, 1fr)`,
|
|
20
|
+
gap: "8px"
|
|
21
|
+
} : { display: "none" },
|
|
22
|
+
children: keyedImages.map(({ image, key }) => image.caption ? /* @__PURE__ */ jsxs("figure", {
|
|
23
|
+
style: { margin: 0 },
|
|
24
|
+
children: [/* @__PURE__ */ jsx("img", {
|
|
25
|
+
src: readImage(image.url),
|
|
26
|
+
alt: image.caption,
|
|
27
|
+
style: EXTERNAL_IMAGE_STYLE
|
|
28
|
+
}), /* @__PURE__ */ jsx("figcaption", { children: image.caption })]
|
|
29
|
+
}, key) : /* @__PURE__ */ jsx("img", {
|
|
30
|
+
src: readImage(image.url),
|
|
31
|
+
alt: "",
|
|
32
|
+
style: EXTERNAL_IMAGE_STYLE
|
|
33
|
+
}, key))
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export { GalleryExternalHtml };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IMAGE_STYLE_PRESETS, getImageStyle } from "../constant/imageBlockConfig.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/modules/blocks/components/ImageExternalHtml.tsx
|
|
4
|
+
const getFloatContainerStyle = (imageStyle, maxWidth) => {
|
|
5
|
+
const base = {
|
|
6
|
+
width: "100%",
|
|
7
|
+
maxWidth: `${maxWidth}px`
|
|
8
|
+
};
|
|
9
|
+
if (imageStyle === "float-left") return {
|
|
10
|
+
...base,
|
|
11
|
+
float: "left",
|
|
12
|
+
marginRight: "1.25em",
|
|
13
|
+
marginBottom: "0.5em"
|
|
14
|
+
};
|
|
15
|
+
if (imageStyle === "float-right") return {
|
|
16
|
+
...base,
|
|
17
|
+
float: "right",
|
|
18
|
+
marginLeft: "1.25em",
|
|
19
|
+
marginBottom: "0.5em"
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
...base,
|
|
23
|
+
margin: "0 auto"
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const ImageExternalHtml = ({ block }) => {
|
|
27
|
+
const { url, caption, name, previewWidth } = block.props;
|
|
28
|
+
const imageStyle = getImageStyle(block.props.imageStyle);
|
|
29
|
+
if (!url) return /* @__PURE__ */ jsx("p", { children: "Add image" });
|
|
30
|
+
const maxWidth = previewWidth || IMAGE_STYLE_PRESETS[imageStyle].maxWidth;
|
|
31
|
+
const containerStyle = getFloatContainerStyle(imageStyle, maxWidth);
|
|
32
|
+
const img = /* @__PURE__ */ jsx("img", {
|
|
33
|
+
src: url,
|
|
34
|
+
alt: caption || name || "",
|
|
35
|
+
className: `erxes-editor-image erxes-editor-image--${imageStyle}`,
|
|
36
|
+
"data-image-style": imageStyle,
|
|
37
|
+
style: {
|
|
38
|
+
width: "100%",
|
|
39
|
+
height: "auto",
|
|
40
|
+
display: "block"
|
|
41
|
+
},
|
|
42
|
+
...previewWidth ? { width: previewWidth } : {}
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
45
|
+
className: `erxes-editor-image erxes-editor-image--${imageStyle}`,
|
|
46
|
+
"data-image-style": imageStyle,
|
|
47
|
+
style: containerStyle,
|
|
48
|
+
children: [img, caption && /* @__PURE__ */ jsx("figcaption", { children: caption })]
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
export { ImageExternalHtml };
|