@flozy/editor 4.9.8 → 4.9.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from "react";
1
+ import React, { useState, useEffect, useRef } 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";
@@ -24,6 +24,13 @@ const VideoContent = props => {
24
24
  alt,
25
25
  videoSX
26
26
  } = props;
27
+ const iframeRef = useRef(null);
28
+ useEffect(() => {
29
+ if (iframeRef.current) {
30
+ iframeRef.current.src = "about:blank"; // reloading the iframe
31
+ iframeRef.current.src = embedURL;
32
+ }
33
+ }, [embedURL, iframeRef.current]);
27
34
  return resizing ? /*#__PURE__*/_jsx("div", {
28
35
  style: {
29
36
  width: "100%",
@@ -37,6 +44,7 @@ const VideoContent = props => {
37
44
  icon: "videoPlayer"
38
45
  })
39
46
  }) : /*#__PURE__*/_jsx(Box, {
47
+ ref: iframeRef,
40
48
  component: "iframe",
41
49
  className: "embedd-iframe",
42
50
  sx: {
@@ -52,7 +60,6 @@ const VideoContent = props => {
52
60
  background: bgColor || "transparent",
53
61
  ...videoSX
54
62
  },
55
- src: embedURL,
56
63
  title: alt,
57
64
  allowFullScreen: true
58
65
  });
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import React, { useEffect, useState, useRef } from "react";
3
- import { Button, Dialog, DialogActions, DialogContent, useTheme } from "@mui/material";
3
+ import { Button, Dialog, DialogActions, DialogContent, useTheme, Popper } from "@mui/material";
4
4
  import { Node, Path, Transforms } from "slate";
5
5
  import { useSlateStatic, ReactEditor } from "slate-react";
6
6
  import GridItemPopup from "./GridItemPopup";
@@ -37,27 +37,23 @@ const Resizer = ({
37
37
  };
38
38
  const GridItemToolbar = props => {
39
39
  const {
40
+ classes,
40
41
  selected,
41
42
  showTool,
42
43
  onSettings,
43
- onAddColumn
44
+ onAddColumn,
45
+ columnRef
44
46
  } = props;
45
- return selected && !showTool ? /*#__PURE__*/_jsxs("div", {
46
- contentEditable: false,
47
- className: "grid-item-toolbar",
48
- style: {
49
- top: "-34px",
50
- left: "calc(100% - 68px)",
51
- display: "flex",
52
- flexDirection: "row"
53
- },
47
+ return selected && !showTool ? /*#__PURE__*/_jsxs(Popper, {
48
+ anchorEl: columnRef?.current,
49
+ open: true,
50
+ placement: "top-end",
51
+ sx: classes.popTools,
52
+ className: "gi-tool-pp",
54
53
  children: [/*#__PURE__*/_jsx(Tooltip, {
55
54
  title: "Column Settings",
56
55
  arrow: true,
57
56
  children: /*#__PURE__*/_jsx(IconButton, {
58
- sx: {
59
- marginRight: "4px"
60
- },
61
57
  size: "small",
62
58
  onClick: onSettings,
63
59
  children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
@@ -66,9 +62,6 @@ const GridItemToolbar = props => {
66
62
  title: "Add Column",
67
63
  arrow: true,
68
64
  children: /*#__PURE__*/_jsx(IconButton, {
69
- sx: {
70
- marginRight: "4px"
71
- },
72
65
  size: "small",
73
66
  onClick: onAddColumn,
74
67
  children: /*#__PURE__*/_jsx(AddIcon, {})
@@ -84,9 +77,13 @@ const GridItem = props => {
84
77
  updateColumnWidth,
85
78
  updateColNodes
86
79
  } = useGrid() || {};
80
+ const {
81
+ hoverPath,
82
+ theme: appTheme
83
+ } = useEditorContext();
87
84
  const columnRef = useRef(null);
88
85
  const theme = useTheme();
89
- const classes = GridStyles(theme);
86
+ const classes = GridStyles(theme, appTheme);
90
87
  const {
91
88
  attributes,
92
89
  children,
@@ -123,9 +120,6 @@ const GridItem = props => {
123
120
  } = alignment || {};
124
121
  const editor = useSlateStatic();
125
122
  const path = ReactEditor.findPath(editor, element);
126
- const {
127
- hoverPath
128
- } = useEditorContext();
129
123
  const selected = hoverPath === path.join(",");
130
124
  const [showTool] = useEditorSelection(editor);
131
125
  const [parentDOM, setParentDOM] = useState({});
@@ -308,10 +302,12 @@ const GridItem = props => {
308
302
  className: "element-selector-dots br",
309
303
  children: " "
310
304
  }), /*#__PURE__*/_jsx(GridItemToolbar, {
305
+ classes: classes,
311
306
  selected: selected,
312
307
  showTool: showTool,
313
308
  onSettings: onSettings,
314
- onAddColumn: onAddColumn
309
+ onAddColumn: onAddColumn,
310
+ columnRef: columnRef
315
311
  })]
316
312
  }), /*#__PURE__*/_jsx(Box, {
317
313
  ref: columnRef,
@@ -1,4 +1,4 @@
1
- const GridStyles = theme => ({
1
+ const GridStyles = (theme, appTheme) => ({
2
2
  gridButton: {
3
3
  background: "#007FFF",
4
4
  color: "#fff",
@@ -86,6 +86,32 @@ const GridStyles = theme => ({
86
86
  }
87
87
  }
88
88
  }
89
+ },
90
+ popTools: {
91
+ zIndex: 1000,
92
+ "& button": {
93
+ borderRadius: "8px",
94
+ marginRight: "4px",
95
+ border: "1px solid rgba(37, 99, 235, 0.32)",
96
+ boxShadow: "0px 0px 10px 0px rgba(0, 0, 0, 0.16)",
97
+ background: appTheme?.palette?.editor?.background,
98
+ color: "#64748B",
99
+ "& svg": {
100
+ width: "16px",
101
+ height: "16px",
102
+ "& .fillStroke": {
103
+ stroke: "#64748B"
104
+ }
105
+ },
106
+ "&:hover": {
107
+ background: appTheme?.palette?.editor?.background,
108
+ border: "1px solid #2684ff",
109
+ color: "#2684ff",
110
+ "& .fillStroke": {
111
+ stroke: "#2684ff"
112
+ }
113
+ }
114
+ }
89
115
  }
90
116
  });
91
117
  export default GridStyles;
@@ -9,7 +9,7 @@ import { getBreakPointsValue, getTRBLBreakPoints, groupByBreakpoint } from "../.
9
9
  import DragHandle from "../DnD/DragHandleButton";
10
10
  import { useEditorSelection } from "../../hooks/useMouseMove";
11
11
  import SectionStyle from "./styles";
12
- // import useWindowResize from "../../hooks/useWindowResize"; //commenting for ui demo if okay remove this comment before dev
12
+ import useWindowResize from "../../hooks/useWindowResize";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -45,11 +45,8 @@ const Section = props => {
45
45
  const path = ReactEditor.findPath(editor, element);
46
46
  const anchorEl = useRef(null);
47
47
  const popperEl = useRef(null);
48
-
49
- // const [size] = useWindowResize();
50
- // const isSectionFullWidth =
51
- // sectionGridSize && sectionGridSize[size?.device] >= 12;
52
-
48
+ const [size] = useWindowResize();
49
+ const isSectionFullWidth = sectionGridSize && sectionGridSize[size?.device] >= 12;
53
50
  const [isHovering, setIsHovering] = useState(false);
54
51
  const onMouseEnter = () => {
55
52
  setIsHovering(true);
@@ -80,9 +77,6 @@ const Section = props => {
80
77
  children: /*#__PURE__*/_jsx(Tooltip, {
81
78
  title: "Section Settings",
82
79
  children: /*#__PURE__*/_jsx(IconButton, {
83
- sx: {
84
- marginBottom: '25px !important'
85
- },
86
80
  onClick: onSettings,
87
81
  children: /*#__PURE__*/_jsx(TuneIcon, {})
88
82
  })
@@ -155,16 +149,11 @@ const Section = props => {
155
149
  className: "ed-section-inner",
156
150
  sx: {
157
151
  position: "relative",
158
- ...edInnerSp,
159
- outline: isHovering ? `1px dashed ${theme?.palette?.editor?.inputFieldBorder}` : 'none'
160
- // borderRadius: '5px'
152
+ ...edInnerSp
161
153
  },
162
-
163
154
  ref: anchorEl,
164
- children: [isHovering ? /*#__PURE__*/_jsx(Popper, {
165
- open: isHovering
166
- // open={isHovering && isSectionFullWidth} //commenting for ui demo if okay remove this comment before dev
167
- ,
155
+ children: [isHovering && isSectionFullWidth ? /*#__PURE__*/_jsx(Popper, {
156
+ open: isHovering && isSectionFullWidth,
168
157
  anchorEl: anchorEl?.current,
169
158
  placement: "top-start",
170
159
  sx: {
@@ -187,7 +176,11 @@ const Section = props => {
187
176
  fromPopper: true
188
177
  })]
189
178
  })
190
- }) : /*#__PURE__*/_jsx(_Fragment, {}), children]
179
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
180
+ children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
181
+ ...props
182
+ }) : null, /*#__PURE__*/_jsx(Toolbar, {})]
183
+ }), children]
191
184
  }), openSetttings ? /*#__PURE__*/_jsx(SectionPopup, {
192
185
  element: {
193
186
  ...element,
@@ -1274,6 +1274,7 @@ export const GridSettingsIcon = props => /*#__PURE__*/_jsxs("svg", {
1274
1274
  children: [/*#__PURE__*/_jsx("path", {
1275
1275
  d: "M11 13.75C12.5188 13.75 13.75 12.5188 13.75 11C13.75 9.48122 12.5188 8.25 11 8.25C9.48122 8.25 8.25 9.48122 8.25 11C8.25 12.5188 9.48122 13.75 11 13.75Z",
1276
1276
  stroke: "#64748B",
1277
+ className: "fillStroke",
1277
1278
  strokeWidth: "1.5",
1278
1279
  strokeMiterlimit: "10",
1279
1280
  strokeLinecap: "round",
@@ -1281,6 +1282,7 @@ export const GridSettingsIcon = props => /*#__PURE__*/_jsxs("svg", {
1281
1282
  }), /*#__PURE__*/_jsx("path", {
1282
1283
  d: "M1.8335 11.8066V10.1933C1.8335 9.23998 2.61266 8.45165 3.57516 8.45165C5.23433 8.45165 5.91266 7.27832 5.0785 5.83915C4.60183 5.01415 4.886 3.94165 5.72016 3.46498L7.306 2.55748C8.03016 2.12665 8.96516 2.38332 9.396 3.10748L9.49683 3.28165C10.3218 4.72082 11.6785 4.72082 12.5127 3.28165L12.6135 3.10748C13.0443 2.38332 13.9793 2.12665 14.7035 2.55748L16.2893 3.46498C17.1235 3.94165 17.4077 5.01415 16.931 5.83915C16.0968 7.27832 16.7752 8.45165 18.4343 8.45165C19.3877 8.45165 20.176 9.23082 20.176 10.1933V11.8066C20.176 12.76 19.3968 13.5483 18.4343 13.5483C16.7752 13.5483 16.0968 14.7216 16.931 16.1608C17.4077 16.995 17.1235 18.0583 16.2893 18.535L14.7035 19.4425C13.9793 19.8733 13.0443 19.6166 12.6135 18.8925L12.5127 18.7183C11.6877 17.2791 10.331 17.2791 9.49683 18.7183L9.396 18.8925C8.96516 19.6166 8.03016 19.8733 7.306 19.4425L5.72016 18.535C4.886 18.0583 4.60183 16.9858 5.0785 16.1608C5.91266 14.7216 5.23433 13.5483 3.57516 13.5483C2.61266 13.5483 1.8335 12.76 1.8335 11.8066Z",
1283
1284
  stroke: "#64748B",
1285
+ className: "fillStroke",
1284
1286
  strokeWidth: "1.5",
1285
1287
  strokeMiterlimit: "10",
1286
1288
  strokeLinecap: "round",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.9.8",
3
+ "version": "4.9.9",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"