@flozy/editor 5.0.3 → 5.0.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.
- package/dist/Editor/Elements/Grid/GridItem.js +10 -3
- package/dist/Editor/Elements/Grid/Styles.js +0 -9
- package/dist/Editor/common/FontLoader/FontLoader.js +1 -1
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -1
- package/dist/Editor/common/LinkSettings/index.js +2 -1
- package/dist/Editor/common/Select/index.js +20 -0
- package/dist/Editor/common/Select/styles.js +17 -0
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/plugins/withEmbeds.js +0 -1
- package/dist/Editor/utils/helper.js +25 -2
- package/package.json +1 -1
@@ -136,13 +136,20 @@ const GridItem = props => {
|
|
136
136
|
const minWidthInPercent = isRightCol ? `${widths?.right}%` : cmWidth;
|
137
137
|
useEffect(() => {
|
138
138
|
try {
|
139
|
-
if (columnRef?.current && (!parentDOM?.parentDOM || !minWidth)) {
|
140
|
-
initDoms();
|
139
|
+
if (columnRef?.current && (!parentDOM?.parentDOM || !minWidth || lastChild)) {
|
140
|
+
initDoms(lastChild);
|
141
|
+
if (lastChild) {
|
142
|
+
Transforms.setNodes(editor, {
|
143
|
+
minWidth: null
|
144
|
+
}, {
|
145
|
+
at: path
|
146
|
+
});
|
147
|
+
}
|
141
148
|
}
|
142
149
|
} catch (err) {
|
143
150
|
console.log(err);
|
144
151
|
}
|
145
|
-
}, [columnRef?.current, minWidth, childCount]);
|
152
|
+
}, [columnRef?.current, minWidth, childCount, lastChild]);
|
146
153
|
useEffect(() => {
|
147
154
|
if (isDone || isRightCol) {
|
148
155
|
initDoms();
|
@@ -23,15 +23,6 @@ const GridStyles = (theme, appTheme) => ({
|
|
23
23
|
flexWrap: "wrap"
|
24
24
|
}
|
25
25
|
},
|
26
|
-
"&.cc-1": {
|
27
|
-
"& .grid-item": {
|
28
|
-
"&:last-child": {
|
29
|
-
"& .col-width-resizer": {
|
30
|
-
display: "block !important"
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
},
|
35
26
|
"& .grid-item": {
|
36
27
|
minWidth: "var(--minWidth)",
|
37
28
|
maxWidth: "var(--minWidth)",
|
@@ -15,7 +15,7 @@ const FontLoader = props => {
|
|
15
15
|
let retryCount = 0;
|
16
16
|
function loadNextBatch() {
|
17
17
|
if (currentIndex >= families?.length) {
|
18
|
-
console.log("All fonts have been loaded");
|
18
|
+
// console.log("All fonts have been loaded");
|
19
19
|
return;
|
20
20
|
}
|
21
21
|
const batch = families?.slice(currentIndex, currentIndex + batchSize);
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { Autocomplete, Checkbox, FormControlLabel, MenuItem,
|
1
|
+
import { Autocomplete, Checkbox, FormControlLabel, MenuItem, TextField, Typography, createFilterOptions } from "@mui/material";
|
2
2
|
import { useEffect, useMemo, useState } from "react";
|
3
3
|
import { useSlate } from "slate-react";
|
4
|
+
import Select from "../Select";
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
6
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
6
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -5,13 +5,14 @@ import DialogContent from "@mui/material/DialogContent";
|
|
5
5
|
import DialogActions from "@mui/material/DialogActions";
|
6
6
|
import IconButton from "@mui/material/IconButton";
|
7
7
|
import CloseIcon from "@mui/icons-material/Close";
|
8
|
-
import { Box, FormControl, FormControlLabel, Grid, MenuItem, Radio, RadioGroup,
|
8
|
+
import { Box, FormControl, FormControlLabel, Grid, MenuItem, Radio, RadioGroup, Typography } from "@mui/material";
|
9
9
|
import { useState } from "react";
|
10
10
|
import LinkSettingsStyles from "./style";
|
11
11
|
import { getNavOptions } from "./navOptions";
|
12
12
|
import { ScrollTopBottom, SelectPage, TextInput, Trigger } from "./NavComponents";
|
13
13
|
import SwipeableDrawer from "../SwipeableDrawer";
|
14
14
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
15
|
+
import Select from "../Select";
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
17
18
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { Select as Core } from "@mui/material";
|
2
|
+
import SelectStyles from "./styles";
|
3
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
function Select(props) {
|
6
|
+
const {
|
7
|
+
children,
|
8
|
+
...rest
|
9
|
+
} = props;
|
10
|
+
const {
|
11
|
+
theme
|
12
|
+
} = useEditorContext();
|
13
|
+
const classes = SelectStyles(theme);
|
14
|
+
return /*#__PURE__*/_jsx(Core, {
|
15
|
+
MenuProps: classes.MenuProps,
|
16
|
+
...rest,
|
17
|
+
children: children
|
18
|
+
});
|
19
|
+
}
|
20
|
+
export default Select;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const SelectStyles = (theme = {}) => {
|
2
|
+
const {
|
3
|
+
textColor,
|
4
|
+
background
|
5
|
+
} = theme?.palette?.editor || {};
|
6
|
+
return {
|
7
|
+
MenuProps: {
|
8
|
+
PaperProps: {
|
9
|
+
sx: {
|
10
|
+
color: textColor,
|
11
|
+
background
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
};
|
16
|
+
};
|
17
|
+
export default SelectStyles;
|
@@ -329,14 +329,14 @@ export const isCarouselSelected = editor => {
|
|
329
329
|
return false;
|
330
330
|
}
|
331
331
|
const [nodeEntry] = Editor.nodes(editor, {
|
332
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type ===
|
332
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "carousel"
|
333
333
|
});
|
334
334
|
if (!nodeEntry) {
|
335
335
|
return false;
|
336
336
|
}
|
337
337
|
const [node] = nodeEntry;
|
338
338
|
const carouselDom = ReactEditor.toDOMNode(editor, node);
|
339
|
-
const isEdit = carouselDom.classList.contains(
|
339
|
+
const isEdit = carouselDom.classList.contains("carousel_slider_edit");
|
340
340
|
return !isEdit;
|
341
341
|
} catch (err) {
|
342
342
|
console.log(err);
|
@@ -23,7 +23,6 @@ const withEmbeds = editor => {
|
|
23
23
|
const previousPath = Path.previous(parentPath);
|
24
24
|
const previousNode = Node.get(editor, previousPath);
|
25
25
|
if (BlockTypes.includes(previousNode?.children[0]?.type) && parentNode?.type?.indexOf("heading") >= 0) {
|
26
|
-
console.log("grid is in previous", parentPath, previousPath, [...args]);
|
27
26
|
insertNodes(...[{
|
28
27
|
type: "paragraph",
|
29
28
|
children: [{
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Editor, Node, Transforms, Element, Path, Range } from "slate";
|
1
|
+
import { Editor, Node, Transforms, Element, Path, Range, Text } from "slate";
|
2
2
|
import { ReactEditor } from "slate-react";
|
3
3
|
import insertNewLine from "./insertNewLine";
|
4
4
|
import { getDevice } from "../helper/theme";
|
@@ -110,11 +110,34 @@ export const isEmptyNode = (editor, children, path) => {
|
|
110
110
|
}
|
111
111
|
};
|
112
112
|
export const outsideEditorClickLabel = "handle-outside-editor-click";
|
113
|
+
function isLastChildParagraphWithText(node) {
|
114
|
+
try {
|
115
|
+
if (!node || !Array.isArray(node.children)) {
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
|
119
|
+
// Get the last child node
|
120
|
+
const lastChild = node.children[node.children.length - 1];
|
121
|
+
|
122
|
+
// Check if the last child exists and is of type 'paragraph'
|
123
|
+
if (lastChild && lastChild.type === "paragraph") {
|
124
|
+
// Ensure all children of the paragraph node are text nodes
|
125
|
+
const hasOnlyTextChildren = lastChild.children.every(child => Text.isText(child));
|
126
|
+
console.log(hasOnlyTextChildren);
|
127
|
+
return hasOnlyTextChildren;
|
128
|
+
}
|
129
|
+
return false;
|
130
|
+
} catch (err) {
|
131
|
+
console.log(err);
|
132
|
+
return false;
|
133
|
+
}
|
134
|
+
}
|
113
135
|
const insertNewLineOnColumn = (editor, pathStr) => {
|
114
136
|
try {
|
115
137
|
const path = pathStr.split(",").map(m => parseInt(m));
|
116
138
|
const colNode = Node.get(editor, path);
|
117
|
-
|
139
|
+
const isValid = isLastChildParagraphWithText(colNode);
|
140
|
+
if (colNode?.type === "grid-item" && !isValid) {
|
118
141
|
const newPath = [...path, colNode?.children.length];
|
119
142
|
Transforms.insertNodes(editor, [{
|
120
143
|
type: "paragraph",
|