@flozy/editor 4.7.2 → 4.7.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +0 -2
- package/dist/Editor/Elements/Embed/Embed.js +8 -1
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +15 -12
- package/dist/Editor/common/Shorthands/elements.js +3 -1
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -4
- package/dist/Editor/plugins/withCustomDeleteBackward.js +25 -0
- package/dist/Editor/utils/embed.js +6 -3
- package/dist/Editor/utils/helper.js +1 -1
- package/package.json +1 -1
@@ -584,8 +584,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
584
584
|
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
585
585
|
...htmlAction,
|
586
586
|
handleCodeToText: handleCodeToText
|
587
|
-
}), /*#__PURE__*/_jsx(FontLoader, {
|
588
|
-
...props
|
589
587
|
})]
|
590
588
|
}, id)
|
591
589
|
})
|
@@ -58,8 +58,15 @@ const Embed = ({
|
|
58
58
|
url: img
|
59
59
|
};
|
60
60
|
setFormData(fd);
|
61
|
+
let extProps = {};
|
62
|
+
if (format === "video") {
|
63
|
+
extProps = {
|
64
|
+
aspectRatio: "16 / 9"
|
65
|
+
};
|
66
|
+
}
|
61
67
|
handleFormSubmit({
|
62
|
-
...fd
|
68
|
+
...fd,
|
69
|
+
...extProps
|
63
70
|
});
|
64
71
|
};
|
65
72
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
@@ -5,6 +5,7 @@ import LinkSettings from "../../../LinkSettings";
|
|
5
5
|
import { insertLink, removeLink } from "../../../../utils/link";
|
6
6
|
import { getBlockActive, isBlockActive, upateBlockActive } from "../../../../utils/SlateUtilityFunctions";
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
8
9
|
const Link = props => {
|
9
10
|
const {
|
10
11
|
onClose,
|
@@ -138,18 +139,20 @@ const Link = props => {
|
|
138
139
|
console.log(err);
|
139
140
|
}
|
140
141
|
};
|
141
|
-
return /*#__PURE__*/_jsx(
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
142
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
143
|
+
children: blockProps ? /*#__PURE__*/_jsx(LinkSettings, {
|
144
|
+
handleClose: onClose,
|
145
|
+
onSave: d => {
|
146
|
+
const upData = getTransformedData(d);
|
147
|
+
onSave({
|
148
|
+
...upData
|
149
|
+
});
|
150
|
+
onClose();
|
151
|
+
},
|
152
|
+
...(blockProps || {}),
|
153
|
+
customProps: customProps,
|
154
|
+
theme: theme
|
155
|
+
}) : null
|
153
156
|
});
|
154
157
|
};
|
155
158
|
export default Link;
|
@@ -107,7 +107,9 @@ const ELEMENTS_LIST = [{
|
|
107
107
|
icon: /*#__PURE__*/_jsx(Icon, {
|
108
108
|
icon: "video"
|
109
109
|
}),
|
110
|
-
onInsert: editor => insertDefaultEmbed(editor, "video"
|
110
|
+
onInsert: editor => insertDefaultEmbed(editor, "video", "", {
|
111
|
+
aspectRatio: "16 / 9"
|
112
|
+
})
|
111
113
|
}, {
|
112
114
|
name: "Embed",
|
113
115
|
desc: "",
|
@@ -16,14 +16,14 @@ const embedVideoStyle = [{
|
|
16
16
|
key: "aspectRatio",
|
17
17
|
type: "textOptions",
|
18
18
|
options: [{
|
19
|
-
text: "
|
20
|
-
value: ""
|
21
|
-
}, {
|
22
|
-
text: "16:9",
|
19
|
+
text: "16:9 (Default)",
|
23
20
|
value: "16 / 9"
|
24
21
|
}, {
|
25
22
|
text: "9:16",
|
26
23
|
value: "9 / 16"
|
24
|
+
}, {
|
25
|
+
text: "Custom",
|
26
|
+
value: ""
|
27
27
|
}],
|
28
28
|
renderOption: option => {
|
29
29
|
return /*#__PURE__*/_jsx("span", {
|
@@ -1,4 +1,16 @@
|
|
1
1
|
import { Editor, Node, Path, Transforms } from "slate";
|
2
|
+
const getCurrentNodeType = editor => {
|
3
|
+
if (editor.selection) {
|
4
|
+
// Get the current node at the selection
|
5
|
+
const [node] = Editor.nodes(editor, {
|
6
|
+
match: n => Editor.isBlock(editor, n)
|
7
|
+
});
|
8
|
+
|
9
|
+
// Return the node's type if it exists
|
10
|
+
return node ? node[0].type : null;
|
11
|
+
}
|
12
|
+
return null;
|
13
|
+
};
|
2
14
|
const isNodeTextEmpty = node => {
|
3
15
|
const nodeText = Node.string(node);
|
4
16
|
return nodeText.trim() === "";
|
@@ -14,6 +26,19 @@ const withCustomDeleteBackward = editor => {
|
|
14
26
|
selection
|
15
27
|
} = editor;
|
16
28
|
if (selection) {
|
29
|
+
// get the current node
|
30
|
+
const [freeGridItemNode] = Editor.nodes(editor, {
|
31
|
+
match: n => n.type === "freegridItem" // Adjust based on your list item type
|
32
|
+
});
|
33
|
+
|
34
|
+
// if it is freegrid
|
35
|
+
if (freeGridItemNode && freeGridItemNode[0]) {
|
36
|
+
const hasText = Node.string(freeGridItemNode[0]);
|
37
|
+
if (!hasText) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
17
42
|
// Check if current node is a list item and is the last one
|
18
43
|
const [node] = Editor.nodes(editor, {
|
19
44
|
match: n => n.type === "list-item" // Adjust based on your list item type
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
export const insertDefaultEmbed = (editor, type, defaultURL = "") => {
|
3
|
+
export const insertDefaultEmbed = (editor, type, defaultURL = "", extProps = {}) => {
|
4
4
|
try {
|
5
5
|
const url = defaultURL ? defaultURL : type === "image" ? "" : "";
|
6
6
|
insertEmbed(editor, {
|
7
7
|
url,
|
8
|
-
images: []
|
8
|
+
images: [],
|
9
|
+
...extProps
|
9
10
|
}, type);
|
10
11
|
} catch (err) {
|
11
12
|
console.log(err);
|
@@ -14,7 +15,8 @@ export const insertDefaultEmbed = (editor, type, defaultURL = "") => {
|
|
14
15
|
export const createEmbedNode = (type, {
|
15
16
|
url,
|
16
17
|
alt,
|
17
|
-
images
|
18
|
+
images,
|
19
|
+
...rest
|
18
20
|
}) => ({
|
19
21
|
type,
|
20
22
|
alt,
|
@@ -23,6 +25,7 @@ export const createEmbedNode = (type, {
|
|
23
25
|
children: [{
|
24
26
|
text: " "
|
25
27
|
}],
|
28
|
+
...(rest || {}),
|
26
29
|
size: {
|
27
30
|
xs: {
|
28
31
|
widthInPercent: "100",
|