@flozy/editor 5.9.1 → 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 +22 -15
- 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 +13 -11
- 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 +31 -37
- package/dist/Editor/common/FontLoader/FontList.js +3 -11
- package/dist/Editor/common/FontLoader/FontLoader.js +75 -43
- 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/Section/index.js +78 -97
- 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/useEditorScroll.js +1 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/plugins/withLayout.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +15 -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 +2 -2
@@ -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
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flozy/editor",
|
3
|
-
"version": "5.9.
|
3
|
+
"version": "5.9.3",
|
4
4
|
"description": "An Editor for flozy app brain",
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -69,7 +69,7 @@
|
|
69
69
|
"storybook": "storybook dev -p 6006",
|
70
70
|
"build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
|
71
71
|
"publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
|
72
|
-
"publish:local": "rm -rf /Users/
|
72
|
+
"publish:local": "rm -rf /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist --copy-files"
|
73
73
|
},
|
74
74
|
"eslintConfig": {
|
75
75
|
"extends": [
|