@erxes/ui 4.0.0-v2.0 → 4.0.0-v2.1

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.
Files changed (308) hide show
  1. package/README.md +6 -6
  2. package/dist/base.css +17 -4
  3. package/dist/components/accordion.d.ts +6 -7
  4. package/dist/components/accordion.js +8 -13
  5. package/dist/components/alert-dialog.d.ts +12 -11
  6. package/dist/components/alert-dialog.js +26 -29
  7. package/dist/components/alert.js +2 -2
  8. package/dist/components/avatar.d.ts +7 -5
  9. package/dist/components/avatar.js +30 -19
  10. package/dist/components/background-gradient-animation.d.ts +2 -11
  11. package/dist/components/background-gradient-animation.js +21 -50
  12. package/dist/components/badge.d.ts +3 -2
  13. package/dist/components/badge.js +36 -21
  14. package/dist/components/breadcrumb.d.ts +6 -4
  15. package/dist/components/breadcrumb.js +18 -14
  16. package/dist/components/button.d.ts +15 -7
  17. package/dist/components/button.js +46 -23
  18. package/dist/components/calendar.js +1 -1
  19. package/dist/components/card.js +1 -1
  20. package/dist/components/chart-config.d.ts +4 -18
  21. package/dist/components/chart-config.js +1 -6
  22. package/dist/components/charts.d.ts +1 -1
  23. package/dist/components/charts.js +20 -28
  24. package/dist/components/checkbox.d.ts +2 -3
  25. package/dist/components/checkbox.js +4 -6
  26. package/dist/components/choicebox-group.d.ts +1 -1
  27. package/dist/components/choicebox-group.js +5 -9
  28. package/dist/components/collapsible.d.ts +5 -9
  29. package/dist/components/collapsible.js +8 -25
  30. package/dist/components/color-picker.js +9 -8
  31. package/dist/components/combobox.d.ts +6 -6
  32. package/dist/components/combobox.js +19 -18
  33. package/dist/components/command-bar.js +22 -19
  34. package/dist/components/command.d.ts +18 -8
  35. package/dist/components/command.js +62 -26
  36. package/dist/components/context-menu.d.ts +17 -29
  37. package/dist/components/context-menu.js +20 -66
  38. package/dist/components/copy-text.js +7 -11
  39. package/dist/components/date-picker.js +21 -18
  40. package/dist/components/date-text-input.js +3 -3
  41. package/dist/components/date-time-input.d.ts +12 -0
  42. package/dist/components/date-time-input.js +21 -0
  43. package/dist/components/dialog.d.ts +17 -12
  44. package/dist/components/dialog.js +36 -32
  45. package/dist/components/drag-handle.d.ts +2 -2
  46. package/dist/components/drag-handle.js +0 -1
  47. package/dist/components/dropdown-menu.d.ts +35 -16
  48. package/dist/components/dropdown-menu.js +78 -37
  49. package/dist/components/empty.js +2 -2
  50. package/dist/components/form.d.ts +15 -6
  51. package/dist/components/form.js +34 -17
  52. package/dist/components/hover-card.d.ts +6 -5
  53. package/dist/components/hover-card.js +18 -9
  54. package/dist/components/info-card.js +5 -6
  55. package/dist/components/input-group.d.ts +22 -0
  56. package/dist/components/input-group.js +42 -0
  57. package/dist/components/input.d.ts +11 -2
  58. package/dist/components/input.js +21 -8
  59. package/dist/components/kbd.js +2 -2
  60. package/dist/components/label.d.ts +3 -3
  61. package/dist/components/label.js +9 -6
  62. package/dist/components/multiselect.d.ts +21 -6
  63. package/dist/components/multiselect.js +81 -127
  64. package/dist/components/on-demand.d.ts +17 -0
  65. package/dist/components/on-demand.js +42 -0
  66. package/dist/components/popover.d.ts +18 -9
  67. package/dist/components/popover.js +38 -13
  68. package/dist/components/radio-group.d.ts +5 -5
  69. package/dist/components/radio-group.js +23 -29
  70. package/dist/components/resizable.d.ts +8 -21
  71. package/dist/components/resizable.js +5 -10
  72. package/dist/components/scroll-area.d.ts +12 -7
  73. package/dist/components/scroll-area.js +18 -18
  74. package/dist/components/select.d.ts +22 -14
  75. package/dist/components/select.js +90 -51
  76. package/dist/components/separator.d.ts +3 -3
  77. package/dist/components/separator.js +8 -12
  78. package/dist/components/sheet.d.ts +15 -11
  79. package/dist/components/sheet.js +63 -47
  80. package/dist/components/sidebar/context.js +4 -4
  81. package/dist/components/sidebar/group.d.ts +9 -8
  82. package/dist/components/sidebar/group.js +18 -13
  83. package/dist/components/sidebar/layout.d.ts +7 -2
  84. package/dist/components/sidebar/layout.js +11 -3
  85. package/dist/components/sidebar/menu-sub.d.ts +4 -3
  86. package/dist/components/sidebar/menu-sub.js +13 -13
  87. package/dist/components/sidebar/menu.d.ts +6 -6
  88. package/dist/components/sidebar/menu.js +28 -40
  89. package/dist/components/sidebar/panel.js +10 -15
  90. package/dist/components/sidebar/root.d.ts +1 -2
  91. package/dist/components/sidebar/root.js +7 -8
  92. package/dist/components/sidebar/trigger.js +1 -1
  93. package/dist/components/sidebar-tree-indicator.js +4 -4
  94. package/dist/components/skeleton.d.ts +7 -1
  95. package/dist/components/skeleton.js +18 -2
  96. package/dist/components/slider.d.ts +5 -5
  97. package/dist/components/slider.js +20 -11
  98. package/dist/components/spinner.d.ts +2 -2
  99. package/dist/components/spinner.js +24 -188
  100. package/dist/components/string-array.js +2 -2
  101. package/dist/components/switch.d.ts +2 -3
  102. package/dist/components/switch.js +6 -8
  103. package/dist/components/table.d.ts +14 -3
  104. package/dist/components/table.js +33 -9
  105. package/dist/components/tabs.d.ts +34 -8
  106. package/dist/components/tabs.js +96 -23
  107. package/dist/components/text-overflow.d.ts +8 -10
  108. package/dist/components/text-overflow.js +33 -39
  109. package/dist/components/textarea.d.ts +8 -1
  110. package/dist/components/textarea.js +24 -3
  111. package/dist/components/toaster.d.ts +1 -0
  112. package/dist/components/toaster.js +41 -20
  113. package/dist/components/toggle-group.d.ts +5 -3
  114. package/dist/components/toggle-group.js +11 -12
  115. package/dist/components/toggle.d.ts +3 -4
  116. package/dist/components/toggle.js +6 -6
  117. package/dist/components/tooltip.d.ts +7 -6
  118. package/dist/components/tooltip.js +18 -8
  119. package/dist/components/upload.d.ts +7 -2
  120. package/dist/components/upload.js +28 -7
  121. package/dist/components.css +325 -0
  122. package/dist/constants/CountryPhoneCodes.d.ts +1 -1
  123. package/dist/constants/CountryPhoneCodes.js +2 -2
  124. package/dist/federation.d.ts +10 -0
  125. package/dist/federation.js +24 -0
  126. package/dist/fonts.css +1 -1
  127. package/dist/hooks/use-confirm.js +17 -19
  128. package/dist/hooks/use-toast.d.ts +14 -16
  129. package/dist/hooks/use-toast.js +13 -108
  130. package/dist/index.d.ts +9 -8
  131. package/dist/index.js +7 -7
  132. package/dist/lib/cn-tables.d.ts +27 -0
  133. package/dist/lib/cn-tables.js +128 -0
  134. package/dist/lib/utils.d.ts +14 -2
  135. package/dist/lib/utils.js +14 -6
  136. package/dist/modules/attachments/attachment-media.js +56 -56
  137. package/dist/modules/blocks/components/BarcodeAttribute.js +11 -8
  138. package/dist/modules/blocks/components/BarcodeSizeSettings.js +5 -6
  139. package/dist/modules/blocks/components/BlockEditor.js +14 -4
  140. package/dist/modules/blocks/components/BlockEditorInlineContent.d.ts +26 -36
  141. package/dist/modules/blocks/components/BlockEditorInlineContent.js +2 -2
  142. package/dist/modules/blocks/components/BlockToolbar.d.ts +6 -0
  143. package/dist/modules/blocks/components/BlockToolbar.js +19 -4
  144. package/dist/modules/blocks/components/CustomFileBlock.d.ts +13 -39
  145. package/dist/modules/blocks/components/CustomFileBlock.js +8 -9
  146. package/dist/modules/blocks/components/CustomImageBlock.d.ts +28 -78
  147. package/dist/modules/blocks/components/CustomImageBlock.js +20 -99
  148. package/dist/modules/blocks/components/CustomVideoBlock.d.ts +26 -63
  149. package/dist/modules/blocks/components/CustomVideoBlock.js +10 -8
  150. package/dist/modules/blocks/components/DocumentPlaceholderBlock.d.ts +13 -39
  151. package/dist/modules/blocks/components/DocumentPlaceholderBlock.js +1 -2
  152. package/dist/modules/blocks/components/Editor.d.ts +1 -1
  153. package/dist/modules/blocks/components/Editor.js +5 -4
  154. package/dist/modules/blocks/components/FontFamilyButton.js +25 -21
  155. package/dist/modules/blocks/components/FontSizeButton.js +26 -22
  156. package/dist/modules/blocks/components/GalleryBlock.d.ts +7 -25
  157. package/dist/modules/blocks/components/GalleryBlock.js +2 -35
  158. package/dist/modules/blocks/components/GalleryBlockContent.js +8 -3
  159. package/dist/modules/blocks/components/GalleryBlockParts.js +23 -21
  160. package/dist/modules/blocks/components/GalleryExternalHtml.d.ts +2 -0
  161. package/dist/modules/blocks/components/GalleryExternalHtml.js +36 -0
  162. package/dist/modules/blocks/components/ImageExternalHtml.d.ts +2 -0
  163. package/dist/modules/blocks/components/ImageExternalHtml.js +51 -0
  164. package/dist/modules/blocks/components/ImageStyleButton.js +22 -18
  165. package/dist/modules/blocks/components/LazyEditor.d.ts +9 -0
  166. package/dist/modules/blocks/components/LazyEditor.js +14 -0
  167. package/dist/modules/blocks/components/MediaBlockWrapper.d.ts +24 -0
  168. package/dist/modules/blocks/components/MediaBlockWrapper.js +98 -0
  169. package/dist/modules/blocks/components/SlashMenu.js +2 -2
  170. package/dist/modules/blocks/components/SuggestionMenu.js +5 -6
  171. package/dist/modules/blocks/components/TableColorPicker.d.ts +1 -1
  172. package/dist/modules/blocks/components/TableColorPicker.js +20 -27
  173. package/dist/modules/blocks/components/TableHandleWithRemove.js +34 -50
  174. package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.d.ts +2 -2
  175. package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.js +3 -4
  176. package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.d.ts +2 -2
  177. package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.js +3 -4
  178. package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.d.ts +3 -0
  179. package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.js +8 -0
  180. package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuDropdown.js +1 -1
  181. package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.d.ts +2 -2
  182. package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.js +5 -16
  183. package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.d.ts +1 -1
  184. package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.js +24 -20
  185. package/dist/modules/blocks/constant/blockEditorSchema.d.ts +268 -653
  186. package/dist/modules/blocks/constant/blockEditorSchema.js +33 -41
  187. package/dist/modules/blocks/constant/galleryBlockConfig.d.ts +1 -2
  188. package/dist/modules/blocks/constant/imageBlockConfig.d.ts +46 -0
  189. package/dist/modules/blocks/constant/imageBlockConfig.js +39 -0
  190. package/dist/modules/blocks/constant/toolbar/editorUIComponents.d.ts +2 -3
  191. package/dist/modules/blocks/constant/toolbar/editorUIComponents.js +7 -9
  192. package/dist/modules/blocks/hooks/toolbar/useCodeActive.js +5 -7
  193. package/dist/modules/blocks/hooks/toolbar/useStringStyle.d.ts +9 -0
  194. package/dist/modules/blocks/hooks/toolbar/useStringStyle.js +27 -0
  195. package/dist/modules/blocks/hooks/useBlockEditor.d.ts +2 -0
  196. package/dist/modules/blocks/hooks/useBlockEditor.js +9 -3
  197. package/dist/modules/blocks/hooks/useEditorValue.d.ts +2 -1
  198. package/dist/modules/blocks/hooks/useEditorValue.js +8 -19
  199. package/dist/modules/blocks/types/TextEditor.d.ts +3 -1
  200. package/dist/modules/blocks/types/toolbar/ImageStyleOption.d.ts +1 -1
  201. package/dist/modules/blocks/utils/getSlashMenuItems.js +0 -15
  202. package/dist/modules/blocks/utils/parseBlocks.d.ts +3 -1
  203. package/dist/modules/blocks/utils/parseBlocks.js +14 -1
  204. package/dist/modules/display/components/EmailDisplay.js +26 -27
  205. package/dist/modules/display/components/PhoneDisplay.js +2 -2
  206. package/dist/modules/display/components/RelativeDateDisplay.d.ts +2 -2
  207. package/dist/modules/display/components/RelativeDateDisplay.js +7 -10
  208. package/dist/modules/filter/components/FilterBar.js +6 -6
  209. package/dist/modules/filter/components/FilterDialog.js +13 -20
  210. package/dist/modules/filter/components/FilterPopover.js +20 -28
  211. package/dist/modules/hotkey/components/PopoverScoped.d.ts +5 -4
  212. package/dist/modules/hotkey/components/PopoverScoped.js +5 -5
  213. package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +3 -3
  214. package/dist/modules/hotkey/hooks/useScopedHotkeys.js +15 -24
  215. package/dist/modules/icons/components/IconComponent.d.ts +1 -1
  216. package/dist/modules/icons/components/IconPicker.js +15 -14
  217. package/dist/modules/inputs/components/ContactFieldParts.js +13 -14
  218. package/dist/modules/inputs/components/EmailFieldForm.js +2 -3
  219. package/dist/modules/inputs/components/FullNameField.js +6 -4
  220. package/dist/modules/inputs/components/PhoneFieldForm.js +2 -1
  221. package/dist/modules/layout/components/AppLayout.js +18 -20
  222. package/dist/modules/layout/components/AppLayoutPageSlot.js +1 -1
  223. package/dist/modules/layout/components/AppLayoutResizeHandle.js +1 -1
  224. package/dist/modules/layout/components/Page.d.ts +6 -1
  225. package/dist/modules/layout/components/Page.js +11 -3
  226. package/dist/modules/layout/components/PageHeader.d.ts +10 -3
  227. package/dist/modules/layout/components/PageHeader.js +19 -4
  228. package/dist/modules/navigation-menu/components/NavigationMenu.js +12 -15
  229. package/dist/modules/record-field/components/NumberField.d.ts +2 -2
  230. package/dist/modules/record-field/components/NumberField.js +22 -25
  231. package/dist/modules/record-field/components/TextField.d.ts +3 -3
  232. package/dist/modules/record-field/components/TextField.js +25 -28
  233. package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +3 -1
  234. package/dist/modules/record-field/meta-inputs/components/PhoneInput.js +18 -12
  235. package/dist/modules/record-table/components/CheckboxColumn.d.ts +4 -3
  236. package/dist/modules/record-table/components/CheckboxColumn.js +52 -35
  237. package/dist/modules/record-table/components/MoreColumn.js +4 -3
  238. package/dist/modules/record-table/components/RecordTable.d.ts +3 -2
  239. package/dist/modules/record-table/components/RecordTable.js +2 -1
  240. package/dist/modules/record-table/components/RecordTableCell.d.ts +6 -3
  241. package/dist/modules/record-table/components/RecordTableCell.js +17 -11
  242. package/dist/modules/record-table/components/RecordTableCellInline.d.ts +15 -4
  243. package/dist/modules/record-table/components/RecordTableCellInline.js +48 -24
  244. package/dist/modules/record-table/components/RecordTableColumnSelector.d.ts +1 -2
  245. package/dist/modules/record-table/components/RecordTableColumnSelector.js +48 -45
  246. package/dist/modules/record-table/components/RecordTableContainer.d.ts +8 -3
  247. package/dist/modules/record-table/components/RecordTableContainer.js +28 -16
  248. package/dist/modules/record-table/components/RecordTableCursor.js +4 -4
  249. package/dist/modules/record-table/components/RecordTableHead.d.ts +9 -4
  250. package/dist/modules/record-table/components/RecordTableHead.js +40 -34
  251. package/dist/modules/record-table/components/RecordTableHeader.js +24 -15
  252. package/dist/modules/record-table/components/RecordTableProvider.d.ts +30 -7
  253. package/dist/modules/record-table/components/RecordTableProvider.js +32 -22
  254. package/dist/modules/record-table/components/RecordTableRoot.d.ts +2 -1
  255. package/dist/modules/record-table/components/RecordTableRoot.js +7 -12
  256. package/dist/modules/record-table/components/RecordTableRow.d.ts +8 -1
  257. package/dist/modules/record-table/components/RecordTableRow.js +13 -12
  258. package/dist/modules/record-table/components/RecordTableRowList.d.ts +6 -1
  259. package/dist/modules/record-table/components/RecordTableRowList.js +28 -20
  260. package/dist/modules/record-table/components/RecordTableRowSkeleton.js +8 -12
  261. package/dist/modules/record-table/hooks/useColumnLayout.d.ts +2 -2
  262. package/dist/modules/record-table/hooks/useColumnLayout.js +8 -5
  263. package/dist/modules/record-table/hooks/useTablePreferences.d.ts +5 -5
  264. package/dist/modules/record-table/hooks/useTablePreferences.js +3 -3
  265. package/dist/modules/record-table/utils/columnLayout.d.ts +4 -4
  266. package/dist/modules/record-table/utils/columnLayout.js +7 -7
  267. package/dist/modules/record-table/utils/columnUtils.d.ts +3 -2
  268. package/dist/modules/record-table/utils/rowFields.d.ts +1 -0
  269. package/dist/modules/record-table/utils/rowFields.js +10 -9
  270. package/dist/styles.css +3 -0
  271. package/dist/theme.css +102 -69
  272. package/dist/utils/file-storage.d.ts +1 -1
  273. package/dist/utils/plugin-runtime.d.ts +1 -1
  274. package/dist/utils/record-timeline.d.ts +1 -1
  275. package/dist/utils/record-timeline.js +1 -1
  276. package/package.json +25 -22
  277. package/dist/components/multiselect-options.d.ts +0 -16
  278. package/dist/components/multiselect-options.js +0 -13
  279. package/dist/components/multiselect-parts.d.ts +0 -23
  280. package/dist/components/multiselect-parts.js +0 -62
  281. package/dist/components/multiselect-state.d.ts +0 -66
  282. package/dist/components/multiselect-state.js +0 -131
  283. package/dist/components/time-picker.d.ts +0 -10
  284. package/dist/components/time-picker.js +0 -33
  285. package/dist/components/toasts.d.ts +0 -21
  286. package/dist/components/toasts.js +0 -69
  287. package/dist/modules/blocks/hooks/toolbar/useFontFamily.d.ts +0 -2
  288. package/dist/modules/blocks/hooks/toolbar/useFontFamily.js +0 -24
  289. package/dist/modules/blocks/hooks/toolbar/useFontSize.d.ts +0 -2
  290. package/dist/modules/blocks/hooks/toolbar/useFontSize.js +0 -24
  291. package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.d.ts +0 -6
  292. package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.js +0 -0
  293. package/dist/modules/blocks/types/toolbar/FontFamily.d.ts +0 -5
  294. package/dist/modules/blocks/types/toolbar/FontFamily.js +0 -0
  295. package/dist/modules/blocks/types/toolbar/FontSize.d.ts +0 -5
  296. package/dist/modules/blocks/types/toolbar/FontSize.js +0 -0
  297. package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.d.ts +0 -4
  298. package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.js +0 -0
  299. package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.d.ts +0 -3
  300. package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.js +0 -0
  301. package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.d.ts +0 -2
  302. package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.js +0 -30
  303. package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.d.ts +0 -2
  304. package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.js +0 -41
  305. package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.d.ts +0 -9
  306. package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.js +0 -15
  307. package/dist/modules/hotkey/states/internal/pendingHotkeyState.d.ts +0 -4
  308. package/dist/modules/hotkey/states/internal/pendingHotkeyState.js +0 -4
@@ -1,64 +1,27 @@
1
- export declare const customVideoBlock: {
2
- config: {
3
- type: "video";
4
- propSchema: {
5
- textAlignment: {
6
- default: "left";
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
- implementation: import("@blocknote/core").TiptapBlockImplementation<{
34
- type: "video";
35
- propSchema: {
36
- textAlignment: {
37
- default: "left";
38
- values: readonly ["left", "center", "right", "justify"];
39
- };
40
- backgroundColor: {
41
- default: "default";
42
- };
43
- name: {
44
- default: "";
45
- };
46
- url: {
47
- default: "";
48
- };
49
- caption: {
50
- default: "";
51
- };
52
- showPreview: {
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, ResizableFileBlockWrapper, VideoBlock, VideoToExternalHTML, createReactBlockSpec, useBlockNoteEditor } from "@blocknote/react";
5
- import { videoBlockConfig, videoParse } from "@blocknote/core";
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(ResizableFileBlockWrapper, {
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(videoBlockConfig, {
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 = videoParse(element);
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
- config: {
3
- type: 'documentPlaceholder';
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
- implementation: import("@blocknote/core").TiptapBlockImplementation<{
22
- type: 'documentPlaceholder';
23
- propSchema: {
24
- documentId: {
25
- default: string;
26
- };
27
- documentName: {
28
- default: string;
29
- };
30
- documentCode: {
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: "outline",
21
- className: cn("min-w-0 w-full overflow-x-hidden overflow-y-auto h-28 rounded-md min-h-28 styled-scroll shadow-xs transition-[color,box-shadow] pt-1", className),
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 { useFontFamily } from "../hooks/toolbar/useFontFamily.js";
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 { currentFont, isFileBlock, handleFontChange } = useFontFamily();
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, { children: [/* @__PURE__ */ jsx(Components.Generic.Menu.Trigger, { children: /* @__PURE__ */ jsx(Components.FormattingToolbar.Button, {
12
- "data-test": "fontFamily",
13
- className: "bn-button",
14
- label: "Font",
15
- mainTooltip: "Font Family",
16
- icon: /* @__PURE__ */ jsx(IconTypography, { size: 16 })
17
- }) }), /* @__PURE__ */ jsx(Components.Generic.Menu.Dropdown, {
18
- className: "bn-menu-dropdown bn-drag-handle-menu",
19
- children: FONT_FAMILIES.map((font) => /* @__PURE__ */ jsx(Components.Generic.Menu.Item, {
20
- checked: currentFont === font.value,
21
- onClick: () => handleFontChange(font.value),
22
- children: /* @__PURE__ */ jsx("div", {
23
- className: "flex items-center gap-2 w-full",
24
- style: { fontFamily: font.value },
25
- children: font.name
26
- })
27
- }, font.value || "default"))
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 { useFontSize } from "../hooks/toolbar/useFontSize.js";
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 { currentSize, isFileBlock, handleSizeChange } = useFontSize();
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, { children: [/* @__PURE__ */ jsx(Components.Generic.Menu.Trigger, { children: /* @__PURE__ */ jsx(Components.FormattingToolbar.Button, {
28
- "data-test": "fontSize",
29
- className: "bn-button",
30
- label: "Font Size",
31
- mainTooltip: "Font Size",
32
- icon: /* @__PURE__ */ jsx(IconTextSize, { size: 16 }),
33
- children: currentSize || "Default"
34
- }) }), /* @__PURE__ */ jsxs(Components.Generic.Menu.Dropdown, {
35
- className: "bn-menu-dropdown bn-drag-handle-menu",
36
- children: [/* @__PURE__ */ jsx(Components.Generic.Menu.Item, {
37
- checked: !currentSize,
38
- onClick: () => handleSizeChange(""),
39
- children: "Default"
40
- }), FONT_SIZES.map((size) => /* @__PURE__ */ jsxs(Components.Generic.Menu.Item, {
41
- checked: currentSize === `${size}pt`,
42
- onClick: () => handleSizeChange(`${size}pt`),
43
- children: [size, " pt"]
44
- }, size))]
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
- config: {
3
- type: 'gallery';
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
- implementation: import("@blocknote/core").TiptapBlockImplementation<{
15
- type: 'gallery';
16
- propSchema: {
17
- images: {
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 { jsx, jsxs } from "react/jsx-runtime";
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: GalleryExternalHTML,
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 { cn } from "../../../lib/utils.js";
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 p-0 rounded-none",
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
- style: {
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: "ghost",
36
+ variant: "overlay",
37
+ size: "icon",
41
38
  "aria-label": "Remove image",
42
- className: "absolute top-1 right-1 h-5 w-5 p-0 rounded-full bg-black/50 text-white opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity [&>svg]:size-3",
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: "ghost",
65
+ variant: "dashed",
69
66
  disabled: uploading,
70
- className: "flex-1 h-auto gap-1.5 py-2 text-muted-foreground border border-dashed rounded-md hover:bg-muted",
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
- }), COLUMN_OPTIONS.map((n) => /* @__PURE__ */ jsx(Button, {
86
- variant: "ghost",
87
- "aria-label": `${n} columns`,
88
- "aria-pressed": columns === n,
89
- className: cn("h-6 w-6 p-0 text-xs", columns === n ? "bg-primary text-primary-foreground hover:bg-primary" : "text-muted-foreground hover:bg-muted"),
90
- onMouseDown: (e) => e.preventDefault(),
91
- onClick: () => onChange(n),
92
- children: n
93
- }, n))]
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,2 @@
1
+ import { GalleryRenderProps } from "../constant/galleryBlockConfig.js";
2
+ export declare const GalleryExternalHtml: ({ block }: GalleryRenderProps) => import("react").JSX.Element;
@@ -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,2 @@
1
+ import { ImageRenderProps } from "../constant/imageBlockConfig.js";
2
+ export declare const ImageExternalHtml: ({ block }: ImageRenderProps) => import("react").JSX.Element;
@@ -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 };