@flozy/editor 5.8.4 → 5.8.6
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/ChatEditor.js +3 -6
- package/dist/Editor/CommonEditor.js +5 -2
- package/dist/Editor/Editor.css +2 -2
- package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
- package/dist/Editor/Elements/Button/EditorButton.js +1 -0
- package/dist/Editor/Elements/DataView/DataView.js +4 -3
- 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/Divider/Divider.js +3 -3
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
- 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/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/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/FontLoader.js +4 -4
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +6 -0
- package/dist/Editor/common/Section/index.js +39 -29
- package/dist/Editor/common/Section/styles.js +0 -15
- 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/commonStyle.js +5 -0
- package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/utils/SlateUtilityFunctions.js +10 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
- package/dist/Editor/utils/helper.js +41 -0
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/dist/Editor/utils/table.js +21 -0
- package/package.json +1 -1
@@ -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
|
}
|
@@ -314,7 +313,8 @@ export const getBlock = props => {
|
|
314
313
|
borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
|
315
314
|
margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
|
316
315
|
width: element?.bgColor ? "calc(100% - 16px)" : "100%",
|
317
|
-
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
|
316
|
+
borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
|
317
|
+
lineHeight: 1.43
|
318
318
|
},
|
319
319
|
children: children
|
320
320
|
});
|
@@ -374,6 +374,9 @@ export const getBlock = props => {
|
|
374
374
|
});
|
375
375
|
case "orderedList":
|
376
376
|
return /*#__PURE__*/_jsx("ol", {
|
377
|
+
style: {
|
378
|
+
lineHeight: 1.43
|
379
|
+
},
|
377
380
|
className: "listItemMargin",
|
378
381
|
type: "1",
|
379
382
|
...attributes,
|
@@ -381,6 +384,9 @@ export const getBlock = props => {
|
|
381
384
|
});
|
382
385
|
case "unorderedList":
|
383
386
|
return /*#__PURE__*/_jsx("ul", {
|
387
|
+
style: {
|
388
|
+
lineHeight: 1.43
|
389
|
+
},
|
384
390
|
className: "listItemMargin",
|
385
391
|
...attributes,
|
386
392
|
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,
|
@@ -713,6 +713,47 @@ export const getSlateDom = (editor, range) => {
|
|
713
713
|
console.log(err);
|
714
714
|
}
|
715
715
|
};
|
716
|
+
|
717
|
+
// The inputs inside the dynamic table lose focus after calling `setNodes` on the first `onChange` event.
|
718
|
+
// To replicate this issue, insert some paragraph nodes above the dynamic table, then type something in the title.
|
719
|
+
// After typing the first word, the input loses focus.
|
720
|
+
export const focusDynamicTableInput = e => {
|
721
|
+
setTimeout(() => {
|
722
|
+
const input = document.getElementById(e.target.id);
|
723
|
+
if (input) {
|
724
|
+
// Check if the input is not already focused
|
725
|
+
if (document.activeElement !== input) {
|
726
|
+
const length = input.value.length;
|
727
|
+
// Focus on the input
|
728
|
+
input.focus();
|
729
|
+
|
730
|
+
// number input not supports selection
|
731
|
+
if (e.target.type !== "number") {
|
732
|
+
// Set the cursor to the end
|
733
|
+
input.setSelectionRange(length, length);
|
734
|
+
}
|
735
|
+
}
|
736
|
+
}
|
737
|
+
}, 0);
|
738
|
+
};
|
739
|
+
export const clearWindowSelection = () => {
|
740
|
+
const selection = window.getSelection();
|
741
|
+
if (selection) {
|
742
|
+
selection.removeAllRanges(); // Clears the selection
|
743
|
+
}
|
744
|
+
};
|
745
|
+
|
746
|
+
export const viewSlateSelection = () => {
|
747
|
+
// 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
|
748
|
+
clearWindowSelection();
|
749
|
+
const selectionBg = "rgba(35, 131, 226, 0.35)";
|
750
|
+
const root = document.documentElement;
|
751
|
+
root.style.setProperty("--slate-highlight-bg", selectionBg);
|
752
|
+
};
|
753
|
+
export const hideSlateSelection = () => {
|
754
|
+
const root = document.documentElement;
|
755
|
+
root.style.setProperty("--slate-highlight-bg", "none");
|
756
|
+
};
|
716
757
|
export function handleNegativeInteger(val) {
|
717
758
|
return val < 0 ? 0 : val;
|
718
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
|
};
|