@flozy/editor 1.8.3 → 1.8.5
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 +11 -9
- package/dist/Editor/Editor.css +15 -12
- package/dist/Editor/Elements/AppHeader/AppHeader.js +5 -11
- package/dist/Editor/Elements/Button/EditorButton.js +4 -10
- package/dist/Editor/Elements/Carousel/Arrows.js +16 -2
- package/dist/Editor/Elements/Carousel/Carousel.js +1 -1
- package/dist/Editor/Elements/Carousel/slick-theme.min.css +1 -0
- package/dist/Editor/Elements/ChipText/ChipText.js +8 -12
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +5 -3
- package/dist/Editor/Elements/Color Picker/Styles.js +3 -17
- package/dist/Editor/Elements/Color Picker/colorWheel.png +0 -0
- package/dist/Editor/Elements/Embed/Embed.css +48 -45
- package/dist/Editor/Elements/Embed/Image.js +8 -14
- package/dist/Editor/Elements/Embed/Video.js +1 -7
- package/dist/Editor/Elements/Form/Form.js +17 -23
- package/dist/Editor/Elements/Form/FormElements/FormText.js +8 -12
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +8 -12
- package/dist/Editor/Elements/Grid/Grid.js +12 -20
- package/dist/Editor/Elements/Grid/GridItem.js +18 -24
- package/dist/Editor/Elements/Grid/templates/carousel_item.js +2 -3
- package/dist/Editor/Elements/Grid/templates/default_grid.js +2 -2
- package/dist/Editor/Elements/SimpleText.js +0 -1
- package/dist/Editor/Elements/Table/Table.js +3 -1
- package/dist/Editor/Elements/TopBanner/TopBanner.js +3 -1
- package/dist/Editor/IframeEditor.js +30 -0
- package/dist/Editor/MiniEditor.js +6 -8
- package/dist/Editor/Styles/EditorStyles.js +13 -3
- package/dist/Editor/Toolbar/Basic/index.js +3 -1
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +30 -13
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +7 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +3 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +4 -2
- package/dist/Editor/common/Icon.js +3 -0
- package/dist/Editor/common/Section/index.js +13 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +10 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +18 -4
- package/dist/Editor/common/StyleBuilder/formStyle.js +3 -0
- package/dist/Editor/common/StyleBuilder/gridItemStyle.js +18 -1
- package/dist/Editor/common/StyleBuilder/gridStyle.js +19 -1
- package/dist/Editor/common/StyleBuilder/sectionStyle.js +1 -1
- package/dist/Editor/helper/theme.js +83 -0
- package/dist/Editor/hooks/useWindowMessage.js +35 -0
- package/dist/Editor/hooks/useWindowResize.js +5 -2
- package/dist/Editor/plugins/withLayout.js +42 -27
- package/dist/Editor/utils/SlateUtilityFunctions.js +22 -5
- package/dist/Editor/utils/pageSettings.js +17 -0
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/dist/Editor/Elements/Color Picker/LogoIcon.js +0 -25
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Checkbox, FormControlLabel, Grid, Slider, Typography } from "@mui/material";
|
|
3
3
|
import { squreStyle } from "./radiusStyle";
|
|
4
|
+
import { getBreakPointsValue } from "../../../helper/theme";
|
|
5
|
+
import useWindowResize from "../../../hooks/useWindowResize";
|
|
4
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
8
|
const BANNER_SPACING_KEYS = ["top", "left", "right", "bottom"];
|
|
7
9
|
const BannerSpacing = props => {
|
|
8
10
|
const {
|
|
9
|
-
value,
|
|
11
|
+
value: val,
|
|
10
12
|
data,
|
|
11
13
|
onChange,
|
|
12
14
|
elementProps
|
|
@@ -19,6 +21,8 @@ const BannerSpacing = props => {
|
|
|
19
21
|
if (lockSpacing === undefined) {
|
|
20
22
|
lockSpacing = true;
|
|
21
23
|
}
|
|
24
|
+
const [size] = useWindowResize();
|
|
25
|
+
const value = getBreakPointsValue(val, size?.device);
|
|
22
26
|
const handleChange = e => {
|
|
23
27
|
let changeAll = {};
|
|
24
28
|
if (lockSpacing) {
|
|
@@ -28,9 +32,12 @@ const BannerSpacing = props => {
|
|
|
28
32
|
}
|
|
29
33
|
onChange({
|
|
30
34
|
[key]: {
|
|
31
|
-
...
|
|
32
|
-
[
|
|
33
|
-
|
|
35
|
+
...getBreakPointsValue(val),
|
|
36
|
+
[size?.device]: {
|
|
37
|
+
...value,
|
|
38
|
+
...changeAll,
|
|
39
|
+
[e.target.name]: e.target.value
|
|
40
|
+
}
|
|
34
41
|
}
|
|
35
42
|
});
|
|
36
43
|
};
|
|
@@ -64,8 +71,10 @@ const BannerSpacing = props => {
|
|
|
64
71
|
"aria-label": "Default",
|
|
65
72
|
valueLabelDisplay: "auto",
|
|
66
73
|
max: 100,
|
|
74
|
+
name: "top",
|
|
67
75
|
onChange: handleChange
|
|
68
76
|
}), /*#__PURE__*/_jsx("input", {
|
|
77
|
+
name: "top",
|
|
69
78
|
value: !lockSpacing ? "" : value?.top || 0,
|
|
70
79
|
className: "sliderInput",
|
|
71
80
|
disabled: !lockSpacing,
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Grid, Slider, Typography } from "@mui/material";
|
|
3
|
+
import useWindowResize from "../../../hooks/useWindowResize";
|
|
4
|
+
import { getBreakPointsValue } from "../../../helper/theme";
|
|
3
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
7
|
const GridSize = props => {
|
|
6
8
|
const {
|
|
7
|
-
value,
|
|
9
|
+
value: val,
|
|
8
10
|
data,
|
|
9
11
|
onChange
|
|
10
12
|
} = props;
|
|
11
13
|
const {
|
|
12
14
|
key
|
|
13
15
|
} = data;
|
|
16
|
+
const [size] = useWindowResize();
|
|
17
|
+
const value = getBreakPointsValue(val, size?.device);
|
|
14
18
|
const handleChange = e => {
|
|
15
19
|
onChange({
|
|
16
|
-
[key]:
|
|
20
|
+
[key]: {
|
|
21
|
+
...getBreakPointsValue(val),
|
|
22
|
+
[size?.device]: e.target.value
|
|
23
|
+
}
|
|
17
24
|
});
|
|
18
25
|
};
|
|
19
26
|
return /*#__PURE__*/_jsxs(Grid, {
|
|
@@ -27,7 +34,7 @@ const GridSize = props => {
|
|
|
27
34
|
fontWeight: 500,
|
|
28
35
|
marginBottom: "5px"
|
|
29
36
|
},
|
|
30
|
-
children: ["Grid Size: ", value || 12]
|
|
37
|
+
children: [data?.label || "Grid Size", ": ", value || 12]
|
|
31
38
|
}), /*#__PURE__*/_jsx("div", {
|
|
32
39
|
className: "sld-wrpr",
|
|
33
40
|
children: /*#__PURE__*/_jsx(Slider, {
|
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Grid, MenuItem, Select, Typography } from "@mui/material";
|
|
3
|
+
import { getBreakPointsValue } from "../../../helper/theme";
|
|
4
|
+
import useWindowResize from "../../../hooks/useWindowResize";
|
|
3
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
7
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
8
|
const TextOptions = props => {
|
|
7
9
|
const {
|
|
8
|
-
value,
|
|
10
|
+
value: val,
|
|
9
11
|
data,
|
|
10
12
|
onChange,
|
|
11
13
|
elementProps
|
|
12
14
|
} = props;
|
|
13
15
|
const {
|
|
14
16
|
key,
|
|
17
|
+
isBreakpoint,
|
|
15
18
|
options,
|
|
16
19
|
renderOption,
|
|
17
20
|
width
|
|
18
21
|
} = data;
|
|
22
|
+
const [size] = useWindowResize();
|
|
23
|
+
const value = isBreakpoint ? getBreakPointsValue(val, size?.device) : val;
|
|
19
24
|
const handleChange = e => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
if (isBreakpoint) {
|
|
26
|
+
onChange({
|
|
27
|
+
[key]: {
|
|
28
|
+
...getBreakPointsValue(val),
|
|
29
|
+
[size?.device]: e.target.value
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
onChange({
|
|
34
|
+
[key]: e.target.value
|
|
35
|
+
});
|
|
36
|
+
}
|
|
23
37
|
};
|
|
24
38
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
25
39
|
children: /*#__PURE__*/_jsxs(Grid, {
|
|
@@ -71,9 +71,26 @@ const gridItemStyle = [{
|
|
|
71
71
|
tab: "Size",
|
|
72
72
|
value: "gridSize",
|
|
73
73
|
fields: [{
|
|
74
|
-
label: "
|
|
74
|
+
label: "Width Size",
|
|
75
75
|
key: "grid",
|
|
76
76
|
type: "gridSize"
|
|
77
|
+
}, {
|
|
78
|
+
label: "Height",
|
|
79
|
+
key: "cellGHeight",
|
|
80
|
+
type: "textOptions",
|
|
81
|
+
isBreakpoint: true,
|
|
82
|
+
options: [{
|
|
83
|
+
text: "Auto",
|
|
84
|
+
value: "auto"
|
|
85
|
+
}, {
|
|
86
|
+
text: "Full",
|
|
87
|
+
value: "100%"
|
|
88
|
+
}],
|
|
89
|
+
renderOption: option => {
|
|
90
|
+
return /*#__PURE__*/_jsx("span", {
|
|
91
|
+
children: option.text
|
|
92
|
+
});
|
|
93
|
+
}
|
|
77
94
|
}]
|
|
78
95
|
}, {
|
|
79
96
|
tab: "Animation",
|
|
@@ -90,9 +90,27 @@ const gridStyle = [{
|
|
|
90
90
|
tab: "Size",
|
|
91
91
|
value: "gridSize",
|
|
92
92
|
fields: [{
|
|
93
|
-
label: "
|
|
93
|
+
label: "Width Size",
|
|
94
94
|
key: "gridSize",
|
|
95
95
|
type: "gridSize"
|
|
96
|
+
}, {
|
|
97
|
+
label: "Wrap",
|
|
98
|
+
key: "flexWrap",
|
|
99
|
+
type: "textOptions",
|
|
100
|
+
width: 12,
|
|
101
|
+
isBreakpoint: true,
|
|
102
|
+
options: [{
|
|
103
|
+
text: "Wrap",
|
|
104
|
+
value: "wrap"
|
|
105
|
+
}, {
|
|
106
|
+
text: "No Wrap",
|
|
107
|
+
value: "nowrap"
|
|
108
|
+
}],
|
|
109
|
+
renderOption: option => {
|
|
110
|
+
return /*#__PURE__*/_jsx("span", {
|
|
111
|
+
children: option.text
|
|
112
|
+
});
|
|
113
|
+
}
|
|
96
114
|
}]
|
|
97
115
|
}, {
|
|
98
116
|
tab: "Save As Template",
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { sizeMap } from "../utils/font";
|
|
2
|
+
export const breakpoints = {
|
|
3
|
+
small: 0,
|
|
4
|
+
mobile: 600,
|
|
5
|
+
tablet: 900
|
|
6
|
+
};
|
|
7
|
+
export const BREAKPOINTS_DEVICES = ["xs", "sm", "md", "lg"];
|
|
8
|
+
export const getDevice = width => {
|
|
9
|
+
if (width > 0 && width < breakpoints.mobile) {
|
|
10
|
+
return "xs";
|
|
11
|
+
} else {
|
|
12
|
+
return "lg";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const copyAllLg = (value, ot) => {
|
|
16
|
+
return BREAKPOINTS_DEVICES.reduce((a, b) => {
|
|
17
|
+
return {
|
|
18
|
+
...a,
|
|
19
|
+
[b]: overrides[ot] ? overrides[ot](value) : value
|
|
20
|
+
};
|
|
21
|
+
}, {});
|
|
22
|
+
};
|
|
23
|
+
const overrideValues = (value, ot) => {
|
|
24
|
+
return Object.keys(value).reduce((a, b) => {
|
|
25
|
+
return {
|
|
26
|
+
...a,
|
|
27
|
+
[b]: overrides[ot] ? overrides[ot](value[b]) : value
|
|
28
|
+
};
|
|
29
|
+
}, {});
|
|
30
|
+
};
|
|
31
|
+
const overrides = {
|
|
32
|
+
overrideText: val => {
|
|
33
|
+
return sizeMap[val] || val;
|
|
34
|
+
},
|
|
35
|
+
overrideGridSize: val => {
|
|
36
|
+
return `${(val || 8) / 12 * 100}%`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const getBreakPointsValue = (value, breakpoint, ot = null, ov = false) => {
|
|
40
|
+
try {
|
|
41
|
+
if (breakpoint) {
|
|
42
|
+
if (typeof value !== "object") {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
return value ? value[breakpoint] || value["lg"] : value;
|
|
46
|
+
} else if (typeof value === "object") {
|
|
47
|
+
return !breakpoint && value["lg"] ? !ov ? value : overrideValues(value, ot) : value[breakpoint] || copyAllLg(value, ot);
|
|
48
|
+
} else {
|
|
49
|
+
// consider without breakpoints
|
|
50
|
+
return copyAllLg(value, ot);
|
|
51
|
+
}
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.log(err);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export const getTRBLBreakPoints = (value, breakpoint) => {
|
|
57
|
+
try {
|
|
58
|
+
const values = getBreakPointsValue(value, breakpoint);
|
|
59
|
+
const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
|
|
60
|
+
if (values[b] || values["lg"]) {
|
|
61
|
+
const {
|
|
62
|
+
top,
|
|
63
|
+
right,
|
|
64
|
+
bottom,
|
|
65
|
+
left
|
|
66
|
+
} = values[b] || values["lg"];
|
|
67
|
+
return {
|
|
68
|
+
...a,
|
|
69
|
+
[b]: `${top || 0}px ${right || 0}px ${bottom || 0}px ${left || 0}px`
|
|
70
|
+
};
|
|
71
|
+
} else {
|
|
72
|
+
return a;
|
|
73
|
+
}
|
|
74
|
+
}, {});
|
|
75
|
+
if (breakpoint) {
|
|
76
|
+
return value[breakpoint] || value["lg"] || value;
|
|
77
|
+
} else {
|
|
78
|
+
return cssVal;
|
|
79
|
+
}
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.log(err);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
const useWindowMessage = props => {
|
|
3
|
+
const {
|
|
4
|
+
type
|
|
5
|
+
} = props;
|
|
6
|
+
const [message, setMessage] = useState(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (window.addEventListener) {
|
|
9
|
+
window.addEventListener("message", onMessage, false);
|
|
10
|
+
} else {
|
|
11
|
+
window.attachEvent("onmessage", onMessage);
|
|
12
|
+
}
|
|
13
|
+
return () => {
|
|
14
|
+
if (window.addEventListener) {
|
|
15
|
+
window.removeEventListener("message", onMessage, false);
|
|
16
|
+
} else {
|
|
17
|
+
window.detachEvent("onmessage", onMessage);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}, []);
|
|
21
|
+
const onMessage = e => {
|
|
22
|
+
if (e?.data && e?.data[type]) {
|
|
23
|
+
setMessage(e?.data[type]);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const sendMessage = action => {
|
|
27
|
+
if (window.parent) {
|
|
28
|
+
window.parent.postMessage({
|
|
29
|
+
...action
|
|
30
|
+
}, "*");
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return [message, sendMessage];
|
|
34
|
+
};
|
|
35
|
+
export default useWindowMessage;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
+
import { getDevice } from "../helper/theme";
|
|
2
3
|
const useWindowResize = () => {
|
|
3
4
|
const [size, setSize] = useState({
|
|
4
5
|
width: window.innerWidth,
|
|
5
|
-
height: window.innerHeight
|
|
6
|
+
height: window.innerHeight,
|
|
7
|
+
device: getDevice(window.innerWidth)
|
|
6
8
|
});
|
|
7
9
|
const onResize = () => {
|
|
8
10
|
setSize({
|
|
9
11
|
width: window.innerWidth,
|
|
10
|
-
height: window.innerHeight
|
|
12
|
+
height: window.innerHeight,
|
|
13
|
+
device: getDevice(window.innerWidth)
|
|
11
14
|
});
|
|
12
15
|
};
|
|
13
16
|
useEffect(() => {
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import { Transforms, Node,
|
|
1
|
+
import { Transforms, Node, Editor } from "slate";
|
|
2
|
+
const ORDERS_LAYOUT = ["topbanner", "title", "paragraph"];
|
|
3
|
+
const ORDERS_LAYOUT_VALIDATIONS = {
|
|
4
|
+
topbanner: val => {
|
|
5
|
+
if (val.type !== ORDERS_LAYOUT[0]) {
|
|
6
|
+
return "title";
|
|
7
|
+
} else {
|
|
8
|
+
return val.type;
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
title: (val, prev) => {
|
|
12
|
+
if (prev?.type === "topbanner") {
|
|
13
|
+
return "title";
|
|
14
|
+
} else if (prev?.type === "title" && val?.type !== "title") {
|
|
15
|
+
return val.type;
|
|
16
|
+
} else {
|
|
17
|
+
return "paragraph";
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
paragraph: val => {
|
|
21
|
+
if (val.type === "title") {
|
|
22
|
+
return "paragraph";
|
|
23
|
+
} else {
|
|
24
|
+
return val.type;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
2
28
|
const withLayout = editor => {
|
|
3
29
|
const {
|
|
4
30
|
normalizeNode
|
|
@@ -17,7 +43,7 @@ const withLayout = editor => {
|
|
|
17
43
|
select: true
|
|
18
44
|
});
|
|
19
45
|
}
|
|
20
|
-
if (editor.children.length
|
|
46
|
+
if (editor.children.length === 0) {
|
|
21
47
|
const paragraph = {
|
|
22
48
|
type: "paragraph",
|
|
23
49
|
children: [{
|
|
@@ -28,34 +54,23 @@ const withLayout = editor => {
|
|
|
28
54
|
at: path.concat(1)
|
|
29
55
|
});
|
|
30
56
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Transforms.setNodes(editor,
|
|
41
|
-
|
|
57
|
+
ORDERS_LAYOUT.forEach((enforce, index) => {
|
|
58
|
+
if (index < editor.children.length) {
|
|
59
|
+
const existsNode = Node.get(editor, [index]);
|
|
60
|
+
let prevNode = null;
|
|
61
|
+
if (index > 0) {
|
|
62
|
+
prevNode = Node.get(editor, [index - 1]);
|
|
63
|
+
}
|
|
64
|
+
const newType = ORDERS_LAYOUT_VALIDATIONS[enforce](existsNode, prevNode);
|
|
65
|
+
if (existsNode?.type !== newType) {
|
|
66
|
+
Transforms.setNodes(editor, {
|
|
67
|
+
type: newType
|
|
68
|
+
}, {
|
|
69
|
+
at: [index]
|
|
42
70
|
});
|
|
43
71
|
}
|
|
44
|
-
};
|
|
45
|
-
switch (slateIndex) {
|
|
46
|
-
case 0:
|
|
47
|
-
type = child.type === "topbanner" ? "topbanner" : "title";
|
|
48
|
-
prevType = type;
|
|
49
|
-
enforceType(type);
|
|
50
|
-
break;
|
|
51
|
-
case 1:
|
|
52
|
-
type = prevType === "topbanner" ? "title" : "paragraph";
|
|
53
|
-
enforceType(type);
|
|
54
|
-
break;
|
|
55
|
-
default:
|
|
56
|
-
break;
|
|
57
72
|
}
|
|
58
|
-
}
|
|
73
|
+
});
|
|
59
74
|
}
|
|
60
75
|
return normalizeNode([node, path]);
|
|
61
76
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Editor, Transforms, Element as SlateElement } from "slate";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
2
3
|
import { fontFamilyMap, sizeMap } from "./font";
|
|
3
4
|
import Link from "../Elements/Link/Link";
|
|
4
5
|
import Image from "../Elements/Embed/Image";
|
|
@@ -34,6 +35,7 @@ import SimpleText from "../Elements/SimpleText";
|
|
|
34
35
|
import CheckList from "../Elements/List/CheckList";
|
|
35
36
|
import { isEmptyTextNode } from "../helper";
|
|
36
37
|
import Attachments from "../Elements/Attachments/Attachments";
|
|
38
|
+
import { getBreakPointsValue } from "../helper/theme";
|
|
37
39
|
import Variables from "../Elements/Variables/Variable";
|
|
38
40
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
39
41
|
const alignment = ["alignLeft", "alignRight", "alignCenter"];
|
|
@@ -86,7 +88,11 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
|
86
88
|
}
|
|
87
89
|
};
|
|
88
90
|
export const addMarkData = (editor, data) => {
|
|
89
|
-
|
|
91
|
+
try {
|
|
92
|
+
Editor.addMark(editor, data.format, data.value);
|
|
93
|
+
} catch (err) {
|
|
94
|
+
console.log(err);
|
|
95
|
+
}
|
|
90
96
|
};
|
|
91
97
|
export const toggleMark = (editor, format) => {
|
|
92
98
|
const isActive = isMarkActive(editor, format);
|
|
@@ -210,10 +216,13 @@ export const getMarked = (leaf, children) => {
|
|
|
210
216
|
});
|
|
211
217
|
}
|
|
212
218
|
if (leaf.fontSize) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
fontSize:
|
|
219
|
+
children = /*#__PURE__*/_jsx(Box, {
|
|
220
|
+
component: "span",
|
|
221
|
+
sx: {
|
|
222
|
+
fontSize: {
|
|
223
|
+
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
|
224
|
+
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
|
225
|
+
}
|
|
217
226
|
},
|
|
218
227
|
children: children
|
|
219
228
|
});
|
|
@@ -484,6 +493,14 @@ export const getBlock = props => {
|
|
|
484
493
|
return /*#__PURE__*/_jsx(Variables, {
|
|
485
494
|
...props
|
|
486
495
|
});
|
|
496
|
+
case "topbanner":
|
|
497
|
+
return /*#__PURE__*/_jsx("span", {
|
|
498
|
+
...props,
|
|
499
|
+
style: {
|
|
500
|
+
display: "none"
|
|
501
|
+
},
|
|
502
|
+
children: children
|
|
503
|
+
});
|
|
487
504
|
default:
|
|
488
505
|
return /*#__PURE__*/_jsx(SimpleText, {
|
|
489
506
|
...props,
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { Editor, Transforms, Element } from "slate";
|
|
2
|
+
export const findPageSettings = editor => {
|
|
3
|
+
try {
|
|
4
|
+
console.log(editor?.children);
|
|
5
|
+
return {
|
|
6
|
+
element: editor?.children?.find(f => f.type === "page-settings")
|
|
7
|
+
};
|
|
8
|
+
} catch (err) {
|
|
9
|
+
return {
|
|
10
|
+
path: null,
|
|
11
|
+
element: {
|
|
12
|
+
pageProps: {
|
|
13
|
+
pageWidth: "fixed"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
2
19
|
export const getPageSettings = editor => {
|
|
3
20
|
try {
|
|
4
21
|
const [pageSettingsNode] = Editor.nodes(editor, {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Collaborative from "./Editor/CollaborativeEditor";
|
|
2
2
|
import CommonEditor from "./Editor/CommonEditor";
|
|
3
3
|
import Mini from "./Editor/MiniEditor";
|
|
4
|
+
import EditorInFrame from "./Editor/IframeEditor";
|
|
4
5
|
export const Editor = CommonEditor;
|
|
5
6
|
export const MiniEditor = Mini;
|
|
6
|
-
export const CollaborativeEditor = Collaborative;
|
|
7
|
+
export const CollaborativeEditor = Collaborative;
|
|
8
|
+
export const IframeEditor = EditorInFrame;
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export const logo = {
|
|
3
|
-
color: color => /*#__PURE__*/_jsx("svg", {
|
|
4
|
-
width: "14",
|
|
5
|
-
height: "14",
|
|
6
|
-
viewBox: "0 0 11 14",
|
|
7
|
-
fill: "none",
|
|
8
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
-
children: /*#__PURE__*/_jsx("path", {
|
|
10
|
-
d: "M5.16796 0C5.16796 0 0 5.92326 0 8.8319C0 12.0176 2.65524 14 5.16796 14C7.83258 14 10.3359 11.9129 10.3359 8.8319C10.3359 5.92326 5.16796 0 5.16796 0ZM8.7402 9.70788C8.45278 11.3396 7.03388 12.0548 5.89918 12.0548C5.80706 12.0543 9.14466 10.6134 7.85834 6.30322C8.53622 7.06776 8.96266 8.4448 8.7402 9.70788Z",
|
|
11
|
-
fill: "#778599"
|
|
12
|
-
})
|
|
13
|
-
}),
|
|
14
|
-
bgColor: color => /*#__PURE__*/_jsx("svg", {
|
|
15
|
-
width: "14",
|
|
16
|
-
height: "14",
|
|
17
|
-
viewBox: "0 0 14 14",
|
|
18
|
-
fill: "none",
|
|
19
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20
|
-
children: /*#__PURE__*/_jsx("path", {
|
|
21
|
-
d: "M13.5512 6.73405L6.71385 12.8277C6.30072 13.1996 5.76365 13.3648 5.22658 13.3442C4.6895 13.3235 4.19375 13.0756 3.80127 12.6625L0.516875 8.98561C-0.226762 8.13869 -0.164793 6.83733 0.682127 6.09369L7.51946 0L13.5512 6.7547V6.73405ZM13.3859 8.01475C13.4479 8.26263 11.6095 11.1959 13.138 11.3818C14.9558 11.5883 13.324 7.76687 13.3859 8.01475ZM12.5183 6.67208L7.47814 1.03283L1.19854 6.65142L12.5183 6.69273V6.67208Z",
|
|
22
|
-
fill: "#64748B"
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
};
|