@flozy/editor 5.3.0 → 5.3.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +25 -34
- package/dist/Editor/CommonEditor.js +20 -12
- package/dist/Editor/Editor.css +28 -15
- package/dist/Editor/Elements/AI/AIInput.js +0 -3
- package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
- package/dist/Editor/Elements/Button/EditorButton.js +8 -2
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +4 -2
- package/dist/Editor/Elements/DataView/DataView.js +124 -0
- package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +67 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +35 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +74 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -0
- package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +37 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +60 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +112 -0
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +80 -0
- package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
- package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +281 -0
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +74 -0
- package/dist/Editor/Elements/DataView/styles.js +154 -0
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +2 -1
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
- package/dist/Editor/Elements/SimpleText/index.js +8 -1
- package/dist/Editor/Elements/SimpleText/style.js +10 -1
- package/dist/Editor/Elements/Table/Table.js +1 -1
- package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
- package/dist/Editor/Styles/EditorStyles.js +7 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -0
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
- package/dist/Editor/Toolbar/Toolbar.js +6 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
- package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
- package/dist/Editor/common/Icon.js +6 -0
- package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
- package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
- package/dist/Editor/common/RnD/ShadowElement.js +1 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -6
- package/dist/Editor/common/RnD/index.js +3 -2
- package/dist/Editor/common/Shorthands/elements.js +13 -1
- 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/iconListV2.js +53 -53
- package/dist/Editor/common/iconslist.js +6 -3
- package/dist/Editor/commonStyle.js +9 -0
- package/dist/Editor/helper/enforceDateFormat.js +41 -0
- package/dist/Editor/helper/index.js +16 -3
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/plugins/withEmbeds.js +30 -26
- package/dist/Editor/plugins/withHTML.js +47 -12
- package/dist/Editor/plugins/withLayout.js +42 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +27 -4
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +26 -1
- package/dist/Editor/utils/dataView.js +43 -0
- package/dist/Editor/utils/events.js +0 -1
- package/dist/Editor/utils/helper.js +51 -1
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/dist/Editor/utils/serializeToText.js +2 -0
- package/package.json +1 -1
@@ -0,0 +1,43 @@
|
|
1
|
+
import { Transforms } from "slate";
|
2
|
+
import insertNewLine from "./insertNewLine";
|
3
|
+
const getDefaultDatView = () => ({
|
4
|
+
type: "dataView",
|
5
|
+
title: "",
|
6
|
+
layouts: [{
|
7
|
+
key: "view1",
|
8
|
+
type: "table",
|
9
|
+
label: "Table 1 View",
|
10
|
+
value: "table1",
|
11
|
+
filter: [],
|
12
|
+
sort: []
|
13
|
+
}],
|
14
|
+
properties: [{
|
15
|
+
key: "column1",
|
16
|
+
label: "Task",
|
17
|
+
type: "text",
|
18
|
+
visible: true,
|
19
|
+
default: true
|
20
|
+
}],
|
21
|
+
rows: [{
|
22
|
+
id: new Date().getTime(),
|
23
|
+
column1: ""
|
24
|
+
}],
|
25
|
+
children: [{
|
26
|
+
type: "viewData",
|
27
|
+
children: [{
|
28
|
+
text: ""
|
29
|
+
}]
|
30
|
+
}]
|
31
|
+
});
|
32
|
+
export const insertDataView = editor => {
|
33
|
+
try {
|
34
|
+
Transforms.insertNodes(editor, {
|
35
|
+
...getDefaultDatView()
|
36
|
+
}, {
|
37
|
+
at: editor?.selection.focus.path
|
38
|
+
});
|
39
|
+
insertNewLine(editor);
|
40
|
+
} catch (err) {
|
41
|
+
console.log(err);
|
42
|
+
}
|
43
|
+
};
|
@@ -5,7 +5,6 @@ import { insertAccordion } from "./accordion";
|
|
5
5
|
import { isListItem } from "./helper";
|
6
6
|
import RnDCtrlCmds from "./RnD/RnDCtrlCmds";
|
7
7
|
import EDITORCMDS from "../common/EditorCmds";
|
8
|
-
import { ReactEditor } from "slate-react";
|
9
8
|
const HOTKEYS = {
|
10
9
|
b: "bold",
|
11
10
|
i: "italic",
|
@@ -4,6 +4,7 @@ import insertNewLine from "./insertNewLine";
|
|
4
4
|
import { getDevice } from "../helper/theme";
|
5
5
|
export const windowVar = {};
|
6
6
|
let ST_TIMEOUT = null;
|
7
|
+
const BLOCKS = ["grid", "dataView"];
|
7
8
|
export const formatDate = (date, format = "MM/DD/YYYY") => {
|
8
9
|
if (!date) return "";
|
9
10
|
var d = new Date(date),
|
@@ -163,7 +164,7 @@ export const handleInsertLastElement = (event, editor) => {
|
|
163
164
|
if (isFreeGrid) {
|
164
165
|
return;
|
165
166
|
}
|
166
|
-
const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c => c.type
|
167
|
+
const isLastElementEmpty = lastElement.type === "paragraph" && !lastElement.children[0]?.text && !lastElement.children?.some(c => BLOCKS.includes(c.type));
|
167
168
|
if (!ReactEditor.isFocused(editor)) {
|
168
169
|
if (isLastElementEmpty) {
|
169
170
|
if (hasPath) {
|
@@ -627,6 +628,24 @@ export function capitalizeFirstLetter(str) {
|
|
627
628
|
if (!str) return str;
|
628
629
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
629
630
|
}
|
631
|
+
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
632
|
+
try {
|
633
|
+
const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
|
634
|
+
if (node) {
|
635
|
+
// Insert the line break
|
636
|
+
Transforms.insertNodes(editor, {
|
637
|
+
type: "paragraph",
|
638
|
+
children: [{
|
639
|
+
text: ""
|
640
|
+
}]
|
641
|
+
}, {
|
642
|
+
at: nodePath
|
643
|
+
});
|
644
|
+
}
|
645
|
+
} catch (err) {
|
646
|
+
console.log(err);
|
647
|
+
}
|
648
|
+
};
|
630
649
|
export function isHavingSelection(editor) {
|
631
650
|
try {
|
632
651
|
return editor?.selection && !Range.isCollapsed(editor.selection);
|
@@ -634,6 +653,37 @@ export function isHavingSelection(editor) {
|
|
634
653
|
console.log(err);
|
635
654
|
}
|
636
655
|
}
|
656
|
+
const omitNodes = ["site-settings", "page-settings"];
|
657
|
+
export function getInitialValue(value = [], readOnly) {
|
658
|
+
if (readOnly === "readonly" && value?.length) {
|
659
|
+
// remove last empty nodes on readonly mode, to remove empty spaces
|
660
|
+
|
661
|
+
let lastNonEmptyElementIndex;
|
662
|
+
for (let i = value?.length; i > 0; i--) {
|
663
|
+
const elementIndex = i - 1;
|
664
|
+
const node = value[elementIndex];
|
665
|
+
if (lastNonEmptyElementIndex) {
|
666
|
+
break;
|
667
|
+
}
|
668
|
+
if (node?.type === "paragraph") {
|
669
|
+
// Ensure all children of the paragraph node are text nodes
|
670
|
+
const hasOnlyTextChildren = node.children.every(child => Text.isText(child));
|
671
|
+
const text = node.children[node.children.length - 1]?.text;
|
672
|
+
lastNonEmptyElementIndex = hasOnlyTextChildren ? text ? elementIndex : null : elementIndex;
|
673
|
+
} else if (omitNodes.includes(node?.type)) {
|
674
|
+
continue;
|
675
|
+
} else {
|
676
|
+
lastNonEmptyElementIndex = elementIndex;
|
677
|
+
}
|
678
|
+
}
|
679
|
+
const newValue = [...value].slice(0, lastNonEmptyElementIndex + 1);
|
680
|
+
return newValue;
|
681
|
+
}
|
682
|
+
return value;
|
683
|
+
}
|
637
684
|
export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
|
638
685
|
return `${defaultCls} ${selected ? selectedClsName : ""}`;
|
686
|
+
}
|
687
|
+
export function handleNegativeInteger(val) {
|
688
|
+
return val < 0 ? 0 : val;
|
639
689
|
}
|
@@ -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
|
};
|
@@ -2,6 +2,8 @@ export const serializeToText = node => {
|
|
2
2
|
try {
|
3
3
|
if (!node?.type && node?.text) {
|
4
4
|
return node?.text;
|
5
|
+
} else if (node?.type === 'mention') {
|
6
|
+
return '@' + node?.character?.name || '';
|
5
7
|
}
|
6
8
|
let n = Array.isArray(node) ? node : node?.children;
|
7
9
|
n = n && Array.isArray(n) ? n : n ? [n] : [];
|