@flozy/editor 5.5.6 → 5.5.8
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 +34 -25
- package/dist/Editor/CommonEditor.js +16 -33
- package/dist/Editor/Editor.css +20 -105
- package/dist/Editor/Elements/AI/AIInput.js +1 -0
- package/dist/Editor/Elements/AI/CustomSelect.js +10 -17
- package/dist/Editor/Elements/AI/PopoverAIInput.js +53 -59
- package/dist/Editor/Elements/AI/Styles.js +6 -24
- package/dist/Editor/Elements/Accordion/Accordion.js +1 -8
- package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
- package/dist/Editor/Elements/Button/EditorButton.js +2 -9
- package/dist/Editor/Elements/Carousel/CarouselItem.js +3 -11
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +5 -7
- package/dist/Editor/Elements/Color Picker/Styles.js +3 -8
- package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
- package/dist/Editor/Elements/Divider/Divider.js +20 -36
- package/dist/Editor/Elements/Embed/Image.js +16 -51
- package/dist/Editor/Elements/Embed/Video.js +3 -26
- package/dist/Editor/Elements/Form/Form.js +2 -39
- package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormDate.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormEmail.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormText.js +1 -7
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -6
- package/dist/Editor/Elements/Form/FormPopup.js +9 -12
- package/dist/Editor/Elements/Form/Workflow/Styles.js +0 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +2 -4
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -20
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -2
- package/dist/Editor/Elements/Grid/GridButton.js +2 -2
- package/dist/Editor/Elements/Grid/GridItem.js +36 -47
- package/dist/Editor/Elements/Grid/Styles.js +0 -50
- package/dist/Editor/Elements/Link/LinkButton.js +1 -1
- package/dist/Editor/Elements/List/CheckList.js +1 -2
- package/dist/Editor/Elements/Search/SearchAttachment.js +0 -1
- package/dist/Editor/Elements/Search/SearchButton.js +0 -1
- package/dist/Editor/Elements/Signature/Signature.css +1 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
- package/dist/Editor/Elements/Signature/SignaturePopup.js +52 -17
- package/dist/Editor/Elements/SimpleText/index.js +3 -11
- package/dist/Editor/Elements/SimpleText/style.js +1 -20
- package/dist/Editor/Elements/Table/Styles.js +78 -88
- package/dist/Editor/Elements/Table/Table.js +140 -263
- package/dist/Editor/Elements/Table/TableCell.js +111 -365
- package/dist/Editor/Elements/Table/TablePopup.js +3 -9
- package/dist/Editor/Elements/Table/TableRow.js +2 -10
- package/dist/Editor/Elements/TopBanner/TopBanner.js +1 -2
- package/dist/Editor/MiniEditor.js +2 -21
- package/dist/Editor/Styles/EditorStyles.js +4 -13
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +0 -10
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +12 -7
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -26
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +0 -3
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -5
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +8 -8
- package/dist/Editor/Toolbar/Mini/Styles.js +1 -9
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +3 -7
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -6
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +15 -19
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +58 -557
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +16 -73
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -3
- package/dist/Editor/Toolbar/Toolbar.js +0 -6
- package/dist/Editor/Toolbar/toolbarGroups.js +0 -4
- package/dist/Editor/assets/svg/BrainIcon.js +2 -2
- package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
- package/dist/Editor/common/ColorPickerButton.js +45 -85
- package/dist/Editor/common/DnD/Draggable.js +1 -2
- package/dist/Editor/common/FontLoader/FontLoader.js +6 -12
- package/dist/Editor/common/Icon.js +21 -54
- package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -2
- package/dist/Editor/common/ImageSelector/Styles.js +6 -47
- package/dist/Editor/common/ImageSelector/UploadStyles.js +6 -18
- package/dist/Editor/common/LinkSettings/NavComponents.js +1 -2
- package/dist/Editor/common/LinkSettings/index.js +1 -2
- package/dist/Editor/common/MentionsPopup/Styles.js +8 -143
- package/dist/Editor/common/MentionsPopup/index.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +12 -108
- 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 +2 -14
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +6 -9
- package/dist/Editor/common/RnD/VirtualElement/index.js +1 -5
- package/dist/Editor/common/RnD/index.js +3 -4
- package/dist/Editor/common/Section/index.js +3 -3
- package/dist/Editor/common/Section/styles.js +1 -5
- package/dist/Editor/common/Shorthands/elements.js +1 -13
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -9
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +7 -35
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +2 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +1 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +0 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +6 -22
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +2 -21
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -20
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +2 -12
- package/dist/Editor/common/StyleBuilder/formStyle.js +149 -268
- package/dist/Editor/common/StyleBuilder/index.js +20 -101
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
- package/dist/Editor/common/StyleBuilder/tableStyle.js +25 -69
- package/dist/Editor/common/SwipeableDrawer/style.js +4 -15
- package/dist/Editor/common/ToolbarIcon.js +1 -1
- package/dist/Editor/common/Uploader.js +36 -46
- package/dist/Editor/common/iconListV2.js +74 -598
- package/dist/Editor/common/iconslist.js +19 -25
- package/dist/Editor/commonStyle.js +15 -421
- package/dist/Editor/helper/deserialize/index.js +2 -31
- package/dist/Editor/helper/index.js +4 -17
- package/dist/Editor/helper/theme.js +2 -39
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/hooks/useMouseMove.js +2 -5
- package/dist/Editor/plugins/withCustomDeleteBackward.js +104 -100
- package/dist/Editor/plugins/withEmbeds.js +26 -30
- package/dist/Editor/plugins/withHTML.js +12 -100
- package/dist/Editor/plugins/withLayout.js +0 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +12 -39
- package/dist/Editor/utils/brains.js +1 -1
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +6 -75
- package/dist/Editor/utils/customHooks/useResize.js +4 -7
- package/dist/Editor/utils/customHooks/useTableResize.js +2 -6
- package/dist/Editor/utils/embed.js +1 -2
- package/dist/Editor/utils/events.js +1 -0
- package/dist/Editor/utils/font.js +4 -11
- package/dist/Editor/utils/formfield.js +4 -8
- package/dist/Editor/utils/helper.js +2 -103
- package/dist/Editor/utils/insertNewLine.js +1 -19
- package/dist/Editor/utils/pageSettings.js +2 -14
- package/dist/Editor/utils/serializeToText.js +0 -2
- package/dist/Editor/utils/table.js +24 -228
- package/package.json +2 -2
- package/dist/Editor/Elements/DataView/DataView.js +0 -124
- package/dist/Editor/Elements/DataView/DataViewButton.js +0 -23
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +0 -83
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +0 -33
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +0 -180
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +0 -62
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +0 -68
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +0 -35
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +0 -39
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +0 -30
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +0 -30
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +0 -35
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +0 -36
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +0 -17
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +0 -29
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +0 -38
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +0 -86
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +0 -71
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +0 -138
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -213
- package/dist/Editor/Elements/DataView/Layouts/Formula.js +0 -29
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +0 -113
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +0 -44
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +0 -146
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +0 -79
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +0 -57
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +0 -101
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +0 -174
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +0 -241
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +0 -45
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +0 -32
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -110
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +0 -217
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +0 -131
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +0 -253
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +0 -85
- package/dist/Editor/Elements/DataView/Layouts/colStyles.js +0 -10
- package/dist/Editor/Elements/DataView/Layouts/index.js +0 -25
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +0 -277
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +0 -15
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +0 -88
- package/dist/Editor/Elements/DataView/styles.js +0 -169
- package/dist/Editor/Elements/Table/AddRowCol.js +0 -77
- package/dist/Editor/Elements/Table/DragButton.js +0 -142
- package/dist/Editor/Elements/Table/DragStyles.js +0 -70
- package/dist/Editor/Elements/Table/Draggable.js +0 -25
- package/dist/Editor/Elements/Table/Droppable.js +0 -53
- package/dist/Editor/Elements/Table/TableTool.js +0 -101
- package/dist/Editor/Elements/Table/tableHelper.js +0 -71
- package/dist/Editor/assets/svg/ArrowDownIcon.js +0 -25
- package/dist/Editor/assets/svg/ArrowUpIcon.js +0 -25
- package/dist/Editor/assets/svg/CalenderIconTick.js +0 -64
- package/dist/Editor/assets/svg/ChervDown.js +0 -18
- package/dist/Editor/assets/svg/ChervUp.js +0 -18
- package/dist/Editor/assets/svg/DataTableIcon.js +0 -50
- package/dist/Editor/assets/svg/DuplicateIcon.js +0 -23
- package/dist/Editor/assets/svg/EyeIcon.js +0 -23
- package/dist/Editor/assets/svg/EyeSlash.js +0 -43
- package/dist/Editor/assets/svg/HashtagIcon.js +0 -33
- package/dist/Editor/assets/svg/PlusIcon.js +0 -23
- package/dist/Editor/assets/svg/SelectRoundedIcon.js +0 -24
- package/dist/Editor/assets/svg/SortByIcon.js +0 -33
- package/dist/Editor/assets/svg/TableIcons.js +0 -220
- package/dist/Editor/assets/svg/TickOutlined.js +0 -23
- package/dist/Editor/assets/svg/TrashCanIcon.js +0 -38
- package/dist/Editor/common/Select/index.js +0 -20
- package/dist/Editor/common/Select/styles.js +0 -17
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
- package/dist/Editor/helper/enforceDateFormat.js +0 -41
- package/dist/Editor/hooks/useTable.js +0 -210
- package/dist/Editor/utils/dataView.js +0 -43
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Transforms, Editor, Range, Element, Path, Node } from "slate";
|
2
2
|
import { ReactEditor } from "slate-react";
|
3
|
-
import { customInsertNode
|
3
|
+
import { customInsertNode } from "./helper";
|
4
4
|
export const DEFAULT_TABLE_NODE = () => ({
|
5
5
|
type: "table",
|
6
6
|
children: [{
|
@@ -13,10 +13,7 @@ export const DEFAULT_TABLE_NODE = () => ({
|
|
13
13
|
text: ""
|
14
14
|
}],
|
15
15
|
cellBgColor: "#FFFFFF"
|
16
|
-
}]
|
17
|
-
size: {
|
18
|
-
width: 120
|
19
|
-
}
|
16
|
+
}]
|
20
17
|
}, {
|
21
18
|
type: "table-cell",
|
22
19
|
children: [{
|
@@ -25,10 +22,7 @@ export const DEFAULT_TABLE_NODE = () => ({
|
|
25
22
|
text: ""
|
26
23
|
}],
|
27
24
|
cellBgColor: "#FFFFFF"
|
28
|
-
}]
|
29
|
-
size: {
|
30
|
-
width: 120
|
31
|
-
}
|
25
|
+
}]
|
32
26
|
}, {
|
33
27
|
type: "table-cell",
|
34
28
|
children: [{
|
@@ -37,10 +31,7 @@ export const DEFAULT_TABLE_NODE = () => ({
|
|
37
31
|
text: ""
|
38
32
|
}],
|
39
33
|
cellBgColor: "#FFFFFF"
|
40
|
-
}]
|
41
|
-
size: {
|
42
|
-
width: 120
|
43
|
-
}
|
34
|
+
}]
|
44
35
|
}]
|
45
36
|
}, {
|
46
37
|
type: "table-row",
|
@@ -52,10 +43,7 @@ export const DEFAULT_TABLE_NODE = () => ({
|
|
52
43
|
text: ""
|
53
44
|
}],
|
54
45
|
cellBgColor: "#FFFFFF"
|
55
|
-
}]
|
56
|
-
size: {
|
57
|
-
width: 120
|
58
|
-
}
|
46
|
+
}]
|
59
47
|
}, {
|
60
48
|
type: "table-cell",
|
61
49
|
children: [{
|
@@ -64,10 +52,7 @@ export const DEFAULT_TABLE_NODE = () => ({
|
|
64
52
|
text: ""
|
65
53
|
}],
|
66
54
|
cellBgColor: "#FFFFFF"
|
67
|
-
}]
|
68
|
-
size: {
|
69
|
-
width: 120
|
70
|
-
}
|
55
|
+
}]
|
71
56
|
}, {
|
72
57
|
type: "table-cell",
|
73
58
|
children: [{
|
@@ -78,7 +63,9 @@ export const DEFAULT_TABLE_NODE = () => ({
|
|
78
63
|
cellBgColor: "#FFFFFF"
|
79
64
|
}],
|
80
65
|
size: {
|
81
|
-
|
66
|
+
widthInPercent: 100,
|
67
|
+
height: 100,
|
68
|
+
width: 365.3307291666667
|
82
69
|
}
|
83
70
|
}]
|
84
71
|
}, {
|
@@ -91,10 +78,7 @@ export const DEFAULT_TABLE_NODE = () => ({
|
|
91
78
|
text: ""
|
92
79
|
}],
|
93
80
|
cellBgColor: "#FFFFFF"
|
94
|
-
}]
|
95
|
-
size: {
|
96
|
-
width: 120
|
97
|
-
}
|
81
|
+
}]
|
98
82
|
}, {
|
99
83
|
type: "table-cell",
|
100
84
|
children: [{
|
@@ -103,10 +87,7 @@ export const DEFAULT_TABLE_NODE = () => ({
|
|
103
87
|
text: ""
|
104
88
|
}],
|
105
89
|
cellBgColor: "#FFFFFF"
|
106
|
-
}]
|
107
|
-
size: {
|
108
|
-
width: 120
|
109
|
-
}
|
90
|
+
}]
|
110
91
|
}, {
|
111
92
|
type: "table-cell",
|
112
93
|
children: [{
|
@@ -117,14 +98,14 @@ export const DEFAULT_TABLE_NODE = () => ({
|
|
117
98
|
cellBgColor: "#FFFFFF"
|
118
99
|
}],
|
119
100
|
size: {
|
120
|
-
|
101
|
+
height: 300,
|
102
|
+
widthInPercent: 100
|
121
103
|
}
|
122
104
|
}]
|
123
105
|
}],
|
124
106
|
rows: 3,
|
125
107
|
columns: 3
|
126
108
|
});
|
127
|
-
const isFreeGridTable = n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "freegridItem" && n.childType === "table";
|
128
109
|
const prefixKey = (obj, pk = "") => {
|
129
110
|
return Object.keys(obj).reduce((a, b) => {
|
130
111
|
a[`${pk}${b}`] = obj[b];
|
@@ -163,49 +144,12 @@ export class TableUtil {
|
|
163
144
|
customInsertNode(this.editor, newTable);
|
164
145
|
};
|
165
146
|
removeTable = () => {
|
166
|
-
|
167
|
-
match:
|
147
|
+
Transforms.removeNodes(this.editor, {
|
148
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
149
|
+
// mode:'highest'
|
168
150
|
});
|
169
|
-
if (freeGridItem) {
|
170
|
-
Transforms.removeNodes(this.editor, {
|
171
|
-
match: isFreeGridTable
|
172
|
-
});
|
173
|
-
} else {
|
174
|
-
Transforms.removeNodes(this.editor, {
|
175
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
176
|
-
});
|
177
|
-
}
|
178
|
-
};
|
179
|
-
duplicateTable = () => {
|
180
|
-
const {
|
181
|
-
selection
|
182
|
-
} = this.editor;
|
183
|
-
if (!!selection && Range.isCollapsed(selection)) {
|
184
|
-
const [freeGridItem] = Editor.nodes(this.editor, {
|
185
|
-
match: isFreeGridTable
|
186
|
-
});
|
187
|
-
let clone;
|
188
|
-
let path;
|
189
|
-
if (freeGridItem) {
|
190
|
-
const [freeGridNode, freeGridPath] = freeGridItem;
|
191
|
-
clone = freeGridNode;
|
192
|
-
path = freeGridPath;
|
193
|
-
} else {
|
194
|
-
const [[tableNode, tablePath]] = Editor.nodes(this.editor, {
|
195
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
196
|
-
});
|
197
|
-
clone = tableNode;
|
198
|
-
path = tablePath;
|
199
|
-
}
|
200
|
-
const nextPath = Path.next(path);
|
201
|
-
if (clone) {
|
202
|
-
const clonedNode = JSON.parse(JSON.stringify(clone));
|
203
|
-
Transforms.insertNodes(this.editor, clonedNode, {
|
204
|
-
at: nextPath
|
205
|
-
});
|
206
|
-
}
|
207
|
-
}
|
208
151
|
};
|
152
|
+
|
209
153
|
getDOMNode = path => {
|
210
154
|
try {
|
211
155
|
const [tableNode] = Editor.nodes(this.editor, {
|
@@ -242,12 +186,9 @@ export class TableUtil {
|
|
242
186
|
const [[table, tablePath]] = Editor.nodes(this.editor, {
|
243
187
|
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
244
188
|
});
|
245
|
-
const [
|
246
|
-
const
|
247
|
-
|
248
|
-
const path = isInsertNext ? Path.next(currentRow) : currentRow;
|
249
|
-
const insertData = isDuplicate ? JSON.parse(JSON.stringify(currentRowData)) : createRowOnInsertAbove(currentRowData, currentRow, this.editor);
|
250
|
-
Transforms.insertNodes(this.editor, insertData, {
|
189
|
+
const [, currentRow] = tableNode;
|
190
|
+
const path = action === "after" ? Path.next(currentRow) : currentRow;
|
191
|
+
Transforms.insertNodes(this.editor, createRow(Array(table.columns).fill("")), {
|
251
192
|
at: path
|
252
193
|
});
|
253
194
|
Transforms.setNodes(this.editor, {
|
@@ -258,23 +199,6 @@ export class TableUtil {
|
|
258
199
|
}
|
259
200
|
}
|
260
201
|
};
|
261
|
-
clearRow = () => {
|
262
|
-
const {
|
263
|
-
selection
|
264
|
-
} = this.editor;
|
265
|
-
if (!!selection && Range.isCollapsed(selection)) {
|
266
|
-
const [tableRow] = Editor.nodes(this.editor, {
|
267
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
|
268
|
-
});
|
269
|
-
if (tableRow) {
|
270
|
-
const [tableRowNode, tableRowPath] = tableRow;
|
271
|
-
tableRowNode?.children?.forEach((cell, index) => {
|
272
|
-
const currentCellPath = [...tableRowPath, index];
|
273
|
-
clearCellText(this.editor, currentCellPath);
|
274
|
-
});
|
275
|
-
}
|
276
|
-
}
|
277
|
-
};
|
278
202
|
deleteRow = () => {
|
279
203
|
try {
|
280
204
|
const {
|
@@ -335,58 +259,6 @@ export class TableUtil {
|
|
335
259
|
}
|
336
260
|
}
|
337
261
|
};
|
338
|
-
duplicateColumn = () => {
|
339
|
-
const {
|
340
|
-
selection
|
341
|
-
} = this.editor;
|
342
|
-
if (!!selection && Range.isCollapsed(selection)) {
|
343
|
-
const [tableNode] = Editor.nodes(this.editor, {
|
344
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
|
345
|
-
});
|
346
|
-
if (tableNode) {
|
347
|
-
const [[table, tablePath]] = Editor.nodes(this.editor, {
|
348
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
349
|
-
});
|
350
|
-
const [, currentCell] = tableNode;
|
351
|
-
const currentCellPath = currentCell;
|
352
|
-
const insertNextCellPath = Path.next(currentCell);
|
353
|
-
for (let row = 0; row < table.rows; row++) {
|
354
|
-
currentCellPath[currentCellPath.length - 2] = row;
|
355
|
-
insertNextCellPath[insertNextCellPath?.length - 2] = row;
|
356
|
-
const cellNode = getNode(this.editor, currentCellPath);
|
357
|
-
Transforms.insertNodes(this.editor, JSON.parse(JSON.stringify(cellNode)), {
|
358
|
-
at: insertNextCellPath
|
359
|
-
});
|
360
|
-
}
|
361
|
-
Transforms.setNodes(this.editor, {
|
362
|
-
columns: table.columns + 1
|
363
|
-
}, {
|
364
|
-
at: tablePath
|
365
|
-
});
|
366
|
-
}
|
367
|
-
}
|
368
|
-
};
|
369
|
-
clearColumn = () => {
|
370
|
-
const {
|
371
|
-
selection
|
372
|
-
} = this.editor;
|
373
|
-
if (!!selection && Range.isCollapsed(selection)) {
|
374
|
-
const [tableNode] = Editor.nodes(this.editor, {
|
375
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
|
376
|
-
});
|
377
|
-
if (tableNode) {
|
378
|
-
const [[table]] = Editor.nodes(this.editor, {
|
379
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
380
|
-
});
|
381
|
-
const [, currentCell] = tableNode;
|
382
|
-
const currentCellPath = currentCell;
|
383
|
-
for (let row = 0; row < table.rows; row++) {
|
384
|
-
currentCellPath[currentCellPath.length - 2] = row;
|
385
|
-
clearCellText(this.editor, currentCellPath);
|
386
|
-
}
|
387
|
-
}
|
388
|
-
}
|
389
|
-
};
|
390
262
|
deleteColumn = () => {
|
391
263
|
try {
|
392
264
|
const {
|
@@ -454,7 +326,6 @@ export class TableUtil {
|
|
454
326
|
}, {
|
455
327
|
at: currentCellPath
|
456
328
|
});
|
457
|
-
applyColumnStyle(this.editor, currentCellPath, currentTablePath, cellProps, tableProps?.rows);
|
458
329
|
|
459
330
|
// cell bg entire
|
460
331
|
if (cellProps?.entireBgColor || tableProps?.borderColor || rowProps?.borderColor) {
|
@@ -492,14 +363,6 @@ export class TableUtil {
|
|
492
363
|
console.log(err);
|
493
364
|
}
|
494
365
|
};
|
495
|
-
resizeTableCell = (styleProps, path) => {
|
496
|
-
const cellProps = parseByPrefixKey(styleProps, "col.");
|
497
|
-
Transforms.setNodes(this.editor, {
|
498
|
-
...cellProps
|
499
|
-
}, {
|
500
|
-
at: path
|
501
|
-
});
|
502
|
-
};
|
503
366
|
getTableProps = () => {
|
504
367
|
const {
|
505
368
|
selection
|
@@ -622,14 +485,14 @@ export class TableUtil {
|
|
622
485
|
}
|
623
486
|
};
|
624
487
|
}
|
625
|
-
const createRow =
|
626
|
-
const newRow = Array.from(cellText, value => createTableCell(value
|
488
|
+
const createRow = cellText => {
|
489
|
+
const newRow = Array.from(cellText, value => createTableCell(value));
|
627
490
|
return {
|
628
491
|
type: "table-row",
|
629
492
|
children: newRow
|
630
493
|
};
|
631
494
|
};
|
632
|
-
export const createTableCell =
|
495
|
+
export const createTableCell = text => {
|
633
496
|
return {
|
634
497
|
type: "table-cell",
|
635
498
|
children: [{
|
@@ -637,35 +500,7 @@ export const createTableCell = (text, other = {}) => {
|
|
637
500
|
children: [{
|
638
501
|
text
|
639
502
|
}]
|
640
|
-
}]
|
641
|
-
size: {
|
642
|
-
width: 120
|
643
|
-
},
|
644
|
-
...other
|
645
|
-
};
|
646
|
-
};
|
647
|
-
const createRowOnInsertAbove = (currentRow, currRowPath, editor) => {
|
648
|
-
const isFirstRow = currRowPath[currRowPath?.length - 1] === 0;
|
649
|
-
const rowChild = currentRow?.children?.map((cell, i) => {
|
650
|
-
let other = {};
|
651
|
-
|
652
|
-
// remove the current row's size and add it on the currently inserting cell
|
653
|
-
if (isFirstRow) {
|
654
|
-
const cellPath = [...currRowPath, i];
|
655
|
-
Transforms.setNodes(editor, {
|
656
|
-
size: null
|
657
|
-
}, {
|
658
|
-
at: cellPath
|
659
|
-
});
|
660
|
-
other = {
|
661
|
-
size: cell?.size
|
662
|
-
};
|
663
|
-
}
|
664
|
-
return createTableCell("", other);
|
665
|
-
});
|
666
|
-
return {
|
667
|
-
type: "table-row",
|
668
|
-
children: rowChild
|
503
|
+
}]
|
669
504
|
};
|
670
505
|
};
|
671
506
|
|
@@ -714,43 +549,4 @@ const createTableNode = (cellText, rows, columns) => {
|
|
714
549
|
columns
|
715
550
|
};
|
716
551
|
return tableNode;
|
717
|
-
};
|
718
|
-
const columnStyleKeys = ["entireBgColor", "entireBorderColor", "entireTextColor", "entireFontFamily", "entireFontWeight", "entireTextSize"];
|
719
|
-
const applyColumnStyle = (editor, currentCellPath, currentTablePath, cellProps, rows) => {
|
720
|
-
const colStyle = columnStyleKeys.reduce((acc, key) => {
|
721
|
-
const style = cellProps[key];
|
722
|
-
if (style) {
|
723
|
-
acc[key] = style;
|
724
|
-
}
|
725
|
-
return acc;
|
726
|
-
}, {});
|
727
|
-
for (let r = 0; r < rows; r++) {
|
728
|
-
const cellPosition = currentCellPath[currentCellPath?.length - 1]; // cell position on each row as per selected column cell
|
729
|
-
|
730
|
-
Transforms.setNodes(editor, colStyle, {
|
731
|
-
at: [...currentTablePath, r, cellPosition]
|
732
|
-
});
|
733
|
-
}
|
734
|
-
};
|
735
|
-
export const clearCellText = (editor, currentCellPath) => {
|
736
|
-
try {
|
737
|
-
const existingCellNode = getNode(editor, currentCellPath);
|
738
|
-
Transforms.removeNodes(editor, {
|
739
|
-
at: currentCellPath
|
740
|
-
});
|
741
|
-
Transforms.insertNodes(editor, {
|
742
|
-
...(existingCellNode || {}),
|
743
|
-
children: [{
|
744
|
-
type: "paragraph",
|
745
|
-
children: [{
|
746
|
-
text: ""
|
747
|
-
}],
|
748
|
-
cellBgColor: "#FFFFFF"
|
749
|
-
}]
|
750
|
-
}, {
|
751
|
-
at: currentCellPath
|
752
|
-
});
|
753
|
-
} catch (err) {
|
754
|
-
console.log(err);
|
755
|
-
}
|
756
552
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flozy/editor",
|
3
|
-
"version": "5.5.
|
3
|
+
"version": "5.5.8",
|
4
4
|
"description": "An Editor for flozy app brain",
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -68,7 +68,7 @@
|
|
68
68
|
"storybook": "storybook dev -p 6006",
|
69
69
|
"build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
|
70
70
|
"publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
|
71
|
-
"publish:local": "rm -rf /Users/
|
71
|
+
"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"
|
72
72
|
},
|
73
73
|
"eslintConfig": {
|
74
74
|
"extends": [
|
@@ -1,124 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { Node, Path, Transforms } from "slate";
|
3
|
-
import { ReactEditor, useSlateStatic } from "slate-react";
|
4
|
-
import { Box, useTheme } from "@mui/material";
|
5
|
-
import { DataViewProvider } from "./Providers/DataViewProvider";
|
6
|
-
import useDataViewStyles from "./styles";
|
7
|
-
import LayoutView from "./Layouts";
|
8
|
-
import FilterView from "./Layouts/FilterView";
|
9
|
-
import { insertLineBreakAtEndOfPath } from "../../utils/helper";
|
10
|
-
import { useEditorContext } from "../../hooks/useMouseMove";
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
13
|
-
const DataView = props => {
|
14
|
-
const {
|
15
|
-
theme: appTheme
|
16
|
-
} = useEditorContext();
|
17
|
-
const theme = useTheme();
|
18
|
-
const editor = useSlateStatic();
|
19
|
-
const {
|
20
|
-
attributes,
|
21
|
-
children,
|
22
|
-
element,
|
23
|
-
customProps
|
24
|
-
} = props;
|
25
|
-
const {
|
26
|
-
CHARACTERS,
|
27
|
-
readOnly
|
28
|
-
} = customProps || {};
|
29
|
-
const {
|
30
|
-
properties,
|
31
|
-
layouts,
|
32
|
-
rows,
|
33
|
-
title
|
34
|
-
} = element;
|
35
|
-
const classes = useDataViewStyles(theme, appTheme);
|
36
|
-
const path = ReactEditor.findPath(editor, element);
|
37
|
-
const users = CHARACTERS?.map(m => {
|
38
|
-
const name = [m?.first_name || "", m?.last_name || ""]?.join(" ").trim();
|
39
|
-
return {
|
40
|
-
value: m?.email,
|
41
|
-
label: name || m?.username || m?.email,
|
42
|
-
avatar: m?.avatar || null
|
43
|
-
};
|
44
|
-
});
|
45
|
-
const onDuplicate = () => {
|
46
|
-
try {
|
47
|
-
const newPath = ReactEditor.findPath(editor, element);
|
48
|
-
const dataViewNode = Node.get(editor, newPath);
|
49
|
-
const cloneNode = JSON.parse(JSON.stringify(dataViewNode));
|
50
|
-
const toPath = Path.next(Path.parent(newPath));
|
51
|
-
Transforms.insertNodes(editor, [{
|
52
|
-
type: "paragraph",
|
53
|
-
children: [{
|
54
|
-
...cloneNode
|
55
|
-
}]
|
56
|
-
}], {
|
57
|
-
at: toPath
|
58
|
-
});
|
59
|
-
} catch (err) {
|
60
|
-
console.log(err);
|
61
|
-
}
|
62
|
-
};
|
63
|
-
const onDelete = () => {
|
64
|
-
try {
|
65
|
-
const newPath = ReactEditor.findPath(editor, element);
|
66
|
-
Transforms.removeNodes(editor, {
|
67
|
-
at: newPath
|
68
|
-
});
|
69
|
-
} catch (err) {
|
70
|
-
console.log(err);
|
71
|
-
}
|
72
|
-
};
|
73
|
-
const onEnter = () => {
|
74
|
-
try {
|
75
|
-
const newPath = ReactEditor.findPath(editor, element);
|
76
|
-
const toPath = Path.previous(Path.parent(newPath));
|
77
|
-
insertLineBreakAtEndOfPath(editor, toPath);
|
78
|
-
} catch (err) {
|
79
|
-
console.log(err);
|
80
|
-
}
|
81
|
-
};
|
82
|
-
const onTitleChange = value => {
|
83
|
-
try {
|
84
|
-
Transforms.setNodes(editor, {
|
85
|
-
title: value
|
86
|
-
}, {
|
87
|
-
at: path
|
88
|
-
});
|
89
|
-
} catch (err) {
|
90
|
-
console.log(err);
|
91
|
-
}
|
92
|
-
};
|
93
|
-
return /*#__PURE__*/_jsx(Box, {
|
94
|
-
...attributes,
|
95
|
-
className: "fe-dataview",
|
96
|
-
sx: classes.root,
|
97
|
-
contentEditable: false,
|
98
|
-
"data-title": title,
|
99
|
-
children: /*#__PURE__*/_jsxs(DataViewProvider, {
|
100
|
-
data: {
|
101
|
-
properties,
|
102
|
-
layouts,
|
103
|
-
rows
|
104
|
-
},
|
105
|
-
path: path,
|
106
|
-
editor: editor,
|
107
|
-
title: title,
|
108
|
-
users: users,
|
109
|
-
children: [/*#__PURE__*/_jsx(FilterView, {
|
110
|
-
classes: classes,
|
111
|
-
onEnter: onEnter,
|
112
|
-
onDelete: onDelete,
|
113
|
-
onDuplicate: onDuplicate,
|
114
|
-
readOnly: readOnly,
|
115
|
-
title: title,
|
116
|
-
onTitleChange: onTitleChange
|
117
|
-
}), /*#__PURE__*/_jsx(LayoutView, {
|
118
|
-
readOnly: readOnly,
|
119
|
-
children: children
|
120
|
-
})]
|
121
|
-
})
|
122
|
-
});
|
123
|
-
};
|
124
|
-
export default DataView;
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import ToolbarIcon from "../../common/ToolbarIcon";
|
3
|
-
import Icon from "../../common/Icon";
|
4
|
-
import { insertDataView } from "../../utils/dataView";
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
-
const DataViewButton = props => {
|
7
|
-
const {
|
8
|
-
editor,
|
9
|
-
icoBtnType
|
10
|
-
} = props;
|
11
|
-
const onClick = () => {
|
12
|
-
insertDataView(editor);
|
13
|
-
};
|
14
|
-
return /*#__PURE__*/_jsx(ToolbarIcon, {
|
15
|
-
title: "Dynamic Table",
|
16
|
-
onClick: onClick,
|
17
|
-
icon: /*#__PURE__*/_jsx(Icon, {
|
18
|
-
icon: "dataView"
|
19
|
-
}),
|
20
|
-
icoBtnType: icoBtnType
|
21
|
-
});
|
22
|
-
};
|
23
|
-
export default DataViewButton;
|
@@ -1,83 +0,0 @@
|
|
1
|
-
import React, { useEffect, useRef, useState } from "react";
|
2
|
-
import { Box, Checkbox, Popper, useTheme } from "@mui/material";
|
3
|
-
import DataTypes from "./DataTypes";
|
4
|
-
import useColumnStyles from "./colStyles";
|
5
|
-
import Icon from "../../../common/Icon";
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
-
const ColumnView = props => {
|
9
|
-
const theme = useTheme();
|
10
|
-
const {
|
11
|
-
needAnchor,
|
12
|
-
rowIndex,
|
13
|
-
row,
|
14
|
-
property,
|
15
|
-
onSelect,
|
16
|
-
selected,
|
17
|
-
readOnly
|
18
|
-
} = props;
|
19
|
-
const DataType = DataTypes[property?.type] || DataTypes["text"];
|
20
|
-
const anchorRef = useRef(null);
|
21
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
22
|
-
const [popperRefresh, setPopperRefresh] = useState(new Date().getTime());
|
23
|
-
const open = Boolean(anchorEl);
|
24
|
-
const classes = useColumnStyles(theme);
|
25
|
-
const parentRef = useRef(null);
|
26
|
-
useEffect(() => {
|
27
|
-
if (!anchorRef?.current) return;
|
28
|
-
setAnchorEl(anchorRef?.current);
|
29
|
-
parentRef.current = anchorRef?.current.closest(".tv-d-wrapper");
|
30
|
-
const resizeObserver = new ResizeObserver(() => {
|
31
|
-
if (parentRef?.current) {
|
32
|
-
setPopperRefresh(new Date().getTime());
|
33
|
-
}
|
34
|
-
});
|
35
|
-
resizeObserver.observe(parentRef.current);
|
36
|
-
return () => {
|
37
|
-
resizeObserver.disconnect();
|
38
|
-
};
|
39
|
-
}, [anchorRef?.current]);
|
40
|
-
const handleSelect = id => e => {
|
41
|
-
onSelect(id, e.target.checked);
|
42
|
-
};
|
43
|
-
return /*#__PURE__*/_jsxs(Box, {
|
44
|
-
component: "td",
|
45
|
-
children: [needAnchor ? /*#__PURE__*/_jsx("span", {
|
46
|
-
ref: anchorRef,
|
47
|
-
style: {
|
48
|
-
position: "absolute",
|
49
|
-
width: "1px"
|
50
|
-
}
|
51
|
-
}) : null, /*#__PURE__*/_jsx(DataType, {
|
52
|
-
options: property?.options,
|
53
|
-
property: property?.key,
|
54
|
-
value: row[property?.key] || "",
|
55
|
-
rowIndex: rowIndex,
|
56
|
-
label: property?.label,
|
57
|
-
readOnly: readOnly
|
58
|
-
}), needAnchor && !readOnly ? /*#__PURE__*/_jsx(Popper, {
|
59
|
-
sx: classes.root,
|
60
|
-
open: open,
|
61
|
-
anchorEl: anchorEl,
|
62
|
-
placement: "left",
|
63
|
-
className: `tv-tr-pop ${selected ? "active" : ""}`,
|
64
|
-
disablePortal: true,
|
65
|
-
children: /*#__PURE__*/_jsx(Checkbox, {
|
66
|
-
onClick: handleSelect(row?.id),
|
67
|
-
size: "small",
|
68
|
-
className: "tv-ck-box",
|
69
|
-
sx: {
|
70
|
-
mr: 0
|
71
|
-
},
|
72
|
-
checked: selected,
|
73
|
-
icon: /*#__PURE__*/_jsx(Icon, {
|
74
|
-
icon: "uncheckedIcon"
|
75
|
-
}),
|
76
|
-
checkedIcon: /*#__PURE__*/_jsx(Icon, {
|
77
|
-
icon: "checkedIcon"
|
78
|
-
})
|
79
|
-
})
|
80
|
-
}, popperRefresh) : null]
|
81
|
-
});
|
82
|
-
};
|
83
|
-
export default ColumnView;
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { useDataView } from "../../Providers/DataViewProvider";
|
3
|
-
import Checkbox from "@mui/material/Checkbox";
|
4
|
-
import Icon from "../../../../common/Icon";
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
-
const CheckType = props => {
|
7
|
-
const {
|
8
|
-
rowIndex,
|
9
|
-
property,
|
10
|
-
value,
|
11
|
-
readOnly
|
12
|
-
} = props;
|
13
|
-
const {
|
14
|
-
onChange
|
15
|
-
} = useDataView();
|
16
|
-
const handleChange = e => {
|
17
|
-
onChange(rowIndex, {
|
18
|
-
[property]: e?.target?.checked
|
19
|
-
});
|
20
|
-
};
|
21
|
-
return /*#__PURE__*/_jsx(Checkbox, {
|
22
|
-
checked: value || false,
|
23
|
-
icon: /*#__PURE__*/_jsx(Icon, {
|
24
|
-
icon: "checkListButton"
|
25
|
-
}),
|
26
|
-
checkedIcon: /*#__PURE__*/_jsx(Icon, {
|
27
|
-
icon: "checkListButtonActive"
|
28
|
-
}),
|
29
|
-
onChange: handleChange,
|
30
|
-
disabled: readOnly
|
31
|
-
}, rowIndex);
|
32
|
-
};
|
33
|
-
export default CheckType;
|