@flozy/editor 4.3.2 → 4.3.4

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.
@@ -42,7 +42,8 @@ function AIInput({
42
42
  onInputChange,
43
43
  onClickOutside,
44
44
  startRecording,
45
- loading
45
+ loading,
46
+ isMobile
46
47
  }, ref) {
47
48
  const {
48
49
  theme
@@ -130,7 +131,7 @@ function AIInput({
130
131
  component: "div",
131
132
  style: classes.sendIconContainer,
132
133
  className: "icons-elements",
133
- children: [/*#__PURE__*/_jsx(IconButton, {
134
+ children: [isMobile ? null : /*#__PURE__*/_jsx(IconButton, {
134
135
  disabled: loading,
135
136
  onClick: () => startRecording(),
136
137
  children: /*#__PURE__*/_jsx(ChatMicIcon, {})
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from "react";
1
+ import { useEffect, useRef, useState } from "react";
2
2
  import { useEditorContext } from "../../hooks/useMouseMove";
3
3
  import Styles from "./Styles";
4
4
  import { Fade, Paper, Popper } from "@mui/material";
@@ -173,10 +173,11 @@ function PopoverAIInput({
173
173
  const [generatedText, setGeneratedText] = useState("");
174
174
  const [inputValue, setInputValue] = useState("");
175
175
  const [selectedOption, setSelectedOption] = useState();
176
+ const selectedEleRef = useRef({});
176
177
  const classes = Styles();
177
178
  const editor = useSlate();
178
179
  const updateAnchor = () => {
179
- updateAnchorEl(setAnchorEl, editor, openAI, selectedElement);
180
+ updateAnchorEl(setAnchorEl, editor, openAI, selectedEleRef.current);
180
181
  };
181
182
  useEditorScroll(editorWrapper, updateAnchor);
182
183
  const onClickOutside = () => {
@@ -195,6 +196,9 @@ function PopoverAIInput({
195
196
  scrollToAIInput(editor);
196
197
  }
197
198
  }, [openAI]);
199
+ useEffect(() => {
200
+ selectedEleRef.current = selectedElement;
201
+ }, [selectedElement]);
198
202
  const onSend = async (type, option) => {
199
203
  if (type === "close") {
200
204
  onClickOutside();
@@ -303,7 +307,8 @@ function PopoverAIInput({
303
307
  openAI: openAI,
304
308
  inputValue: inputValue,
305
309
  onInputChange: onInputChange,
306
- onClickOutside: onClickOutside
310
+ onClickOutside: onClickOutside,
311
+ isMobile: otherProps?.isMobile
307
312
  })
308
313
  })
309
314
  })
@@ -42,7 +42,8 @@ const styles = theme => ({
42
42
  height: "100%"
43
43
  },
44
44
  TranscriptionContainer: {
45
- padding: "12px"
45
+ padding: "12px",
46
+ color: theme?.palette?.editor?.textColor
46
47
  }
47
48
  });
48
49
  export default styles;
@@ -10,7 +10,6 @@ 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 => {
@@ -1,27 +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
- const Select = props => {
5
- const {
6
- classes,
7
- data,
8
- onSelectTemplate
9
- } = props;
10
- return /*#__PURE__*/_jsx(Box, {
11
- className: "template-card-action",
12
- component: "div",
13
- sx: classes.templateCardBtnGrp,
14
- style: {
15
- padding: 0,
16
- background: "transparent"
17
- },
18
- children: /*#__PURE__*/_jsx(Button, {
19
- className: "blueBtn",
20
- onClick: onSelectTemplate(data),
21
- children: "Select"
22
- })
23
- });
24
- };
25
20
  const ButtonTemplateCard = props => {
26
21
  const {
27
22
  classes,
@@ -1,26 +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={{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
- const Select = props => {
5
- const {
6
- classes,
7
- data,
8
- onSelectTemplate
9
- } = props;
10
- return /*#__PURE__*/_jsx(Box, {
11
- className: "template-card-action",
12
- component: "div",
13
- sx: classes.templateCardBtnGrp,
14
- style: {
15
- background: "transparent"
16
- },
17
- children: /*#__PURE__*/_jsx(Button, {
18
- className: "blueBtn",
19
- onClick: onSelectTemplate(data),
20
- children: "Select"
21
- })
22
- });
23
- };
24
20
  const FullViewCard = props => {
25
21
  const {
26
22
  classes,
@@ -50,9 +50,6 @@ const FontLoader = props => {
50
50
  }
51
51
  loadNextBatch();
52
52
  };
53
- const sanitizeFontFamily = fontFamily => {
54
- return fontFamily.replace(/\\/g, '').replace(/['"]/g, '');
55
- };
56
53
  useEffect(() => {
57
54
  let families = [...defaultFonts];
58
55
  if (!readOnly) {
@@ -70,13 +67,24 @@ const FontLoader = props => {
70
67
  console.log(err);
71
68
  });
72
69
  } else {
70
+ function correctFontArray(fontString) {
71
+ let fontsArray = fontString.split(',');
72
+ let cleanedFontsArray = [...new Set(fontsArray.map(font => font.trim()))];
73
+ return cleanedFontsArray;
74
+ }
75
+ function sanitizeFontFamily(fontFamily) {
76
+ const correctedFonts = correctFontArray(fontFamily);
77
+ return correctedFonts.join(', ');
78
+ }
73
79
  const elements = Array.from(document?.querySelectorAll("*"));
74
80
  const fontSet = new Set();
75
81
  elements.forEach(element => {
76
82
  const computedStyles = window?.getComputedStyle(element);
77
83
  fontSet.add(sanitizeFontFamily(computedStyles?.fontFamily));
78
84
  });
79
- families = Array.from(fontSet);
85
+ let families = Array.from(fontSet);
86
+ families = correctFontArray(families.join(', '));
87
+ families = families.map(font => font.replace(/\"/g, ''));
80
88
  loadFontsInBatches(families);
81
89
  }
82
90
  }, []);
@@ -1,5 +1,4 @@
1
1
  import React from "react";
2
- import { Node } from "slate";
3
2
  import { Dialog, DialogContent, DialogTitle, IconButton } from "@mui/material";
4
3
  import SaveAsTemplate from "../../../StyleBuilder/fieldTypes/saveAsTemplate";
5
4
  import { CloseIcon } from "../../../iconslist";
@@ -151,7 +151,7 @@ const RnD = props => {
151
151
  // to prevent auto scroll to top
152
152
  // when no editor.selection
153
153
  if (!editor.selection) {
154
- Transforms.select(editor, Editor.end(editor, []));
154
+ // Transforms.select(editor, Editor.end(editor, []));
155
155
  }
156
156
  switch (e.detail) {
157
157
  case 1:
@@ -416,7 +416,9 @@ const RnD = props => {
416
416
  }
417
417
  };
418
418
  const onMouseOver = e => {
419
- e.stopPropagation();
419
+ if (type !== "child") {
420
+ e.stopPropagation();
421
+ }
420
422
  if (type !== "child") {
421
423
  updateDragging({
422
424
  dragOver: str_path
@@ -546,7 +548,7 @@ const RnD = props => {
546
548
  contextMenu: contextMenu,
547
549
  handleClose: handleClose,
548
550
  theme: theme
549
- }), type === "parent" && breakpoint === "lg" ? /*#__PURE__*/_jsx(VirtualElement, {
551
+ }), type === "parent" && breakpoint === "lg" && !readOnly ? /*#__PURE__*/_jsx(VirtualElement, {
550
552
  parentEle: positionRef?.current?.resizableElement?.current,
551
553
  updated_at: updated_at,
552
554
  path: str_path,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.3.2",
3
+ "version": "4.3.4",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"