@flozy/editor 4.5.0 → 4.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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;
@@ -225,8 +225,10 @@ const FreeGrid = props => {
225
225
  left: 50,
226
226
  marginTop: 0,
227
227
  top: 0,
228
- width: 150,
229
- height: 130
228
+ width: 217,
229
+ height: 173,
230
+ width_xs: 217,
231
+ height_xs: 173
230
232
  }], {
231
233
  at: [...insertAt]
232
234
  });
@@ -382,6 +384,7 @@ const FreeGrid = props => {
382
384
  Transforms.removeNodes(editor, {
383
385
  at: Path.parent(path)
384
386
  });
387
+ setSelectedElement({});
385
388
  } catch (err) {
386
389
  console.log(err);
387
390
  }
@@ -169,9 +169,17 @@ const useFreeGridStyles = ({
169
169
  height: "100%",
170
170
  "& .signature-btn-container": {
171
171
  height: "100%",
172
- "& button": {
172
+ display: "flex",
173
+ flexDirection: "column",
174
+ "& .sign-placeholder": {
175
+ display: "flex",
176
+ // remove hidden sign placeholder
173
177
  width: "100%",
174
- height: "100%"
178
+ background: theme?.palette?.editor?.background,
179
+ flexGrow: 1
180
+ },
181
+ "& button": {
182
+ margin: "6px 0px"
175
183
  }
176
184
  }
177
185
  }
@@ -42,7 +42,8 @@ const TypeSignature = props => {
42
42
  overflow: "hidden",
43
43
  textOverflow: "ellipsis",
44
44
  warp: "noWarp",
45
- maxWidth: "120px"
45
+ maxWidth: "120px",
46
+ color: "#000000"
46
47
  },
47
48
  children: name || "Signature"
48
49
  })
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from "react";
2
- import { Dialog, DialogTitle, DialogContent, DialogActions, Button, IconButton, Grid, TextField, Typography, Tabs, Tab, InputAdornment } from "@mui/material";
2
+ import { Dialog, DialogTitle, DialogContent, DialogActions, Button, IconButton, Grid, TextField, Typography, Tabs, Tab, InputAdornment, Box } from "@mui/material";
3
3
  import CloseIcon from "@mui/icons-material/Close";
4
4
  import DatePicker from "react-datepicker";
5
5
  import "react-datepicker/dist/react-datepicker.css";
@@ -11,6 +11,7 @@ import { useEditorContext } from "../../hooks/useMouseMove";
11
11
  import { validationMethods } from "../Form/FormElements/validations";
12
12
  import { CalenderDownIconSignature, CalenderIconSignature } from "../../common/iconListV2";
13
13
  import ColorPickerButton from "../../common/ColorPickerButton";
14
+ import { SignaturePlaceholderIcon } from "../../common/iconslist";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
17
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -129,13 +130,25 @@ const SignaturePopup = props => {
129
130
  isEmpty = signedData?.signature === "" && signedData?.signedText === "" || signedData?.signedBy === "" || signedData?.signedByEmail === "";
130
131
  }
131
132
  return /*#__PURE__*/_jsxs(_Fragment, {
132
- children: [onlyPopup ? null : /*#__PURE__*/_jsx("div", {
133
+ children: [onlyPopup ? null : /*#__PURE__*/_jsxs("div", {
133
134
  className: `signature-btn-container`,
134
- children: /*#__PURE__*/_jsx(Button, {
135
- contentEditable: false,
135
+ contentEditable: false,
136
+ children: [/*#__PURE__*/_jsxs(Box, {
137
+ className: "sign-placeholder",
138
+ children: [/*#__PURE__*/_jsx(SignaturePlaceholderIcon, {}), /*#__PURE__*/_jsx(Typography, {
139
+ variant: "body2",
140
+ style: {
141
+ color: "#A2B0B9"
142
+ },
143
+ children: "Your sign will be placed here"
144
+ })]
145
+ }), /*#__PURE__*/_jsx(Button, {
136
146
  onClick: handleOpen,
147
+ style: {
148
+ width: "fit-content"
149
+ },
137
150
  children: "Sign Here"
138
- })
151
+ })]
139
152
  }), /*#__PURE__*/_jsx(Dialog, {
140
153
  className: `${className} dialogComp`,
141
154
  open: onlyPopup || open,
@@ -42,6 +42,11 @@ const useElementOptionsStyle = ({
42
42
  "& .strokePath": {
43
43
  stroke: "#2563EB"
44
44
  }
45
+ },
46
+ "& .SignatureIcon": {
47
+ "& path": {
48
+ fill: theme?.palette?.editor?.textColor
49
+ }
45
50
  }
46
51
  }
47
52
  }
@@ -12,6 +12,8 @@ const RnDCopy = props => {
12
12
  useEffect(() => {
13
13
  if (selectedElement?.path) {
14
14
  window.selectedRnDElement = selectedElement;
15
+ } else {
16
+ window.selectedRnDElement = {};
15
17
  }
16
18
  }, [selectedElement?.path, selectedElement?.enable]);
17
19
  return !readOnly ? /*#__PURE__*/_jsx(Box, {
@@ -2337,4 +2337,27 @@ export const ResetIcon = () => /*#__PURE__*/_jsxs("svg", {
2337
2337
  strokeLinecap: "round",
2338
2338
  strokeLinejoin: "round"
2339
2339
  })]
2340
+ });
2341
+ export const SignaturePlaceholderIcon = () => /*#__PURE__*/_jsxs("svg", {
2342
+ width: "39",
2343
+ height: "29",
2344
+ viewBox: "0 0 39 29",
2345
+ fill: "none",
2346
+ xmlns: "http://www.w3.org/2000/svg",
2347
+ children: [/*#__PURE__*/_jsx("path", {
2348
+ d: "M32.9361 2.30469L18.7107 16.5287C17.8881 17.3501 17.8881 18.6836 18.7107 19.5061L19.4967 20.2922C20.3182 21.1137 21.6528 21.1137 22.4742 20.2922L36.701 6.06677L32.9361 2.30469Z",
2349
+ fill: "#64748B"
2350
+ }), /*#__PURE__*/_jsx("path", {
2351
+ d: "M18.0898 20.1246C17.7023 19.7372 17.4549 19.2631 17.3415 18.7656L17.277 18.9424C17.1454 19.3043 16.9272 19.899 16.7945 20.2609L15.9122 22.6728C15.9074 22.6848 15.906 22.6972 15.9023 22.7056L16.9701 21.6392C17.0787 21.532 17.254 21.532 17.3626 21.6392C17.4711 21.7489 17.4711 21.9245 17.3626 22.0317L16.2962 23.1006C16.3083 23.0958 16.3181 23.0933 16.3304 23.0885L18.7423 22.2073C19.1042 22.0743 19.6978 21.8575 20.0608 21.7248L20.2376 21.6602C19.739 21.5458 19.2649 21.2983 18.8774 20.9132L18.0898 20.1246Z",
2352
+ fill: "#64748B"
2353
+ }), /*#__PURE__*/_jsx("path", {
2354
+ d: "M38.3842 1.40407L37.5982 0.617994C36.7756 -0.205998 35.4421 -0.205998 34.6207 0.617994L33.5664 1.67231L37.3299 5.43583L38.3842 4.38151C39.2057 3.55896 39.2057 2.22547 38.3842 1.40407Z",
2355
+ fill: "#64748B"
2356
+ }), /*#__PURE__*/_jsx("path", {
2357
+ d: "M36.7307 7.02477L30.3199 13.4356C30.0626 13.6928 30.0626 14.1095 30.3199 14.3667C30.5772 14.624 30.9938 14.624 31.251 14.3667L37.6604 7.95591C37.9177 7.69865 37.9177 7.28204 37.6604 7.02477C37.4034 6.76779 36.9865 6.76779 36.7307 7.02477Z",
2358
+ fill: "#64748B"
2359
+ }), /*#__PURE__*/_jsx("path", {
2360
+ d: "M19.034 24.3978H14.2468C12.5175 24.3978 11.4972 24.7574 10.8208 24.9951C10.0347 25.2742 9.97013 25.295 9.23397 24.6259C9.00841 24.4185 8.79632 24.1408 8.57216 23.8445C8.02117 23.1207 7.33161 22.2115 6.14206 22.2833C4.44193 22.3784 4.29183 24.1467 4.20291 25.2035C4.18833 25.3814 4.17121 25.58 4.14821 25.775C4.03234 25.4131 3.9204 25.0181 3.83511 24.7159C3.69624 24.221 3.55232 23.7116 3.39746 23.2826C3.07567 22.3966 2.51371 22.276 2.17738 22.2833C1.84465 22.2906 0.959808 22.3088 0.0410129 25.2229C-0.105155 25.6847 0.151831 26.1773 0.613894 26.3246C1.0782 26.4697 1.57054 26.2124 1.71698 25.7506C1.81208 25.4485 1.92907 25.134 2.04719 24.8512C2.07889 24.9634 2.11171 25.0779 2.14341 25.1912C2.59566 26.7976 2.95282 28.0638 3.9229 28.2955C3.99725 28.3126 4.08982 28.3261 4.19699 28.3261C4.47474 28.3261 4.84534 28.2285 5.20499 27.8337C5.79863 27.1843 5.88139 26.2102 5.95321 25.3534C5.98744 24.9438 6.05196 24.1796 6.23853 24.0371C6.49214 24.0273 6.76625 24.3724 7.17334 24.9085C7.42331 25.2376 7.70723 25.6104 8.05091 25.9224C9.46232 27.2081 10.2594 27.0558 11.4048 26.6512C12.0338 26.4293 12.8174 26.1541 14.2457 26.1541H19.0329C19.518 26.1541 19.9116 25.7591 19.9116 25.2754C19.9127 24.7915 19.5205 24.3979 19.034 24.3979L19.034 24.3978Z",
2361
+ fill: "#64748B"
2362
+ })]
2340
2363
  });
@@ -1,6 +1,7 @@
1
1
  import { Editor, Transforms, Node, Path } from "slate";
2
2
  import { isSelectionInNodeType, getCaretPosition, onPasteRnDNode, bringItemToFB } from "../../helper";
3
3
  import focusOnNewItem from "../../helper/RnD/focusOnNewItem";
4
+ import { ReactEditor } from "slate-react";
4
5
  const RND_ITEM_TYPES = ["freegrid", "freegridItem", "freegridBox"];
5
6
  const parsePath = path => path?.split("|").map(m => parseInt(m));
6
7
  const selectAll = (event, {
@@ -182,17 +183,19 @@ export const onInsertFragment = ({
182
183
  });
183
184
  }
184
185
  } else {
185
- // if no selection place items at last
186
- const np = onPasteRnDNode(editor, {
187
- path: [editor.children.length - 1, 0],
188
- children: [],
189
- slateNodes: slateNodes
190
- });
191
- if (np && window.updateSelectedItem) {
192
- focusOnNewItem(editor, np, {
193
- setSelectedElement: window.updateSelectedItem
186
+ ReactEditor.focus(editor);
187
+ if (editor.children.length === 0) {
188
+ Transforms.insertNodes(editor, {
189
+ text: ""
190
+ }, {
191
+ at: [0]
194
192
  });
195
193
  }
194
+ Transforms.insertNodes(editor, [{
195
+ ...slateNodes
196
+ }], {
197
+ at: [editor.children.length - 1]
198
+ });
196
199
  }
197
200
  } catch (err) {
198
201
  console.log(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.5.0",
3
+ "version": "4.5.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"