@flozy/editor 5.9.2 → 5.9.3
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 +11 -6
- package/dist/Editor/Editor.css +22 -16
- package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
- package/dist/Editor/Elements/Button/EditorButton.js +3 -1
- package/dist/Editor/Elements/DataView/DataView.js +4 -3
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +8 -14
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
- package/dist/Editor/Elements/Grid/GridItem.js +1 -2
- package/dist/Editor/Elements/Link/Link.js +70 -43
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
- package/dist/Editor/Elements/Search/SearchList.js +8 -1
- package/dist/Editor/Elements/SimpleText/index.js +8 -1
- package/dist/Editor/Elements/SimpleText/style.js +5 -1
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Table/TableCell.js +14 -9
- package/dist/Editor/Elements/Title/title.js +13 -1
- package/dist/Editor/Elements/Variables/Style.js +28 -2
- package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
- package/dist/Editor/MiniEditor.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +37 -28
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +5 -0
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
- package/dist/Editor/common/FontLoader/FontList.js +3 -11
- package/dist/Editor/common/FontLoader/FontLoader.js +72 -53
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
- package/dist/Editor/common/Uploader.js +8 -0
- package/dist/Editor/common/iconslist.js +1 -2
- package/dist/Editor/commonStyle.js +58 -57
- package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +10 -4
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/helper.js +60 -19
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/dist/Editor/utils/table.js +21 -0
- package/package.json +1 -1
@@ -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);
|
@@ -161,4 +161,27 @@ export const groupByBreakpoint = (styleProps, theme) => {
|
|
161
161
|
}
|
162
162
|
};
|
163
163
|
};
|
164
|
-
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
164
|
+
export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
|
165
|
+
export const getBreakpointLineSpacing = (value, breakpoint) => {
|
166
|
+
try {
|
167
|
+
const values = getBreakPointsValue(value, breakpoint);
|
168
|
+
const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
|
169
|
+
if (values[b] || values["lg"]) {
|
170
|
+
const value = values[b] || values["lg"];
|
171
|
+
return {
|
172
|
+
...a,
|
173
|
+
[b]: value
|
174
|
+
};
|
175
|
+
} else {
|
176
|
+
return a;
|
177
|
+
}
|
178
|
+
}, {});
|
179
|
+
if (breakpoint) {
|
180
|
+
return value[breakpoint] || value["lg"] || value;
|
181
|
+
} else {
|
182
|
+
return cssVal["lg"];
|
183
|
+
}
|
184
|
+
} catch (err) {
|
185
|
+
// console.log(err);
|
186
|
+
}
|
187
|
+
};
|
@@ -35,6 +35,7 @@ export const EditorProvider = ({
|
|
35
35
|
path: null
|
36
36
|
});
|
37
37
|
const [fontFamilies, setFontFamilies] = useState({});
|
38
|
+
const [activeBreakPoint, setActiveBreakPoint] = useState("");
|
38
39
|
useEffect(() => {
|
39
40
|
window.updateSelectedItem = d => {
|
40
41
|
setSelectedElement(d);
|
@@ -97,8 +98,10 @@ export const EditorProvider = ({
|
|
97
98
|
setOpenAI,
|
98
99
|
updateDragging,
|
99
100
|
fontFamilies,
|
100
|
-
setFontFamilies
|
101
|
-
|
101
|
+
setFontFamilies,
|
102
|
+
activeBreakPoint,
|
103
|
+
setActiveBreakPoint
|
104
|
+
}), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
|
102
105
|
return /*#__PURE__*/_jsx(EditorContext.Provider, {
|
103
106
|
value: otherValues,
|
104
107
|
children: children
|
@@ -173,10 +173,9 @@ export const getMarked = (leaf, children, theme) => {
|
|
173
173
|
if (leaf.highlight) {
|
174
174
|
children = /*#__PURE__*/_jsx("span", {
|
175
175
|
style: {
|
176
|
-
color: "inherit"
|
176
|
+
color: "inherit",
|
177
|
+
background: "var(--slate-highlight-bg)"
|
177
178
|
},
|
178
|
-
className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
|
179
|
-
,
|
180
179
|
children: children
|
181
180
|
});
|
182
181
|
}
|
@@ -338,7 +337,8 @@ export const getBlock = props => {
|
|
338
337
|
borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
|
339
338
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
340
339
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
341
|
-
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
340
|
+
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
|
341
|
+
lineHeight: 1.43
|
342
342
|
},
|
343
343
|
children: children
|
344
344
|
});
|
@@ -398,6 +398,9 @@ export const getBlock = props => {
|
|
398
398
|
});
|
399
399
|
case "orderedList":
|
400
400
|
return /*#__PURE__*/_jsx("ol", {
|
401
|
+
style: {
|
402
|
+
lineHeight: 1.43
|
403
|
+
},
|
401
404
|
className: "listItemMargin",
|
402
405
|
type: "1",
|
403
406
|
...attributes,
|
@@ -405,6 +408,9 @@ export const getBlock = props => {
|
|
405
408
|
});
|
406
409
|
case "unorderedList":
|
407
410
|
return /*#__PURE__*/_jsx("ul", {
|
411
|
+
style: {
|
412
|
+
lineHeight: 1.43
|
413
|
+
},
|
408
414
|
className: "listItemMargin",
|
409
415
|
...attributes,
|
410
416
|
children: children
|
@@ -43,7 +43,8 @@ const useTableResize = ({
|
|
43
43
|
minWidth
|
44
44
|
} = minMaxProps || {};
|
45
45
|
setSize(currentSize => {
|
46
|
-
const
|
46
|
+
const width = currentSize?.width || parentDOM?.clientWidth;
|
47
|
+
const calcWidth = width + e.movementX;
|
47
48
|
return {
|
48
49
|
width: minWidth && calcWidth < minWidth ? minWidth : calcWidth,
|
49
50
|
height: currentSize.height + e.movementY,
|
@@ -82,7 +82,8 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
|
|
82
82
|
};
|
83
83
|
export const draftToSlate = props => {
|
84
84
|
const {
|
85
|
-
data
|
85
|
+
data,
|
86
|
+
needLayout
|
86
87
|
} = props;
|
87
88
|
if (data?.blocks && data?.blocks?.length > 0) {
|
88
89
|
const converted = data?.blocks?.reduce((a, b) => {
|
@@ -104,7 +105,7 @@ export const draftToSlate = props => {
|
|
104
105
|
return data;
|
105
106
|
} else {
|
106
107
|
return [{
|
107
|
-
type: "paragraph",
|
108
|
+
type: needLayout ? "title" : "paragraph",
|
108
109
|
children: [{
|
109
110
|
text: ""
|
110
111
|
}]
|
@@ -625,6 +625,10 @@ export const isRestrictedNode = (event, editor) => {
|
|
625
625
|
return isNodeRestricted;
|
626
626
|
}
|
627
627
|
};
|
628
|
+
export function capitalizeFirstLetter(str) {
|
629
|
+
if (!str) return str;
|
630
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
631
|
+
}
|
628
632
|
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
629
633
|
try {
|
630
634
|
const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
|
@@ -643,6 +647,13 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
|
|
643
647
|
console.log(err);
|
644
648
|
}
|
645
649
|
};
|
650
|
+
export function isHavingSelection(editor) {
|
651
|
+
try {
|
652
|
+
return editor?.selection && !Range.isCollapsed(editor.selection);
|
653
|
+
} catch (err) {
|
654
|
+
console.log(err);
|
655
|
+
}
|
656
|
+
}
|
646
657
|
const omitNodes = ["site-settings", "page-settings"];
|
647
658
|
export function getInitialValue(value = [], readOnly) {
|
648
659
|
if (readOnly === "readonly" && value?.length) {
|
@@ -673,20 +684,17 @@ export function getInitialValue(value = [], readOnly) {
|
|
673
684
|
}
|
674
685
|
return value;
|
675
686
|
}
|
676
|
-
export function capitalizeFirstLetter(str) {
|
677
|
-
if (!str) return str;
|
678
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
679
|
-
}
|
680
|
-
export function isHavingSelection(editor) {
|
681
|
-
try {
|
682
|
-
return editor?.selection && !Range.isCollapsed(editor.selection);
|
683
|
-
} catch (err) {
|
684
|
-
console.log(err);
|
685
|
-
}
|
686
|
-
}
|
687
687
|
export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
|
688
688
|
return `${defaultCls} ${selected ? selectedClsName : ""}`;
|
689
689
|
}
|
690
|
+
export function handleNegativeInteger(val) {
|
691
|
+
return val < 0 ? 0 : val;
|
692
|
+
}
|
693
|
+
export const containsSurrogatePair = text => {
|
694
|
+
// Match surrogate pairs (high and low surrogate)
|
695
|
+
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
696
|
+
return surrogatePairRegex.test(text);
|
697
|
+
};
|
690
698
|
export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
691
699
|
try {
|
692
700
|
const options = {
|
@@ -700,11 +708,6 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
|
700
708
|
return [];
|
701
709
|
}
|
702
710
|
};
|
703
|
-
export const containsSurrogatePair = text => {
|
704
|
-
// Match surrogate pairs (high and low surrogate)
|
705
|
-
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
706
|
-
return surrogatePairRegex.test(text);
|
707
|
-
};
|
708
711
|
export const getSlateDom = (editor, range) => {
|
709
712
|
try {
|
710
713
|
const slateDom = ReactEditor.toDOMRange(editor, range);
|
@@ -713,6 +716,44 @@ export const getSlateDom = (editor, range) => {
|
|
713
716
|
console.log(err);
|
714
717
|
}
|
715
718
|
};
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
+
|
720
|
+
// The inputs inside the dynamic table lose focus after calling `setNodes` on the first `onChange` event.
|
721
|
+
// To replicate this issue, insert some paragraph nodes above the dynamic table, then type something in the title.
|
722
|
+
// After typing the first word, the input loses focus.
|
723
|
+
export const focusDynamicTableInput = e => {
|
724
|
+
setTimeout(() => {
|
725
|
+
const input = document.getElementById(e.target.id);
|
726
|
+
if (input) {
|
727
|
+
// Check if the input is not already focused
|
728
|
+
if (document.activeElement !== input) {
|
729
|
+
const length = input.value.length;
|
730
|
+
// Focus on the input
|
731
|
+
input.focus();
|
732
|
+
|
733
|
+
// number input not supports selection
|
734
|
+
if (e.target.type !== "number") {
|
735
|
+
// Set the cursor to the end
|
736
|
+
input.setSelectionRange(length, length);
|
737
|
+
}
|
738
|
+
}
|
739
|
+
}
|
740
|
+
}, 0);
|
741
|
+
};
|
742
|
+
export const clearWindowSelection = () => {
|
743
|
+
const selection = window.getSelection();
|
744
|
+
if (selection) {
|
745
|
+
selection.removeAllRanges(); // Clears the selection
|
746
|
+
}
|
747
|
+
};
|
748
|
+
|
749
|
+
export const viewSlateSelection = () => {
|
750
|
+
// if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
|
751
|
+
clearWindowSelection();
|
752
|
+
const selectionBg = "rgba(35, 131, 226, 0.35)";
|
753
|
+
const root = document.documentElement;
|
754
|
+
root.style.setProperty("--slate-highlight-bg", selectionBg);
|
755
|
+
};
|
756
|
+
export const hideSlateSelection = () => {
|
757
|
+
const root = document.documentElement;
|
758
|
+
root.style.setProperty("--slate-highlight-bg", "none");
|
759
|
+
};
|
@@ -9,7 +9,13 @@ export const findPageSettings = editor => {
|
|
9
9
|
path: null,
|
10
10
|
element: {
|
11
11
|
pageProps: {
|
12
|
-
pageWidth: "fixed"
|
12
|
+
pageWidth: "fixed",
|
13
|
+
"lineHeight": {
|
14
|
+
"xs": 1.43,
|
15
|
+
"sm": 1.43,
|
16
|
+
"md": 1.43,
|
17
|
+
"lg": 1.43
|
18
|
+
}
|
13
19
|
}
|
14
20
|
}
|
15
21
|
};
|
@@ -34,7 +40,13 @@ export const getPageSettings = editor => {
|
|
34
40
|
path: null,
|
35
41
|
element: {
|
36
42
|
pageProps: {
|
37
|
-
pageWidth: "fixed"
|
43
|
+
pageWidth: "fixed",
|
44
|
+
"lineHeight": {
|
45
|
+
"xs": 1.43,
|
46
|
+
"sm": 1.43,
|
47
|
+
"md": 1.43,
|
48
|
+
"lg": 1.43
|
49
|
+
}
|
38
50
|
}
|
39
51
|
}
|
40
52
|
};
|
@@ -753,4 +753,25 @@ export const clearCellText = (editor, currentCellPath) => {
|
|
753
753
|
} catch (err) {
|
754
754
|
console.log(err);
|
755
755
|
}
|
756
|
+
};
|
757
|
+
export const getTableColumns = element => {
|
758
|
+
const {
|
759
|
+
columns,
|
760
|
+
children
|
761
|
+
} = element || {};
|
762
|
+
if (columns) {
|
763
|
+
return columns;
|
764
|
+
}
|
765
|
+
const firstRow = children?.length ? children[0] : {};
|
766
|
+
return firstRow?.children?.length || 0;
|
767
|
+
};
|
768
|
+
export const getTableRows = element => {
|
769
|
+
const {
|
770
|
+
rows,
|
771
|
+
children
|
772
|
+
} = element || {};
|
773
|
+
if (rows) {
|
774
|
+
return rows;
|
775
|
+
}
|
776
|
+
return children?.length || 0;
|
756
777
|
};
|