@flozy/editor 4.4.7 → 4.4.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +2 -14
- package/dist/Editor/CommonEditor.js +13 -30
- package/dist/Editor/Editor.css +7 -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 +4 -4
- 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 +25 -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 +37 -0
- package/dist/Editor/Elements/Mentions/Mentions.js +2 -3
- package/dist/Editor/Elements/Signature/SignaturePopup.js +7 -3
- package/dist/Editor/Elements/Signature/Signed.js +1 -1
- package/dist/Editor/Elements/SimpleText/index.js +3 -2
- 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/RnD/ElementOptions/Actions.js +14 -1
- 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/Utils/gridDropItem.js +5 -3
- package/dist/Editor/common/RnD/index.js +17 -17
- package/dist/Editor/common/Section/index.js +11 -1
- package/dist/Editor/common/Section/styles.js +14 -0
- package/dist/Editor/common/Shorthands/mentions.js +1 -1
- package/dist/Editor/helper/RnD/focusNode.js +70 -0
- package/dist/Editor/helper/index.js +4 -2
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/hooks/useMentions.js +13 -39
- package/dist/Editor/hooks/withCommon.js +2 -7
- package/dist/Editor/plugins/withHTML.js +0 -29
- package/dist/Editor/utils/Decorators/highlightSelection.js +16 -0
- package/dist/Editor/utils/Decorators/index.js +3 -2
- package/dist/Editor/utils/SlateUtilityFunctions.js +18 -0
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +24 -1
- package/dist/Editor/utils/customHooks/useResize.js +4 -5
- package/dist/Editor/utils/events.js +36 -0
- package/dist/Editor/utils/helper.js +1 -8
- package/package.json +1 -1
@@ -46,8 +46,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
46
46
|
const [deboundedValue] = useDebounce(value, 500);
|
47
47
|
const editor = useMemo(() => {
|
48
48
|
return withCommon(createEditor(), {
|
49
|
-
needLayout
|
50
|
-
isChatEditor: true
|
49
|
+
needLayout
|
51
50
|
});
|
52
51
|
}, []);
|
53
52
|
const isReadOnly = readOnly === "readonly";
|
@@ -249,16 +248,6 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
249
248
|
restVal
|
250
249
|
});
|
251
250
|
};
|
252
|
-
const handlePaste = event => {
|
253
|
-
const items = event.clipboardData.items;
|
254
|
-
for (let i = 0; i < items.length; i++) {
|
255
|
-
if (items[i].type.startsWith("image/")) {
|
256
|
-
event.preventDefault(); // Prevent the default paste behavior
|
257
|
-
return; // Exit early to keep the editor empty
|
258
|
-
}
|
259
|
-
}
|
260
|
-
};
|
261
|
-
|
262
251
|
return /*#__PURE__*/_jsx(EditorProvider, {
|
263
252
|
theme: theme,
|
264
253
|
editor: editor,
|
@@ -278,8 +267,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
278
267
|
placeholder: "Start typing ...",
|
279
268
|
spellCheck: true,
|
280
269
|
onBlur: handleBlur,
|
281
|
-
onKeyDown: onKeyDown
|
282
|
-
onPaste: handlePaste
|
270
|
+
onKeyDown: onKeyDown
|
283
271
|
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
284
272
|
ref: mentionsRef,
|
285
273
|
mentions: mentions,
|
@@ -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, Transforms
|
4
|
+
import { createEditor, 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 {
|
30
|
+
import { handleInsertLastElement, isFreeGridFragment, 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(({
|
@@ -365,24 +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 === '
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
event.preventDefault();
|
373
|
-
if (selection) {
|
374
|
-
if (!Range.isCollapsed(selection)) {
|
375
|
-
editor.deleteFragment();
|
376
|
-
} else {
|
377
|
-
const match = getPreviousNode(editor);
|
378
|
-
if (match?.type === "page-settings") {
|
379
|
-
return;
|
380
|
-
}
|
381
|
-
editor.deleteBackward({
|
382
|
-
unit: "character"
|
383
|
-
});
|
384
|
-
}
|
385
|
-
}
|
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);
|
386
372
|
}
|
387
373
|
}, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
|
388
374
|
const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
|
@@ -447,22 +433,19 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
447
433
|
const selection = window?.getSelection();
|
448
434
|
if (selection && selection.rangeCount > 0) {
|
449
435
|
const cursorPosition = selection.getRangeAt(0)?.getBoundingClientRect();
|
450
|
-
const
|
451
|
-
const containerBottom = containerRect?.bottom;
|
436
|
+
const containerBottom = container?.getBoundingClientRect()?.bottom;
|
452
437
|
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
438
|
container?.scrollBy({
|
456
|
-
top:
|
439
|
+
top: 200,
|
457
440
|
behavior: "smooth"
|
458
441
|
});
|
459
442
|
}
|
460
443
|
} else {
|
461
|
-
console.warn(
|
444
|
+
console.warn("No valid selection range found");
|
462
445
|
}
|
463
446
|
}
|
464
447
|
} catch (err) {
|
465
|
-
console.log(
|
448
|
+
console.log("handleCursorScroll", err);
|
466
449
|
}
|
467
450
|
};
|
468
451
|
return /*#__PURE__*/_jsx(EditorProvider, {
|
@@ -527,7 +510,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
527
510
|
readOnly: isReadOnly,
|
528
511
|
renderElement: renderElement,
|
529
512
|
renderLeaf: renderLeaf,
|
530
|
-
decorate: decorators,
|
513
|
+
decorate: d => decorators(d, editor),
|
531
514
|
onKeyDown: onKeyDown,
|
532
515
|
onSelect: () => handleCursorScroll(editorWrapper.current)
|
533
516
|
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
package/dist/Editor/Editor.css
CHANGED
@@ -244,6 +244,13 @@ blockquote {
|
|
244
244
|
width: 17px !important;
|
245
245
|
}
|
246
246
|
|
247
|
+
.react-datepicker__input-container input {
|
248
|
+
height: 40px !important;
|
249
|
+
border: 1px solid #ccc;
|
250
|
+
border-radius: 5px;
|
251
|
+
width: 100%;
|
252
|
+
}
|
253
|
+
|
247
254
|
.close-popupbtn {
|
248
255
|
border-radius: 4px !important;
|
249
256
|
width: 24px;
|
@@ -884,7 +891,6 @@ blockquote {
|
|
884
891
|
/* For Firefox */
|
885
892
|
.removeScroll {
|
886
893
|
-moz-appearance: textfield;
|
887
|
-
appearance: none;
|
888
894
|
}
|
889
895
|
|
890
896
|
.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 => {
|
@@ -180,7 +179,7 @@ const Video = ({
|
|
180
179
|
const getWidth = () => {
|
181
180
|
if (resizing) {
|
182
181
|
return {
|
183
|
-
width: size.
|
182
|
+
width: size.width ? `${size.width}px` : "100%",
|
184
183
|
height: url ? `${size.height || 370}px` : "auto"
|
185
184
|
};
|
186
185
|
} else {
|
@@ -221,6 +220,7 @@ const Video = ({
|
|
221
220
|
alignContent: vertical
|
222
221
|
},
|
223
222
|
...element.attr,
|
223
|
+
contentEditable: false,
|
224
224
|
children: [openSetttings ? /*#__PURE__*/_jsx(EmbedPopup, {
|
225
225
|
element: element,
|
226
226
|
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,31 @@ 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: 150,
|
229
|
+
height: 130
|
230
|
+
}], {
|
231
|
+
at: [...insertAt]
|
232
|
+
});
|
233
|
+
break;
|
209
234
|
case "addImage":
|
210
235
|
Transforms.insertNodes(editor, [{
|
211
236
|
type: "freegridItem",
|
@@ -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;
|
@@ -160,6 +160,43 @@ const useFreeGridStyles = ({
|
|
160
160
|
}
|
161
161
|
}
|
162
162
|
},
|
163
|
+
"& .fgi_type_signature": {
|
164
|
+
height: "100%",
|
165
|
+
"& .signature-container": {
|
166
|
+
height: "100%",
|
167
|
+
"& .signature-btn-container": {
|
168
|
+
height: "100%",
|
169
|
+
"& button": {
|
170
|
+
width: "100%",
|
171
|
+
height: "100%"
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}
|
175
|
+
},
|
176
|
+
"& .fgi_type_sign": {
|
177
|
+
width: "100%",
|
178
|
+
height: "100%",
|
179
|
+
"& .signature-signed-wrapper": {
|
180
|
+
width: "100%",
|
181
|
+
height: "100%",
|
182
|
+
"& .signature-signed-span": {
|
183
|
+
width: "100%",
|
184
|
+
height: "100%",
|
185
|
+
"& .signed-btn": {
|
186
|
+
width: "100%",
|
187
|
+
height: "100%",
|
188
|
+
display: "flex",
|
189
|
+
flexDirection: "column",
|
190
|
+
"& img": {
|
191
|
+
width: "100% !important",
|
192
|
+
maxWidth: "none !important",
|
193
|
+
height: "70% !important",
|
194
|
+
flexGrow: 1
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
},
|
163
200
|
"& .fgi_type_box": {
|
164
201
|
display: "grid",
|
165
202
|
width: "100%",
|
@@ -14,10 +14,9 @@ const Mentions = ({
|
|
14
14
|
verticalAlign: "baseline",
|
15
15
|
display: "inline-block",
|
16
16
|
borderRadius: "4px",
|
17
|
-
backgroundColor: "#
|
17
|
+
backgroundColor: "#eee",
|
18
18
|
fontSize: "0.9em",
|
19
|
-
boxShadow: selected && focused ? "0 0 0 2px #B4D5FF" : "none"
|
20
|
-
color: "#FFF"
|
19
|
+
boxShadow: selected && focused ? "0 0 0 2px #B4D5FF" : "none"
|
21
20
|
};
|
22
21
|
// See if our empty text child has any styling marks applied and apply those
|
23
22
|
if (element.children[0].bold) {
|
@@ -24,7 +24,8 @@ const SignaturePopup = props => {
|
|
24
24
|
onSave,
|
25
25
|
onClear,
|
26
26
|
customProps,
|
27
|
-
className
|
27
|
+
className,
|
28
|
+
onlyPopup
|
28
29
|
} = props;
|
29
30
|
const {
|
30
31
|
readOnly,
|
@@ -52,6 +53,9 @@ const SignaturePopup = props => {
|
|
52
53
|
};
|
53
54
|
const handleClose = () => {
|
54
55
|
setOpen(false);
|
56
|
+
if (props.handleClose) {
|
57
|
+
props.handleClose();
|
58
|
+
}
|
55
59
|
};
|
56
60
|
const handleSave = async () => {
|
57
61
|
await customProps?.services("workFlowAction", {
|
@@ -125,7 +129,7 @@ const SignaturePopup = props => {
|
|
125
129
|
isEmpty = signedData?.signature === "" && signedData?.signedText === "" || signedData?.signedBy === "" || signedData?.signedByEmail === "";
|
126
130
|
}
|
127
131
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
128
|
-
children: [/*#__PURE__*/_jsx("div", {
|
132
|
+
children: [onlyPopup ? null : /*#__PURE__*/_jsx("div", {
|
129
133
|
className: `signature-btn-container`,
|
130
134
|
children: /*#__PURE__*/_jsx(Button, {
|
131
135
|
contentEditable: false,
|
@@ -134,7 +138,7 @@ const SignaturePopup = props => {
|
|
134
138
|
})
|
135
139
|
}), /*#__PURE__*/_jsx(Dialog, {
|
136
140
|
className: `${className} dialogComp`,
|
137
|
-
open: open,
|
141
|
+
open: onlyPopup || open,
|
138
142
|
onClose: handleClose,
|
139
143
|
fullWidth: true,
|
140
144
|
PaperProps: {
|
@@ -6,6 +6,7 @@ import { isTextSelected } from "../../utils/helper";
|
|
6
6
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
7
7
|
import SimpleTextStyle from "./style";
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
import { createElement as _createElement } from "react";
|
11
12
|
const SimpleText = props => {
|
@@ -47,9 +48,9 @@ const SimpleText = props => {
|
|
47
48
|
sx: classes.root,
|
48
49
|
key: `para_${path.join("|")}`
|
49
50
|
}, children, openAI ? null : /*#__PURE__*/_jsx("span", {
|
51
|
+
contentEditable: false,
|
50
52
|
className: "placeholder-simple-text",
|
51
|
-
children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? /*#__PURE__*/_jsxs(
|
52
|
-
className: "placeholder-simple-text-default",
|
53
|
+
children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? /*#__PURE__*/_jsxs(_Fragment, {
|
53
54
|
children: ["Type ", /*#__PURE__*/_jsx("span", {
|
54
55
|
style: {
|
55
56
|
backgroundColor: '#F2F6FA',
|