@flozy/editor 4.4.0 → 4.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/dist/Editor/ChatEditor.js +14 -2
  2. package/dist/Editor/CommonEditor.js +24 -11
  3. package/dist/Editor/Editor.css +1 -7
  4. package/dist/Editor/Elements/AI/PopoverAIInput.js +76 -71
  5. package/dist/Editor/Elements/AI/Styles.js +1 -0
  6. package/dist/Editor/Elements/Button/EditorButton.js +4 -8
  7. package/dist/Editor/Elements/Embed/Embed.css +1 -1
  8. package/dist/Editor/Elements/Embed/Image.js +2 -3
  9. package/dist/Editor/Elements/Embed/Video.js +2 -3
  10. package/dist/Editor/Elements/Form/Form.js +1 -0
  11. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
  12. package/dist/Editor/Elements/Mentions/Mentions.js +3 -2
  13. package/dist/Editor/Elements/SimpleText/index.js +2 -3
  14. package/dist/Editor/Elements/Table/TableRow.js +1 -1
  15. package/dist/Editor/Styles/EditorStyles.js +1 -1
  16. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  17. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +29 -35
  18. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +30 -35
  19. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -0
  20. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +38 -22
  21. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +1 -0
  22. package/dist/Editor/Toolbar/PopupTool/index.js +5 -5
  23. package/dist/Editor/common/FontLoader/FontLoader.js +6 -6
  24. package/dist/Editor/common/Icon.js +1 -1
  25. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +0 -1
  26. package/dist/Editor/common/RnD/index.js +2 -3
  27. package/dist/Editor/common/Section/index.js +1 -11
  28. package/dist/Editor/common/Section/styles.js +0 -14
  29. package/dist/Editor/common/Shorthands/mentions.js +1 -1
  30. package/dist/Editor/helper/index.js +2 -4
  31. package/dist/Editor/hooks/useBreakpoints.js +1 -1
  32. package/dist/Editor/hooks/useMentions.js +39 -13
  33. package/dist/Editor/hooks/withCommon.js +7 -2
  34. package/dist/Editor/plugins/withHTML.js +29 -0
  35. package/dist/Editor/utils/SlateUtilityFunctions.js +0 -9
  36. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +1 -24
  37. package/dist/Editor/utils/customHooks/useResize.js +3 -2
  38. package/dist/Editor/utils/events.js +0 -36
  39. package/package.json +1 -1
  40. package/dist/Editor/helper/RnD/focusNode.js +0 -70
@@ -46,7 +46,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
46
46
  const [deboundedValue] = useDebounce(value, 500);
47
47
  const editor = useMemo(() => {
48
48
  return withCommon(createEditor(), {
49
- needLayout
49
+ needLayout,
50
+ isChatEditor: true
50
51
  });
51
52
  }, []);
52
53
  const isReadOnly = readOnly === "readonly";
@@ -248,6 +249,16 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
248
249
  restVal
249
250
  });
250
251
  };
252
+ const handlePaste = event => {
253
+ const items = event.clipboardData.items;
254
+ for (let i = 0; i < items.length; i++) {
255
+ if (items[i].type.startsWith("image/")) {
256
+ event.preventDefault(); // Prevent the default paste behavior
257
+ return; // Exit early to keep the editor empty
258
+ }
259
+ }
260
+ };
261
+
251
262
  return /*#__PURE__*/_jsx(EditorProvider, {
252
263
  theme: theme,
253
264
  editor: editor,
@@ -267,7 +278,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
267
278
  placeholder: "Start typing ...",
268
279
  spellCheck: true,
269
280
  onBlur: handleBlur,
270
- onKeyDown: onKeyDown
281
+ onKeyDown: onKeyDown,
282
+ onPaste: handlePaste
271
283
  }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
272
284
  ref: mentionsRef,
273
285
  mentions: mentions,
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle } from "react";
3
3
  import PropTypes from "prop-types";
4
- import { createEditor, Transforms } from "slate";
4
+ import { createEditor, Transforms, Range } from "slate";
5
5
  import { Slate, Editable, ReactEditor } from "slate-react";
6
6
  import { useDebounce, useDebouncedCallback } from "use-debounce";
7
7
  import { getMarked, getBlock } from "./utils/SlateUtilityFunctions";
@@ -10,7 +10,7 @@ import { draftToSlate } from "./utils/draftToSlate";
10
10
  import useMentions from "./hooks/useMentions";
11
11
  import MentionsPopup from "./common/MentionsPopup";
12
12
  import { RemoteCursorOverlay } from "./RemoteCursorOverlay/Overlay";
13
- import { mentionsEvent, commands, indentation, escapeEvent, enterEvent, upDownArrowKeyEvents } from "./utils/events";
13
+ import { mentionsEvent, commands, indentation, escapeEvent, enterEvent } from "./utils/events";
14
14
  import withCommon from "./hooks/withCommon";
15
15
  import DialogWrapper from "./DialogWrapper";
16
16
  import { serializeToText } from "./utils/serializeToText";
@@ -33,10 +33,10 @@ import PopoverAIInput from "./Elements/AI/PopoverAIInput";
33
33
  import RnDCopy from "./common/RnD/RnDCopy";
34
34
  import SwitchViewport from "./common/RnD/SwitchViewport/SwitchViewport";
35
35
  import { onInsertFragment } from "./utils/RnD/RnDCtrlCmds";
36
+ import FontLoader from "./common/FontLoader/FontLoader";
36
37
  import "./font.css";
37
38
  import "./Editor.css";
38
39
  import "animate.css";
39
- import FontLoader from "./common/FontLoader/FontLoader";
40
40
  import { jsx as _jsx } from "react/jsx-runtime";
41
41
  import { jsxs as _jsxs } from "react/jsx-runtime";
42
42
  const Item = /*#__PURE__*/forwardRef(({
@@ -365,10 +365,20 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
365
365
  });
366
366
  } else if (event.key === "Enter") {
367
367
  enterEvent(event, editor, customProps?.isMobile);
368
- } else if (event.key === "ArrowUp" && otherProps?.tagName !== 'Pages') {
369
- upDownArrowKeyEvents(event, editor);
370
- } else if (event.key === "ArrowDown" && otherProps?.tagName !== 'Pages') {
371
- upDownArrowKeyEvents(event, editor);
368
+ } else if (event.key === 'Backspace') {
369
+ const {
370
+ selection
371
+ } = editor;
372
+ event.preventDefault();
373
+ if (selection) {
374
+ if (!Range.isCollapsed(selection)) {
375
+ editor.deleteFragment();
376
+ } else {
377
+ editor.deleteBackward({
378
+ unit: 'character'
379
+ });
380
+ }
381
+ }
372
382
  }
373
383
  }, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
374
384
  const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
@@ -433,19 +443,22 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
433
443
  const selection = window?.getSelection();
434
444
  if (selection && selection.rangeCount > 0) {
435
445
  const cursorPosition = selection.getRangeAt(0)?.getBoundingClientRect();
436
- const containerBottom = container?.getBoundingClientRect()?.bottom;
446
+ const containerRect = container?.getBoundingClientRect();
447
+ const containerBottom = containerRect?.bottom;
437
448
  if (cursorPosition && cursorPosition.bottom > containerBottom - 250) {
449
+ // Calculate dynamic scroll based on remaining space
450
+ const scrollAmount = Math.min(200, cursorPosition.bottom - containerBottom + 250);
438
451
  container?.scrollBy({
439
- top: 200,
452
+ top: scrollAmount,
440
453
  behavior: "smooth"
441
454
  });
442
455
  }
443
456
  } else {
444
- console.warn("No valid selection range found");
457
+ console.warn('No valid selection range found');
445
458
  }
446
459
  }
447
460
  } catch (err) {
448
- console.log("handleCursorScroll", err);
461
+ console.log('handleCursorScroll', err);
449
462
  }
450
463
  };
451
464
  return /*#__PURE__*/_jsx(EditorProvider, {
@@ -244,13 +244,6 @@ blockquote {
244
244
  width: 17px !important;
245
245
  }
246
246
 
247
- .react-datepicker__input-container input {
248
- height: 40px !important;
249
- border: 1px solid #ccc;
250
- border-radius: 5px;
251
- width: 100%;
252
- }
253
-
254
247
  .close-popupbtn {
255
248
  border-radius: 4px !important;
256
249
  width: 24px;
@@ -891,6 +884,7 @@ blockquote {
891
884
  /* For Firefox */
892
885
  .removeScroll {
893
886
  -moz-appearance: textfield;
887
+ appearance: none;
894
888
  }
895
889
 
896
890
  .borderInput:focus-visible {
@@ -40,9 +40,11 @@ const scrollToAIInput = editor => {
40
40
  }, 200);
41
41
  };
42
42
  const insertText = (editor, text, options) => {
43
- const parsed = new DOMParser().parseFromString(text, "text/html");
44
- const fragment = deserialize(parsed.body);
45
- Transforms.insertFragment(editor, fragment, options);
43
+ if (text?.length) {
44
+ const parsed = new DOMParser().parseFromString(text, "text/html");
45
+ const fragment = deserialize(parsed.body);
46
+ Transforms.insertFragment(editor, fragment, options);
47
+ }
46
48
  };
47
49
  const insertAtNextLine = (editor, text) => {
48
50
  const nextLine = getNextLine(editor);
@@ -200,80 +202,83 @@ function PopoverAIInput({
200
202
  selectedEleRef.current = selectedElement;
201
203
  }, [selectedElement]);
202
204
  const onSend = async (type, option) => {
203
- if (type === "close") {
204
- onClickOutside();
205
- return;
206
- }
207
- if (type === "done") {
208
- // Get the current selection point
209
- const {
210
- anchor
211
- } = editor.selection;
212
- const {
213
- path
214
- } = anchor;
215
- const {
216
- text: selectText
217
- } = Node.get(editor, path);
218
- if (selectText?.length) {
219
- insertAtNextLine(editor, generatedText);
220
- } else {
205
+ try {
206
+ if (type === "close") {
207
+ onClickOutside();
208
+ return;
209
+ }
210
+ if (type === "done") {
211
+ // Get the current selection point
212
+ const {
213
+ anchor
214
+ } = editor.selection;
215
+ const {
216
+ path
217
+ } = anchor;
218
+ const {
219
+ text: selectText
220
+ } = Node.get(editor, path);
221
+ if (selectText?.length) {
222
+ insertAtNextLine(editor, generatedText);
223
+ } else {
224
+ insertText(editor, generatedText);
225
+ }
226
+ onClickOutside();
227
+ return;
228
+ }
229
+ if (type === "replace_selection") {
230
+ // replace generated text
221
231
  insertText(editor, generatedText);
232
+ onClickOutside();
233
+ return;
222
234
  }
223
- onClickOutside();
224
- return;
225
- }
226
- if (type === "replace_selection") {
227
- // replace generated text
228
- insertText(editor, generatedText);
229
- onClickOutside();
230
- return;
231
- }
232
- if (type === "speech_to_text") {
233
- setGeneratedText(option.text);
234
- return;
235
- }
236
- if (type === "try_again") {
237
- // resetting the previous option and try again
238
- option = selectedOption;
239
- type = selectedOption.value;
240
- } else {
241
- setSelectedOption(option);
242
- }
243
- setLoading(true);
244
- const payload = {
245
- mode: option.mode || 0,
246
- query: option?.inputValue || inputValue
247
- };
248
- if (option.mode === MODES.translate || option.mode === MODES.rephraseTone) {
249
- payload.textOptionInput = type;
250
- }
251
- if (option.mode) {
252
- payload.textData = generatedText || window.getSelection().toString();
253
- }
254
- const result = await services("infinityAI", payload);
255
- setLoading(false);
256
- setInputValue("");
257
- let {
258
- data: text
259
- } = result || {};
260
- if (!text) {
261
- onClickOutside();
262
- return;
263
- }
264
- if (!option.replace) {
265
- if (type === "continue_writing") {
266
- setGeneratedText(generatedText + text);
235
+ if (type === "speech_to_text") {
236
+ setGeneratedText(option.text);
237
+ return;
238
+ }
239
+ if (type === "try_again") {
240
+ // resetting the previous option and try again
241
+ option = selectedOption;
242
+ type = selectedOption.value;
267
243
  } else {
268
- setGeneratedText(text);
244
+ setSelectedOption(option);
269
245
  }
270
- return;
271
- }
272
- insertText(editor, text);
246
+ setLoading(true);
247
+ const payload = {
248
+ mode: option.mode || 0,
249
+ query: option?.inputValue || inputValue
250
+ };
251
+ if (option.mode === MODES.translate || option.mode === MODES.rephraseTone) {
252
+ payload.textOptionInput = type;
253
+ }
254
+ if (option.mode) {
255
+ payload.textData = generatedText || window.getSelection().toString();
256
+ }
257
+ const result = await services("infinityAI", payload);
258
+ setLoading(false);
259
+ setInputValue("");
260
+ let {
261
+ data: text
262
+ } = result || {};
263
+ if (!text) {
264
+ onClickOutside();
265
+ return;
266
+ }
267
+ if (!option.replace) {
268
+ if (type === "continue_writing") {
269
+ setGeneratedText(generatedText + text);
270
+ } else {
271
+ setGeneratedText(text);
272
+ }
273
+ return;
274
+ }
275
+ insertText(editor, text);
273
276
 
274
- // scrollToAIInput();
277
+ // scrollToAIInput();
278
+ } catch (err) {
279
+ console.error("Error on sending/inserting text", err);
280
+ }
275
281
  };
276
-
277
282
  const onInputChange = e => {
278
283
  setInputValue(e.target.value);
279
284
  };
@@ -1,5 +1,6 @@
1
1
  const Styles = theme => ({
2
2
  aiContainer: {
3
+ background: "#FCFAFF",
3
4
  background: theme?.palette?.editor?.aiInputBackground,
4
5
  border: "1px solid #8360FD",
5
6
  borderRadius: "6px",
@@ -10,14 +10,10 @@ import { getTRBLBreakPoints, getBreakPointsValue, groupByBreakpoint } from "../.
10
10
  import { handleLinkType, windowVar } from "../../utils/helper";
11
11
  import LinkSettings from "../../common/LinkSettings";
12
12
  import Icon from "../../common/Icon";
13
- import { useEditorContext } from "../../hooks/useMouseMove";
14
13
  import { jsx as _jsx } from "react/jsx-runtime";
15
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
15
  const EditorButton = props => {
17
16
  const theme = useTheme();
18
- const {
19
- theme: appTheme
20
- } = useEditorContext();
21
17
  const {
22
18
  attributes,
23
19
  element,
@@ -144,8 +140,8 @@ const EditorButton = props => {
144
140
  sx: {
145
141
  display: "inline-flex",
146
142
  color: "rgba(0, 0, 0, 0.54)",
147
- borderRadius: "50% !important",
148
- border: "none !important"
143
+ borderRadius: '50% !important',
144
+ border: 'none !important'
149
145
  },
150
146
  ...btnProps,
151
147
  children: /*#__PURE__*/_jsx(Icon, {
@@ -216,7 +212,7 @@ const EditorButton = props => {
216
212
  },
217
213
  "& svg": {
218
214
  "& path": {
219
- stroke: appTheme.palette.text.primary
215
+ stroke: theme.palette.text.primary
220
216
  }
221
217
  },
222
218
  "& button": {
@@ -281,7 +277,7 @@ const EditorButton = props => {
281
277
  right: "-42px",
282
278
  stroke: "#fff",
283
279
  "& path": {
284
- fill: openMoreOptions ? appTheme.palette.text.blueText : ""
280
+ fill: openMoreOptions ? theme.palette.text.blueText : ""
285
281
  }
286
282
  },
287
283
  onClick: handleMoreBtn,
@@ -1,5 +1,5 @@
1
1
  .embed {
2
- width: fit-content;
2
+ /* width: fit-content; */
3
3
  position: relative;
4
4
  margin: 0px;
5
5
  }
@@ -94,8 +94,7 @@ const ImageContent = props => {
94
94
  onTouchEnd: onTouchEnd // for mobile
95
95
  ,
96
96
  "data-path": path.join(","),
97
- draggable: false,
98
- contentEditable: false
97
+ draggable: false
99
98
  });
100
99
  };
101
100
  const Image = props => {
@@ -223,7 +222,7 @@ const Image = props => {
223
222
  const getWidth = () => {
224
223
  if (resizing) {
225
224
  return {
226
- width: `${size.width}px`,
225
+ width: `${size.widthInPercent}%`,
227
226
  height: objectFit ? `${size.height}px` : "auto"
228
227
  };
229
228
  } else {
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from "react";
1
+ import React, { useState, useEffect, useCallback } from "react";
2
2
  import { useSlateStatic, ReactEditor } from "slate-react";
3
3
  import { Node, Transforms } from "slate";
4
4
  import { IconButton, Tooltip, Box, useTheme } from "@mui/material";
@@ -179,7 +179,7 @@ const Video = ({
179
179
  const getWidth = () => {
180
180
  if (resizing) {
181
181
  return {
182
- width: size.width ? `${size.width}px` : "100%",
182
+ width: size.widthInPercent ? `${size.widthInPercent}%` : "100%",
183
183
  height: url ? `${size.height || 370}px` : "auto"
184
184
  };
185
185
  } else {
@@ -220,7 +220,6 @@ const Video = ({
220
220
  alignContent: vertical
221
221
  },
222
222
  ...element.attr,
223
- contentEditable: false,
224
223
  children: [openSetttings ? /*#__PURE__*/_jsx(EmbedPopup, {
225
224
  element: element,
226
225
  onSave: onSave,
@@ -401,6 +401,7 @@ const Form = props => {
401
401
  component: "button",
402
402
  onClick: onSubmitClick,
403
403
  disabled: loading,
404
+ contentEditable: false,
404
405
  sx: {
405
406
  background: buttonProps?.bgColor || "rgb(30, 75, 122)",
406
407
  borderWidth: "1px",
@@ -71,11 +71,11 @@ const FormWorkflow = props => {
71
71
  children: [/*#__PURE__*/_jsx(Grid, {
72
72
  item: true,
73
73
  sx: classes.radioBtn,
74
- children: /*#__PURE__*/_jsx(RadioGroup, {
74
+ children: /*#__PURE__*/_jsxs(RadioGroup, {
75
75
  name: "set timing",
76
76
  value: schedule,
77
77
  defaultValue: 1,
78
- children: /*#__PURE__*/_jsx(FormControlLabel, {
78
+ children: [/*#__PURE__*/_jsx(FormControlLabel, {
79
79
  value: "immediately",
80
80
  label: "Immediately",
81
81
  onChange: () => {
@@ -84,7 +84,16 @@ const FormWorkflow = props => {
84
84
  control: /*#__PURE__*/_jsx(Radio, {
85
85
  size: "small"
86
86
  })
87
- })
87
+ }), /*#__PURE__*/_jsx(FormControlLabel, {
88
+ value: "after",
89
+ label: "After",
90
+ onChange: () => {
91
+ setSchedule("after");
92
+ },
93
+ control: /*#__PURE__*/_jsx(Radio, {
94
+ size: "small"
95
+ })
96
+ })]
88
97
  })
89
98
  }), schedule === "after" && /*#__PURE__*/_jsx(Grid, {
90
99
  item: true,
@@ -14,9 +14,10 @@ const Mentions = ({
14
14
  verticalAlign: "baseline",
15
15
  display: "inline-block",
16
16
  borderRadius: "4px",
17
- backgroundColor: "#eee",
17
+ backgroundColor: "#2563EB",
18
18
  fontSize: "0.9em",
19
- boxShadow: selected && focused ? "0 0 0 2px #B4D5FF" : "none"
19
+ boxShadow: selected && focused ? "0 0 0 2px #B4D5FF" : "none",
20
+ color: "#FFF"
20
21
  };
21
22
  // See if our empty text child has any styling marks applied and apply those
22
23
  if (element.children[0].bold) {
@@ -6,7 +6,6 @@ import { isTextSelected } from "../../utils/helper";
6
6
  import { useEditorContext } from "../../hooks/useMouseMove";
7
7
  import SimpleTextStyle from "./style";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- import { Fragment as _Fragment } from "react/jsx-runtime";
10
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
10
  import { createElement as _createElement } from "react";
12
11
  const SimpleText = props => {
@@ -48,9 +47,9 @@ const SimpleText = props => {
48
47
  sx: classes.root,
49
48
  key: `para_${path.join("|")}`
50
49
  }, children, openAI ? null : /*#__PURE__*/_jsx("span", {
51
- contentEditable: false,
52
50
  className: "placeholder-simple-text",
53
- children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? /*#__PURE__*/_jsxs(_Fragment, {
51
+ children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? /*#__PURE__*/_jsxs("span", {
52
+ className: "placeholder-simple-text-default",
54
53
  children: ["Type ", /*#__PURE__*/_jsx("span", {
55
54
  style: {
56
55
  backgroundColor: '#F2F6FA',
@@ -23,7 +23,7 @@ const TableRow = props => {
23
23
  return /*#__PURE__*/_jsx("tr", {
24
24
  ...attributes,
25
25
  style: {
26
- backgroundColor: bgColor,
26
+ background: bgColor,
27
27
  border: rowBorderColor ? `1px solid ${rowBorderColor}` : ""
28
28
  },
29
29
  children: children
@@ -215,7 +215,7 @@ const editorStyles = ({
215
215
  },
216
216
  "& .content-editable.empty": {
217
217
  "&:after": {
218
- color: theme.palette.type === "dark" ? "#99A5B6" : placeHolderColor
218
+ color: placeHolderColor
219
219
  }
220
220
  },
221
221
  "& .checkbox-edit": {
@@ -123,7 +123,8 @@ const MiniToolbar = props => {
123
123
  label,
124
124
  icon: Icon
125
125
  }) => {
126
- const isDisabled = popupType === type || type === "undo" ? !canUndo : type === "redo" ? !canRedo : false;
126
+ const isDisabled = popupType === type || type === "undo" ? !canUndo : type === "redo" ? !canRedo : false; // for textFormat type
127
+
127
128
  return /*#__PURE__*/_jsx(Tooltip, {
128
129
  arrow: true,
129
130
  title: label,
@@ -1,28 +1,22 @@
1
1
  import React from "react";
2
- import { Box, Button, Card, CardMedia, Grid } from "@mui/material";
2
+ import { Box, Card, CardMedia, Grid } from "@mui/material";
3
+
4
+ // const Select = (props) => {
5
+ // const { classes, data, onSelectTemplate } = props;
6
+ // return (
7
+ // <Box
8
+ // className="template-card-action"
9
+ // component={"div"}
10
+ // sx={classes.templateCardBtnGrp}
11
+ // style={{ padding: 0, background: "transparent"}}
12
+ // >
13
+ // <Button className="blueBtn" onClick={onSelectTemplate(data)}>
14
+ // Select
15
+ // </Button>
16
+ // </Box>
17
+ // );
18
+ // };
3
19
  import { jsx as _jsx } from "react/jsx-runtime";
4
- import { jsxs as _jsxs } from "react/jsx-runtime";
5
- const Select = props => {
6
- const {
7
- classes,
8
- data,
9
- onSelectTemplate
10
- } = props;
11
- return /*#__PURE__*/_jsx(Box, {
12
- className: "template-card-action",
13
- component: "div",
14
- sx: classes.templateCardBtnGrp,
15
- style: {
16
- padding: 0,
17
- background: "transparent"
18
- },
19
- children: /*#__PURE__*/_jsx(Button, {
20
- className: "blueBtn",
21
- onClick: onSelectTemplate(data),
22
- children: "Select"
23
- })
24
- });
25
- };
26
20
  const ButtonTemplateCard = props => {
27
21
  const {
28
22
  classes,
@@ -34,19 +28,19 @@ const ButtonTemplateCard = props => {
34
28
  xs: 3,
35
29
  children: /*#__PURE__*/_jsx(Card, {
36
30
  sx: classes.paperOverrides,
37
- children: /*#__PURE__*/_jsxs(Box, {
31
+ children: /*#__PURE__*/_jsx(Box, {
38
32
  sx: classes.buttonCardMediaWrpr,
39
- children: [/*#__PURE__*/_jsx(CardMedia, {
40
- className: `template-card-media`,
41
- component: "div",
42
- image: m?.thumbnail,
43
- alt: m?.title,
44
- sx: classes.buttonCardMedia
45
- }), /*#__PURE__*/_jsx(Select, {
46
- classes: classes,
47
- onSelectTemplate: onSelectTemplate,
48
- data: m
49
- })]
33
+ onClick: onSelectTemplate(m),
34
+ children: /*#__PURE__*/_jsx("div", {
35
+ className: "img-wrapper",
36
+ children: /*#__PURE__*/_jsx(CardMedia, {
37
+ className: `template-card-media`,
38
+ component: "div",
39
+ image: m?.thumbnail,
40
+ alt: m?.title,
41
+ sx: classes.buttonCardMedia
42
+ })
43
+ })
50
44
  })
51
45
  })
52
46
  }, `template_${m.id}`);