@flozy/editor 4.5.8 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +8 -0
- package/dist/Editor/CommonEditor.js +16 -15
- package/dist/Editor/Editor.css +19 -1
- package/dist/Editor/Elements/AI/AIInput.js +4 -5
- package/dist/Editor/Elements/AI/PopoverAIInput.js +40 -29
- package/dist/Editor/Elements/AI/Styles.js +1 -1
- package/dist/Editor/Elements/Button/EditorButton.js +8 -4
- package/dist/Editor/Elements/Embed/Embed.css +1 -1
- package/dist/Editor/Elements/Embed/Image.js +4 -3
- package/dist/Editor/Elements/Embed/Video.js +9 -7
- package/dist/Editor/Elements/Form/Form.js +0 -1
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +30 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +2 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +3 -1
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +4 -0
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +5 -1
- package/dist/Editor/Elements/FreeGrid/styles.js +82 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +24 -7
- package/dist/Editor/Elements/Signature/Signed.js +1 -1
- package/dist/Editor/Elements/SimpleText/index.js +7 -8
- package/dist/Editor/Elements/Table/TableRow.js +1 -1
- package/dist/Editor/Styles/EditorStyles.js +2 -2
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +35 -29
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +35 -30
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -4
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +22 -38
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +0 -1
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -5
- package/dist/Editor/common/FontLoader/FontLoader.js +6 -6
- package/dist/Editor/common/Icon.js +1 -1
- package/dist/Editor/common/LinkSettings/index.js +3 -2
- package/dist/Editor/common/LinkSettings/navOptions.js +4 -1
- package/dist/Editor/common/RnD/DragOver/index.js +0 -1
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +14 -1
- package/dist/Editor/common/RnD/ElementOptions/styles.js +5 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +53 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +32 -2
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +2 -1
- package/dist/Editor/common/RnD/RnDCopy.js +2 -0
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -3
- package/dist/Editor/common/RnD/VirtualElement/index.js +1 -1
- package/dist/Editor/common/RnD/index.js +67 -37
- package/dist/Editor/common/Section/index.js +11 -1
- package/dist/Editor/common/Section/styles.js +16 -0
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +19 -0
- package/dist/Editor/common/iconslist.js +23 -0
- package/dist/Editor/helper/RnD/focusNode.js +74 -0
- package/dist/Editor/helper/index.js +5 -2
- package/dist/Editor/helper/theme.js +2 -2
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/hooks/useDragging.js +51 -0
- package/dist/Editor/hooks/useMouseMove.js +5 -4
- package/dist/Editor/hooks/withCommon.js +1 -0
- package/dist/Editor/hooks/withRestrictedNodes.js +48 -0
- package/dist/Editor/utils/Decorators/highlightSelection.js +16 -0
- package/dist/Editor/utils/Decorators/index.js +3 -2
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +16 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +33 -5
- package/dist/Editor/utils/customHooks/useResize.js +4 -5
- package/dist/Editor/utils/events.js +71 -0
- package/dist/Editor/utils/helper.js +16 -0
- package/package.json +1 -1
@@ -180,6 +180,14 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
180
180
|
});
|
181
181
|
};
|
182
182
|
const handleEditorChange = newValue => {
|
183
|
+
const value_txt = serializeToText(value);
|
184
|
+
if (!value_txt) {
|
185
|
+
const {
|
186
|
+
value: strVal,
|
187
|
+
...restVal
|
188
|
+
} = getOnSaveData(newValue);
|
189
|
+
onSave(strVal, restVal);
|
190
|
+
}
|
183
191
|
setValue(newValue);
|
184
192
|
if (!isInteracted) {
|
185
193
|
setIsInteracted(true);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
2
2
|
import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle } from "react";
|
3
3
|
import PropTypes from "prop-types";
|
4
|
-
import { createEditor,
|
4
|
+
import { createEditor, Range, Transforms } from "slate";
|
5
5
|
import { Slate, Editable, ReactEditor } from "slate-react";
|
6
6
|
import { useDebounce, useDebouncedCallback } from "use-debounce";
|
7
7
|
import { getMarked, getBlock } from "./utils/SlateUtilityFunctions";
|
@@ -10,7 +10,7 @@ import { draftToSlate } from "./utils/draftToSlate";
|
|
10
10
|
import useMentions from "./hooks/useMentions";
|
11
11
|
import MentionsPopup from "./common/MentionsPopup";
|
12
12
|
import { RemoteCursorOverlay } from "./RemoteCursorOverlay/Overlay";
|
13
|
-
import { mentionsEvent, commands, indentation, escapeEvent, enterEvent } from "./utils/events";
|
13
|
+
import { mentionsEvent, commands, indentation, escapeEvent, enterEvent, upDownArrowKeyEvents } from "./utils/events";
|
14
14
|
import withCommon from "./hooks/withCommon";
|
15
15
|
import DialogWrapper from "./DialogWrapper";
|
16
16
|
import { serializeToText } from "./utils/serializeToText";
|
@@ -27,16 +27,16 @@ import DragAndDrop from "./common/DnD";
|
|
27
27
|
import Section from "./common/Section";
|
28
28
|
import decorators from "./utils/Decorators";
|
29
29
|
import { getTRBLBreakPoints } from "./helper/theme";
|
30
|
-
import { handleInsertLastElement, isFreeGridFragment, isPageSettings, outsideEditorClickLabel } from "./utils/helper";
|
30
|
+
import { handleInsertLastElement, isFreeGrid, isFreeGridFragment, isPageSettings, outsideEditorClickLabel } from "./utils/helper";
|
31
31
|
import useWindowResize from "./hooks/useWindowResize";
|
32
32
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
33
33
|
import RnDCopy from "./common/RnD/RnDCopy";
|
34
34
|
import SwitchViewport from "./common/RnD/SwitchViewport/SwitchViewport";
|
35
35
|
import { onInsertFragment } from "./utils/RnD/RnDCtrlCmds";
|
36
|
-
import FontLoader from "./common/FontLoader/FontLoader";
|
37
36
|
import "./font.css";
|
38
37
|
import "./Editor.css";
|
39
38
|
import "animate.css";
|
39
|
+
import FontLoader from "./common/FontLoader/FontLoader";
|
40
40
|
import { jsx as _jsx } from "react/jsx-runtime";
|
41
41
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
42
42
|
const Item = /*#__PURE__*/forwardRef(({
|
@@ -82,7 +82,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
82
82
|
onSave,
|
83
83
|
editor: collaborativeEditor,
|
84
84
|
readOnly,
|
85
|
-
toolbarOptions,
|
86
85
|
otherProps,
|
87
86
|
isIframe,
|
88
87
|
theme,
|
@@ -115,7 +114,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
115
114
|
editorClass,
|
116
115
|
fixedWidth = "60%",
|
117
116
|
fullWidth = "80%",
|
118
|
-
hideTools
|
117
|
+
hideTools = []
|
119
118
|
} = otherProps || {};
|
120
119
|
const editor = useMemo(() => {
|
121
120
|
if (collaborativeEditor) return collaborativeEditor;
|
@@ -288,10 +287,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
288
287
|
index,
|
289
288
|
type
|
290
289
|
} = mentions;
|
291
|
-
const
|
290
|
+
const updatedHideTools = !isFreeGrid(content) ? [...hideTools, "freegrid"] : hideTools;
|
291
|
+
const chars = type && !isFreeGrid(content) ? Shorthands[type]({
|
292
292
|
...mentions,
|
293
293
|
CHARACTERS,
|
294
|
-
hideTools:
|
294
|
+
hideTools: updatedHideTools || []
|
295
295
|
}) : [];
|
296
296
|
const handleEditorChange = newValue => {
|
297
297
|
setValue(newValue);
|
@@ -365,6 +365,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
365
365
|
});
|
366
366
|
} else if (event.key === "Enter") {
|
367
367
|
enterEvent(event, editor, customProps?.isMobile);
|
368
|
+
} else if (event.key === "ArrowUp" && otherProps?.tagName !== "Pages") {
|
369
|
+
upDownArrowKeyEvents(event, editor);
|
370
|
+
} else if (event.key === "ArrowDown" && otherProps?.tagName !== "Pages") {
|
371
|
+
upDownArrowKeyEvents(event, editor);
|
368
372
|
} else if (event.key === "Backspace") {
|
369
373
|
const isPageSettingsNode = isPageSettings(event, editor);
|
370
374
|
if (isPageSettingsNode) {
|
@@ -384,7 +388,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
384
388
|
}
|
385
389
|
}
|
386
390
|
}
|
387
|
-
}, [chars,
|
391
|
+
}, [chars, target, mentions, setMentions, search, type, mentionsRef]);
|
388
392
|
const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
|
389
393
|
const dotBg = needDotsBG ? {
|
390
394
|
background: "white",
|
@@ -447,13 +451,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
447
451
|
const selection = window?.getSelection();
|
448
452
|
if (selection && selection.rangeCount > 0) {
|
449
453
|
const cursorPosition = selection.getRangeAt(0)?.getBoundingClientRect();
|
450
|
-
const
|
451
|
-
const containerBottom = containerRect?.bottom;
|
454
|
+
const containerBottom = container?.getBoundingClientRect()?.bottom;
|
452
455
|
if (cursorPosition && cursorPosition.bottom > containerBottom - 250) {
|
453
|
-
// Calculate dynamic scroll based on remaining space
|
454
|
-
const scrollAmount = Math.min(200, cursorPosition.bottom - containerBottom + 250);
|
455
456
|
container?.scrollBy({
|
456
|
-
top:
|
457
|
+
top: 200,
|
457
458
|
behavior: "smooth"
|
458
459
|
});
|
459
460
|
}
|
@@ -527,7 +528,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
527
528
|
readOnly: isReadOnly,
|
528
529
|
renderElement: renderElement,
|
529
530
|
renderLeaf: renderLeaf,
|
530
|
-
decorate: decorators,
|
531
|
+
decorate: d => decorators(d, editor),
|
531
532
|
onKeyDown: onKeyDown,
|
532
533
|
onSelect: () => handleCursorScroll(editorWrapper.current)
|
533
534
|
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
package/dist/Editor/Editor.css
CHANGED
@@ -234,6 +234,18 @@ blockquote {
|
|
234
234
|
background-color: #0052cc;
|
235
235
|
}
|
236
236
|
|
237
|
+
.signature-btn-container .sign-placeholder {
|
238
|
+
display: none; /* will changed to flex on DnD */
|
239
|
+
flex-direction: column;
|
240
|
+
justify-content: center;
|
241
|
+
align-items: center;
|
242
|
+
border: 1px solid #E4E6E9;
|
243
|
+
border-radius: 10px;
|
244
|
+
background: white;
|
245
|
+
box-shadow: 0px 4px 16px 0px #0000000D;
|
246
|
+
gap: 10px;
|
247
|
+
}
|
248
|
+
|
237
249
|
.signature-btn-grps {
|
238
250
|
display: flex;
|
239
251
|
justify-content: space-around;
|
@@ -244,6 +256,13 @@ blockquote {
|
|
244
256
|
width: 17px !important;
|
245
257
|
}
|
246
258
|
|
259
|
+
.react-datepicker__input-container input {
|
260
|
+
height: 40px !important;
|
261
|
+
border: 1px solid #ccc;
|
262
|
+
border-radius: 5px;
|
263
|
+
width: 100%;
|
264
|
+
}
|
265
|
+
|
247
266
|
.close-popupbtn {
|
248
267
|
border-radius: 4px !important;
|
249
268
|
width: 24px;
|
@@ -884,7 +903,6 @@ blockquote {
|
|
884
903
|
/* For Firefox */
|
885
904
|
.removeScroll {
|
886
905
|
-moz-appearance: textfield;
|
887
|
-
appearance: none;
|
888
906
|
}
|
889
907
|
|
890
908
|
.borderInput:focus-visible {
|
@@ -90,6 +90,7 @@ function AIInput({
|
|
90
90
|
children: [/*#__PURE__*/_jsxs(Box, {
|
91
91
|
component: "div",
|
92
92
|
sx: classes.aiContainer,
|
93
|
+
ref: refs[0],
|
93
94
|
children: [generatedText ? /*#__PURE__*/_jsx(Typography, {
|
94
95
|
sx: classes.generatedText,
|
95
96
|
style: {
|
@@ -104,7 +105,6 @@ function AIInput({
|
|
104
105
|
onSubmit: e => {
|
105
106
|
e.preventDefault();
|
106
107
|
},
|
107
|
-
ref: refs[0],
|
108
108
|
children: [/*#__PURE__*/_jsx("div", {
|
109
109
|
className: "icon-container icons-elements",
|
110
110
|
ref: inputWrapperRef,
|
@@ -116,22 +116,21 @@ function AIInput({
|
|
116
116
|
children: /*#__PURE__*/_jsx(WaveLoading, {})
|
117
117
|
}) : /*#__PURE__*/_jsx(TextareaAutosize, {
|
118
118
|
className: "ai-input",
|
119
|
-
placeholder:
|
119
|
+
placeholder: "Ask AI to write anything...",
|
120
120
|
ref: inputRef,
|
121
121
|
value: inputValue,
|
122
122
|
onChange: onInputChange,
|
123
|
-
disabled: fromToolBar,
|
124
123
|
onKeyDown: event => {
|
125
124
|
if (event.key === "Enter" && !event.shiftKey) {
|
126
125
|
event.preventDefault();
|
127
126
|
handleSendBtnClick();
|
128
127
|
}
|
129
128
|
}
|
130
|
-
}),
|
129
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
131
130
|
component: "div",
|
132
131
|
style: classes.sendIconContainer,
|
133
132
|
className: "icons-elements",
|
134
|
-
children: [
|
133
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
135
134
|
disabled: loading,
|
136
135
|
onClick: () => startRecording(),
|
137
136
|
children: /*#__PURE__*/_jsx(ChatMicIcon, {})
|
@@ -201,6 +201,29 @@ function PopoverAIInput({
|
|
201
201
|
useEffect(() => {
|
202
202
|
selectedEleRef.current = selectedElement;
|
203
203
|
}, [selectedElement]);
|
204
|
+
const framePayload = (type, option) => {
|
205
|
+
let payload = {
|
206
|
+
mode: option.mode || 0,
|
207
|
+
query: option?.inputValue || inputValue
|
208
|
+
};
|
209
|
+
if (option.mode === MODES.translate || option.mode === MODES.rephraseTone) {
|
210
|
+
payload.textOptionInput = type;
|
211
|
+
}
|
212
|
+
const selectedText = getSelectedText(editor);
|
213
|
+
const textData = generatedText || selectedText;
|
214
|
+
if (option.mode) {
|
215
|
+
payload.textData = textData;
|
216
|
+
} else if (selectedText && Number(payload.mode) === 0) {
|
217
|
+
payload.query = `${selectedText} \n ${payload.query}`;
|
218
|
+
}
|
219
|
+
const tryAgain = type === "try_again";
|
220
|
+
if (tryAgain) {
|
221
|
+
// resetting previous payload
|
222
|
+
const prevPayload = selectedOption?.payload || {};
|
223
|
+
payload = prevPayload;
|
224
|
+
}
|
225
|
+
return payload;
|
226
|
+
};
|
204
227
|
const onSend = async (type, option) => {
|
205
228
|
try {
|
206
229
|
if (type === "close") {
|
@@ -232,28 +255,12 @@ function PopoverAIInput({
|
|
232
255
|
onClickOutside();
|
233
256
|
return;
|
234
257
|
}
|
235
|
-
if (type === "speech_to_text") {
|
236
|
-
setGeneratedText(option.text);
|
237
|
-
return;
|
238
|
-
}
|
239
|
-
if (type === "try_again") {
|
240
|
-
// resetting the previous option and try again
|
241
|
-
option = selectedOption;
|
242
|
-
type = selectedOption.value;
|
243
|
-
} else {
|
244
|
-
setSelectedOption(option);
|
245
|
-
}
|
246
258
|
setLoading(true);
|
247
|
-
const payload =
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
payload.textOptionInput = type;
|
253
|
-
}
|
254
|
-
if (option.mode) {
|
255
|
-
payload.textData = generatedText || window.getSelection().toString();
|
256
|
-
}
|
259
|
+
const payload = framePayload(type, option);
|
260
|
+
setSelectedOption({
|
261
|
+
...option,
|
262
|
+
payload
|
263
|
+
});
|
257
264
|
const result = await services("infinityAI", payload);
|
258
265
|
setLoading(false);
|
259
266
|
setInputValue("");
|
@@ -264,15 +271,19 @@ function PopoverAIInput({
|
|
264
271
|
onClickOutside();
|
265
272
|
return;
|
266
273
|
}
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
return;
|
274
|
+
|
275
|
+
// if (!option.replace) {
|
276
|
+
if (type === "continue_writing") {
|
277
|
+
setGeneratedText(generatedText + text);
|
278
|
+
} else {
|
279
|
+
setGeneratedText(text);
|
274
280
|
}
|
275
|
-
|
281
|
+
|
282
|
+
// return;
|
283
|
+
// }
|
284
|
+
|
285
|
+
// ** we are not using this insertText right now, AI returned response will not insert into the editor immediately, so option.replace will be false always
|
286
|
+
// insertText(editor, text);
|
276
287
|
|
277
288
|
// scrollToAIInput();
|
278
289
|
} catch (err) {
|
@@ -1,6 +1,5 @@
|
|
1
1
|
const Styles = theme => ({
|
2
2
|
aiContainer: {
|
3
|
-
background: "#FCFAFF",
|
4
3
|
background: theme?.palette?.editor?.aiInputBackground,
|
5
4
|
border: "1px solid #8360FD",
|
6
5
|
borderRadius: "6px",
|
@@ -103,6 +102,7 @@ const Styles = theme => ({
|
|
103
102
|
customSelectWrapper: {
|
104
103
|
width: "fit-content",
|
105
104
|
marginTop: "4px",
|
105
|
+
position: "absolute",
|
106
106
|
"@media only screen and (max-width: 600px)": {
|
107
107
|
marginBottom: "4px"
|
108
108
|
}
|
@@ -10,10 +10,14 @@ import { getTRBLBreakPoints, getBreakPointsValue, groupByBreakpoint } from "../.
|
|
10
10
|
import { handleLinkType, windowVar } from "../../utils/helper";
|
11
11
|
import LinkSettings from "../../common/LinkSettings";
|
12
12
|
import Icon from "../../common/Icon";
|
13
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
14
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
15
16
|
const EditorButton = props => {
|
16
17
|
const theme = useTheme();
|
18
|
+
const {
|
19
|
+
theme: appTheme
|
20
|
+
} = useEditorContext();
|
17
21
|
const {
|
18
22
|
attributes,
|
19
23
|
element,
|
@@ -140,8 +144,8 @@ const EditorButton = props => {
|
|
140
144
|
sx: {
|
141
145
|
display: "inline-flex",
|
142
146
|
color: "rgba(0, 0, 0, 0.54)",
|
143
|
-
borderRadius:
|
144
|
-
border:
|
147
|
+
borderRadius: "50% !important",
|
148
|
+
border: "none !important"
|
145
149
|
},
|
146
150
|
...btnProps,
|
147
151
|
children: /*#__PURE__*/_jsx(Icon, {
|
@@ -212,7 +216,7 @@ const EditorButton = props => {
|
|
212
216
|
},
|
213
217
|
"& svg": {
|
214
218
|
"& path": {
|
215
|
-
stroke:
|
219
|
+
stroke: appTheme?.palette?.text?.primary
|
216
220
|
}
|
217
221
|
},
|
218
222
|
"& button": {
|
@@ -277,7 +281,7 @@ const EditorButton = props => {
|
|
277
281
|
right: "-42px",
|
278
282
|
stroke: "#fff",
|
279
283
|
"& path": {
|
280
|
-
fill: openMoreOptions ?
|
284
|
+
fill: openMoreOptions ? appTheme.palette.text.blueText : ""
|
281
285
|
}
|
282
286
|
},
|
283
287
|
onClick: handleMoreBtn,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useEffect, useState
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
2
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
3
3
|
import { Node, Transforms, Editor } from "slate";
|
4
4
|
import AspectRatioIcon from "@mui/icons-material/AspectRatio";
|
@@ -94,7 +94,8 @@ const ImageContent = props => {
|
|
94
94
|
onTouchEnd: onTouchEnd // for mobile
|
95
95
|
,
|
96
96
|
"data-path": path.join(","),
|
97
|
-
draggable: false
|
97
|
+
draggable: false,
|
98
|
+
contentEditable: false
|
98
99
|
});
|
99
100
|
};
|
100
101
|
const Image = props => {
|
@@ -222,7 +223,7 @@ const Image = props => {
|
|
222
223
|
const getWidth = () => {
|
223
224
|
if (resizing) {
|
224
225
|
return {
|
225
|
-
width: `${size.
|
226
|
+
width: `${size.width}px`,
|
226
227
|
height: objectFit ? `${size.height}px` : "auto"
|
227
228
|
};
|
228
229
|
} else {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState, useEffect
|
1
|
+
import React, { useState, useEffect } from "react";
|
2
2
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
3
3
|
import { Node, Transforms } from "slate";
|
4
4
|
import { IconButton, Tooltip, Box, useTheme } from "@mui/material";
|
@@ -53,8 +53,7 @@ const VideoContent = props => {
|
|
53
53
|
...videoSX
|
54
54
|
},
|
55
55
|
src: embedURL,
|
56
|
-
title: alt
|
57
|
-
allowFullScreen: true
|
56
|
+
title: alt
|
58
57
|
});
|
59
58
|
};
|
60
59
|
const VideoPlaceholder = props => {
|
@@ -87,7 +86,8 @@ const Video = ({
|
|
87
86
|
url,
|
88
87
|
xsHidden,
|
89
88
|
width: oldWidth,
|
90
|
-
bannerSpacing
|
89
|
+
bannerSpacing,
|
90
|
+
aspectRatio
|
91
91
|
} = element;
|
92
92
|
const editor = useSlateStatic();
|
93
93
|
const [openSetttings, setOpenSettings] = useState(false);
|
@@ -180,7 +180,7 @@ const Video = ({
|
|
180
180
|
const getWidth = () => {
|
181
181
|
if (resizing) {
|
182
182
|
return {
|
183
|
-
width: size.
|
183
|
+
width: size.width ? `${size.width}px` : "100%",
|
184
184
|
height: url ? `${size.height || 370}px` : "auto"
|
185
185
|
};
|
186
186
|
} else {
|
@@ -189,9 +189,10 @@ const Video = ({
|
|
189
189
|
width: {
|
190
190
|
...getBreakPointsValue(getSize(), null, "overrideReSize", true)
|
191
191
|
},
|
192
|
-
height: url ? {
|
192
|
+
height: url && !aspectRatio ? {
|
193
193
|
...getBreakPointsValue(getSize(), null, "overrideReSizeH", true)
|
194
|
-
} : "auto"
|
194
|
+
} : "auto",
|
195
|
+
aspectRatio: aspectRatio ? aspectRatio : "auto"
|
195
196
|
}, theme)
|
196
197
|
};
|
197
198
|
}
|
@@ -221,6 +222,7 @@ const Video = ({
|
|
221
222
|
alignContent: vertical
|
222
223
|
},
|
223
224
|
...element.attr,
|
225
|
+
contentEditable: false,
|
224
226
|
children: [openSetttings ? /*#__PURE__*/_jsx(EmbedPopup, {
|
225
227
|
element: element,
|
226
228
|
onSave: onSave,
|
@@ -71,11 +71,11 @@ const FormWorkflow = props => {
|
|
71
71
|
children: [/*#__PURE__*/_jsx(Grid, {
|
72
72
|
item: true,
|
73
73
|
sx: classes.radioBtn,
|
74
|
-
children: /*#__PURE__*/
|
74
|
+
children: /*#__PURE__*/_jsx(RadioGroup, {
|
75
75
|
name: "set timing",
|
76
76
|
value: schedule,
|
77
77
|
defaultValue: 1,
|
78
|
-
children:
|
78
|
+
children: /*#__PURE__*/_jsx(FormControlLabel, {
|
79
79
|
value: "immediately",
|
80
80
|
label: "Immediately",
|
81
81
|
onChange: () => {
|
@@ -84,16 +84,7 @@ const FormWorkflow = props => {
|
|
84
84
|
control: /*#__PURE__*/_jsx(Radio, {
|
85
85
|
size: "small"
|
86
86
|
})
|
87
|
-
})
|
88
|
-
value: "after",
|
89
|
-
label: "After",
|
90
|
-
onChange: () => {
|
91
|
-
setSchedule("after");
|
92
|
-
},
|
93
|
-
control: /*#__PURE__*/_jsx(Radio, {
|
94
|
-
size: "small"
|
95
|
-
})
|
96
|
-
})]
|
87
|
+
})
|
97
88
|
})
|
98
89
|
}), schedule === "after" && /*#__PURE__*/_jsx(Grid, {
|
99
90
|
item: true,
|
@@ -206,6 +206,33 @@ const FreeGrid = props => {
|
|
206
206
|
at: [...insertAt]
|
207
207
|
});
|
208
208
|
break;
|
209
|
+
case "addSignature":
|
210
|
+
Transforms.insertNodes(editor, [{
|
211
|
+
type: "freegridItem",
|
212
|
+
childType: "signature",
|
213
|
+
children: [{
|
214
|
+
type: "signature",
|
215
|
+
children: [{
|
216
|
+
text: ""
|
217
|
+
}],
|
218
|
+
data: {
|
219
|
+
name: "",
|
220
|
+
email: "",
|
221
|
+
date: ""
|
222
|
+
}
|
223
|
+
}],
|
224
|
+
gridArea: "3 / 1 / 4 / 2",
|
225
|
+
left: 50,
|
226
|
+
marginTop: 0,
|
227
|
+
top: 0,
|
228
|
+
width: 217,
|
229
|
+
height: 173,
|
230
|
+
width_xs: 217,
|
231
|
+
height_xs: 173
|
232
|
+
}], {
|
233
|
+
at: [...insertAt]
|
234
|
+
});
|
235
|
+
break;
|
209
236
|
case "addImage":
|
210
237
|
Transforms.insertNodes(editor, [{
|
211
238
|
type: "freegridItem",
|
@@ -357,6 +384,7 @@ const FreeGrid = props => {
|
|
357
384
|
Transforms.removeNodes(editor, {
|
358
385
|
at: Path.parent(path)
|
359
386
|
});
|
387
|
+
setSelectedElement({});
|
360
388
|
} catch (err) {
|
361
389
|
console.log(err);
|
362
390
|
}
|
@@ -474,6 +502,8 @@ const FreeGrid = props => {
|
|
474
502
|
backgroundSize: "cover"
|
475
503
|
},
|
476
504
|
"data-path": path.join("|"),
|
505
|
+
"data-dragoverid": path.join("|"),
|
506
|
+
"data-dragovertype": "parent",
|
477
507
|
style: {
|
478
508
|
"--cols": `100%`,
|
479
509
|
"--rows": `repeat(${repeatTimes}, ${ROW_HEIGHT}px)`
|
@@ -190,6 +190,8 @@ const FreeGridBox = props => {
|
|
190
190
|
...attributes,
|
191
191
|
className: "fgi_type_box freegrid-container-parent",
|
192
192
|
"data-path": path.join("|"),
|
193
|
+
"data-dragoverid": path.join("|"),
|
194
|
+
"data-dragovertype": "parent",
|
193
195
|
style: {
|
194
196
|
"--height": `${height}px`,
|
195
197
|
"--cols": `100%`,
|
@@ -220,8 +220,10 @@ const FreeGridItem = props => {
|
|
220
220
|
settingsProps: {
|
221
221
|
settings: "freegridItem",
|
222
222
|
onChange: onChangeSettings,
|
223
|
-
customProps
|
223
|
+
customProps,
|
224
|
+
onlyPopup: true // for signature popup in DnD
|
224
225
|
},
|
226
|
+
|
225
227
|
style: {
|
226
228
|
"--left": `${left || 0}px`,
|
227
229
|
"--marginTop": `${marginTop || 0}px`,
|
@@ -9,6 +9,8 @@ const tableOptions = ["drag", "edit", "settings", "saveAsTemplate", "close"];
|
|
9
9
|
const embedScriptOptions = ["embedScript", "saveAsTemplate", "close"];
|
10
10
|
const sectionOptions = ["addElement", "settings", "moveUp", "moveDown", "saveAsTemplate", "more"];
|
11
11
|
const formOptions = ["drag", "edit", "settings", "addFormField", "workFlow", "saveAsTemplate", "close"];
|
12
|
+
const signatureOptions = ["signatureSettings", "saveAsTemplate", "close"];
|
13
|
+
const signOptions = ["removeSign", "saveAsTemplate", "close"];
|
12
14
|
const itemOptions = {
|
13
15
|
default: commonOptions,
|
14
16
|
text: textOptions,
|
@@ -20,6 +22,8 @@ const itemOptions = {
|
|
20
22
|
section: sectionOptions,
|
21
23
|
table: tableOptions,
|
22
24
|
embedScript: embedScriptOptions,
|
23
|
-
video: videoOptions
|
25
|
+
video: videoOptions,
|
26
|
+
signature: signatureOptions,
|
27
|
+
sign: signOptions
|
24
28
|
};
|
25
29
|
export default itemOptions;
|