@flozy/editor 10.5.2 → 10.5.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.
@@ -1077,7 +1077,7 @@ const usePopupStyle = theme => ({
|
|
1077
1077
|
},
|
1078
1078
|
customSelectPopoverWrapper: {
|
1079
1079
|
"& .MuiPopover-paper": {
|
1080
|
-
maxHeight: "
|
1080
|
+
maxHeight: "180px",
|
1081
1081
|
// minWidth: "130px",
|
1082
1082
|
// border: "1px solid #E4E8EB",
|
1083
1083
|
background: `${theme?.palette?.editor?.textWeightPopUpBackground} !important`,
|
@@ -139,6 +139,10 @@ const PopupTool = props => {
|
|
139
139
|
anchorEl: anchorEl,
|
140
140
|
sx: classes.popupWrapper,
|
141
141
|
placement: "top-start",
|
142
|
+
style: {
|
143
|
+
boxShadow: 'unset'
|
144
|
+
} //this is for overriding global shadow from popupwrapper used in other places
|
145
|
+
,
|
142
146
|
children: /*#__PURE__*/_jsx(Paper, {
|
143
147
|
sx: {
|
144
148
|
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
|
@@ -4,7 +4,7 @@ import { decodeAndParseBase64 } from "../utils/helper";
|
|
4
4
|
import convertMDToHTML from "../helper/markdown";
|
5
5
|
const avoidDefaultInsert = ["table", "grid"];
|
6
6
|
const NON_TEXT_TAGS = ["ol", "ul", "img", "table", "video", "a", "button", "GOOGLE-SHEETS-HTML-ORIGIN"];
|
7
|
-
const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree"];
|
7
|
+
const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix"];
|
8
8
|
const parseCopiedHTML = html => {
|
9
9
|
const parsed = new DOMParser().parseFromString(html, "text/html");
|
10
10
|
|
@@ -137,7 +137,7 @@ const formatFragment = {
|
|
137
137
|
},
|
138
138
|
"check-list-item": fragment => {
|
139
139
|
return fragment.map(a => {
|
140
|
-
a.type = "check-list-item";
|
140
|
+
// a.type = "check-list-item";
|
141
141
|
return a;
|
142
142
|
});
|
143
143
|
}
|
@@ -277,7 +277,13 @@ const withHtml = editor => {
|
|
277
277
|
// }
|
278
278
|
|
279
279
|
if (isTitlePath && isNonText) {
|
280
|
-
|
280
|
+
const firstNodePasted = formattedFragment[0];
|
281
|
+
const isAllowedTextNode = ALLOWED_TEXT_NODES.includes(firstNodePasted?.type || "");
|
282
|
+
if (isAllowedTextNode) {
|
283
|
+
Transforms.insertFragment(editor, formattedFragment);
|
284
|
+
} else {
|
285
|
+
insertAtNextNode(editor, formattedFragment);
|
286
|
+
}
|
281
287
|
return;
|
282
288
|
}
|
283
289
|
const currentText = getCurrentElementText(editor);
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { Transforms } from "slate";
|
1
|
+
import { Range, Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
import { getSelectedText } from "./helper";
|
3
|
+
import { getCurrentNodeText, getSelectedText } from "./helper";
|
4
4
|
import { isMobileWindow } from "../helper";
|
5
5
|
const focusAccordion = (editor, upPath) => {
|
6
6
|
Transforms.select(editor, {
|
@@ -10,7 +10,13 @@ const focusAccordion = (editor, upPath) => {
|
|
10
10
|
};
|
11
11
|
export const insertAccordion = (editor, path) => {
|
12
12
|
try {
|
13
|
-
const
|
13
|
+
const {
|
14
|
+
selection
|
15
|
+
} = editor;
|
16
|
+
const isHavingSelection = selection && !Range.isCollapsed(selection);
|
17
|
+
const selectedText = isHavingSelection ? getSelectedText(editor) : "";
|
18
|
+
const currentNodeText = selectedText ? getCurrentNodeText(editor) : "";
|
19
|
+
const fullySelected = selectedText?.length && currentNodeText.length === selectedText?.length;
|
14
20
|
const accordion = {
|
15
21
|
type: "accordion",
|
16
22
|
children: [{
|
@@ -37,6 +43,9 @@ export const insertAccordion = (editor, path) => {
|
|
37
43
|
} : {
|
38
44
|
select: true
|
39
45
|
};
|
46
|
+
if (fullySelected) {
|
47
|
+
Transforms.removeNodes(editor, props);
|
48
|
+
}
|
40
49
|
Transforms.insertNodes(editor, accordion, props);
|
41
50
|
const curPath = [...editor?.selection?.anchor?.path];
|
42
51
|
const upPath = [...curPath];
|