@flozy/editor 1.5.9 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. package/dist/Editor/CommonEditor.js +195 -94
  2. package/dist/Editor/DialogWrapper.js +3 -0
  3. package/dist/Editor/Editor.css +211 -50
  4. package/dist/Editor/Elements/Accordion/Accordion.js +0 -1
  5. package/dist/Editor/Elements/Accordion/AccordionButton.js +13 -12
  6. package/dist/Editor/Elements/Accordion/AccordionSummary.js +0 -1
  7. package/dist/Editor/Elements/AppHeader/AppHeader.js +136 -133
  8. package/dist/Editor/Elements/AppHeader/AppHeaderPopup.js +4 -2
  9. package/dist/Editor/Elements/Button/ButtonToolIcon.js +10 -9
  10. package/dist/Editor/Elements/Button/EditorButton.js +8 -24
  11. package/dist/Editor/Elements/Carousel/Carousel.js +47 -28
  12. package/dist/Editor/Elements/Carousel/CarouselButton.js +7 -8
  13. package/dist/Editor/Elements/Color Picker/ColorButtons.js +133 -0
  14. package/dist/Editor/Elements/Color Picker/ColorPicker.js +49 -58
  15. package/dist/Editor/Elements/Color Picker/Styles.js +51 -0
  16. package/dist/Editor/Elements/Color Picker/defaultColors.js +1 -1
  17. package/dist/Editor/Elements/Embed/Embed.js +35 -126
  18. package/dist/Editor/Elements/Embed/Image.js +24 -7
  19. package/dist/Editor/Elements/Embed/Video.js +21 -6
  20. package/dist/Editor/Elements/Emoji/EmojiButton.js +73 -0
  21. package/dist/Editor/Elements/Emoji/EmojiPicker.js +0 -0
  22. package/dist/Editor/Elements/Form/Form.js +24 -13
  23. package/dist/Editor/Elements/Form/FormButton.js +11 -9
  24. package/dist/Editor/Elements/Form/FormElements/FormText.js +4 -2
  25. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +3 -2
  26. package/dist/Editor/Elements/Form/FormField.js +7 -1
  27. package/dist/Editor/Elements/Grid/Grid.js +143 -47
  28. package/dist/Editor/Elements/Grid/GridButton.js +52 -29
  29. package/dist/Editor/Elements/Grid/GridItem.js +32 -21
  30. package/dist/Editor/Elements/Grid/Styles.js +11 -0
  31. package/dist/Editor/Elements/InlineIcon/InlineIcon.js +0 -1
  32. package/dist/Editor/Elements/List/CheckList.js +57 -0
  33. package/dist/Editor/Elements/List/CheckListButton.js +24 -0
  34. package/dist/Editor/Elements/NewLine/NewLineButton.js +14 -14
  35. package/dist/Editor/Elements/PageSettings/PageSettings.js +4 -2
  36. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +17 -62
  37. package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +1 -1
  38. package/dist/Editor/Elements/Signature/Signature.js +9 -3
  39. package/dist/Editor/Elements/Signature/SignatureButton.js +10 -9
  40. package/dist/Editor/Elements/Signature/SignaturePopup.js +42 -6
  41. package/dist/Editor/Elements/SimpleText.js +62 -0
  42. package/dist/Editor/Elements/Table/Styles.js +66 -0
  43. package/dist/Editor/Elements/Table/Table.js +33 -16
  44. package/dist/Editor/Elements/Table/TableCell.js +54 -24
  45. package/dist/Editor/Elements/Table/TableSelector.js +13 -15
  46. package/dist/Editor/Elements/Table/table.css +0 -10
  47. package/dist/Editor/Elements/TopBanner/Styles.js +33 -0
  48. package/dist/Editor/Elements/TopBanner/TopBanner.js +106 -0
  49. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +47 -0
  50. package/dist/Editor/Styles/EditorStyles.js +50 -0
  51. package/dist/Editor/Toolbar/FormatTools/Autocomplete.js +0 -2
  52. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +8 -3
  53. package/dist/Editor/Toolbar/FormatTools/FontFamilyDropdown.js +63 -0
  54. package/dist/Editor/Toolbar/FormatTools/FontSize.js +112 -0
  55. package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -3
  56. package/dist/Editor/Toolbar/FormatTools/index.js +4 -1
  57. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +101 -0
  58. package/dist/Editor/Toolbar/Mini/Options/Options.js +17 -0
  59. package/dist/Editor/Toolbar/Mini/Styles.js +30 -0
  60. package/dist/Editor/Toolbar/PopupTool/AddElements.js +32 -0
  61. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +115 -0
  62. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +65 -0
  63. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +160 -6
  64. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +263 -80
  65. package/dist/Editor/Toolbar/PopupTool/index.js +50 -85
  66. package/dist/Editor/Toolbar/Toolbar.js +189 -129
  67. package/dist/Editor/Toolbar/styles.css +136 -18
  68. package/dist/Editor/Toolbar/toolbarGroups.js +94 -34
  69. package/dist/Editor/assets/svg/AddElementIcon.js +29 -0
  70. package/dist/Editor/assets/svg/AddTemplateIcon.js +29 -0
  71. package/dist/Editor/assets/svg/TextIcon.js +29 -0
  72. package/dist/Editor/common/Icon.js +54 -5
  73. package/dist/Editor/common/ImageList.js +75 -0
  74. package/dist/Editor/common/ImageSelector/ImageSelector.js +117 -0
  75. package/dist/Editor/common/ImageSelector/Options/AddLink.js +44 -0
  76. package/dist/Editor/common/ImageSelector/Options/ChooseAssets.js +39 -0
  77. package/dist/Editor/common/ImageSelector/Options/Upload.js +30 -0
  78. package/dist/Editor/common/ImageSelector/Styles.js +41 -0
  79. package/dist/Editor/common/ImageUploader.js +94 -0
  80. package/dist/Editor/common/MentionsPopup/ElementsListCard.js +66 -0
  81. package/dist/Editor/common/MentionsPopup/MentionsListCard.js +70 -0
  82. package/dist/Editor/common/MentionsPopup/Styles.js +68 -0
  83. package/dist/Editor/common/MentionsPopup/index.js +129 -0
  84. package/dist/Editor/common/Shorthands/elements.js +191 -0
  85. package/dist/Editor/common/Shorthands/index.js +7 -0
  86. package/dist/Editor/common/Shorthands/mentions.js +8 -0
  87. package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +5 -5
  88. package/dist/Editor/common/StyleBuilder/buttonStyle.js +1 -1
  89. package/dist/Editor/common/StyleBuilder/embedImageStyle.js +15 -2
  90. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +8 -0
  91. package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +2 -3
  92. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +23 -35
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +3 -20
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +95 -0
  95. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +14 -2
  96. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  97. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +0 -1
  98. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +3 -2
  99. package/dist/Editor/common/StyleBuilder/index.js +0 -1
  100. package/dist/Editor/common/StyleBuilder/tableStyle.js +9 -5
  101. package/dist/Editor/common/ToolbarIcon.js +43 -0
  102. package/dist/Editor/common/Uploader.js +35 -61
  103. package/dist/Editor/common/iconslist.js +46 -1
  104. package/dist/Editor/helper/index.js +0 -1
  105. package/dist/Editor/hooks/useDrag.js +2 -2
  106. package/dist/Editor/hooks/useMentions.js +104 -17
  107. package/dist/Editor/hooks/useMouseMove.js +53 -0
  108. package/dist/Editor/hooks/useScroll.js +26 -0
  109. package/dist/Editor/plugins/withEmbeds.js +12 -0
  110. package/dist/Editor/service/fileupload.js +2 -2
  111. package/dist/Editor/utils/SlateUtilityFunctions.js +61 -9
  112. package/dist/Editor/utils/button.js +2 -1
  113. package/dist/Editor/utils/carousel.js +5 -2
  114. package/dist/Editor/utils/carouselItem.js +2 -2
  115. package/dist/Editor/utils/customHooks/useResize.js +2 -3
  116. package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
  117. package/dist/Editor/utils/embed.js +25 -8
  118. package/dist/Editor/utils/emoji.js +8 -0
  119. package/dist/Editor/utils/events.js +49 -12
  120. package/dist/Editor/utils/form.js +3 -9
  121. package/dist/Editor/utils/formfield.js +2 -1
  122. package/dist/Editor/utils/grid.js +44 -8
  123. package/dist/Editor/utils/gridItem.js +4 -3
  124. package/dist/Editor/utils/insertNewLine.js +12 -0
  125. package/dist/Editor/utils/mentions.js +14 -10
  126. package/dist/Editor/utils/pageSettings.js +67 -0
  127. package/dist/Editor/utils/signature.js +6 -8
  128. package/dist/Editor/utils/table.js +79 -18
  129. package/dist/Editor/utils/topBanner.js +58 -0
  130. package/package.json +6 -2
  131. package/dist/Editor/common/MentionsPopup.js +0 -56
@@ -21,6 +21,7 @@ import { Tooltip } from "@mui/material";
21
21
  import { GridSettingsIcon } from "../../common/iconslist";
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
23
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
+ import { Fragment as _Fragment } from "react/jsx-runtime";
24
25
  const drawerWidth = 240;
25
26
  function AppHeader(props) {
26
27
  const navWrprRef = useRef(null);
@@ -72,8 +73,8 @@ function AppHeader(props) {
72
73
  className: "element-toolbar",
73
74
  contentEditable: false,
74
75
  style: {
75
- top: "-40px",
76
- right: "50px"
76
+ top: "0px",
77
+ right: "0px"
77
78
  },
78
79
  children: [/*#__PURE__*/_jsx(Tooltip, {
79
80
  title: "App Header Settings",
@@ -154,7 +155,7 @@ function AppHeader(props) {
154
155
  src: appLogo
155
156
  }) : appTitle
156
157
  }), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(List, {
157
- children: menus.map(item => /*#__PURE__*/_jsx(ListItem, {
158
+ children: menus.map((item, i) => /*#__PURE__*/_jsx(ListItem, {
158
159
  disablePadding: true,
159
160
  children: /*#__PURE__*/_jsx(ListItemButton, {
160
161
  component: "a",
@@ -166,7 +167,7 @@ function AppHeader(props) {
166
167
  primary: item.text
167
168
  })
168
169
  })
169
- }, item.text))
170
+ }, `${item.text}_${i}`))
170
171
  })]
171
172
  });
172
173
  const container = window !== undefined ? () => window().document.body : undefined;
@@ -179,154 +180,156 @@ function AppHeader(props) {
179
180
  const elevateStyle = {
180
181
  position: "relative"
181
182
  };
182
- return /*#__PURE__*/_jsxs(Box, {
183
- sx: {
184
- display: "flex",
185
- position: "relative"
186
- },
187
- ...attributes,
188
- contentEditable: false,
189
- onClick: handleFocus,
190
- children: [/*#__PURE__*/_jsxs("div", {
191
- ref: navWrprRef,
192
- style: {
183
+ return /*#__PURE__*/_jsxs(_Fragment, {
184
+ children: [/*#__PURE__*/_jsxs(Box, {
185
+ sx: {
193
186
  display: "flex",
194
- width: "100%"
187
+ position: "relative"
195
188
  },
196
- children: [/*#__PURE__*/_jsx(CssBaseline, {}), /*#__PURE__*/_jsx(AppBar, {
197
- component: "nav",
189
+ ...attributes,
190
+ contentEditable: false,
191
+ onClick: handleFocus,
192
+ children: [/*#__PURE__*/_jsxs("div", {
193
+ ref: navWrprRef,
198
194
  style: {
199
- ...elevateStyle,
200
- background: bgColor,
201
- boxShadow: "none",
202
- paddingLeft: `${left}px`,
203
- paddingRight: `${right}px`,
204
- paddingTop: `${top}px`,
205
- paddingBottom: `${bottom}px`
195
+ display: "flex",
196
+ width: "100%"
206
197
  },
207
- children: /*#__PURE__*/_jsxs(Toolbar, {
198
+ children: [/*#__PURE__*/_jsx(CssBaseline, {}), /*#__PURE__*/_jsx(AppBar, {
199
+ component: "nav",
208
200
  style: {
209
- flexDirection: isLogoRight ? "row-reverse" : "row"
201
+ ...elevateStyle,
202
+ background: bgColor,
203
+ boxShadow: "none",
204
+ paddingLeft: `${left}px`,
205
+ paddingRight: `${right}px`,
206
+ paddingTop: `${top}px`,
207
+ paddingBottom: `${bottom}px`
210
208
  },
211
- children: [/*#__PURE__*/_jsx(IconButton, {
212
- color: "inherit",
213
- "aria-label": "open drawer",
214
- edge: "start",
215
- onClick: handleDrawerToggle,
216
- sx: {
217
- mr: 2,
218
- display: {
219
- sm: "none"
220
- }
221
- },
222
- children: /*#__PURE__*/_jsx(MenuIcon, {})
223
- }), /*#__PURE__*/_jsxs(Typography, {
224
- variant: "h6",
225
- component: "div",
226
- color: "primary",
209
+ children: /*#__PURE__*/_jsxs(Toolbar, {
227
210
  style: {
228
- display: "inline-flex",
229
- alignItems: "center",
230
- color: textColor,
231
- fontSize: logoFontSize,
232
- fontFamily: titleFontFamily,
233
- justifyContent: isLogoRight ? "end" : "start"
211
+ flexDirection: isLogoRight ? "row-reverse" : "row"
234
212
  },
235
- sx: {
236
- flexGrow: 1,
237
- display: {
238
- xs: "none",
239
- sm: "block"
240
- }
241
- },
242
- className: "app-logo",
243
- children: [appLogo && appLogo !== "none" ? /*#__PURE__*/_jsx("img", {
244
- alt: `${appTitle} Logo`,
245
- style: {
246
- height: "40px",
247
- width: "auto"
248
- },
249
- src: appLogo
250
- }) : null, "\xA0", appTitle]
251
- }), /*#__PURE__*/_jsxs(Box, {
252
- sx: {
253
- display: {
254
- xs: "none",
255
- sm: "block"
256
- }
257
- },
258
- children: [isDrawer ? /*#__PURE__*/_jsx(IconButton, {
213
+ children: [/*#__PURE__*/_jsx(IconButton, {
259
214
  color: "inherit",
260
215
  "aria-label": "open drawer",
261
216
  edge: "start",
262
217
  onClick: handleDrawerToggle,
218
+ sx: {
219
+ mr: 2,
220
+ display: {
221
+ sm: "none"
222
+ }
223
+ },
263
224
  children: /*#__PURE__*/_jsx(MenuIcon, {})
264
- }) : null, !isDrawer ? menus.map((item, i) => /*#__PURE__*/_jsx(Button, {
265
- component: "a",
266
- href: item.url,
225
+ }), /*#__PURE__*/_jsxs(Typography, {
226
+ variant: "h6",
227
+ component: "div",
228
+ color: "primary",
229
+ style: {
230
+ display: "inline-flex",
231
+ alignItems: "center",
232
+ color: textColor,
233
+ fontSize: logoFontSize,
234
+ fontFamily: titleFontFamily,
235
+ justifyContent: isLogoRight ? "end" : "start"
236
+ },
267
237
  sx: {
268
- position: "relative",
269
- fontFamily: fontFamily,
270
- textTransform: "none",
271
- fontSize: fontSize || "16px",
272
- color: textColor || "#FFF",
273
- background: bgColor || "none",
274
- "& .m-settings": {
275
- display: "none",
276
- position: "absolute",
277
- top: 0,
278
- bottom: 0,
279
- left: 0,
280
- right: 0,
281
- margin: "auto",
282
- width: "42px",
283
- height: "42px",
284
- background: "#FFF"
238
+ flexGrow: 1,
239
+ display: {
240
+ xs: "none",
241
+ sm: "block"
242
+ }
243
+ },
244
+ className: "app-logo",
245
+ children: [appLogo && appLogo !== "none" ? /*#__PURE__*/_jsx("img", {
246
+ alt: `${appTitle} Logo`,
247
+ style: {
248
+ height: "40px",
249
+ width: "auto"
285
250
  },
286
- "&:hover": {
287
- color: textColorHover || textColor || "#FFF",
288
- background: bgColorHover || bgColor || "none",
289
- "& .m-settings": {
290
- display: "block"
291
- }
251
+ src: appLogo
252
+ }) : null, "\xA0", appTitle]
253
+ }), /*#__PURE__*/_jsxs(Box, {
254
+ sx: {
255
+ display: {
256
+ xs: "none",
257
+ sm: "block"
292
258
  }
293
259
  },
294
- children: item.text
295
- }, item)) : null]
296
- })]
297
- })
298
- }), /*#__PURE__*/_jsx("nav", {
299
- children: /*#__PURE__*/_jsx(Drawer, {
300
- container: container,
301
- variant: "temporary",
302
- open: mobileOpen,
303
- onClose: handleDrawerToggle,
304
- ModalProps: {
305
- keepMounted: true // Better open performance on mobile.
306
- },
260
+ children: [isDrawer ? /*#__PURE__*/_jsx(IconButton, {
261
+ color: "inherit",
262
+ "aria-label": "open drawer",
263
+ edge: "start",
264
+ onClick: handleDrawerToggle,
265
+ children: /*#__PURE__*/_jsx(MenuIcon, {})
266
+ }) : null, !isDrawer ? menus.map((item, i) => /*#__PURE__*/_jsx(Button, {
267
+ component: "a",
268
+ href: item.url,
269
+ sx: {
270
+ position: "relative",
271
+ fontFamily: fontFamily,
272
+ textTransform: "none",
273
+ fontSize: fontSize || "16px",
274
+ color: textColor || "#FFF",
275
+ background: bgColor || "none",
276
+ "& .m-settings": {
277
+ display: "none",
278
+ position: "absolute",
279
+ top: 0,
280
+ bottom: 0,
281
+ left: 0,
282
+ right: 0,
283
+ margin: "auto",
284
+ width: "42px",
285
+ height: "42px",
286
+ background: "#FFF"
287
+ },
288
+ "&:hover": {
289
+ color: textColorHover || textColor || "#FFF",
290
+ background: bgColorHover || bgColor || "none",
291
+ "& .m-settings": {
292
+ display: "block"
293
+ }
294
+ }
295
+ },
296
+ children: item.text
297
+ }, `${item.url}_${i}_no_drawer`)) : null]
298
+ })]
299
+ })
300
+ }), /*#__PURE__*/_jsx("nav", {
301
+ children: /*#__PURE__*/_jsx(Drawer, {
302
+ container: container,
303
+ variant: "temporary",
304
+ open: mobileOpen,
305
+ onClose: handleDrawerToggle,
306
+ ModalProps: {
307
+ keepMounted: true // Better open performance on mobile.
308
+ },
307
309
 
308
- sx: {
309
- display: {
310
- xs: "block",
311
- sm: isDrawer ? "block" : "none"
310
+ sx: {
311
+ display: {
312
+ xs: "block",
313
+ sm: isDrawer ? "block" : "none"
314
+ },
315
+ "& .MuiDrawer-paper": {
316
+ boxSizing: "border-box",
317
+ width: drawerWidth
318
+ }
312
319
  },
313
- "& .MuiDrawer-paper": {
314
- boxSizing: "border-box",
315
- width: drawerWidth
316
- }
317
- },
318
- children: drawer
319
- })
320
- }), /*#__PURE__*/_jsx(ToolBar, {}), openSetttings ? /*#__PURE__*/_jsx(AppHeaderPopup, {
321
- element: element,
322
- onSave: onSave,
323
- onClose: onClose,
324
- customProps: customProps
325
- }) : null]
326
- }), /*#__PURE__*/_jsx("div", {
327
- contentEditable: true,
328
- children: children
329
- })]
320
+ children: drawer
321
+ })
322
+ }), /*#__PURE__*/_jsx(ToolBar, {})]
323
+ }), /*#__PURE__*/_jsx("div", {
324
+ contentEditable: false,
325
+ children: children
326
+ })]
327
+ }), openSetttings ? /*#__PURE__*/_jsx(AppHeaderPopup, {
328
+ element: element,
329
+ onSave: onSave,
330
+ onClose: onClose,
331
+ customProps: customProps
332
+ }) : null]
330
333
  });
331
334
  }
332
335
  export default AppHeader;
@@ -6,7 +6,8 @@ const AppHeaderPopup = props => {
6
6
  const {
7
7
  element,
8
8
  onSave,
9
- onClose
9
+ onClose,
10
+ customProps
10
11
  } = props;
11
12
  return /*#__PURE__*/_jsx(StyleBuilder, {
12
13
  title: "App Header",
@@ -14,7 +15,8 @@ const AppHeaderPopup = props => {
14
15
  element: element,
15
16
  onSave: onSave,
16
17
  onClose: onClose,
17
- renderTabs: appHeaderStyle
18
+ renderTabs: appHeaderStyle,
19
+ customProps: customProps
18
20
  });
19
21
  };
20
22
  export default AppHeaderPopup;
@@ -1,22 +1,23 @@
1
1
  import React from "react";
2
- import { IconButton, Tooltip } from "@mui/material";
3
2
  import { insertButton } from "../../utils/button";
4
- import { ButtonIcon } from "../../common/iconslist";
3
+ import ToolbarIcon from "../../common/ToolbarIcon";
4
+ import Icon from "../../common/Icon";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const ButtonToolIcon = props => {
7
7
  const {
8
- editor
8
+ editor,
9
+ icoBtnType
9
10
  } = props;
10
11
  const handleInsertButton = () => {
11
12
  insertButton(editor);
12
13
  };
13
- return /*#__PURE__*/_jsx(Tooltip, {
14
+ return /*#__PURE__*/_jsx(ToolbarIcon, {
14
15
  title: "Button",
15
- arrow: true,
16
- children: /*#__PURE__*/_jsx(IconButton, {
17
- onClick: handleInsertButton,
18
- children: /*#__PURE__*/_jsx(ButtonIcon, {})
19
- })
16
+ onClick: handleInsertButton,
17
+ icon: /*#__PURE__*/_jsx(Icon, {
18
+ icon: "button"
19
+ }),
20
+ icoBtnType: icoBtnType
20
21
  });
21
22
  };
22
23
  export default ButtonToolIcon;
@@ -39,7 +39,7 @@ const EditorButton = props => {
39
39
  textColorHover,
40
40
  bgColorHover,
41
41
  buttonIcon,
42
- iconPosition,
42
+ iconPosition = "start",
43
43
  borderStyle,
44
44
  borderWidth,
45
45
  borderColor
@@ -63,10 +63,10 @@ const EditorButton = props => {
63
63
  const BtnIcon = buttonIcon ? fIcons[buttonIcon] : null;
64
64
  const onClick = async e => {
65
65
  if (readOnly) {
66
- if (metadata?.buttonLink?.handler) {
67
- metadata.buttonLink.handler("click");
68
- } else if (linkType === "actionTrigger") {
69
- if (redirectOnURLResult) {
66
+ if (linkType === "actionTrigger") {
67
+ if (metadata?.buttonLink?.handler) {
68
+ metadata.buttonLink.handler("click");
69
+ } else if (redirectOnURLResult) {
70
70
  // call api and redirect based on api result
71
71
  const apiResult = await actionButtonRedirect({}, {
72
72
  url: buttonLink?.url
@@ -124,12 +124,12 @@ const EditorButton = props => {
124
124
  className: "editor-btn-wrapper",
125
125
  ...attributes,
126
126
  style: {
127
- display: "inline"
127
+ display: "inline",
128
+ textAlign: textAlign || "left"
128
129
  },
129
130
  children: [/*#__PURE__*/_jsx("div", {
130
131
  className: "editor-btn-wrapper-inner",
131
132
  style: {
132
- textAlign: textAlign || "left",
133
133
  display: "inline"
134
134
  },
135
135
  contentEditable: false,
@@ -168,26 +168,10 @@ const EditorButton = props => {
168
168
  paddingLeft: "4px",
169
169
  paddingRight: "4px"
170
170
  }
171
- }), !readOnly && /*#__PURE__*/_jsxs("div", {
172
- className: `element-selector ${anchorEl ? "selected" : ""}`,
173
- contentEditable: false,
174
- children: [/*#__PURE__*/_jsx("div", {
175
- className: "element-selector-dots tl",
176
- children: " "
177
- }), /*#__PURE__*/_jsx("div", {
178
- className: "element-selector-dots tr",
179
- children: " "
180
- }), /*#__PURE__*/_jsx("div", {
181
- className: "element-selector-dots bl",
182
- children: " "
183
- }), /*#__PURE__*/_jsx("div", {
184
- className: "element-selector-dots br",
185
- children: " "
186
- })]
187
171
  })]
188
172
  })
189
173
  }), /*#__PURE__*/_jsx("div", {
190
- contentEditable: true,
174
+ contentEditable: false,
191
175
  style: {
192
176
  display: "inline"
193
177
  },
@@ -1,18 +1,18 @@
1
- import React, { useState } from "react";
2
- import { Transforms, Path } from "slate";
1
+ import React, { useEffect, useState } from "react";
2
+ import { Transforms, Editor } from "slate";
3
3
  import { ReactEditor, useSelected, useSlateStatic } from "slate-react";
4
4
  import Slider from "react-slick";
5
5
  import "./slick-theme.min.css";
6
6
  import "./slick.min.css";
7
7
  import { PrevArrow, NextArrow } from "./Arrows";
8
8
  import { carouselItem } from "../../utils/carouselItem";
9
- import { IconButton, Tooltip } from "@mui/material";
9
+ import { IconButton, Tooltip, Box } from "@mui/material";
10
10
  import EditIcon from "@mui/icons-material/Edit";
11
- import AddIcon from "@mui/icons-material/Add";
11
+ import CheckCircleIcon from "@mui/icons-material/CheckCircle";
12
12
  import DeleteIcon from "@mui/icons-material/Delete";
13
+ import { GridAddSectionIcon } from "../../common/iconslist";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
- import { createElement as _createElement } from "react";
16
16
  const Empty = ({
17
17
  children
18
18
  }) => {
@@ -32,8 +32,9 @@ const Carousel = props => {
32
32
  readOnly
33
33
  } = customProps;
34
34
  const editor = useSlateStatic();
35
- const selected = useSelected();
35
+ const [showOptions, setShowOptions] = useState(false);
36
36
  const [edit, setEdit] = useState(false);
37
+ const path = ReactEditor.findPath(editor, element);
37
38
  const settings = {
38
39
  dots: true,
39
40
  infinite: true,
@@ -43,13 +44,15 @@ const Carousel = props => {
43
44
  nextArrow: /*#__PURE__*/_jsx(NextArrow, {}),
44
45
  prevArrow: /*#__PURE__*/_jsx(PrevArrow, {})
45
46
  };
47
+ useEffect(() => {
48
+ if (!edit) {
49
+ ReactEditor.focus(editor);
50
+ Transforms.select(editor, Editor.end(editor, []));
51
+ }
52
+ }, [edit]);
46
53
  const onAddSlide = () => {
47
- const currentPath = editor.selection?.anchor?.path;
48
- const ancestorsPath = Path.ancestors(currentPath, {
49
- reverse: true
50
- });
51
- const insertPath = ancestorsPath[1];
52
- if (insertPath) {
54
+ const insertPath = [path[0], children.length];
55
+ if (insertPath[0] !== undefined) {
53
56
  insertPath[insertPath.length - 1] = element.children.length;
54
57
  Transforms.insertNodes(editor, [{
55
58
  ...carouselItem()
@@ -67,29 +70,36 @@ const Carousel = props => {
67
70
  at: [...path]
68
71
  });
69
72
  };
73
+ const onMouseOver = () => {
74
+ setShowOptions(true);
75
+ };
76
+ const onMouseLeave = () => {
77
+ setShowOptions(false);
78
+ };
70
79
  const ToolBar = () => {
71
- return selected ? /*#__PURE__*/_jsxs("div", {
80
+ return !readOnly && showOptions ? /*#__PURE__*/_jsxs("div", {
72
81
  className: "element-toolbar hr",
73
82
  contentEditable: false,
74
83
  style: {
75
- top: "-42px"
84
+ top: "-32px",
85
+ left: "0px"
76
86
  },
77
87
  children: [/*#__PURE__*/_jsx(Tooltip, {
78
- title: edit ? "Save" : "Edit",
88
+ title: edit ? "Save Carousel" : "Edit Carousel",
79
89
  arrow: true,
80
90
  children: /*#__PURE__*/_jsx(IconButton, {
81
91
  onClick: onEdit,
82
- children: /*#__PURE__*/_jsx(EditIcon, {})
92
+ children: !edit ? /*#__PURE__*/_jsx(EditIcon, {}) : /*#__PURE__*/_jsx(CheckCircleIcon, {})
83
93
  })
84
94
  }), /*#__PURE__*/_jsx(Tooltip, {
85
95
  title: "Add Slide",
86
96
  arrow: true,
87
97
  children: /*#__PURE__*/_jsx(IconButton, {
88
98
  onClick: onAddSlide,
89
- children: /*#__PURE__*/_jsx(AddIcon, {})
99
+ children: /*#__PURE__*/_jsx(GridAddSectionIcon, {})
90
100
  })
91
101
  }), /*#__PURE__*/_jsx(Tooltip, {
92
- title: "Delete",
102
+ title: "Delete Carousel",
93
103
  arrow: true,
94
104
  children: /*#__PURE__*/_jsx(IconButton, {
95
105
  onClick: onDelete,
@@ -102,20 +112,29 @@ const Carousel = props => {
102
112
  ...attributes,
103
113
  className: "sliderBg",
104
114
  style: {
105
- padding: "32px",
106
115
  backgroundColor: "transparent",
107
- position: "relative"
116
+ position: "relative",
117
+ minHeight: "300px"
108
118
  },
119
+ contentEditable: edit,
120
+ onMouseOver: onMouseOver,
121
+ onMouseLeave: onMouseLeave,
109
122
  children: [edit ? /*#__PURE__*/_jsx(Empty, {
110
123
  children: children
111
- }) : /*#__PURE__*/_createElement(Slider, {
112
- ...settings,
113
- key: children.length
114
- }, children.map((m, i) => {
115
- return /*#__PURE__*/_jsx("div", {
116
- children: m
117
- }, i);
118
- })), !readOnly && /*#__PURE__*/_jsx(ToolBar, {})]
124
+ }) : /*#__PURE__*/_jsx(Box, {
125
+ component: "div",
126
+ style: {
127
+ padding: "12px"
128
+ },
129
+ children: /*#__PURE__*/_jsx(Slider, {
130
+ ...settings,
131
+ children: children.map((m, i) => {
132
+ return /*#__PURE__*/_jsx("div", {
133
+ children: m
134
+ }, i);
135
+ })
136
+ })
137
+ }, `slider_${children.length}`), !readOnly && /*#__PURE__*/_jsx(ToolBar, {})]
119
138
  });
120
139
  };
121
140
  export default Carousel;
@@ -1,22 +1,21 @@
1
1
  import React from "react";
2
- import { IconButton, Tooltip } from "@mui/material";
3
2
  import { insertCarousel } from "../../utils/carousel";
4
3
  import { Carousal } from "../../common/iconslist";
4
+ import ToolbarIcon from "../../common/ToolbarIcon";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const CarouselButton = props => {
7
7
  const {
8
- editor
8
+ editor,
9
+ icoBtnType
9
10
  } = props;
10
11
  const handleClick = () => {
11
12
  insertCarousel(editor);
12
13
  };
13
- return /*#__PURE__*/_jsx(Tooltip, {
14
+ return /*#__PURE__*/_jsx(ToolbarIcon, {
14
15
  title: "Carousel",
15
- arrow: true,
16
- children: /*#__PURE__*/_jsx(IconButton, {
17
- onClick: handleClick,
18
- children: /*#__PURE__*/_jsx(Carousal, {})
19
- })
16
+ onClick: handleClick,
17
+ icon: /*#__PURE__*/_jsx(Carousal, {}),
18
+ icoBtnType: icoBtnType
20
19
  });
21
20
  };
22
21
  export default CarouselButton;