@flozy/editor 3.1.8 → 3.2.0
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.
- package/dist/Editor/CommonEditor.js +13 -26
- package/dist/Editor/Editor.css +5 -0
- package/dist/Editor/Elements/AppHeader/AppHeader.js +33 -29
- package/dist/Editor/Elements/Button/EditorButton.js +32 -86
- package/dist/Editor/Elements/Color Picker/Styles.js +4 -1
- package/dist/Editor/Elements/Embed/Image.js +56 -22
- package/dist/Editor/Elements/Form/Form.js +1 -1
- package/dist/Editor/Styles/EditorStyles.js +6 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +43 -13
- package/dist/Editor/{Elements/Button/ButtonNavSettings → common/LinkSettings}/index.js +10 -36
- package/dist/Editor/common/StyleBuilder/embedImageStyle.js +24 -24
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +0 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +46 -3
- package/dist/Editor/helper/deserialize/index.js +32 -11
- package/dist/Editor/helper/index.js +34 -2
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/utils/events.js +3 -1
- package/dist/Editor/utils/helper.js +88 -3
- package/dist/Editor/utils/insertAppHeader.js +14 -10
- package/package.json +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderWidth.js +0 -75
- /package/dist/Editor/{Elements/Button/ButtonNavSettings → common/LinkSettings}/NavComponents.js +0 -0
- /package/dist/Editor/{Elements/Button/ButtonNavSettings → common/LinkSettings}/navOptions.js +0 -0
- /package/dist/Editor/{Elements/Button/ButtonNavSettings → common/LinkSettings}/style.js +0 -0
|
@@ -28,13 +28,11 @@ import DragAndDrop from "./common/DnD";
|
|
|
28
28
|
import Section from "./common/Section";
|
|
29
29
|
import "animate.css";
|
|
30
30
|
import decorators from "./utils/Decorators";
|
|
31
|
-
import useElement from "./utils/customHooks/useElement";
|
|
32
31
|
import { getTRBLBreakPoints } from "./helper/theme";
|
|
33
32
|
import { handleInsertLastElement, outsideEditorClickLabel } from "./utils/helper";
|
|
34
33
|
import useWindowResize from "./hooks/useWindowResize";
|
|
35
34
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
36
35
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
37
|
-
const PREVIEW_IMAGE_HIDE_CLASS = ["grid-container-toolbar", "grid-item-toolbar", "element-toolbar"];
|
|
38
36
|
const Item = /*#__PURE__*/forwardRef(({
|
|
39
37
|
children,
|
|
40
38
|
...props
|
|
@@ -166,19 +164,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
166
164
|
const dom = needBackground ? editorWrapper?.current : editorWrapper?.current.getElementsByClassName("innert-editor-textbox")[0];
|
|
167
165
|
const c = await getThumbnailImage(dom, {
|
|
168
166
|
...options,
|
|
169
|
-
|
|
170
|
-
backgroundColor: null,
|
|
171
|
-
proxy: "anonymous",
|
|
172
|
-
useCORS: true,
|
|
173
|
-
onclone: document => {
|
|
174
|
-
// hide class
|
|
175
|
-
for (let hidedeClass of PREVIEW_IMAGE_HIDE_CLASS) {
|
|
176
|
-
for (let element of document.getElementsByClassName(hidedeClass)) {
|
|
177
|
-
element.style.display = "none";
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return document;
|
|
181
|
-
}
|
|
167
|
+
proxy: `${otherProps?.PAGES_API_HOST}/page/2canvas`
|
|
182
168
|
});
|
|
183
169
|
return c;
|
|
184
170
|
};
|
|
@@ -372,7 +358,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
372
358
|
}
|
|
373
359
|
}, [readOnly, isTextSelected]);
|
|
374
360
|
const handleFooterClick = () => {
|
|
375
|
-
window.open(
|
|
361
|
+
window.open("https://www.flozy.com", "_blank");
|
|
376
362
|
};
|
|
377
363
|
const editorWrapperStyle = useMemo(() => {
|
|
378
364
|
const style = {
|
|
@@ -381,6 +367,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
381
367
|
if (pageBgImage && pageBgImage !== "none") {
|
|
382
368
|
style.backgroundImage = `url(${pageBgImage})`;
|
|
383
369
|
style.backgroundSize = `cover`;
|
|
370
|
+
style.backgroundRepeat = "repeat";
|
|
384
371
|
} else {
|
|
385
372
|
style.background = pageColor || "";
|
|
386
373
|
}
|
|
@@ -406,12 +393,13 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
406
393
|
initialValue: value,
|
|
407
394
|
onChange: handleEditorChange,
|
|
408
395
|
children: [/*#__PURE__*/_jsx(DragAndDrop, {
|
|
409
|
-
children: /*#__PURE__*/
|
|
410
|
-
children: /*#__PURE__*/_jsx(Box, {
|
|
396
|
+
children: /*#__PURE__*/_jsxs(Overlay, {
|
|
397
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
411
398
|
className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
|
|
412
399
|
sx: classes.slateWrapper,
|
|
413
400
|
id: "slate-wrapper-scroll-container",
|
|
414
401
|
style: editorWrapperStyle,
|
|
402
|
+
ref: editorWrapper,
|
|
415
403
|
onClick: e => {
|
|
416
404
|
handleInsertLastElement(e, editor);
|
|
417
405
|
},
|
|
@@ -425,7 +413,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
425
413
|
"data-info": outsideEditorClickLabel,
|
|
426
414
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
427
415
|
component: "div",
|
|
428
|
-
ref: editorWrapper,
|
|
429
416
|
className: `editor-wrapper ${pageWidth === "fixed" ? "fixed" : "full"}`,
|
|
430
417
|
sx: {
|
|
431
418
|
backgroundColor: "transparent",
|
|
@@ -441,11 +428,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
441
428
|
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
|
|
442
429
|
},
|
|
443
430
|
"data-info": outsideEditorClickLabel,
|
|
444
|
-
children: [
|
|
445
|
-
onDrawerOpen: onDrawerOpen,
|
|
446
|
-
theme: theme,
|
|
447
|
-
setIsTextSelected: setIsTextSelected
|
|
448
|
-
}) : null, /*#__PURE__*/_jsx(Editable, {
|
|
431
|
+
children: [/*#__PURE__*/_jsx(Editable, {
|
|
449
432
|
className: "innert-editor-textbox",
|
|
450
433
|
readOnly: isReadOnly,
|
|
451
434
|
renderElement: renderElement,
|
|
@@ -473,7 +456,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
473
456
|
color: "rgb(100, 116, 139)",
|
|
474
457
|
fontSize: "13px",
|
|
475
458
|
paddingBottom: hideMiniToolBar ? "0px" : "12px",
|
|
476
|
-
cursor:
|
|
459
|
+
cursor: "pointer"
|
|
477
460
|
},
|
|
478
461
|
align: "center",
|
|
479
462
|
"data-info": outsideEditorClickLabel,
|
|
@@ -481,7 +464,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
481
464
|
children: footer
|
|
482
465
|
})]
|
|
483
466
|
})
|
|
484
|
-
})
|
|
467
|
+
}), !readOnly ? /*#__PURE__*/_jsx(PopupTool, {
|
|
468
|
+
onDrawerOpen: onDrawerOpen,
|
|
469
|
+
theme: theme,
|
|
470
|
+
setIsTextSelected: setIsTextSelected
|
|
471
|
+
}) : null]
|
|
485
472
|
})
|
|
486
473
|
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
|
487
474
|
...htmlAction,
|
package/dist/Editor/Editor.css
CHANGED
|
@@ -17,8 +17,10 @@ import Typography from "@mui/material/Typography";
|
|
|
17
17
|
import Button from "@mui/material/Button";
|
|
18
18
|
import AppHeaderPopup from "./AppHeaderPopup";
|
|
19
19
|
import { getTRBLBreakPoints } from "../../helper/theme";
|
|
20
|
+
import { handleLinkType } from "../../utils/helper";
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
import { createElement as _createElement } from "react";
|
|
22
24
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
25
|
const drawerWidth = 240;
|
|
24
26
|
function AppHeader(props) {
|
|
@@ -263,38 +265,40 @@ function AppHeader(props) {
|
|
|
263
265
|
color: textColor
|
|
264
266
|
},
|
|
265
267
|
children: /*#__PURE__*/_jsx(MenuIcon, {})
|
|
266
|
-
}) : null, !isDrawer ? menus.map((item, i) =>
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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",
|
|
268
|
+
}) : null, !isDrawer ? menus.map((item, i) => {
|
|
269
|
+
const buttonProps = handleLinkType(item.url, item.linkType, true, item.target === "_blank");
|
|
270
|
+
return /*#__PURE__*/_createElement(Button, {
|
|
271
|
+
...buttonProps,
|
|
272
|
+
key: `${item.url}_${i}_no_drawer`,
|
|
273
|
+
sx: {
|
|
274
|
+
position: "relative",
|
|
275
|
+
fontFamily: fontFamily,
|
|
276
|
+
textTransform: "none",
|
|
277
|
+
fontSize: fontSize || "16px",
|
|
278
|
+
color: textColor || "#FFF",
|
|
279
|
+
background: bgColor || "none",
|
|
291
280
|
"& .m-settings": {
|
|
292
|
-
display: "
|
|
281
|
+
display: "none",
|
|
282
|
+
position: "absolute",
|
|
283
|
+
top: 0,
|
|
284
|
+
bottom: 0,
|
|
285
|
+
left: 0,
|
|
286
|
+
right: 0,
|
|
287
|
+
margin: "auto",
|
|
288
|
+
width: "42px",
|
|
289
|
+
height: "42px",
|
|
290
|
+
background: "#FFF"
|
|
291
|
+
},
|
|
292
|
+
"&:hover": {
|
|
293
|
+
color: textColorHover || textColor || "#FFF",
|
|
294
|
+
background: bgColorHover || bgColor || "none",
|
|
295
|
+
"& .m-settings": {
|
|
296
|
+
display: "block"
|
|
297
|
+
}
|
|
293
298
|
}
|
|
294
299
|
}
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
}, `${item.url}_${i}_no_drawer`)) : null]
|
|
300
|
+
}, item.text);
|
|
301
|
+
}) : null]
|
|
298
302
|
})]
|
|
299
303
|
})
|
|
300
304
|
}), /*#__PURE__*/_jsx("nav", {
|
|
@@ -10,8 +10,8 @@ import ButtonPopup from "./ButtonPopup";
|
|
|
10
10
|
import { actionButtonRedirect } from "../../service/actionTrigger";
|
|
11
11
|
import { WorkflowIcon } from "../../common/iconslist";
|
|
12
12
|
import { getTRBLBreakPoints, getBreakPointsValue } from "../../helper/theme";
|
|
13
|
-
import { windowVar } from "../../utils/helper";
|
|
14
|
-
import
|
|
13
|
+
import { handleLinkType, windowVar } from "../../utils/helper";
|
|
14
|
+
import LinkSettings from "../../common/LinkSettings";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const EditorButton = props => {
|
|
@@ -53,9 +53,16 @@ const EditorButton = props => {
|
|
|
53
53
|
} = element;
|
|
54
54
|
const {
|
|
55
55
|
linkType,
|
|
56
|
-
redirectOnURLResult
|
|
56
|
+
redirectOnURLResult,
|
|
57
|
+
actionTrigger
|
|
57
58
|
} = buttonLink || {};
|
|
59
|
+
const {
|
|
60
|
+
onClick
|
|
61
|
+
} = actionTrigger || {
|
|
62
|
+
options: []
|
|
63
|
+
};
|
|
58
64
|
const isTrigger = linkType === "actionTrigger";
|
|
65
|
+
const refURl = isTrigger ? buttonLink?.url : url;
|
|
59
66
|
const BtnIcon = buttonIcon ? fIcons[buttonIcon] : null;
|
|
60
67
|
windowVar.lastButtonProps = element;
|
|
61
68
|
const handleTrigger = async () => {
|
|
@@ -72,82 +79,7 @@ const EditorButton = props => {
|
|
|
72
79
|
window.open(refUrl, "_blank").focus();
|
|
73
80
|
}
|
|
74
81
|
};
|
|
75
|
-
const
|
|
76
|
-
const props = {};
|
|
77
|
-
if (!readOnly) {
|
|
78
|
-
return {
|
|
79
|
-
component: "button"
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
switch (linkType) {
|
|
83
|
-
case "webAddress":
|
|
84
|
-
const refUrl = url ? url.includes("http") ? url : `//${url}` : "Link";
|
|
85
|
-
props.component = "a";
|
|
86
|
-
if (refUrl !== "Link") {
|
|
87
|
-
props.href = refUrl;
|
|
88
|
-
}
|
|
89
|
-
if (openInNewTab) {
|
|
90
|
-
props.target = "_blank";
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
case "actionTrigger":
|
|
94
|
-
if (!readOnly) {
|
|
95
|
-
props.component = "button";
|
|
96
|
-
props.onClick = () => {};
|
|
97
|
-
} else {
|
|
98
|
-
props.component = "button";
|
|
99
|
-
props.onClick = handleTrigger;
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
case "page":
|
|
103
|
-
props.component = "a";
|
|
104
|
-
const [page, section] = url.split("#");
|
|
105
|
-
props.href = page === "home" ? `#${section}` : `/${url}`;
|
|
106
|
-
if (openInNewTab) {
|
|
107
|
-
props.target = "_blank";
|
|
108
|
-
}
|
|
109
|
-
break;
|
|
110
|
-
case "email":
|
|
111
|
-
props.component = "a";
|
|
112
|
-
props.href = `mailto:${url}`;
|
|
113
|
-
break;
|
|
114
|
-
case "phone":
|
|
115
|
-
props.component = "a";
|
|
116
|
-
props.href = `tel:${url}`;
|
|
117
|
-
break;
|
|
118
|
-
case "scrollTopOrBottom":
|
|
119
|
-
props.component = "button";
|
|
120
|
-
props.onClick = () => {
|
|
121
|
-
const scrollEle = document.getElementById("slate-wrapper-scroll-container");
|
|
122
|
-
if (scrollEle) {
|
|
123
|
-
if (url === "top") {
|
|
124
|
-
// top of the page
|
|
125
|
-
scrollEle.scrollTo(0, 0);
|
|
126
|
-
} else if (url === "bottom") {
|
|
127
|
-
// bottom of the page
|
|
128
|
-
scrollEle.scrollTo(0, scrollEle.scrollHeight);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
break;
|
|
133
|
-
default:
|
|
134
|
-
return {};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// for iphone fix
|
|
138
|
-
if (props.component === "a") {
|
|
139
|
-
props.onTouchEnd = e => {
|
|
140
|
-
e.preventDefault();
|
|
141
|
-
e.stopPropagation();
|
|
142
|
-
window.open(props.href, props.target);
|
|
143
|
-
};
|
|
144
|
-
props.onClick = () => {
|
|
145
|
-
return false;
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
return props;
|
|
149
|
-
};
|
|
150
|
-
const buttonProps = handleLinkType(readOnly, openInNewTab);
|
|
82
|
+
const buttonProps = handleLinkType(refURl, linkType, readOnly, openInNewTab, handleTrigger);
|
|
151
83
|
const onMenuClick = val => () => {
|
|
152
84
|
switch (val) {
|
|
153
85
|
case "edit":
|
|
@@ -166,7 +98,7 @@ const EditorButton = props => {
|
|
|
166
98
|
}
|
|
167
99
|
};
|
|
168
100
|
const Toolbar = () => {
|
|
169
|
-
const btnProps = handleLinkType(true, true);
|
|
101
|
+
const btnProps = handleLinkType(refURl, linkType, true, true, handleTrigger);
|
|
170
102
|
return !readOnly ? /*#__PURE__*/_jsxs("div", {
|
|
171
103
|
className: "element-toolbar hr",
|
|
172
104
|
style: {
|
|
@@ -307,13 +239,27 @@ const EditorButton = props => {
|
|
|
307
239
|
onClose: onClose,
|
|
308
240
|
onDelete: onMenuClick("delete"),
|
|
309
241
|
customProps: customProps
|
|
310
|
-
}), openNav ? /*#__PURE__*/_jsx(
|
|
311
|
-
open: openNav,
|
|
242
|
+
}), openNav ? /*#__PURE__*/_jsx(LinkSettings, {
|
|
312
243
|
handleClose: () => setOpenNav(false),
|
|
313
|
-
onSave:
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
244
|
+
onSave: ({
|
|
245
|
+
linkType,
|
|
246
|
+
navValue,
|
|
247
|
+
openInNewTab
|
|
248
|
+
}) => {
|
|
249
|
+
onSave({
|
|
250
|
+
buttonLink: {
|
|
251
|
+
linkType,
|
|
252
|
+
onClick
|
|
253
|
+
},
|
|
254
|
+
url: navValue,
|
|
255
|
+
openInNewTab
|
|
256
|
+
});
|
|
257
|
+
setOpenNav(false);
|
|
258
|
+
},
|
|
259
|
+
navType: element?.buttonLink?.linkType,
|
|
260
|
+
navValue: element?.url,
|
|
261
|
+
openInNewTab: element?.openInNewTab,
|
|
262
|
+
customProps: customProps
|
|
317
263
|
}) : null]
|
|
318
264
|
});
|
|
319
265
|
};
|
|
@@ -14,7 +14,10 @@ const ColorPickerStyles = theme => ({
|
|
|
14
14
|
},
|
|
15
15
|
colorPopper: {
|
|
16
16
|
"& .MuiPaper-root": {
|
|
17
|
-
backgroundColor: theme?.palette?.editor?.background
|
|
17
|
+
backgroundColor: theme?.palette?.editor?.background,
|
|
18
|
+
'@media only screen and (max-width: 600px)': {
|
|
19
|
+
marginTop: "-40px"
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
},
|
|
20
23
|
colorButtonSingle: {
|
|
@@ -5,12 +5,14 @@ import AspectRatioIcon from "@mui/icons-material/AspectRatio";
|
|
|
5
5
|
import useResize from "../../utils/customHooks/useResize";
|
|
6
6
|
import EmbedPopup from "./EmbedPopup";
|
|
7
7
|
import { IconButton, Tooltip, Box } from "@mui/material";
|
|
8
|
-
import { GridSettingsIcon } from "../../common/iconslist";
|
|
8
|
+
import { GridSettingsIcon, LinkIcon } from "../../common/iconslist";
|
|
9
9
|
import { useEditorContext, useEditorSelection } from "../../hooks/useMouseMove";
|
|
10
10
|
import { getTRBLBreakPoints, getBreakPointsValue } from "../../helper/theme";
|
|
11
11
|
import Icon from "../../common/Icon";
|
|
12
12
|
import frames from "./Frames";
|
|
13
13
|
import ImageFrame from "./Frames/ImageFrame";
|
|
14
|
+
import LinkSettings from "../../common/LinkSettings";
|
|
15
|
+
import { handleLinkType } from "../../utils/helper";
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
18
|
const Image = ({
|
|
@@ -35,6 +37,7 @@ const Image = ({
|
|
|
35
37
|
frame = null,
|
|
36
38
|
webAddress,
|
|
37
39
|
isNewTab,
|
|
40
|
+
linkType,
|
|
38
41
|
framePos
|
|
39
42
|
} = element;
|
|
40
43
|
const {
|
|
@@ -51,7 +54,8 @@ const Image = ({
|
|
|
51
54
|
const [parentDOM, setParentDOM] = useState(null);
|
|
52
55
|
const [openSetttings, setOpenSettings] = useState(false);
|
|
53
56
|
const path = ReactEditor.findPath(editor, element);
|
|
54
|
-
const [
|
|
57
|
+
const [openNav, setOpenNav] = useState(false);
|
|
58
|
+
const isEmpty = !url && !readOnly;
|
|
55
59
|
const getSize = () => {
|
|
56
60
|
if (element?.size === undefined) {
|
|
57
61
|
return {
|
|
@@ -79,27 +83,29 @@ const Image = ({
|
|
|
79
83
|
selectedPath
|
|
80
84
|
} = useEditorContext();
|
|
81
85
|
const selected = hoverPath === path.join(",") || selectedPath === path?.join(",");
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
onLoad(getSize());
|
|
87
|
-
}
|
|
88
|
-
}, []);
|
|
86
|
+
const {
|
|
87
|
+
onClick,
|
|
88
|
+
onTouchEnd
|
|
89
|
+
} = handleLinkType(webAddress, linkType, readOnly, isNewTab);
|
|
89
90
|
const handleImageClick = () => {
|
|
90
91
|
Transforms.select(editor, {
|
|
91
92
|
anchor: Editor.start(editor, path),
|
|
92
93
|
focus: Editor.end(editor, path)
|
|
93
94
|
});
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
window.location.href = refUrl;
|
|
100
|
-
}
|
|
95
|
+
if (onClick) {
|
|
96
|
+
onClick();
|
|
97
|
+
}
|
|
98
|
+
if (onTouchEnd) {
|
|
99
|
+
onTouchEnd();
|
|
101
100
|
}
|
|
102
101
|
};
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (editor && ele && ele[1] !== undefined) {
|
|
104
|
+
const dom = ReactEditor.toDOMNode(editor, element);
|
|
105
|
+
setParentDOM(dom);
|
|
106
|
+
onLoad(getSize());
|
|
107
|
+
}
|
|
108
|
+
}, []);
|
|
103
109
|
const onSettings = () => {
|
|
104
110
|
setOpenSettings(true);
|
|
105
111
|
};
|
|
@@ -127,7 +133,7 @@ const Image = ({
|
|
|
127
133
|
onSave(data);
|
|
128
134
|
};
|
|
129
135
|
const ToolBar = () => {
|
|
130
|
-
return
|
|
136
|
+
return !isEmpty ? /*#__PURE__*/_jsxs("div", {
|
|
131
137
|
className: "element-toolbar visible-on-hover",
|
|
132
138
|
contentEditable: false,
|
|
133
139
|
style: {
|
|
@@ -136,22 +142,31 @@ const Image = ({
|
|
|
136
142
|
left: "auto",
|
|
137
143
|
margin: "0px"
|
|
138
144
|
},
|
|
139
|
-
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
145
|
+
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
140
146
|
title: "Image Settings",
|
|
141
147
|
arrow: true,
|
|
142
148
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
143
149
|
onClick: onSettings,
|
|
144
150
|
children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
|
|
145
151
|
})
|
|
146
|
-
})
|
|
152
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
153
|
+
title: "Link Settings",
|
|
154
|
+
arrow: true,
|
|
155
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
156
|
+
onClick: () => setOpenNav(true),
|
|
157
|
+
children: /*#__PURE__*/_jsx(LinkIcon, {})
|
|
158
|
+
})
|
|
159
|
+
})]
|
|
147
160
|
}) : null;
|
|
148
161
|
};
|
|
149
162
|
const ImageContent = () => {
|
|
150
163
|
return !url && !readOnly ? /*#__PURE__*/_jsxs(Box, {
|
|
151
164
|
component: "button",
|
|
152
165
|
className: "element-empty-btn",
|
|
153
|
-
onClick: onSettings,
|
|
154
166
|
contentEditable: false,
|
|
167
|
+
onClick: () => {
|
|
168
|
+
setOpenSettings(true);
|
|
169
|
+
},
|
|
155
170
|
children: [/*#__PURE__*/_jsx(Icon, {
|
|
156
171
|
icon: "image"
|
|
157
172
|
}), "Add Image"]
|
|
@@ -168,11 +183,12 @@ const Image = ({
|
|
|
168
183
|
opacity: frame ? 0 : 1,
|
|
169
184
|
cursor: webAddress ? "pointer" : "",
|
|
170
185
|
border: `1px solid ${borderColor}`,
|
|
171
|
-
borderWidth: borderWidth?.
|
|
186
|
+
borderWidth: borderWidth?.includes('px') ? borderWidth : `${borderWidth}px`
|
|
172
187
|
},
|
|
173
188
|
alt: alt,
|
|
174
189
|
src: url,
|
|
175
190
|
onClick: handleImageClick,
|
|
191
|
+
onTouchEnd: onTouchEnd,
|
|
176
192
|
"data-path": path.join(","),
|
|
177
193
|
draggable: false
|
|
178
194
|
});
|
|
@@ -254,7 +270,25 @@ const Image = ({
|
|
|
254
270
|
}), /*#__PURE__*/_jsx("span", {
|
|
255
271
|
contentEditable: false,
|
|
256
272
|
children: children
|
|
257
|
-
})
|
|
273
|
+
}), openNav ? /*#__PURE__*/_jsx(LinkSettings, {
|
|
274
|
+
handleClose: () => setOpenNav(false),
|
|
275
|
+
onSave: ({
|
|
276
|
+
linkType,
|
|
277
|
+
navValue,
|
|
278
|
+
openInNewTab
|
|
279
|
+
}) => {
|
|
280
|
+
onSave({
|
|
281
|
+
linkType,
|
|
282
|
+
webAddress: navValue,
|
|
283
|
+
isNewTab: openInNewTab
|
|
284
|
+
});
|
|
285
|
+
setOpenNav(false);
|
|
286
|
+
},
|
|
287
|
+
navType: linkType,
|
|
288
|
+
navValue: webAddress,
|
|
289
|
+
openInNewTab: isNewTab,
|
|
290
|
+
customProps: customProps
|
|
291
|
+
}) : null]
|
|
258
292
|
});
|
|
259
293
|
};
|
|
260
294
|
export default Image;
|
|
@@ -20,11 +20,15 @@ const editorStyles = ({
|
|
|
20
20
|
"& .mobileMiniTextWrapper": {
|
|
21
21
|
boxShadow: "0px 0px 10px 0px rgba(0, 0, 0, 0.16)",
|
|
22
22
|
position: "fixed",
|
|
23
|
-
bottom:
|
|
23
|
+
bottom: "env(safe-area-inset-bottom)",
|
|
24
24
|
left: 0,
|
|
25
25
|
width: "100%",
|
|
26
26
|
zIndex: 99999,
|
|
27
|
-
|
|
27
|
+
backgroundColor: theme?.palette?.editor?.background,
|
|
28
|
+
color: theme?.palette?.editor?.textColor,
|
|
29
|
+
"& .MuiOutlinedInput-input": {
|
|
30
|
+
color: theme?.palette?.editor?.textColor
|
|
31
|
+
}
|
|
28
32
|
}
|
|
29
33
|
},
|
|
30
34
|
slateWrapper: {
|
|
@@ -7,7 +7,7 @@ import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme"
|
|
|
7
7
|
import { headingMap, sizeMap } from "../../../utils/font";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
const fontSizeOptions = [16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
|
|
10
|
+
const fontSizeOptions = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
|
|
11
11
|
function SelectFontSize({
|
|
12
12
|
editor,
|
|
13
13
|
classes
|
|
@@ -103,7 +103,7 @@ const MiniTextFormat = props => {
|
|
|
103
103
|
transition: true,
|
|
104
104
|
placement: "bottom-end",
|
|
105
105
|
sx: classes.popupWrapper,
|
|
106
|
-
className: `tools-drawer ${size?.device}`,
|
|
106
|
+
className: `tools-drawer ${size?.device} textSettings`,
|
|
107
107
|
children: ({
|
|
108
108
|
TransitionProps
|
|
109
109
|
}) => /*#__PURE__*/_jsx(Fade, {
|