@flozy/editor 4.5.7 → 4.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/ChatEditor.js +14 -2
- package/dist/Editor/CommonEditor.js +19 -16
- package/dist/Editor/Editor.css +1 -19
- package/dist/Editor/Elements/AI/AIInput.js +5 -4
- package/dist/Editor/Elements/AI/PopoverAIInput.js +29 -40
- package/dist/Editor/Elements/AI/Styles.js +1 -1
- package/dist/Editor/Elements/Button/EditorButton.js +4 -8
- package/dist/Editor/Elements/Embed/Embed.css +1 -1
- package/dist/Editor/Elements/Embed/Image.js +3 -4
- package/dist/Editor/Elements/Embed/Video.js +4 -4
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -30
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +0 -2
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -3
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +0 -4
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -5
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -82
- package/dist/Editor/Elements/Mentions/Mentions.js +3 -2
- package/dist/Editor/Elements/Signature/SignaturePopup.js +7 -24
- package/dist/Editor/Elements/Signature/Signed.js +1 -1
- package/dist/Editor/Elements/SimpleText/index.js +8 -6
- package/dist/Editor/Elements/Table/TableRow.js +1 -1
- package/dist/Editor/Styles/EditorStyles.js +2 -2
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +29 -35
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +30 -35
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -4
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +38 -22
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +1 -0
- 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/DragOver/index.js +1 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +1 -14
- package/dist/Editor/common/RnD/ElementOptions/styles.js +0 -5
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +2 -32
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +1 -2
- package/dist/Editor/common/RnD/RnDCopy.js +0 -2
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +3 -5
- package/dist/Editor/common/RnD/index.js +30 -64
- package/dist/Editor/common/Section/index.js +1 -11
- package/dist/Editor/common/Section/styles.js +0 -16
- package/dist/Editor/common/Shorthands/mentions.js +1 -1
- package/dist/Editor/common/iconslist.js +0 -23
- package/dist/Editor/helper/index.js +2 -4
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/hooks/useMentions.js +39 -13
- package/dist/Editor/hooks/useMouseMove.js +4 -5
- package/dist/Editor/hooks/withCommon.js +7 -3
- package/dist/Editor/plugins/withHTML.js +29 -0
- package/dist/Editor/utils/Decorators/index.js +2 -3
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +1 -16
- package/dist/Editor/utils/SlateUtilityFunctions.js +0 -18
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +1 -24
- package/dist/Editor/utils/customHooks/useResize.js +5 -4
- package/dist/Editor/utils/events.js +0 -36
- package/dist/Editor/utils/helper.js +39 -11
- package/package.json +1 -1
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +0 -53
- package/dist/Editor/helper/RnD/focusNode.js +0 -74
- package/dist/Editor/hooks/useDragging.js +0 -51
- package/dist/Editor/hooks/withRestrictedNodes.js +0 -48
- package/dist/Editor/utils/Decorators/highlightSelection.js +0 -16
|
@@ -46,7 +46,8 @@ 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
|
|
49
|
+
needLayout,
|
|
50
|
+
isChatEditor: true
|
|
50
51
|
});
|
|
51
52
|
}, []);
|
|
52
53
|
const isReadOnly = readOnly === "readonly";
|
|
@@ -248,6 +249,16 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
248
249
|
restVal
|
|
249
250
|
});
|
|
250
251
|
};
|
|
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
|
+
|
|
251
262
|
return /*#__PURE__*/_jsx(EditorProvider, {
|
|
252
263
|
theme: theme,
|
|
253
264
|
editor: editor,
|
|
@@ -267,7 +278,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
267
278
|
placeholder: "Start typing ...",
|
|
268
279
|
spellCheck: true,
|
|
269
280
|
onBlur: handleBlur,
|
|
270
|
-
onKeyDown: onKeyDown
|
|
281
|
+
onKeyDown: onKeyDown,
|
|
282
|
+
onPaste: handlePaste
|
|
271
283
|
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
|
272
284
|
ref: mentionsRef,
|
|
273
285
|
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,
|
|
4
|
+
import { createEditor, Transforms, Range } 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
|
|
13
|
+
import { mentionsEvent, commands, indentation, escapeEvent, enterEvent } 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,
|
|
30
|
+
import { handleInsertLastElement, 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";
|
|
36
37
|
import "./font.css";
|
|
37
38
|
import "./Editor.css";
|
|
38
39
|
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,6 +82,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
82
82
|
onSave,
|
|
83
83
|
editor: collaborativeEditor,
|
|
84
84
|
readOnly,
|
|
85
|
+
toolbarOptions,
|
|
85
86
|
otherProps,
|
|
86
87
|
isIframe,
|
|
87
88
|
theme,
|
|
@@ -114,7 +115,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
114
115
|
editorClass,
|
|
115
116
|
fixedWidth = "60%",
|
|
116
117
|
fullWidth = "80%",
|
|
117
|
-
hideTools
|
|
118
|
+
hideTools
|
|
118
119
|
} = otherProps || {};
|
|
119
120
|
const editor = useMemo(() => {
|
|
120
121
|
if (collaborativeEditor) return collaborativeEditor;
|
|
@@ -287,11 +288,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
287
288
|
index,
|
|
288
289
|
type
|
|
289
290
|
} = mentions;
|
|
290
|
-
const
|
|
291
|
-
const chars = type && !isFreeGrid(content) ? Shorthands[type]({
|
|
291
|
+
const chars = type ? Shorthands[type]({
|
|
292
292
|
...mentions,
|
|
293
293
|
CHARACTERS,
|
|
294
|
-
hideTools:
|
|
294
|
+
hideTools: hideTools || []
|
|
295
295
|
}) : [];
|
|
296
296
|
const handleEditorChange = newValue => {
|
|
297
297
|
setValue(newValue);
|
|
@@ -365,11 +365,11 @@ 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);
|
|
372
368
|
} else if (event.key === "Backspace") {
|
|
369
|
+
const isPageSettingsNode = isPageSettings(event, editor);
|
|
370
|
+
if (isPageSettingsNode) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
373
|
const {
|
|
374
374
|
selection
|
|
375
375
|
} = editor;
|
|
@@ -384,7 +384,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
}, [chars, target, mentions, setMentions, search, type, mentionsRef]);
|
|
387
|
+
}, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
|
|
388
388
|
const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
|
|
389
389
|
const dotBg = needDotsBG ? {
|
|
390
390
|
background: "white",
|
|
@@ -447,10 +447,13 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
447
447
|
const selection = window?.getSelection();
|
|
448
448
|
if (selection && selection.rangeCount > 0) {
|
|
449
449
|
const cursorPosition = selection.getRangeAt(0)?.getBoundingClientRect();
|
|
450
|
-
const
|
|
450
|
+
const containerRect = container?.getBoundingClientRect();
|
|
451
|
+
const containerBottom = containerRect?.bottom;
|
|
451
452
|
if (cursorPosition && cursorPosition.bottom > containerBottom - 250) {
|
|
453
|
+
// Calculate dynamic scroll based on remaining space
|
|
454
|
+
const scrollAmount = Math.min(200, cursorPosition.bottom - containerBottom + 250);
|
|
452
455
|
container?.scrollBy({
|
|
453
|
-
top:
|
|
456
|
+
top: scrollAmount,
|
|
454
457
|
behavior: "smooth"
|
|
455
458
|
});
|
|
456
459
|
}
|
|
@@ -524,7 +527,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
524
527
|
readOnly: isReadOnly,
|
|
525
528
|
renderElement: renderElement,
|
|
526
529
|
renderLeaf: renderLeaf,
|
|
527
|
-
decorate:
|
|
530
|
+
decorate: decorators,
|
|
528
531
|
onKeyDown: onKeyDown,
|
|
529
532
|
onSelect: () => handleCursorScroll(editorWrapper.current)
|
|
530
533
|
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
package/dist/Editor/Editor.css
CHANGED
|
@@ -234,18 +234,6 @@ 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
|
-
|
|
249
237
|
.signature-btn-grps {
|
|
250
238
|
display: flex;
|
|
251
239
|
justify-content: space-around;
|
|
@@ -256,13 +244,6 @@ blockquote {
|
|
|
256
244
|
width: 17px !important;
|
|
257
245
|
}
|
|
258
246
|
|
|
259
|
-
.react-datepicker__input-container input {
|
|
260
|
-
height: 40px !important;
|
|
261
|
-
border: 1px solid #ccc;
|
|
262
|
-
border-radius: 5px;
|
|
263
|
-
width: 100%;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
247
|
.close-popupbtn {
|
|
267
248
|
border-radius: 4px !important;
|
|
268
249
|
width: 24px;
|
|
@@ -903,6 +884,7 @@ blockquote {
|
|
|
903
884
|
/* For Firefox */
|
|
904
885
|
.removeScroll {
|
|
905
886
|
-moz-appearance: textfield;
|
|
887
|
+
appearance: none;
|
|
906
888
|
}
|
|
907
889
|
|
|
908
890
|
.borderInput:focus-visible {
|
|
@@ -90,7 +90,6 @@ function AIInput({
|
|
|
90
90
|
children: [/*#__PURE__*/_jsxs(Box, {
|
|
91
91
|
component: "div",
|
|
92
92
|
sx: classes.aiContainer,
|
|
93
|
-
ref: refs[0],
|
|
94
93
|
children: [generatedText ? /*#__PURE__*/_jsx(Typography, {
|
|
95
94
|
sx: classes.generatedText,
|
|
96
95
|
style: {
|
|
@@ -105,6 +104,7 @@ function AIInput({
|
|
|
105
104
|
onSubmit: e => {
|
|
106
105
|
e.preventDefault();
|
|
107
106
|
},
|
|
107
|
+
ref: refs[0],
|
|
108
108
|
children: [/*#__PURE__*/_jsx("div", {
|
|
109
109
|
className: "icon-container icons-elements",
|
|
110
110
|
ref: inputWrapperRef,
|
|
@@ -116,21 +116,22 @@ function AIInput({
|
|
|
116
116
|
children: /*#__PURE__*/_jsx(WaveLoading, {})
|
|
117
117
|
}) : /*#__PURE__*/_jsx(TextareaAutosize, {
|
|
118
118
|
className: "ai-input",
|
|
119
|
-
placeholder: "Ask AI to write anything...",
|
|
119
|
+
placeholder: fromToolBar ? "" : "Ask AI to write anything...",
|
|
120
120
|
ref: inputRef,
|
|
121
121
|
value: inputValue,
|
|
122
122
|
onChange: onInputChange,
|
|
123
|
+
disabled: fromToolBar,
|
|
123
124
|
onKeyDown: event => {
|
|
124
125
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
125
126
|
event.preventDefault();
|
|
126
127
|
handleSendBtnClick();
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
}), /*#__PURE__*/_jsxs(Box, {
|
|
130
|
+
}), fromToolBar ? null : /*#__PURE__*/_jsxs(Box, {
|
|
130
131
|
component: "div",
|
|
131
132
|
style: classes.sendIconContainer,
|
|
132
133
|
className: "icons-elements",
|
|
133
|
-
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
134
|
+
children: [isMobile ? null : /*#__PURE__*/_jsx(IconButton, {
|
|
134
135
|
disabled: loading,
|
|
135
136
|
onClick: () => startRecording(),
|
|
136
137
|
children: /*#__PURE__*/_jsx(ChatMicIcon, {})
|
|
@@ -201,29 +201,6 @@ 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
|
-
};
|
|
227
204
|
const onSend = async (type, option) => {
|
|
228
205
|
try {
|
|
229
206
|
if (type === "close") {
|
|
@@ -255,12 +232,28 @@ function PopoverAIInput({
|
|
|
255
232
|
onClickOutside();
|
|
256
233
|
return;
|
|
257
234
|
}
|
|
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
|
+
}
|
|
258
246
|
setLoading(true);
|
|
259
|
-
const payload =
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
247
|
+
const payload = {
|
|
248
|
+
mode: option.mode || 0,
|
|
249
|
+
query: option?.inputValue || inputValue
|
|
250
|
+
};
|
|
251
|
+
if (option.mode === MODES.translate || option.mode === MODES.rephraseTone) {
|
|
252
|
+
payload.textOptionInput = type;
|
|
253
|
+
}
|
|
254
|
+
if (option.mode) {
|
|
255
|
+
payload.textData = generatedText || window.getSelection().toString();
|
|
256
|
+
}
|
|
264
257
|
const result = await services("infinityAI", payload);
|
|
265
258
|
setLoading(false);
|
|
266
259
|
setInputValue("");
|
|
@@ -271,19 +264,15 @@ function PopoverAIInput({
|
|
|
271
264
|
onClickOutside();
|
|
272
265
|
return;
|
|
273
266
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
267
|
+
if (!option.replace) {
|
|
268
|
+
if (type === "continue_writing") {
|
|
269
|
+
setGeneratedText(generatedText + text);
|
|
270
|
+
} else {
|
|
271
|
+
setGeneratedText(text);
|
|
272
|
+
}
|
|
273
|
+
return;
|
|
280
274
|
}
|
|
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);
|
|
275
|
+
insertText(editor, text);
|
|
287
276
|
|
|
288
277
|
// scrollToAIInput();
|
|
289
278
|
} catch (err) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const Styles = theme => ({
|
|
2
2
|
aiContainer: {
|
|
3
|
+
background: "#FCFAFF",
|
|
3
4
|
background: theme?.palette?.editor?.aiInputBackground,
|
|
4
5
|
border: "1px solid #8360FD",
|
|
5
6
|
borderRadius: "6px",
|
|
@@ -102,7 +103,6 @@ const Styles = theme => ({
|
|
|
102
103
|
customSelectWrapper: {
|
|
103
104
|
width: "fit-content",
|
|
104
105
|
marginTop: "4px",
|
|
105
|
-
position: "absolute",
|
|
106
106
|
"@media only screen and (max-width: 600px)": {
|
|
107
107
|
marginBottom: "4px"
|
|
108
108
|
}
|
|
@@ -10,14 +10,10 @@ 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";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
15
|
const EditorButton = props => {
|
|
17
16
|
const theme = useTheme();
|
|
18
|
-
const {
|
|
19
|
-
theme: appTheme
|
|
20
|
-
} = useEditorContext();
|
|
21
17
|
const {
|
|
22
18
|
attributes,
|
|
23
19
|
element,
|
|
@@ -144,8 +140,8 @@ const EditorButton = props => {
|
|
|
144
140
|
sx: {
|
|
145
141
|
display: "inline-flex",
|
|
146
142
|
color: "rgba(0, 0, 0, 0.54)",
|
|
147
|
-
borderRadius:
|
|
148
|
-
border:
|
|
143
|
+
borderRadius: '50% !important',
|
|
144
|
+
border: 'none !important'
|
|
149
145
|
},
|
|
150
146
|
...btnProps,
|
|
151
147
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
@@ -216,7 +212,7 @@ const EditorButton = props => {
|
|
|
216
212
|
},
|
|
217
213
|
"& svg": {
|
|
218
214
|
"& path": {
|
|
219
|
-
stroke:
|
|
215
|
+
stroke: theme.palette.text.primary
|
|
220
216
|
}
|
|
221
217
|
},
|
|
222
218
|
"& button": {
|
|
@@ -281,7 +277,7 @@ const EditorButton = props => {
|
|
|
281
277
|
right: "-42px",
|
|
282
278
|
stroke: "#fff",
|
|
283
279
|
"& path": {
|
|
284
|
-
fill: openMoreOptions ?
|
|
280
|
+
fill: openMoreOptions ? theme.palette.text.blueText : ""
|
|
285
281
|
}
|
|
286
282
|
},
|
|
287
283
|
onClick: handleMoreBtn,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
1
|
+
import React, { useEffect, useState, memo } 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,8 +94,7 @@ const ImageContent = props => {
|
|
|
94
94
|
onTouchEnd: onTouchEnd // for mobile
|
|
95
95
|
,
|
|
96
96
|
"data-path": path.join(","),
|
|
97
|
-
draggable: false
|
|
98
|
-
contentEditable: false
|
|
97
|
+
draggable: false
|
|
99
98
|
});
|
|
100
99
|
};
|
|
101
100
|
const Image = props => {
|
|
@@ -223,7 +222,7 @@ const Image = props => {
|
|
|
223
222
|
const getWidth = () => {
|
|
224
223
|
if (resizing) {
|
|
225
224
|
return {
|
|
226
|
-
width: `${size.
|
|
225
|
+
width: `${size.widthInPercent}%`,
|
|
227
226
|
height: objectFit ? `${size.height}px` : "auto"
|
|
228
227
|
};
|
|
229
228
|
} else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
|
1
|
+
import React, { useState, useEffect, useCallback } 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,7 +53,8 @@ const VideoContent = props => {
|
|
|
53
53
|
...videoSX
|
|
54
54
|
},
|
|
55
55
|
src: embedURL,
|
|
56
|
-
title: alt
|
|
56
|
+
title: alt,
|
|
57
|
+
allowFullScreen: true
|
|
57
58
|
});
|
|
58
59
|
};
|
|
59
60
|
const VideoPlaceholder = props => {
|
|
@@ -179,7 +180,7 @@ const Video = ({
|
|
|
179
180
|
const getWidth = () => {
|
|
180
181
|
if (resizing) {
|
|
181
182
|
return {
|
|
182
|
-
width: size.
|
|
183
|
+
width: size.widthInPercent ? `${size.widthInPercent}%` : "100%",
|
|
183
184
|
height: url ? `${size.height || 370}px` : "auto"
|
|
184
185
|
};
|
|
185
186
|
} else {
|
|
@@ -220,7 +221,6 @@ const Video = ({
|
|
|
220
221
|
alignContent: vertical
|
|
221
222
|
},
|
|
222
223
|
...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__*/_jsxs(RadioGroup, {
|
|
75
75
|
name: "set timing",
|
|
76
76
|
value: schedule,
|
|
77
77
|
defaultValue: 1,
|
|
78
|
-
children: /*#__PURE__*/_jsx(FormControlLabel, {
|
|
78
|
+
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
|
79
79
|
value: "immediately",
|
|
80
80
|
label: "Immediately",
|
|
81
81
|
onChange: () => {
|
|
@@ -84,7 +84,16 @@ const FormWorkflow = props => {
|
|
|
84
84
|
control: /*#__PURE__*/_jsx(Radio, {
|
|
85
85
|
size: "small"
|
|
86
86
|
})
|
|
87
|
-
})
|
|
87
|
+
}), /*#__PURE__*/_jsx(FormControlLabel, {
|
|
88
|
+
value: "after",
|
|
89
|
+
label: "After",
|
|
90
|
+
onChange: () => {
|
|
91
|
+
setSchedule("after");
|
|
92
|
+
},
|
|
93
|
+
control: /*#__PURE__*/_jsx(Radio, {
|
|
94
|
+
size: "small"
|
|
95
|
+
})
|
|
96
|
+
})]
|
|
88
97
|
})
|
|
89
98
|
}), schedule === "after" && /*#__PURE__*/_jsx(Grid, {
|
|
90
99
|
item: true,
|
|
@@ -206,33 +206,6 @@ 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;
|
|
236
209
|
case "addImage":
|
|
237
210
|
Transforms.insertNodes(editor, [{
|
|
238
211
|
type: "freegridItem",
|
|
@@ -384,7 +357,6 @@ const FreeGrid = props => {
|
|
|
384
357
|
Transforms.removeNodes(editor, {
|
|
385
358
|
at: Path.parent(path)
|
|
386
359
|
});
|
|
387
|
-
setSelectedElement({});
|
|
388
360
|
} catch (err) {
|
|
389
361
|
console.log(err);
|
|
390
362
|
}
|
|
@@ -502,8 +474,6 @@ const FreeGrid = props => {
|
|
|
502
474
|
backgroundSize: "cover"
|
|
503
475
|
},
|
|
504
476
|
"data-path": path.join("|"),
|
|
505
|
-
"data-dragOverId": path.join("|"),
|
|
506
|
-
"data-dragOverType": "parent",
|
|
507
477
|
style: {
|
|
508
478
|
"--cols": `100%`,
|
|
509
479
|
"--rows": `repeat(${repeatTimes}, ${ROW_HEIGHT}px)`
|
|
@@ -190,8 +190,6 @@ 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",
|
|
195
193
|
style: {
|
|
196
194
|
"--height": `${height}px`,
|
|
197
195
|
"--cols": `100%`,
|
|
@@ -220,10 +220,8 @@ const FreeGridItem = props => {
|
|
|
220
220
|
settingsProps: {
|
|
221
221
|
settings: "freegridItem",
|
|
222
222
|
onChange: onChangeSettings,
|
|
223
|
-
customProps
|
|
224
|
-
onlyPopup: true // for signature popup in DnD
|
|
223
|
+
customProps
|
|
225
224
|
},
|
|
226
|
-
|
|
227
225
|
style: {
|
|
228
226
|
"--left": `${left || 0}px`,
|
|
229
227
|
"--marginTop": `${marginTop || 0}px`,
|
|
@@ -9,8 +9,6 @@ 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"];
|
|
14
12
|
const itemOptions = {
|
|
15
13
|
default: commonOptions,
|
|
16
14
|
text: textOptions,
|
|
@@ -22,8 +20,6 @@ const itemOptions = {
|
|
|
22
20
|
section: sectionOptions,
|
|
23
21
|
table: tableOptions,
|
|
24
22
|
embedScript: embedScriptOptions,
|
|
25
|
-
video: videoOptions
|
|
26
|
-
signature: signatureOptions,
|
|
27
|
-
sign: signOptions
|
|
23
|
+
video: videoOptions
|
|
28
24
|
};
|
|
29
25
|
export default itemOptions;
|