@flozy/editor 5.1.3 → 5.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +34 -25
- package/dist/Editor/CommonEditor.js +7 -13
- package/dist/Editor/Editor.css +10 -52
- package/dist/Editor/Elements/AI/AIInput.js +1 -0
- package/dist/Editor/Elements/AI/CustomSelect.js +10 -17
- package/dist/Editor/Elements/AI/Styles.js +1 -7
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +5 -7
- package/dist/Editor/Elements/Color Picker/Styles.js +3 -7
- package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
- package/dist/Editor/Elements/Form/Form.js +2 -38
- 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/FreeGrid/FreeGrid.js +1 -1
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -20
- package/dist/Editor/Elements/Grid/GridButton.js +1 -2
- package/dist/Editor/Elements/Link/LinkButton.js +1 -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 +48 -13
- package/dist/Editor/Elements/SimpleText/index.js +1 -8
- package/dist/Editor/Elements/SimpleText/style.js +1 -8
- package/dist/Editor/Elements/Table/Styles.js +43 -25
- package/dist/Editor/Elements/Table/Table.js +138 -206
- package/dist/Editor/Elements/Table/TableCell.js +102 -355
- package/dist/Editor/Elements/Table/TablePopup.js +3 -9
- package/dist/Editor/Elements/Table/TableRow.js +2 -10
- package/dist/Editor/Styles/EditorStyles.js +1 -3
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +0 -10
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +11 -7
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -10
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +0 -3
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +2 -0
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +6 -3
- package/dist/Editor/Toolbar/Mini/Styles.js +1 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -3
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +11 -16
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +49 -416
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +8 -62
- package/dist/Editor/Toolbar/PopupTool/index.js +6 -5
- 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/common/ColorPickerButton.js +2 -3
- package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
- package/dist/Editor/common/Icon.js +23 -24
- 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 +3 -151
- 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/SwitchViewport/SwitchViewport.js +2 -14
- package/dist/Editor/common/Shorthands/elements.js +1 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +2 -5
- package/dist/Editor/common/StyleBuilder/formStyle.js +149 -268
- package/dist/Editor/common/StyleBuilder/index.js +11 -84
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
- package/dist/Editor/common/StyleBuilder/tableStyle.js +25 -69
- package/dist/Editor/common/Uploader.js +0 -8
- package/dist/Editor/common/iconListV2.js +40 -378
- package/dist/Editor/common/iconslist.js +5 -8
- package/dist/Editor/commonStyle.js +9 -117
- package/dist/Editor/helper/deserialize/index.js +1 -4
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +1 -24
- package/dist/Editor/hooks/useMouseMove.js +2 -5
- package/dist/Editor/plugins/withCustomDeleteBackward.js +2 -3
- package/dist/Editor/plugins/withHTML.js +1 -17
- package/dist/Editor/plugins/withLayout.js +1 -48
- package/dist/Editor/utils/SlateUtilityFunctions.js +0 -18
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +0 -21
- 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 +1 -34
- 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 +1 -1
- package/dist/Editor/Elements/DataView/DataView.js +0 -101
- package/dist/Editor/Elements/DataView/DataViewButton.js +0 -23
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +0 -59
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +0 -30
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +0 -140
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +0 -40
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +0 -59
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +0 -26
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +0 -38
- 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 -74
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +0 -64
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +0 -106
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -174
- 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 -37
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +0 -111
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +0 -62
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +0 -36
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +0 -101
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +0 -160
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +0 -190
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +0 -42
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +0 -30
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -110
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +0 -179
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +0 -100
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +0 -227
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +0 -70
- package/dist/Editor/Elements/DataView/Layouts/index.js +0 -25
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +0 -288
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +0 -15
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +0 -72
- package/dist/Editor/Elements/DataView/styles.js +0 -143
- package/dist/Editor/Elements/Table/AddRowCol.js +0 -77
- package/dist/Editor/Elements/Table/DragButton.js +0 -141
- package/dist/Editor/Elements/Table/DragStyles.js +0 -69
- 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/TableIcons.js +0 -220
- 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/hooks/useTable.js +0 -175
- package/dist/Editor/utils/dataView.js +0 -43
@@ -1,20 +0,0 @@
|
|
1
|
-
import { Select as Core } from "@mui/material";
|
2
|
-
import SelectStyles from "./styles";
|
3
|
-
import { useEditorContext } from "../../hooks/useMouseMove";
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
-
function Select(props) {
|
6
|
-
const {
|
7
|
-
children,
|
8
|
-
...rest
|
9
|
-
} = props;
|
10
|
-
const {
|
11
|
-
theme
|
12
|
-
} = useEditorContext();
|
13
|
-
const classes = SelectStyles(theme);
|
14
|
-
return /*#__PURE__*/_jsx(Core, {
|
15
|
-
MenuProps: classes.MenuProps,
|
16
|
-
...rest,
|
17
|
-
children: children
|
18
|
-
});
|
19
|
-
}
|
20
|
-
export default Select;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
const SelectStyles = (theme = {}) => {
|
2
|
-
const {
|
3
|
-
textColor,
|
4
|
-
background
|
5
|
-
} = theme?.palette?.editor || {};
|
6
|
-
return {
|
7
|
-
MenuProps: {
|
8
|
-
PaperProps: {
|
9
|
-
sx: {
|
10
|
-
color: textColor,
|
11
|
-
background
|
12
|
-
}
|
13
|
-
}
|
14
|
-
}
|
15
|
-
};
|
16
|
-
};
|
17
|
-
export default SelectStyles;
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Grid, Slider, Typography, Box } from "@mui/material";
|
3
|
-
import { getBreakPointsValue } from "../../../helper/theme";
|
4
|
-
import useWindowResize from "../../../hooks/useWindowResize";
|
5
|
-
import { useEditorContext } from "../../../hooks/useMouseMove";
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
-
const LineSpacing = props => {
|
9
|
-
const {
|
10
|
-
value: val,
|
11
|
-
data,
|
12
|
-
onChange
|
13
|
-
} = props;
|
14
|
-
const {
|
15
|
-
theme
|
16
|
-
} = useEditorContext();
|
17
|
-
const {
|
18
|
-
key
|
19
|
-
} = data;
|
20
|
-
const [size] = useWindowResize();
|
21
|
-
const pro_value = getBreakPointsValue(val, size?.device);
|
22
|
-
const [value, setValue] = useState(pro_value);
|
23
|
-
let breakpointValue = getBreakPointsValue(val, null);
|
24
|
-
breakpointValue = typeof breakpointValue['lg'] === 'object' ? breakpointValue['lg'] : breakpointValue;
|
25
|
-
useState(() => {
|
26
|
-
setValue(pro_value);
|
27
|
-
}, [pro_value]);
|
28
|
-
const handleChange = e => {
|
29
|
-
onChange({
|
30
|
-
[key]: {
|
31
|
-
...breakpointValue,
|
32
|
-
[size?.device]: e.target.value
|
33
|
-
}
|
34
|
-
});
|
35
|
-
};
|
36
|
-
return /*#__PURE__*/_jsxs(Grid, {
|
37
|
-
item: true,
|
38
|
-
xs: 12,
|
39
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
40
|
-
variant: "body1",
|
41
|
-
color: "primary",
|
42
|
-
style: {
|
43
|
-
fontSize: "14px",
|
44
|
-
fontWeight: 500
|
45
|
-
},
|
46
|
-
children: data?.label
|
47
|
-
}), /*#__PURE__*/_jsxs(Grid, {
|
48
|
-
container: true,
|
49
|
-
wrap: "nowrap",
|
50
|
-
className: "sld-wrpr",
|
51
|
-
children: [/*#__PURE__*/_jsx(Slider, {
|
52
|
-
className: "spacingSlider",
|
53
|
-
defaultValue: value || 1.43,
|
54
|
-
"aria-label": "Default",
|
55
|
-
valueLabelDisplay: "auto",
|
56
|
-
min: 0.5,
|
57
|
-
max: 3.0,
|
58
|
-
step: 0.1,
|
59
|
-
name: "lineHeight",
|
60
|
-
onChange: handleChange
|
61
|
-
}), /*#__PURE__*/_jsx(Box, {
|
62
|
-
component: "input",
|
63
|
-
sx: {
|
64
|
-
background: theme?.palette?.editor?.background,
|
65
|
-
color: theme?.palette?.editor?.textColor
|
66
|
-
},
|
67
|
-
name: "lineHeight",
|
68
|
-
value: pro_value,
|
69
|
-
className: "sliderInput",
|
70
|
-
onChange: handleChange,
|
71
|
-
type: "number",
|
72
|
-
placeholder: "0",
|
73
|
-
disabled: true,
|
74
|
-
defaultValue: pro_value || 1.43
|
75
|
-
})]
|
76
|
-
})]
|
77
|
-
});
|
78
|
-
};
|
79
|
-
export default LineSpacing;
|
@@ -1,175 +0,0 @@
|
|
1
|
-
import { ClickAwayListener } from "@mui/material";
|
2
|
-
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
3
|
-
import { clearCellText } from "../utils/table";
|
4
|
-
import { Editor, Element, Transforms, Range } from "slate";
|
5
|
-
import { DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
6
|
-
import { encodeToBase64 } from "../utils/helper";
|
7
|
-
import { serializeToText } from "../utils/serializeToText";
|
8
|
-
import { createCopiedTableStructure, getRectangleBounds, tableNodeToDom } from "../Elements/Table/tableHelper";
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
11
|
-
const handleDragEnd = (dragData, editor, resetAll) => {
|
12
|
-
const {
|
13
|
-
active,
|
14
|
-
over
|
15
|
-
} = dragData;
|
16
|
-
if (over) {
|
17
|
-
const {
|
18
|
-
dragType,
|
19
|
-
path: startCellPath
|
20
|
-
} = active?.data?.current || {};
|
21
|
-
const {
|
22
|
-
path: overCellPath
|
23
|
-
} = over?.data?.current || {};
|
24
|
-
if (startCellPath?.length) {
|
25
|
-
if (dragType === "row") {
|
26
|
-
const startRowPath = startCellPath.slice(0, -1);
|
27
|
-
const overRowPath = overCellPath.slice(0, -1);
|
28
|
-
Transforms.moveNodes(editor, {
|
29
|
-
at: startRowPath,
|
30
|
-
to: overRowPath
|
31
|
-
});
|
32
|
-
} else {
|
33
|
-
const [startCol] = startCellPath.slice(-1);
|
34
|
-
const [overCol] = overCellPath.slice(-1);
|
35
|
-
const [tableData] = Editor.nodes(editor, {
|
36
|
-
at: startCellPath,
|
37
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
38
|
-
});
|
39
|
-
const [tableNode, tablePath] = tableData;
|
40
|
-
const rows = tableNode?.rows || 0;
|
41
|
-
for (let row = 0; row < rows; row++) {
|
42
|
-
const startColPath = [...tablePath, row, startCol];
|
43
|
-
const overColPath = [...tablePath, row, overCol];
|
44
|
-
Transforms.moveNodes(editor, {
|
45
|
-
at: startColPath,
|
46
|
-
to: overColPath
|
47
|
-
});
|
48
|
-
}
|
49
|
-
}
|
50
|
-
resetAll();
|
51
|
-
}
|
52
|
-
}
|
53
|
-
};
|
54
|
-
const TableContext = /*#__PURE__*/createContext();
|
55
|
-
export function getDefaultTableSelection() {
|
56
|
-
return {
|
57
|
-
startCellPath: [],
|
58
|
-
endCellPath: [],
|
59
|
-
isDragging: false
|
60
|
-
};
|
61
|
-
}
|
62
|
-
export const TableProvider = ({
|
63
|
-
editor,
|
64
|
-
children,
|
65
|
-
otherProps = {}
|
66
|
-
}) => {
|
67
|
-
const {
|
68
|
-
openSetttings
|
69
|
-
} = otherProps;
|
70
|
-
const [hoverPath, setHoverPath] = useState(null);
|
71
|
-
const [tableSelection, setTableSelection] = useState(getDefaultTableSelection());
|
72
|
-
const [tableResizing, setTableResizing] = useState(null);
|
73
|
-
|
74
|
-
// for the button events (like onclick,...etc) inside draggable component to work correctly
|
75
|
-
const sensors = useSensors(useSensor(PointerSensor, {
|
76
|
-
activationConstraint: {
|
77
|
-
delay: 250,
|
78
|
-
distance: 0 // throws exceeded distance error
|
79
|
-
}
|
80
|
-
}));
|
81
|
-
|
82
|
-
const getSelectedCells = () => {
|
83
|
-
return getRectangleBounds(tableSelection);
|
84
|
-
};
|
85
|
-
const updateTableSelection = update => {
|
86
|
-
setTableSelection(prev => ({
|
87
|
-
...prev,
|
88
|
-
...update
|
89
|
-
}));
|
90
|
-
};
|
91
|
-
const resetAll = () => {
|
92
|
-
setTableSelection(getDefaultTableSelection());
|
93
|
-
Transforms.deselect(editor);
|
94
|
-
|
95
|
-
// hide drag icons after drag completion
|
96
|
-
setTimeout(() => setHoverPath(null), 200);
|
97
|
-
};
|
98
|
-
const values = useMemo(() => {
|
99
|
-
return {
|
100
|
-
hoverPath,
|
101
|
-
setHoverPath,
|
102
|
-
editor,
|
103
|
-
getSelectedCells,
|
104
|
-
updateTableSelection,
|
105
|
-
tableSelection,
|
106
|
-
tableResizing,
|
107
|
-
setTableResizing,
|
108
|
-
otherProps
|
109
|
-
};
|
110
|
-
}, [hoverPath, editor?.selection, tableSelection, tableResizing]);
|
111
|
-
useEffect(() => {
|
112
|
-
const handleKeyDown = event => {
|
113
|
-
if (event.key === "Backspace") {
|
114
|
-
const selectedCells = getSelectedCells();
|
115
|
-
if (selectedCells?.length > 1) {
|
116
|
-
selectedCells.forEach(currentCellPath => {
|
117
|
-
clearCellText(editor, currentCellPath);
|
118
|
-
});
|
119
|
-
}
|
120
|
-
}
|
121
|
-
};
|
122
|
-
const handleCopy = event => {
|
123
|
-
try {
|
124
|
-
const isTextSelected = editor?.selection && !Range.isCollapsed(editor.selection);
|
125
|
-
const customCopy = tableSelection?.startCellPath?.length;
|
126
|
-
if (customCopy && !isTextSelected) {
|
127
|
-
event.preventDefault(); // Prevent default copy behavior
|
128
|
-
|
129
|
-
const {
|
130
|
-
tablePath
|
131
|
-
} = otherProps;
|
132
|
-
const [node] = Editor.node(editor, tablePath);
|
133
|
-
const copiedTableNode = createCopiedTableStructure(editor, tableSelection, node, tablePath);
|
134
|
-
const tableNode = [copiedTableNode];
|
135
|
-
const encodedTableNode = encodeToBase64(tableNode);
|
136
|
-
event.clipboardData.setData("application/x-slate-fragment", encodedTableNode);
|
137
|
-
const textData = serializeToText(tableNode);
|
138
|
-
event.clipboardData.setData("text/plain", textData);
|
139
|
-
const tableDom = tableNodeToDom(copiedTableNode);
|
140
|
-
event.clipboardData.setData("text/html", tableDom?.outerHTML);
|
141
|
-
}
|
142
|
-
} catch (err) {
|
143
|
-
console.log(err);
|
144
|
-
}
|
145
|
-
};
|
146
|
-
window.addEventListener("keydown", handleKeyDown);
|
147
|
-
window.addEventListener("copy", handleCopy);
|
148
|
-
return () => {
|
149
|
-
window.removeEventListener("keydown", handleKeyDown);
|
150
|
-
window.removeEventListener("copy", handleCopy);
|
151
|
-
};
|
152
|
-
}, [tableSelection, editor, tableSelection]);
|
153
|
-
useEffect(() => {
|
154
|
-
if (!openSetttings) {
|
155
|
-
resetAll();
|
156
|
-
}
|
157
|
-
}, [openSetttings]);
|
158
|
-
return /*#__PURE__*/_jsx(TableContext.Provider, {
|
159
|
-
value: values,
|
160
|
-
children: /*#__PURE__*/_jsxs(DndContext, {
|
161
|
-
sensors: sensors,
|
162
|
-
onDragEnd: data => handleDragEnd(data, editor, resetAll),
|
163
|
-
children: [/*#__PURE__*/_jsx(ClickAwayListener, {
|
164
|
-
onClickAway: () => setTableSelection(getDefaultTableSelection()),
|
165
|
-
children: /*#__PURE__*/_jsx("div", {
|
166
|
-
children: children
|
167
|
-
})
|
168
|
-
}), /*#__PURE__*/_jsx(DragOverlay, {})]
|
169
|
-
})
|
170
|
-
});
|
171
|
-
};
|
172
|
-
function useTable() {
|
173
|
-
return useContext(TableContext);
|
174
|
-
}
|
175
|
-
export default useTable;
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import { Transforms } from "slate";
|
2
|
-
const getDefaultDatView = () => ({
|
3
|
-
type: "paragraph",
|
4
|
-
children: [{
|
5
|
-
type: "dataView",
|
6
|
-
title: "",
|
7
|
-
layouts: [{
|
8
|
-
key: "view1",
|
9
|
-
type: "table",
|
10
|
-
label: "Table 1 View",
|
11
|
-
value: "table1",
|
12
|
-
filter: [],
|
13
|
-
sort: []
|
14
|
-
}],
|
15
|
-
properties: [{
|
16
|
-
key: "column1",
|
17
|
-
label: "Task",
|
18
|
-
type: "text",
|
19
|
-
visible: true,
|
20
|
-
default: true
|
21
|
-
}],
|
22
|
-
rows: [{
|
23
|
-
id: new Date().getTime(),
|
24
|
-
column1: ""
|
25
|
-
}],
|
26
|
-
children: [{
|
27
|
-
type: "viewData",
|
28
|
-
children: [{
|
29
|
-
text: ""
|
30
|
-
}]
|
31
|
-
}]
|
32
|
-
}]
|
33
|
-
});
|
34
|
-
export const insertDataView = editor => {
|
35
|
-
try {
|
36
|
-
Transforms.insertNodes(editor, {
|
37
|
-
...getDefaultDatView()
|
38
|
-
});
|
39
|
-
Transforms.move(editor);
|
40
|
-
} catch (err) {
|
41
|
-
console.log(err);
|
42
|
-
}
|
43
|
-
};
|