@flozy/editor 5.4.7 → 5.4.9
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 +8 -14
- package/dist/Editor/Editor.css +16 -18
- package/dist/Editor/Elements/Button/EditorButton.js +1 -3
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +1 -1
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +14 -7
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +7 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +8 -3
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -1
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +2 -2
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +7 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +37 -11
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +17 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +20 -2
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +13 -2
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +27 -4
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +1 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +1 -1
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +4 -1
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +6 -6
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +19 -5
- package/dist/Editor/Elements/Form/Form.js +0 -1
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -2
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -1
- package/dist/Editor/Elements/List/CheckList.js +1 -2
- package/dist/Editor/Elements/Search/SearchAttachment.js +0 -1
- package/dist/Editor/Elements/SimpleText/index.js +3 -11
- package/dist/Editor/Elements/SimpleText/style.js +1 -5
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -5
- package/dist/Editor/Toolbar/Mini/Styles.js +0 -5
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +2 -11
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +0 -45
- package/dist/Editor/assets/svg/PlusIcon.js +2 -2
- package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
- package/dist/Editor/common/MentionsPopup/Styles.js +0 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +0 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -14
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +6 -9
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
- package/dist/Editor/common/Uploader.js +0 -8
- package/dist/Editor/commonStyle.js +8 -8
- package/dist/Editor/helper/deserialize/index.js +24 -66
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +1 -24
- package/dist/Editor/hooks/useMouseMove.js +2 -5
- package/dist/Editor/plugins/withHTML.js +5 -42
- package/dist/Editor/utils/SlateUtilityFunctions.js +1 -8
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +7 -51
- package/dist/Editor/utils/helper.js +16 -19
- package/dist/Editor/utils/pageSettings.js +2 -14
- package/package.json +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
@@ -1,26 +1,4 @@
|
|
1
1
|
import { jsx } from "slate-hyperscript";
|
2
|
-
const inlineStyles = [{
|
3
|
-
key: "bold",
|
4
|
-
getStyle: styles => styles.fontWeight === "bold" || parseInt(styles.fontWeight, 10) >= 700
|
5
|
-
}, {
|
6
|
-
key: "italic",
|
7
|
-
getStyle: styles => styles.fontStyle === "italic"
|
8
|
-
}, {
|
9
|
-
key: "underline",
|
10
|
-
getStyle: styles => styles.textDecoration.includes("underline")
|
11
|
-
}];
|
12
|
-
function getInlineTextStyles(element) {
|
13
|
-
if (!element || !element.style) return {};
|
14
|
-
const styles = element.style;
|
15
|
-
const elementStyles = inlineStyles.reduce((total, currVal) => {
|
16
|
-
const style = currVal.getStyle(styles);
|
17
|
-
if (style) {
|
18
|
-
total[currVal.key] = style;
|
19
|
-
}
|
20
|
-
return total;
|
21
|
-
}, {});
|
22
|
-
return elementStyles;
|
23
|
-
}
|
24
2
|
const handleTableCell = (el, children) => {
|
25
3
|
const wrapChild = children?.map(c => {
|
26
4
|
if (typeof c === "string") {
|
@@ -42,24 +20,6 @@ const handleTableCell = (el, children) => {
|
|
42
20
|
}
|
43
21
|
};
|
44
22
|
};
|
45
|
-
const INLINE_TAGS = ["A", "ABBR", "B", "BDO", "CITE", "CODE", "DATA", "DEL", "DFN", "IMG", "INS", "KBD", "LABEL", "MARK", "Q", "SAMP", "SMALL", "SPAN", "SUB", "SUP", "TIME", "VAR"];
|
46
|
-
|
47
|
-
// to avoid nested paragraph to resolve performace issue
|
48
|
-
const paragraphType = el => {
|
49
|
-
const {
|
50
|
-
childNodes = []
|
51
|
-
} = el || {};
|
52
|
-
|
53
|
-
// if anyone of the child node is text node or wrapped with inline tags, it is considered to be an paragraph node
|
54
|
-
const isHavingText = childNodes?.length ? Array.from(childNodes)?.some(child => {
|
55
|
-
const isTextNode = child?.nodeType === 3;
|
56
|
-
const isHavingInlineTags = TEXT_TAGS[child?.nodeName] || INLINE_TAGS.includes(child.nodeName);
|
57
|
-
return isTextNode || isHavingInlineTags;
|
58
|
-
}) : null;
|
59
|
-
return isHavingText ? {
|
60
|
-
type: "paragraph"
|
61
|
-
} : {};
|
62
|
-
};
|
63
23
|
const ELEMENT_TAGS = {
|
64
24
|
A: el => ({
|
65
25
|
type: "link",
|
@@ -99,14 +59,24 @@ const ELEMENT_TAGS = {
|
|
99
59
|
OL: () => ({
|
100
60
|
type: "orderedList"
|
101
61
|
}),
|
102
|
-
P:
|
103
|
-
|
62
|
+
P: () => ({
|
63
|
+
type: "paragraph"
|
64
|
+
}),
|
65
|
+
DIV: () => ({
|
66
|
+
type: "paragraph"
|
67
|
+
}),
|
104
68
|
PRE: () => ({
|
105
69
|
type: "code"
|
106
70
|
}),
|
107
|
-
META:
|
108
|
-
|
109
|
-
|
71
|
+
META: () => ({
|
72
|
+
type: "paragraph"
|
73
|
+
}),
|
74
|
+
STYLE: () => ({
|
75
|
+
type: "paragraph"
|
76
|
+
}),
|
77
|
+
"GOOGLE-SHEETS-HTML-ORIGIN": () => ({
|
78
|
+
type: "paragraph"
|
79
|
+
}),
|
110
80
|
TABLE: (el, children = []) => {
|
111
81
|
try {
|
112
82
|
const bodyChild = children || [];
|
@@ -128,8 +98,12 @@ const ELEMENT_TAGS = {
|
|
128
98
|
type: "table-row"
|
129
99
|
}),
|
130
100
|
TD: handleTableCell,
|
131
|
-
COLGROUP:
|
132
|
-
|
101
|
+
COLGROUP: () => ({
|
102
|
+
type: "paragraph"
|
103
|
+
}),
|
104
|
+
COL: () => ({
|
105
|
+
type: "paragraph"
|
106
|
+
})
|
133
107
|
};
|
134
108
|
|
135
109
|
// COMPAT: `B` is omitted here because Google Docs uses `<b>` in weird ways.
|
@@ -155,18 +129,11 @@ const TEXT_TAGS = {
|
|
155
129
|
U: () => ({
|
156
130
|
underline: true
|
157
131
|
})
|
158
|
-
// B: () => ({ bold: true }),
|
159
132
|
};
|
160
|
-
|
161
133
|
const deserialize = el => {
|
162
134
|
if (el.nodeType === 3) {
|
163
|
-
// if there is any line-breaks
|
164
135
|
const match = /\r|\n/.exec(el.textContent);
|
165
|
-
|
166
|
-
return match && !text ? null : {
|
167
|
-
text,
|
168
|
-
...getInlineTextStyles(el.parentNode)
|
169
|
-
};
|
136
|
+
return match ? null : el.textContent;
|
170
137
|
} else if (el.nodeType !== 1) {
|
171
138
|
return null;
|
172
139
|
} else if (el.nodeName === "BR") {
|
@@ -193,20 +160,11 @@ const deserialize = el => {
|
|
193
160
|
overwriteChild,
|
194
161
|
...attrs
|
195
162
|
} = ELEMENT_TAGS[nodeName](el, children);
|
196
|
-
|
197
|
-
return jsx("element", attrs, overwriteChild || children);
|
198
|
-
}
|
163
|
+
return jsx("element", attrs, overwriteChild || children);
|
199
164
|
}
|
200
165
|
if (TEXT_TAGS[nodeName]) {
|
201
166
|
const attrs = TEXT_TAGS[nodeName](el);
|
202
|
-
return children.map(child =>
|
203
|
-
if (child?.type) {
|
204
|
-
// if any list elements (like ul, ol... tags) is wrapped inside the TEXT_TAGS, we will return child as it is, else return it as text node
|
205
|
-
return child;
|
206
|
-
} else {
|
207
|
-
return jsx("text", attrs, child);
|
208
|
-
}
|
209
|
-
});
|
167
|
+
return children.map(child => jsx("text", attrs, child));
|
210
168
|
}
|
211
169
|
return children;
|
212
170
|
};
|
@@ -337,14 +337,14 @@ export const isCarouselSelected = editor => {
|
|
337
337
|
return false;
|
338
338
|
}
|
339
339
|
const [nodeEntry] = Editor.nodes(editor, {
|
340
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type ===
|
340
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'carousel'
|
341
341
|
});
|
342
342
|
if (!nodeEntry) {
|
343
343
|
return false;
|
344
344
|
}
|
345
345
|
const [node] = nodeEntry;
|
346
346
|
const carouselDom = ReactEditor.toDOMNode(editor, node);
|
347
|
-
const isEdit = carouselDom.classList.contains(
|
347
|
+
const isEdit = carouselDom.classList.contains('carousel_slider_edit');
|
348
348
|
return !isEdit;
|
349
349
|
} catch (err) {
|
350
350
|
console.log(err);
|
@@ -147,27 +147,4 @@ export const groupByBreakpoint = (styleProps, theme) => {
|
|
147
147
|
}
|
148
148
|
};
|
149
149
|
};
|
150
|
-
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
151
|
-
export const getBreakpointLineSpacing = (value, breakpoint) => {
|
152
|
-
try {
|
153
|
-
const values = getBreakPointsValue(value, breakpoint);
|
154
|
-
const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
|
155
|
-
if (values[b] || values["lg"]) {
|
156
|
-
const value = values[b] || values["lg"];
|
157
|
-
return {
|
158
|
-
...a,
|
159
|
-
[b]: value
|
160
|
-
};
|
161
|
-
} else {
|
162
|
-
return a;
|
163
|
-
}
|
164
|
-
}, {});
|
165
|
-
if (breakpoint) {
|
166
|
-
return value[breakpoint] || value["lg"] || value;
|
167
|
-
} else {
|
168
|
-
return cssVal["lg"];
|
169
|
-
}
|
170
|
-
} catch (err) {
|
171
|
-
// console.log(err);
|
172
|
-
}
|
173
|
-
};
|
150
|
+
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
@@ -35,7 +35,6 @@ export const EditorProvider = ({
|
|
35
35
|
path: null
|
36
36
|
});
|
37
37
|
const [fontFamilies, setFontFamilies] = useState({});
|
38
|
-
const [activeBreakPoint, setActiveBreakPoint] = useState("");
|
39
38
|
useEffect(() => {
|
40
39
|
window.updateSelectedItem = d => {
|
41
40
|
setSelectedElement(d);
|
@@ -98,10 +97,8 @@ export const EditorProvider = ({
|
|
98
97
|
setOpenAI,
|
99
98
|
updateDragging,
|
100
99
|
fontFamilies,
|
101
|
-
setFontFamilies
|
102
|
-
|
103
|
-
setActiveBreakPoint
|
104
|
-
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
|
100
|
+
setFontFamilies
|
101
|
+
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop]);
|
105
102
|
return /*#__PURE__*/_jsx(EditorContext.Provider, {
|
106
103
|
value: otherValues,
|
107
104
|
children: children
|
@@ -4,43 +4,6 @@ import { decodeAndParseBase64 } from "../utils/helper";
|
|
4
4
|
const avoidDefaultInsert = ["table", "grid"];
|
5
5
|
const NON_TEXT_TAGS = ["ol", "ul", "img", "table", "video", "a", "button", "GOOGLE-SHEETS-HTML-ORIGIN"];
|
6
6
|
const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree"];
|
7
|
-
const parseCopiedHTML = html => {
|
8
|
-
const parsed = new DOMParser().parseFromString(html, "text/html");
|
9
|
-
|
10
|
-
// if ol, ul are inside li, remove and push ol,ul after that li to maintain format between our slate list and external source list's json
|
11
|
-
parsed.querySelectorAll("li > ul, li > ol").forEach(list => {
|
12
|
-
// Find the parent li
|
13
|
-
const parentLi = list.parentElement;
|
14
|
-
|
15
|
-
// Move the list after the parent li
|
16
|
-
parentLi.after(list);
|
17
|
-
});
|
18
|
-
|
19
|
-
// to handle google docs list
|
20
|
-
parsed.querySelectorAll("li p, li div").forEach(element => {
|
21
|
-
const parent = element.parentNode;
|
22
|
-
// Move all child nodes of <p> or <div> to its parent <li>
|
23
|
-
while (element.firstChild) {
|
24
|
-
parent.insertBefore(element.firstChild, element);
|
25
|
-
}
|
26
|
-
// Remove the <p> or <div> element
|
27
|
-
parent.removeChild(element);
|
28
|
-
});
|
29
|
-
|
30
|
-
// claude.ai, copy list inbetween, some li tags are not wrapped with ul or ol
|
31
|
-
parsed.querySelectorAll("li").forEach(li => {
|
32
|
-
// Check if the parent of <li> is not a <ul> or <ol>
|
33
|
-
if (!li.parentElement || li.parentElement.tagName !== "UL" && li.parentElement.tagName !== "OL") {
|
34
|
-
// Create a <ul> element
|
35
|
-
const ul = document.createElement("ul");
|
36
|
-
// Append the <li> to the <ul>
|
37
|
-
ul.appendChild(li.cloneNode(true)); // Clone the <li>
|
38
|
-
// Replace the original <li> in the DOM with the <ul>
|
39
|
-
li.replaceWith(ul);
|
40
|
-
}
|
41
|
-
});
|
42
|
-
return parsed;
|
43
|
-
};
|
44
7
|
const loopChildren = (children = [], defaultInsert) => {
|
45
8
|
if (!children?.length) {
|
46
9
|
return defaultInsert;
|
@@ -65,7 +28,7 @@ const getCurrentElement = editor => {
|
|
65
28
|
return null;
|
66
29
|
}
|
67
30
|
};
|
68
|
-
|
31
|
+
const getCurrentElementText = editor => {
|
69
32
|
try {
|
70
33
|
if (editor.selection) {
|
71
34
|
return Editor.string(editor, editor?.selection?.anchor?.path);
|
@@ -223,15 +186,15 @@ const withHtml = editor => {
|
|
223
186
|
return;
|
224
187
|
}
|
225
188
|
const currentText = getCurrentElementText(editor);
|
226
|
-
if (currentText
|
189
|
+
if (currentText && !isTextNode) {
|
227
190
|
insertAtNextNode(editor, decoded);
|
228
191
|
return;
|
229
192
|
}
|
230
193
|
insertData(data);
|
231
194
|
}
|
232
195
|
} else if (html) {
|
233
|
-
const parsed =
|
234
|
-
const rootElement = parsed.body;
|
196
|
+
const parsed = new DOMParser().parseFromString(html, "text/html");
|
197
|
+
const rootElement = parsed.body || parsed.documentElement;
|
235
198
|
const isNonText = rootElement ? rootElement?.querySelector(NON_TEXT_TAGS.toString()) : false;
|
236
199
|
const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
|
237
200
|
if (isGoogleSheet) {
|
@@ -267,7 +230,7 @@ const withHtml = editor => {
|
|
267
230
|
return;
|
268
231
|
}
|
269
232
|
const currentText = getCurrentElementText(editor);
|
270
|
-
if (currentText
|
233
|
+
if (currentText && isNonText) {
|
271
234
|
insertAtNextNode(editor, formattedFragment);
|
272
235
|
return;
|
273
236
|
}
|
@@ -314,8 +314,7 @@ export const getBlock = props => {
|
|
314
314
|
borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
|
315
315
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
316
316
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
317
|
-
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
318
|
-
lineHeight: 1.43
|
317
|
+
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
319
318
|
},
|
320
319
|
children: children
|
321
320
|
});
|
@@ -375,9 +374,6 @@ export const getBlock = props => {
|
|
375
374
|
});
|
376
375
|
case "orderedList":
|
377
376
|
return /*#__PURE__*/_jsx("ol", {
|
378
|
-
style: {
|
379
|
-
lineHeight: 1.43
|
380
|
-
},
|
381
377
|
className: "listItemMargin",
|
382
378
|
type: "1",
|
383
379
|
...attributes,
|
@@ -385,9 +381,6 @@ export const getBlock = props => {
|
|
385
381
|
});
|
386
382
|
case "unorderedList":
|
387
383
|
return /*#__PURE__*/_jsx("ul", {
|
388
|
-
style: {
|
389
|
-
lineHeight: 1.43
|
390
|
-
},
|
391
384
|
className: "listItemMargin",
|
392
385
|
...attributes,
|
393
386
|
children: children
|
@@ -237,30 +237,24 @@ export const getBlock = props => {
|
|
237
237
|
return /*#__PURE__*/_jsx("p", {
|
238
238
|
...attributes,
|
239
239
|
...element.attr,
|
240
|
-
className: `content-editable ${isEmpty ? "empty" : ""}
|
240
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`
|
241
241
|
// placeholder="paragraph"
|
242
242
|
,
|
243
243
|
children: children
|
244
244
|
});
|
245
245
|
case "headingOne":
|
246
|
-
return /*#__PURE__*/_jsx("
|
246
|
+
return /*#__PURE__*/_jsx("h1", {
|
247
247
|
...attributes,
|
248
248
|
...element.attr,
|
249
|
-
style: {
|
250
|
-
margin: "10px 0px"
|
251
|
-
},
|
252
249
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
253
250
|
// placeholder="Heading 1"
|
254
251
|
,
|
255
252
|
children: children
|
256
253
|
});
|
257
254
|
case "headingTwo":
|
258
|
-
return /*#__PURE__*/_jsx("
|
255
|
+
return /*#__PURE__*/_jsx("h2", {
|
259
256
|
...attributes,
|
260
257
|
...element.attr,
|
261
|
-
style: {
|
262
|
-
margin: "10px 0px"
|
263
|
-
},
|
264
258
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
265
259
|
// placeholder="Heading 2"
|
266
260
|
,
|
@@ -270,55 +264,18 @@ export const getBlock = props => {
|
|
270
264
|
return /*#__PURE__*/_jsx("h3", {
|
271
265
|
...attributes,
|
272
266
|
...element.attr,
|
273
|
-
|
274
|
-
margin: "10px 0px"
|
275
|
-
},
|
276
|
-
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
267
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
277
268
|
children: children
|
278
269
|
});
|
279
270
|
case "headingThree":
|
280
271
|
return /*#__PURE__*/_jsx("h3", {
|
281
272
|
...attributes,
|
282
273
|
...element.attr,
|
283
|
-
style: {
|
284
|
-
margin: "10px 0px"
|
285
|
-
},
|
286
274
|
className: `content-editable ${isEmpty ? "empty" : ""}`
|
287
275
|
// placeholder="Heading 3"
|
288
276
|
,
|
289
277
|
children: children
|
290
278
|
});
|
291
|
-
case "headingFour":
|
292
|
-
return /*#__PURE__*/_jsx("h4", {
|
293
|
-
...attributes,
|
294
|
-
...element.attr,
|
295
|
-
style: {
|
296
|
-
margin: "10px 0px"
|
297
|
-
},
|
298
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
299
|
-
children: children
|
300
|
-
});
|
301
|
-
case "headingFive":
|
302
|
-
return /*#__PURE__*/_jsx("h5", {
|
303
|
-
...attributes,
|
304
|
-
...element.attr,
|
305
|
-
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
306
|
-
children: children
|
307
|
-
});
|
308
|
-
case "headingSix":
|
309
|
-
return /*#__PURE__*/_jsx("h6", {
|
310
|
-
...attributes,
|
311
|
-
...element.attr,
|
312
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
313
|
-
children: children
|
314
|
-
});
|
315
|
-
case "headingSeven":
|
316
|
-
return /*#__PURE__*/_jsx("h7", {
|
317
|
-
...attributes,
|
318
|
-
...element.attr,
|
319
|
-
className: `content-editable ${isEmpty ? "empty" : ""} m-0`,
|
320
|
-
children: children
|
321
|
-
});
|
322
279
|
case "blockquote":
|
323
280
|
return /*#__PURE__*/_jsx("blockquote", {
|
324
281
|
...attributes,
|
@@ -370,7 +327,7 @@ export const getBlock = props => {
|
|
370
327
|
return /*#__PURE__*/_jsx("li", {
|
371
328
|
...attributes,
|
372
329
|
...element.attr,
|
373
|
-
className: `content-editable ${isEmpty ? "empty" : ""}
|
330
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
374
331
|
placeholder: "List",
|
375
332
|
style: {
|
376
333
|
color: firstChildren?.color
|
@@ -387,7 +344,7 @@ export const getBlock = props => {
|
|
387
344
|
return /*#__PURE__*/_jsx("p", {
|
388
345
|
...attributes,
|
389
346
|
...element.attr,
|
390
|
-
className: `content-editable ${isEmpty ? "empty" : ""}
|
347
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`
|
391
348
|
// placeholder="paragraph"
|
392
349
|
,
|
393
350
|
children: children
|
@@ -409,8 +366,7 @@ export const getBlock = props => {
|
|
409
366
|
default:
|
410
367
|
return /*#__PURE__*/_jsx(SimpleText, {
|
411
368
|
...props,
|
412
|
-
isEmpty: isEmpty
|
413
|
-
isChatEditor: true
|
369
|
+
isEmpty: isEmpty
|
414
370
|
});
|
415
371
|
}
|
416
372
|
};
|
@@ -624,10 +624,6 @@ export const isPageSettings = (event, editor) => {
|
|
624
624
|
return isPageSettingsNode;
|
625
625
|
}
|
626
626
|
};
|
627
|
-
export function capitalizeFirstLetter(str) {
|
628
|
-
if (!str) return str;
|
629
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
630
|
-
}
|
631
627
|
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
632
628
|
try {
|
633
629
|
const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
|
@@ -646,13 +642,6 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
|
|
646
642
|
console.log(err);
|
647
643
|
}
|
648
644
|
};
|
649
|
-
export function isHavingSelection(editor) {
|
650
|
-
try {
|
651
|
-
return editor?.selection && !Range.isCollapsed(editor.selection);
|
652
|
-
} catch (err) {
|
653
|
-
console.log(err);
|
654
|
-
}
|
655
|
-
}
|
656
645
|
const omitNodes = ["site-settings", "page-settings"];
|
657
646
|
export function getInitialValue(value = [], readOnly) {
|
658
647
|
if (readOnly === "readonly" && value?.length) {
|
@@ -681,17 +670,20 @@ export function getInitialValue(value = [], readOnly) {
|
|
681
670
|
}
|
682
671
|
return value;
|
683
672
|
}
|
673
|
+
export function capitalizeFirstLetter(str) {
|
674
|
+
if (!str) return str;
|
675
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
676
|
+
}
|
677
|
+
export function isHavingSelection(editor) {
|
678
|
+
try {
|
679
|
+
return editor?.selection && !Range.isCollapsed(editor.selection);
|
680
|
+
} catch (err) {
|
681
|
+
console.log(err);
|
682
|
+
}
|
683
|
+
}
|
684
684
|
export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
|
685
685
|
return `${defaultCls} ${selected ? selectedClsName : ""}`;
|
686
686
|
}
|
687
|
-
export function handleNegativeInteger(val) {
|
688
|
-
return val < 0 ? 0 : val;
|
689
|
-
}
|
690
|
-
export const containsSurrogatePair = text => {
|
691
|
-
// Match surrogate pairs (high and low surrogate)
|
692
|
-
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
693
|
-
return surrogatePairRegex.test(text);
|
694
|
-
};
|
695
687
|
export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
696
688
|
try {
|
697
689
|
const options = {
|
@@ -705,6 +697,11 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
|
705
697
|
return [];
|
706
698
|
}
|
707
699
|
};
|
700
|
+
export const containsSurrogatePair = text => {
|
701
|
+
// Match surrogate pairs (high and low surrogate)
|
702
|
+
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
703
|
+
return surrogatePairRegex.test(text);
|
704
|
+
};
|
708
705
|
export const getSlateDom = (editor, range) => {
|
709
706
|
try {
|
710
707
|
const slateDom = ReactEditor.toDOMRange(editor, range);
|
@@ -9,13 +9,7 @@ export const findPageSettings = editor => {
|
|
9
9
|
path: null,
|
10
10
|
element: {
|
11
11
|
pageProps: {
|
12
|
-
pageWidth: "fixed"
|
13
|
-
"lineHeight": {
|
14
|
-
"xs": 1.43,
|
15
|
-
"sm": 1.43,
|
16
|
-
"md": 1.43,
|
17
|
-
"lg": 1.43
|
18
|
-
}
|
12
|
+
pageWidth: "fixed"
|
19
13
|
}
|
20
14
|
}
|
21
15
|
};
|
@@ -40,13 +34,7 @@ export const getPageSettings = editor => {
|
|
40
34
|
path: null,
|
41
35
|
element: {
|
42
36
|
pageProps: {
|
43
|
-
pageWidth: "fixed"
|
44
|
-
"lineHeight": {
|
45
|
-
"xs": 1.43,
|
46
|
-
"sm": 1.43,
|
47
|
-
"md": 1.43,
|
48
|
-
"lg": 1.43
|
49
|
-
}
|
37
|
+
pageWidth: "fixed"
|
50
38
|
}
|
51
39
|
}
|
52
40
|
};
|
package/package.json
CHANGED
@@ -1,79 +0,0 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Grid, Slider, Typography, Box } from "@mui/material";
|
3
|
-
import { getBreakPointsValue } from "../../../helper/theme";
|
4
|
-
import useWindowResize from "../../../hooks/useWindowResize";
|
5
|
-
import { useEditorContext } from "../../../hooks/useMouseMove";
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
-
const LineSpacing = props => {
|
9
|
-
const {
|
10
|
-
value: val,
|
11
|
-
data,
|
12
|
-
onChange
|
13
|
-
} = props;
|
14
|
-
const {
|
15
|
-
theme
|
16
|
-
} = useEditorContext();
|
17
|
-
const {
|
18
|
-
key
|
19
|
-
} = data;
|
20
|
-
const [size] = useWindowResize();
|
21
|
-
const pro_value = getBreakPointsValue(val, size?.device);
|
22
|
-
const [value, setValue] = useState(pro_value);
|
23
|
-
let breakpointValue = getBreakPointsValue(val, null);
|
24
|
-
breakpointValue = typeof breakpointValue['lg'] === 'object' ? breakpointValue['lg'] : breakpointValue;
|
25
|
-
useState(() => {
|
26
|
-
setValue(pro_value);
|
27
|
-
}, [pro_value]);
|
28
|
-
const handleChange = e => {
|
29
|
-
onChange({
|
30
|
-
[key]: {
|
31
|
-
...breakpointValue,
|
32
|
-
[size?.device]: e.target.value
|
33
|
-
}
|
34
|
-
});
|
35
|
-
};
|
36
|
-
return /*#__PURE__*/_jsxs(Grid, {
|
37
|
-
item: true,
|
38
|
-
xs: 12,
|
39
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
40
|
-
variant: "body1",
|
41
|
-
color: "primary",
|
42
|
-
style: {
|
43
|
-
fontSize: "14px",
|
44
|
-
fontWeight: 500
|
45
|
-
},
|
46
|
-
children: data?.label
|
47
|
-
}), /*#__PURE__*/_jsxs(Grid, {
|
48
|
-
container: true,
|
49
|
-
wrap: "nowrap",
|
50
|
-
className: "sld-wrpr",
|
51
|
-
children: [/*#__PURE__*/_jsx(Slider, {
|
52
|
-
className: "spacingSlider",
|
53
|
-
defaultValue: value || 1.43,
|
54
|
-
"aria-label": "Default",
|
55
|
-
valueLabelDisplay: "auto",
|
56
|
-
min: 0.5,
|
57
|
-
max: 3.0,
|
58
|
-
step: 0.1,
|
59
|
-
name: "lineHeight",
|
60
|
-
onChange: handleChange
|
61
|
-
}), /*#__PURE__*/_jsx(Box, {
|
62
|
-
component: "input",
|
63
|
-
sx: {
|
64
|
-
background: theme?.palette?.editor?.background,
|
65
|
-
color: theme?.palette?.editor?.textColor
|
66
|
-
},
|
67
|
-
name: "lineHeight",
|
68
|
-
value: pro_value,
|
69
|
-
className: "sliderInput",
|
70
|
-
onChange: handleChange,
|
71
|
-
type: "number",
|
72
|
-
placeholder: "0",
|
73
|
-
disabled: true,
|
74
|
-
defaultValue: pro_value || 1.43
|
75
|
-
})]
|
76
|
-
})]
|
77
|
-
});
|
78
|
-
};
|
79
|
-
export default LineSpacing;
|