@flozy/editor 10.6.3 → 10.6.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/Editor.css +8 -0
- package/dist/Editor/common/LinkSettings/NavComponents.js +6 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
- package/dist/Editor/utils/accordion.js +55 -24
- package/dist/Editor/utils/events.js +0 -42
- package/dist/Editor/utils/helper.js +5 -1
- package/dist/Editor/utils/insertAppHeader.js +8 -4
- package/package.json +1 -1
package/dist/Editor/Editor.css
CHANGED
@@ -1132,6 +1132,14 @@ blockquote {
|
|
1132
1132
|
margin: 0px;
|
1133
1133
|
}
|
1134
1134
|
|
1135
|
+
.listItemMargin .accordion-container {
|
1136
|
+
margin-left: -20px;
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
li:has(.accordion-container) {
|
1140
|
+
list-style: none;
|
1141
|
+
}
|
1142
|
+
|
1135
1143
|
.content-editable.empty {
|
1136
1144
|
position: relative;
|
1137
1145
|
}
|
@@ -175,7 +175,8 @@ export const ScrollTopBottom = props => {
|
|
175
175
|
const {
|
176
176
|
value,
|
177
177
|
onChange,
|
178
|
-
translation
|
178
|
+
translation,
|
179
|
+
classes
|
179
180
|
} = props;
|
180
181
|
return /*#__PURE__*/_jsx(Select, {
|
181
182
|
options: scrollToOptions,
|
@@ -183,7 +184,10 @@ export const ScrollTopBottom = props => {
|
|
183
184
|
onChange: e => onChange(e.target.value),
|
184
185
|
label: translation("Choose Top/Bottom of page"),
|
185
186
|
showDefault: true,
|
186
|
-
translation: translation
|
187
|
+
translation: translation,
|
188
|
+
MenuProps: {
|
189
|
+
sx: classes.customSelect
|
190
|
+
}
|
187
191
|
});
|
188
192
|
};
|
189
193
|
const filter = createFilterOptions();
|
@@ -129,6 +129,7 @@ const MenusArray = props => {
|
|
129
129
|
className: "menu-item-app-header",
|
130
130
|
children: [/*#__PURE__*/_jsx(TextField, {
|
131
131
|
name: "text",
|
132
|
+
placeholder: m?.placeholder || "text",
|
132
133
|
type: "text",
|
133
134
|
value: m.text,
|
134
135
|
onChange: handleChange(i),
|
@@ -140,6 +141,7 @@ const MenusArray = props => {
|
|
140
141
|
}), /*#__PURE__*/_jsx(TextField, {
|
141
142
|
name: "url",
|
142
143
|
type: "text",
|
144
|
+
placeholder: m?.placeholder || "url",
|
143
145
|
value: m.url,
|
144
146
|
onChange: handleChange(i),
|
145
147
|
size: "small",
|
@@ -10,12 +10,42 @@ const focusAccordion = (editor, upPath) => {
|
|
10
10
|
offset: 0
|
11
11
|
});
|
12
12
|
};
|
13
|
+
const getAccordionNode = summaryNode => {
|
14
|
+
return {
|
15
|
+
type: "accordion",
|
16
|
+
children: [{
|
17
|
+
type: "accordion-summary",
|
18
|
+
children: summaryNode
|
19
|
+
}, {
|
20
|
+
type: "accordion-details",
|
21
|
+
children: [{
|
22
|
+
type: "paragraph",
|
23
|
+
children: [{
|
24
|
+
text: ""
|
25
|
+
}]
|
26
|
+
}]
|
27
|
+
}]
|
28
|
+
};
|
29
|
+
};
|
13
30
|
export const insertAccordion = (editor, path) => {
|
14
31
|
try {
|
15
32
|
const {
|
16
33
|
selection
|
17
34
|
} = editor;
|
18
|
-
|
35
|
+
let accordionPath;
|
36
|
+
if (path) {
|
37
|
+
const summaryNode = {
|
38
|
+
type: "paragraph",
|
39
|
+
children: [{
|
40
|
+
text: ""
|
41
|
+
}]
|
42
|
+
};
|
43
|
+
const accordion = getAccordionNode([summaryNode]);
|
44
|
+
Transforms.insertNodes(editor, accordion, {
|
45
|
+
at: path
|
46
|
+
});
|
47
|
+
accordionPath = path;
|
48
|
+
} else if (selection) {
|
19
49
|
const selectedNodes = Array.from(Editor.nodes(editor, {
|
20
50
|
at: selection,
|
21
51
|
match: n => Element.isElement(n),
|
@@ -23,21 +53,21 @@ export const insertAccordion = (editor, path) => {
|
|
23
53
|
}));
|
24
54
|
|
25
55
|
for (const [node, path] of selectedNodes) {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
40
|
-
}
|
56
|
+
let currNode = node;
|
57
|
+
const isListItem = node.type === "list-item";
|
58
|
+
if (isListItem) {
|
59
|
+
currNode = {
|
60
|
+
type: "paragraph",
|
61
|
+
children: node.children
|
62
|
+
};
|
63
|
+
}
|
64
|
+
let accordion = getAccordionNode([currNode]);
|
65
|
+
if (isListItem) {
|
66
|
+
accordion = {
|
67
|
+
type: "list-item",
|
68
|
+
children: [accordion]
|
69
|
+
};
|
70
|
+
}
|
41
71
|
Transforms.removeNodes(editor, {
|
42
72
|
at: path
|
43
73
|
});
|
@@ -47,15 +77,16 @@ export const insertAccordion = (editor, path) => {
|
|
47
77
|
}
|
48
78
|
const lastNode = selectedNodes[selectedNodes.length - 1];
|
49
79
|
const lastNodePath = lastNode[1];
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
80
|
+
accordionPath = lastNodePath;
|
81
|
+
}
|
82
|
+
const focusPath = [...accordionPath, 0, 0, 0];
|
83
|
+
if (isMobileWindow()) {
|
84
|
+
// timeout to resolve focus issue in mobile
|
85
|
+
setTimeout(() => focusAccordion(editor, focusPath), 0);
|
86
|
+
} else {
|
87
|
+
focusAccordion(editor, focusPath);
|
58
88
|
}
|
89
|
+
insertNewLine(editor);
|
59
90
|
} catch (err) {
|
60
91
|
console.log(err);
|
61
92
|
}
|
@@ -341,48 +341,6 @@ export const enterEvent = (e, editor, isMobile) => {
|
|
341
341
|
console.log(err);
|
342
342
|
}
|
343
343
|
};
|
344
|
-
|
345
|
-
// not using now
|
346
|
-
// export const handleAccordionOnBackspace = (e, editor) => {
|
347
|
-
// try {
|
348
|
-
// let isAccordion = false;
|
349
|
-
|
350
|
-
// const [accordionDetails] = getNodeWithType(editor, "accordion-details");
|
351
|
-
// const [accordionDetailsNode] = accordionDetails || [];
|
352
|
-
|
353
|
-
// if (accordionDetailsNode) {
|
354
|
-
// const dom = ReactEditor.toDOMNode(editor, accordionDetailsNode);
|
355
|
-
|
356
|
-
// if (dom?.parentElement) {
|
357
|
-
// dom.parentElement.style.display = "block";
|
358
|
-
// }
|
359
|
-
// }
|
360
|
-
|
361
|
-
// const [accordionSummary] = getNodeWithType(editor, "accordion-summary");
|
362
|
-
|
363
|
-
// const [accordionTitle, accordionTitlePath] = accordionSummary || [];
|
364
|
-
|
365
|
-
// if (accordionTitle) {
|
366
|
-
// // no selection
|
367
|
-
// if (Range.isCollapsed(editor.selection)) {
|
368
|
-
// const start = Editor.start(editor, accordionTitlePath);
|
369
|
-
// const isCursorAtStart = Point.equals(editor.selection.focus, start);
|
370
|
-
|
371
|
-
// if (isCursorAtStart) {
|
372
|
-
// e.preventDefault();
|
373
|
-
// const parentPath = Path.parent(accordionTitlePath);
|
374
|
-
// removeAccordion(editor, parentPath);
|
375
|
-
// isAccordion = true;
|
376
|
-
// }
|
377
|
-
// }
|
378
|
-
// }
|
379
|
-
|
380
|
-
// return isAccordion;
|
381
|
-
// } catch (err) {
|
382
|
-
// console.log(err);
|
383
|
-
// }
|
384
|
-
// };
|
385
|
-
|
386
344
|
export const upDownArrowKeyEvents = (e, editor) => {
|
387
345
|
try {
|
388
346
|
const {
|
@@ -218,9 +218,13 @@ export const handleInsertLastElement = (event, editor) => {
|
|
218
218
|
};
|
219
219
|
export const isListItem = editor => {
|
220
220
|
const format = ["list-item", "check-list-item", "accordion-summary", "headingOne", "headingTwo", "headingThree"];
|
221
|
-
const [
|
221
|
+
const [node1, node2] = Editor.nodes(editor, {
|
222
222
|
match: n => !Editor.isEditor(n) && Element.isElement(n) && format.indexOf(n.type) > -1
|
223
223
|
});
|
224
|
+
let node = node1;
|
225
|
+
if (node2 && node2[0] && node2[0].type === "accordion-summary") {
|
226
|
+
node = node2;
|
227
|
+
}
|
224
228
|
return node;
|
225
229
|
};
|
226
230
|
export const getNode = (editor, path) => {
|
@@ -8,27 +8,31 @@ export const appHeaderNode = ({
|
|
8
8
|
appLogo: "none",
|
9
9
|
menus: menus || [{
|
10
10
|
type: "menu",
|
11
|
-
url: "
|
11
|
+
url: "",
|
12
|
+
placeholder: "home",
|
12
13
|
target: "",
|
13
14
|
text: "Home",
|
14
15
|
linkType: "page"
|
15
16
|
}, {
|
16
17
|
type: "menu",
|
17
|
-
url: "
|
18
|
+
url: "",
|
19
|
+
placeholder: "wireframe2",
|
18
20
|
target: "",
|
19
21
|
text: "Wireframe",
|
20
22
|
linkType: "page"
|
21
23
|
}, {
|
22
24
|
type: "menu",
|
23
|
-
url: "
|
25
|
+
url: "",
|
24
26
|
target: "",
|
27
|
+
placeholder: "Work",
|
25
28
|
text: "Work",
|
26
29
|
linkType: "webAddress"
|
27
30
|
}, {
|
28
31
|
type: "menu",
|
29
|
-
url: "
|
32
|
+
url: "",
|
30
33
|
target: "",
|
31
34
|
text: "Contact",
|
35
|
+
placeholder: "Contact",
|
32
36
|
linkType: "webAddress"
|
33
37
|
}],
|
34
38
|
menuStyle: "stacked",
|