@flozy/editor 10.6.5 → 10.6.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 +17 -16
- package/dist/Editor/CommonEditor.js +133 -14
- package/dist/Editor/DialogWrapper.js +31 -25
- package/dist/Editor/Editor.css +57 -11
- package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
- package/dist/Editor/Elements/AI/Styles.js +1 -0
- package/dist/Editor/Elements/Accordion/Accordion.js +45 -9
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +1 -23
- package/dist/Editor/Elements/AppHeader/AppHeader.js +10 -5
- package/dist/Editor/Elements/Button/EditorButton.js +26 -10
- package/dist/Editor/Elements/Carousel/CarouselItem.js +2 -1
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
- package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/{MultiSelect.js → SelectV1.js} +125 -69
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +10 -10
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +28 -9
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +12 -5
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +40 -14
- package/dist/Editor/Elements/Divider/Divider.js +1 -1
- package/dist/Editor/Elements/Embed/Embed.css +4 -0
- package/dist/Editor/Elements/Embed/Video.js +1 -1
- package/dist/Editor/Elements/Form/Form.js +3 -3
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +0 -1
- package/dist/Editor/Elements/Form/FormField.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +35 -31
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
- package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -1
- package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +9 -0
- package/dist/Editor/Elements/Grid/Grid.js +14 -2
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/Signature/Signature.css +2 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +18 -5
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +16 -3
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/AddRowCol.js +8 -2
- package/dist/Editor/Elements/Table/DragButton.js +0 -1
- package/dist/Editor/Elements/Table/Draggable.js +6 -2
- package/dist/Editor/Elements/Table/Styles.js +7 -0
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Table/TableCell.js +24 -5
- package/dist/Editor/Elements/Title/title.js +8 -11
- package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
- package/dist/Editor/MiniEditor.js +2 -1
- package/dist/Editor/Styles/EditorStyles.js +4 -4
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +73 -13
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +58 -10
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +12 -5
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/BackIcon.js +18 -0
- package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
- package/dist/Editor/common/Checkbox/index.js +46 -0
- package/dist/Editor/common/Checkbox/styles.js +45 -0
- package/dist/Editor/common/ColorPickerButton.js +41 -16
- package/dist/Editor/common/CustomColorPicker/index.js +130 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog2/index.js +94 -0
- package/dist/Editor/common/CustomDialog2/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +43 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
- package/dist/Editor/common/Icon.js +28 -0
- package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
- package/dist/Editor/common/ImageSelector/Styles.js +3 -9
- package/dist/Editor/common/LinkSettings/NavComponents.js +47 -63
- package/dist/Editor/common/LinkSettings/index.js +17 -28
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
- package/dist/Editor/common/LinkSettings/style.js +164 -244
- package/dist/Editor/common/RadioGroup/index.js +48 -0
- package/dist/Editor/common/RadioGroup/styles.js +29 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +4 -5
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +4 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
- package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -19
- package/dist/Editor/common/RnD/Utils/index.js +58 -25
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +45 -58
- package/dist/Editor/common/RnD/VirtualElement/helper.js +323 -132
- package/dist/Editor/common/RnD/VirtualElement/styles.js +22 -0
- package/dist/Editor/common/RnD/index.js +72 -38
- package/dist/Editor/common/Select/index.js +44 -7
- package/dist/Editor/common/Select/styles.js +30 -2
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +12 -9
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
- package/dist/Editor/common/SwipeableDrawer/style.js +14 -12
- package/dist/Editor/common/Uploader.js +16 -0
- package/dist/Editor/common/iconListV2.js +76 -0
- package/dist/Editor/common/iconslist.js +21 -0
- package/dist/Editor/commonStyle.js +116 -61
- package/dist/Editor/helper/deserialize/index.js +6 -4
- package/dist/Editor/helper/index.js +11 -2
- package/dist/Editor/helper/textIndeces.js +58 -0
- package/dist/Editor/helper/theme.js +203 -2
- package/dist/Editor/hooks/useEditorTheme.js +153 -0
- package/dist/Editor/hooks/useMouseMove.js +9 -3
- package/dist/Editor/hooks/useTable.js +5 -4
- package/dist/Editor/hooks/useThemeValues.js +63 -0
- package/dist/Editor/plugins/withCustomDeleteBackward.js +6 -1
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +14 -5
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +149 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
- package/dist/Editor/themeSettings/buttons/index.js +300 -0
- package/dist/Editor/themeSettings/buttons/style.js +23 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
- package/dist/Editor/themeSettings/fonts/index.js +240 -0
- package/dist/Editor/themeSettings/fonts/style.js +62 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +380 -0
- package/dist/Editor/themeSettings/style.js +299 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +355 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
- package/dist/Editor/themeSettingsAI/style.js +332 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +173 -50
- package/dist/Editor/utils/accordion.js +158 -37
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/customHooks/useTableResize.js +49 -9
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/events.js +18 -6
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/formfield.js +1 -0
- package/dist/Editor/utils/helper.js +149 -30
- package/dist/Editor/utils/insertAppHeader.js +9 -5
- package/dist/Editor/utils/signature.js +2 -9
- package/dist/Editor/utils/updateFormName.js +22 -0
- package/package.json +4 -4
@@ -1,48 +1,169 @@
|
|
1
|
-
import { Transforms } from "slate";
|
1
|
+
import { Editor, Element, Path, Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
import { ALLOWED_TEXT_NODES, getNode, getNodeText, getNodeWithType } from "./helper";
|
4
|
+
import { isMobileWindow } from "../helper";
|
5
|
+
import { removeAccordion } from "./events";
|
6
|
+
import { ReactEditor } from "slate-react";
|
7
|
+
const focusAccordion = (editor, upPath) => {
|
8
|
+
Transforms.select(editor, {
|
9
|
+
path: upPath,
|
10
|
+
offset: 0
|
11
|
+
});
|
12
|
+
};
|
13
|
+
const getAccordionNode = summaryNode => {
|
14
|
+
return {
|
15
|
+
type: "accordion",
|
16
|
+
children: [{
|
17
|
+
type: "accordion-summary",
|
18
|
+
children: summaryNode
|
19
|
+
}, {
|
20
|
+
type: "accordion-details",
|
9
21
|
children: [{
|
10
|
-
type: "
|
22
|
+
type: "paragraph",
|
11
23
|
children: [{
|
12
|
-
|
13
|
-
children: [{
|
14
|
-
text: selectedText || ""
|
15
|
-
}]
|
24
|
+
text: ""
|
16
25
|
}]
|
17
|
-
}
|
18
|
-
|
26
|
+
}]
|
27
|
+
}]
|
28
|
+
};
|
29
|
+
};
|
30
|
+
export const insertAccordion = (editor, path) => {
|
31
|
+
try {
|
32
|
+
const {
|
33
|
+
selection
|
34
|
+
} = editor;
|
35
|
+
let accordionPath;
|
36
|
+
if (path) {
|
37
|
+
const summaryNode = {
|
38
|
+
type: "paragraph",
|
19
39
|
children: [{
|
20
|
-
|
21
|
-
children: [{
|
22
|
-
text: ""
|
23
|
-
}]
|
40
|
+
text: ""
|
24
41
|
}]
|
25
|
-
}
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
};
|
43
|
+
const accordion = getAccordionNode([summaryNode]);
|
44
|
+
Transforms.insertNodes(editor, accordion, {
|
45
|
+
at: path
|
46
|
+
});
|
47
|
+
accordionPath = path;
|
48
|
+
} else if (selection) {
|
49
|
+
const selectedNodes = Array.from(Editor.nodes(editor, {
|
50
|
+
at: selection,
|
51
|
+
match: n => Element.isElement(n),
|
52
|
+
mode: "lowest" // use 'lowest' to get individual blocks
|
53
|
+
}));
|
54
|
+
|
55
|
+
for (const [node, path] of selectedNodes) {
|
56
|
+
let currNode = node;
|
57
|
+
const isListItem = node.type === "list-item";
|
58
|
+
if (isListItem) {
|
59
|
+
currNode = {
|
60
|
+
type: "paragraph",
|
61
|
+
children: node.children
|
62
|
+
};
|
63
|
+
}
|
64
|
+
let accordion = getAccordionNode([currNode]);
|
65
|
+
if (isListItem) {
|
66
|
+
accordion = {
|
67
|
+
type: "list-item",
|
68
|
+
children: [accordion]
|
69
|
+
};
|
70
|
+
}
|
71
|
+
Transforms.removeNodes(editor, {
|
72
|
+
at: path
|
73
|
+
});
|
74
|
+
Transforms.insertNodes(editor, accordion, {
|
75
|
+
at: path
|
76
|
+
});
|
77
|
+
}
|
78
|
+
const lastNode = selectedNodes[selectedNodes.length - 1];
|
79
|
+
const lastNodePath = lastNode[1];
|
80
|
+
accordionPath = lastNodePath;
|
81
|
+
}
|
82
|
+
const focusPath = [...accordionPath, 0, 0, 0];
|
83
|
+
if (isMobileWindow()) {
|
84
|
+
// timeout to resolve focus issue in mobile
|
85
|
+
setTimeout(() => focusAccordion(editor, focusPath), 0);
|
86
|
+
} else {
|
87
|
+
focusAccordion(editor, focusPath);
|
88
|
+
}
|
44
89
|
insertNewLine(editor);
|
45
90
|
} catch (err) {
|
46
91
|
console.log(err);
|
47
92
|
}
|
93
|
+
};
|
94
|
+
export const onDeleteBackwardAccordion = editor => {
|
95
|
+
try {
|
96
|
+
let preventDefault = false;
|
97
|
+
const {
|
98
|
+
selection
|
99
|
+
} = editor;
|
100
|
+
const {
|
101
|
+
path: currentPath,
|
102
|
+
offset
|
103
|
+
} = selection.anchor || {};
|
104
|
+
const isCursorAtStart = offset === 0;
|
105
|
+
if (isCursorAtStart) {
|
106
|
+
// If the cursor is at the start of the accordion-summary and backspace is pressed,
|
107
|
+
// unwrap the accordion by removing both the summary and details,
|
108
|
+
// and insert their contents as regular nodes without the accordion wrapper.
|
109
|
+
const [accordionSummary] = getNodeWithType(editor, "accordion-summary");
|
110
|
+
const [accordionTitle, accordionTitlePath] = accordionSummary || [];
|
111
|
+
if (accordionTitle) {
|
112
|
+
const accordionPath = Path.parent(accordionTitlePath);
|
113
|
+
removeAccordion(editor, accordionPath);
|
114
|
+
preventDefault = true;
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
const parentPath = Path.parent(currentPath);
|
118
|
+
const parentNode = getNode(editor, parentPath);
|
119
|
+
const isTextNode = ALLOWED_TEXT_NODES.includes(parentNode?.type);
|
120
|
+
if (isTextNode) {
|
121
|
+
const prevEntry = Editor.previous(editor, {
|
122
|
+
at: parentPath,
|
123
|
+
match: n => n.type === "accordion"
|
124
|
+
});
|
125
|
+
if (prevEntry) {
|
126
|
+
const [accordionNode, accordionPath] = prevEntry;
|
127
|
+
const dom = ReactEditor.toDOMNode(editor, accordionNode);
|
128
|
+
const aContent = dom.querySelector(".accordion-content");
|
129
|
+
const isContentVisible = aContent.style.display !== "none";
|
130
|
+
if (!isContentVisible) {
|
131
|
+
// If the accordion content is not visible and backspace is pressed,
|
132
|
+
// the content from the current node should be merged with the accordion title,
|
133
|
+
// and the cursor should move to the title.
|
134
|
+
// Otherwise, Slate will by default merge the current node into the hidden details section,
|
135
|
+
// which makes the content invisible.
|
136
|
+
|
137
|
+
let targetPath = [...accordionPath, 0, 0];
|
138
|
+
const targetNodeEntry = getNode(editor, targetPath);
|
139
|
+
if (targetNodeEntry) {
|
140
|
+
const nodeText = getNodeText(parentNode);
|
141
|
+
const endPath = Editor.end(editor, targetPath);
|
142
|
+
|
143
|
+
// Move current paragraph text into the end of the target block
|
144
|
+
Transforms.select(editor, Editor.start(editor, parentPath));
|
145
|
+
Transforms.delete(editor, {
|
146
|
+
at: parentPath
|
147
|
+
});
|
148
|
+
Transforms.insertText(editor, nodeText, {
|
149
|
+
at: endPath
|
150
|
+
});
|
151
|
+
|
152
|
+
// move the focus and cursor to the inserted node
|
153
|
+
Transforms.select(editor, {
|
154
|
+
anchor: endPath,
|
155
|
+
focus: endPath
|
156
|
+
});
|
157
|
+
ReactEditor.focus(editor);
|
158
|
+
preventDefault = true;
|
159
|
+
return;
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
return preventDefault;
|
166
|
+
} catch (err) {
|
167
|
+
console.log(err);
|
168
|
+
}
|
48
169
|
};
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Path, Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
import { windowVar } from "./helper";
|
4
3
|
import { getCurrentElementText } from "../plugins/withHTML";
|
5
4
|
export const insertButton = editor => {
|
6
5
|
const button = {
|
@@ -11,22 +10,7 @@ export const insertButton = editor => {
|
|
11
10
|
buttonLink: {
|
12
11
|
linkType: "webAddress"
|
13
12
|
},
|
14
|
-
iconPosition: "start"
|
15
|
-
bgColor: "#2563EB",
|
16
|
-
textColor: "#FFF",
|
17
|
-
borderRadius: {
|
18
|
-
topLeft: 30,
|
19
|
-
topRight: 30,
|
20
|
-
bottomLeft: 30,
|
21
|
-
bottomRight: 30
|
22
|
-
},
|
23
|
-
bannerSpacing: {
|
24
|
-
left: 16,
|
25
|
-
top: 8,
|
26
|
-
right: 16,
|
27
|
-
bottom: 8
|
28
|
-
},
|
29
|
-
...(windowVar.lastButtonProps || {})
|
13
|
+
iconPosition: "start"
|
30
14
|
};
|
31
15
|
const hasText = getCurrentElementText(editor);
|
32
16
|
const insertPath = hasText ? Path.next(Path.parent(editor?.selection.focus.path)) : editor?.selection.focus.path;
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import { useState } from "react";
|
1
|
+
import { useRef, useState } from "react";
|
2
2
|
const useTableResize = ({
|
3
3
|
parentDOM,
|
4
4
|
size: defaultSize,
|
5
5
|
onDone,
|
6
|
-
minMaxProps = {}
|
6
|
+
minMaxProps = {},
|
7
|
+
isMobile
|
7
8
|
}) => {
|
8
9
|
const {
|
9
10
|
width
|
@@ -18,6 +19,10 @@ const useTableResize = ({
|
|
18
19
|
});
|
19
20
|
const [resizing, setResizing] = useState(false);
|
20
21
|
const [isDone, setIsDone] = useState(0);
|
22
|
+
const lastTouch = useRef({
|
23
|
+
x: 0,
|
24
|
+
y: 0
|
25
|
+
});
|
21
26
|
const onLoad = defaultSize => {
|
22
27
|
setSize({
|
23
28
|
widthInPercent: 100,
|
@@ -25,29 +30,64 @@ const useTableResize = ({
|
|
25
30
|
...defaultSize
|
26
31
|
});
|
27
32
|
};
|
33
|
+
const handleEventListeners = type => {
|
34
|
+
const listener = type === "add" ? document.addEventListener : document.removeEventListener;
|
35
|
+
const onMoveListener = isMobile ? "touchmove" : "pointermove";
|
36
|
+
const onEndListener = isMobile ? "touchend" : "pointerup";
|
37
|
+
listener(onMoveListener, onMouseMove);
|
38
|
+
listener(onEndListener, onMouseUp);
|
39
|
+
};
|
40
|
+
const updateLastTouch = ({
|
41
|
+
clientX,
|
42
|
+
clientY
|
43
|
+
}) => {
|
44
|
+
lastTouch.current.x = clientX;
|
45
|
+
lastTouch.current.y = clientY;
|
46
|
+
};
|
28
47
|
const onMouseDown = e => {
|
29
|
-
|
30
|
-
|
31
|
-
|
48
|
+
if (isMobile) {
|
49
|
+
updateLastTouch(e.touches[0]);
|
50
|
+
} else {
|
51
|
+
e.preventDefault();
|
52
|
+
}
|
53
|
+
handleEventListeners("add");
|
32
54
|
setResizing(true);
|
33
55
|
setIsDone(0);
|
34
56
|
};
|
35
57
|
const onMouseUp = () => {
|
36
|
-
|
37
|
-
document.removeEventListener("pointerup", onMouseUp);
|
58
|
+
handleEventListeners("remove");
|
38
59
|
setResizing(false);
|
39
60
|
setIsDone(1);
|
40
61
|
};
|
41
62
|
const onMouseMove = e => {
|
63
|
+
let {
|
64
|
+
movementX,
|
65
|
+
movementY
|
66
|
+
} = e || {};
|
67
|
+
if (e.type === "touchmove") {
|
68
|
+
// for mobile
|
69
|
+
const {
|
70
|
+
x,
|
71
|
+
y
|
72
|
+
} = lastTouch.current || {};
|
73
|
+
const touches = e.touches[0];
|
74
|
+
const {
|
75
|
+
clientX,
|
76
|
+
clientY
|
77
|
+
} = touches;
|
78
|
+
movementX = clientX - x;
|
79
|
+
movementY = clientY - y;
|
80
|
+
updateLastTouch(touches);
|
81
|
+
}
|
42
82
|
const {
|
43
83
|
minWidth
|
44
84
|
} = minMaxProps || {};
|
45
85
|
setSize(currentSize => {
|
46
86
|
const width = currentSize?.width || parentDOM?.clientWidth;
|
47
|
-
const calcWidth = width +
|
87
|
+
const calcWidth = width + movementX;
|
48
88
|
return {
|
49
89
|
width: minWidth && calcWidth < minWidth ? minWidth : calcWidth,
|
50
|
-
height: currentSize.height +
|
90
|
+
height: currentSize.height + movementY,
|
51
91
|
widthInPercent: calcWidth / width * 100
|
52
92
|
};
|
53
93
|
});
|
@@ -82,7 +82,8 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
|
|
82
82
|
};
|
83
83
|
export const draftToSlate = props => {
|
84
84
|
const {
|
85
|
-
data
|
85
|
+
data,
|
86
|
+
needLayout
|
86
87
|
} = props;
|
87
88
|
if (data?.blocks && data?.blocks?.length > 0) {
|
88
89
|
const converted = data?.blocks?.reduce((a, b) => {
|
@@ -104,7 +105,7 @@ export const draftToSlate = props => {
|
|
104
105
|
return data;
|
105
106
|
} else {
|
106
107
|
return [{
|
107
|
-
type: "paragraph",
|
108
|
+
type: needLayout ? "title" : "paragraph",
|
108
109
|
children: [{
|
109
110
|
text: ""
|
110
111
|
}]
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { Editor, Transforms, Element, Node, Path, Range } from "slate";
|
1
|
+
import { Editor, Transforms, Element, Node, Path, Range, Point } from "slate";
|
2
2
|
import { toggleBlock } from "./SlateUtilityFunctions";
|
3
3
|
import insertNewLine from "./insertNewLine";
|
4
4
|
import { insertAccordion } from "./accordion";
|
5
|
-
import { isListItem } from "./helper";
|
5
|
+
import { getNode, isListItem } from "./helper";
|
6
6
|
import RnDCtrlCmds from "./RnD/RnDCtrlCmds";
|
7
7
|
import EDITORCMDS from "../common/EditorCmds";
|
8
8
|
const HOTKEYS = {
|
@@ -183,6 +183,20 @@ const checkListEnterEvent = (editor, type) => {
|
|
183
183
|
insertNewLine(editor);
|
184
184
|
}
|
185
185
|
};
|
186
|
+
export const removeAccordion = (editor, accordionPath) => {
|
187
|
+
const accordion = getNode(editor, accordionPath);
|
188
|
+
Transforms.removeNodes(editor, {
|
189
|
+
at: accordionPath
|
190
|
+
});
|
191
|
+
const insertNodes = [];
|
192
|
+
accordion.children.forEach(a => {
|
193
|
+
a.children.forEach(n => insertNodes.push(n));
|
194
|
+
});
|
195
|
+
Transforms.insertNodes(editor, insertNodes, {
|
196
|
+
at: accordionPath,
|
197
|
+
select: true
|
198
|
+
});
|
199
|
+
};
|
186
200
|
export const enterEvent = (e, editor, isMobile) => {
|
187
201
|
try {
|
188
202
|
const ele = isListItem(editor);
|
@@ -225,9 +239,7 @@ export const enterEvent = (e, editor, isMobile) => {
|
|
225
239
|
e.preventDefault();
|
226
240
|
if (!text) {
|
227
241
|
const accordionIndex = ele[1].slice(0, Math.max(ele[1].length - 1));
|
228
|
-
|
229
|
-
at: accordionIndex
|
230
|
-
});
|
242
|
+
removeAccordion(editor, accordionIndex);
|
231
243
|
} else {
|
232
244
|
const nextPath = Path.next(Path.parent(ele[1]));
|
233
245
|
insertAccordion(editor, nextPath);
|
@@ -348,7 +360,7 @@ export const upDownArrowKeyEvents = (e, editor) => {
|
|
348
360
|
}
|
349
361
|
Transforms.move(editor, {
|
350
362
|
distance: 0,
|
351
|
-
unit:
|
363
|
+
unit: "offset",
|
352
364
|
reverse: false
|
353
365
|
});
|
354
366
|
Transforms.select(editor, {
|
@@ -7,43 +7,43 @@ export const sizeMap = {
|
|
7
7
|
export const fontFamilyMap = {
|
8
8
|
PoppinsRegular: "PoppinsRegular",
|
9
9
|
PoppinsBold: "PoppinsBold",
|
10
|
-
sans:
|
11
|
-
serif:
|
12
|
-
monospace:
|
13
|
-
roboto: "
|
14
|
-
qwitcher: "
|
15
|
-
garamond: "
|
16
|
-
anton: "
|
17
|
-
dmserif: "
|
18
|
-
inter: "
|
19
|
-
libre: "
|
20
|
-
montserrat: "
|
21
|
-
opensans: "
|
22
|
-
publicsans: "
|
23
|
-
raleway: "
|
24
|
-
spacemono: "
|
25
|
-
bulgarian: "
|
26
|
-
impact: "
|
27
|
-
redacted: "
|
28
|
-
greatVibes: "
|
29
|
-
zeyada: "
|
30
|
-
allura: "
|
31
|
-
pinyon: "
|
32
|
-
muellerhoff: "
|
33
|
-
dawning: "
|
10
|
+
sans: 'Helvetica, Arial, "sans serif"',
|
11
|
+
serif: 'Georgia, "Times New Roaman", serif',
|
12
|
+
monospace: 'Monaco, "Courier New", monospace',
|
13
|
+
roboto: "Roboto, sans-serif",
|
14
|
+
qwitcher: '"Qwitcher Grypen", cursive',
|
15
|
+
garamond: '"EB Garamond", serif',
|
16
|
+
anton: "Anton, sans-serif",
|
17
|
+
dmserif: '"DM Serif Text", serif',
|
18
|
+
inter: "Inter, sans-serif",
|
19
|
+
libre: '"Libre Baskerville", serif',
|
20
|
+
montserrat: "Montserrat, sans-serif",
|
21
|
+
opensans: '"Open Sans", sans-serif',
|
22
|
+
publicsans: '"Public Sans", sans-serif',
|
23
|
+
raleway: "Raleway, sans-serif",
|
24
|
+
spacemono: '"Space Mono", sans-serif',
|
25
|
+
bulgarian: '"Bulgarian Garamond", monospace',
|
26
|
+
impact: "Impact, serif",
|
27
|
+
redacted: '"Redacted Script", cursive',
|
28
|
+
greatVibes: '"Great Vibes", cursive',
|
29
|
+
zeyada: "Zeyada, cursive",
|
30
|
+
allura: "Allura, cursive",
|
31
|
+
pinyon: '"Pinyon Script", cursive',
|
32
|
+
muellerhoff: '"Herr Von Muellerhoff", cursive',
|
33
|
+
dawning: '"Dawning of a New Day", cursive',
|
34
34
|
// New Font Added for Type Signature
|
35
|
-
comingsoon: "
|
36
|
-
dancingScript: "
|
37
|
-
engagement: "
|
38
|
-
gaegu: "
|
39
|
-
ingridDarling: "
|
40
|
-
kitaOne: "
|
41
|
-
laBelleAurore: "
|
42
|
-
lobster: "
|
43
|
-
meaCulpa: "
|
44
|
-
meddon: "
|
45
|
-
merriWeather: "
|
46
|
-
theGirlNextDoor: "
|
35
|
+
comingsoon: '"Coming Soon", cursive',
|
36
|
+
dancingScript: '"Dancing Script", cursive',
|
37
|
+
engagement: "Engagement, cursive",
|
38
|
+
gaegu: "Gaegu, cursive",
|
39
|
+
ingridDarling: '"Ingrid Darling", cursive',
|
40
|
+
kitaOne: "Times",
|
41
|
+
laBelleAurore: '"La Belle Aurore", cursive',
|
42
|
+
lobster: "Lobster, cursive",
|
43
|
+
meaCulpa: '"Mea Culpa", cursive',
|
44
|
+
meddon: "Meddon, cursive",
|
45
|
+
merriWeather: "Merriweather, serif",
|
46
|
+
theGirlNextDoor: '"The Girl Next Door", cursive'
|
47
47
|
};
|
48
48
|
export const fontOptions = Object.keys(fontFamilyMap).map(m => {
|
49
49
|
return {
|
@@ -62,7 +62,10 @@ export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
|
|
62
62
|
export const headingMap = {
|
63
63
|
headingOne: "32px",
|
64
64
|
headingTwo: "24px",
|
65
|
-
headingThree: "19px"
|
65
|
+
headingThree: "19px",
|
66
|
+
headingFour: "16px",
|
67
|
+
headingFive: "13px",
|
68
|
+
headingSix: "11px"
|
66
69
|
};
|
67
70
|
export const fontWeightOptions = [{
|
68
71
|
text: "Bold",
|