@flozy/editor 3.5.6 → 3.5.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -94,7 +94,7 @@ const Form = props => {
94
94
  let user_email = "";
95
95
  let meta_data = [];
96
96
  const validations = [];
97
- let metaFieldDataBoards = getFieldData('element_metadatakey', "form-field", "board");
97
+ let metaFieldDataBoards = getFieldData("element_metadatakey", "form-field", "board");
98
98
  for (let pair of formData.entries()) {
99
99
  const emailObject = getFieldProps("element", "email");
100
100
  if (emailObject?.name === pair[0]) {
@@ -164,7 +164,7 @@ const Form = props => {
164
164
  alert(isValidForm[0]);
165
165
  } else {
166
166
  const formRes = await formSubmit(params, customProps);
167
- if (formRes?.hasOwnProperty('form_id')) {
167
+ if (formRes?.hasOwnProperty("form_id")) {
168
168
  onFormSubmit(formRes);
169
169
  setSubmittedSuccessfully(true);
170
170
  setAnchorEl(null);
@@ -414,6 +414,7 @@ const Form = props => {
414
414
  })]
415
415
  }) : /*#__PURE__*/_jsx(Grid, {
416
416
  item: true,
417
+ contentEditable: false,
417
418
  children: /*#__PURE__*/_jsxs(Grid, {
418
419
  container: true,
419
420
  alignItems: "center",
@@ -435,11 +436,11 @@ const Form = props => {
435
436
  ...getTRBLBreakPoints(bannerSpacing)
436
437
  },
437
438
  minHeight: `${formHeight}px`,
438
- display: 'flex',
439
+ display: "flex",
439
440
  alignItems: "center",
440
441
  justifyContent: "center",
441
442
  textAlign: "center",
442
- position: 'relative'
443
+ position: "relative"
443
444
  },
444
445
  children: "Form Submitted Successfully...!"
445
446
  })
@@ -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__*/_jsxs(RadioGroup, {
74
+ children: /*#__PURE__*/_jsx(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,16 +84,7 @@ const FormWorkflow = props => {
84
84
  control: /*#__PURE__*/_jsx(Radio, {
85
85
  size: "small"
86
86
  })
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
- })]
87
+ })
97
88
  })
98
89
  }), schedule === "after" && /*#__PURE__*/_jsx(Grid, {
99
90
  item: true,
@@ -87,6 +87,7 @@ const BasicToolbar = props => {
87
87
  item: true,
88
88
  children: /*#__PURE__*/_jsxs(Grid, {
89
89
  container: true,
90
+ alignItems: "center",
90
91
  children: [!hideResetIcon && /*#__PURE__*/_jsx(Grid, {
91
92
  item: true,
92
93
  children: /*#__PURE__*/_jsx(IconButton, {
@@ -129,31 +129,32 @@ const formStyle = [{
129
129
  key: "backgroundImage",
130
130
  type: "backgroundImage"
131
131
  }]
132
- }, {
133
- tab: "Add to Boards",
134
- value: "metadatamapping",
135
- fields: [{
136
- label: "Add response to contacts board",
137
- key: "metadatamapping",
138
- type: "metadatamapping",
139
- compType: "card",
140
- content: "By default, form responses are added as separate cards on the default contact board.",
141
- value: "mappingToContactBoard",
142
- infoIcon: /*#__PURE__*/_jsx(Icon, {
143
- icon: "info"
144
- })
145
- }, {
146
- label: "Create a separate board",
147
- key: "metadatamapping",
148
- type: "metadatamapping",
149
- compType: "card",
150
- content: "By default, form responses are added as separate cards on a new board (Contact Us).",
151
- value: "mappingToSeparateBoard",
152
- infoIcon: /*#__PURE__*/_jsx(Icon, {
153
- icon: "info"
154
- })
155
- }]
156
- }, {
132
+ },
133
+ // {
134
+ // tab: "Add to Boards",
135
+ // value: "metadatamapping",
136
+ // fields: [
137
+ // {
138
+ // label: "Add response to contacts board",
139
+ // key: "metadatamapping",
140
+ // type: "metadatamapping",
141
+ // compType: "card",
142
+ // content: "By default, form responses are added as separate cards on the default contact board.",
143
+ // value: "mappingToContactBoard",
144
+ // infoIcon: <Icon icon="info" />
145
+ // },
146
+ // {
147
+ // label: "Create a separate board",
148
+ // key: "metadatamapping",
149
+ // type: "metadatamapping",
150
+ // compType: "card",
151
+ // content: "By default, form responses are added as separate cards on a new board (Contact Us).",
152
+ // value: "mappingToSeparateBoard",
153
+ // infoIcon: <Icon icon="info" />
154
+ // },
155
+ // ],
156
+ // },
157
+ {
157
158
  tab: "Save As Template",
158
159
  value: "saveAsTemplate",
159
160
  needActions: false,
@@ -7,7 +7,8 @@ import withEquation from "../plugins/withEquation";
7
7
  import withMentions from "../plugins/withMentions";
8
8
  import withLayout from "../plugins/withLayout";
9
9
  import withHtml from "../plugins/withHTML";
10
+ import withCustomDeleteBackward from "../plugins/withCustomDeleteBackward";
10
11
  const withCommon = (props, rest = {}) => {
11
- return rest.needLayout ? withHtml(withEquation(withLayout(withHistory(withEmbeds(withTables(withLinks(withMentions(withReact(props))))))))) : withHtml(withEquation(withHistory(withEmbeds(withTables(withLinks(withMentions(withReact(props))))))));
12
+ return rest.needLayout ? withHtml(withEquation(withLayout(withHistory(withEmbeds(withTables(withLinks(withMentions(withCustomDeleteBackward(withReact(props)))))))))) : withHtml(withEquation(withHistory(withEmbeds(withTables(withLinks(withMentions(withCustomDeleteBackward(withReact(props)))))))));
12
13
  };
13
14
  export default withCommon;
@@ -0,0 +1,46 @@
1
+ import { Editor, Node, Path, Transforms } from "slate";
2
+ const isNodeTextEmpty = node => {
3
+ const nodeText = Node.string(node);
4
+ return nodeText.trim() === "";
5
+ };
6
+ const withCustomDeleteBackward = editor => {
7
+ const {
8
+ deleteBackward
9
+ } = editor;
10
+
11
+ // Override deleteBackward
12
+ editor.deleteBackward = (...args) => {
13
+ const {
14
+ selection
15
+ } = editor;
16
+ if (selection) {
17
+ // Check if current node is a list item and is the last one
18
+ const [node] = Editor.nodes(editor, {
19
+ match: n => n.type === "list-item" // Adjust based on your list item type
20
+ });
21
+
22
+ if (node) {
23
+ // Check if it is the last list item is empty text
24
+ const parentNodePath = Path.parent(node[1]);
25
+ const isLastChildren = Node.get(editor, parentNodePath);
26
+ const isEmpty = isNodeTextEmpty(node[0]) && isLastChildren?.children?.length === 1;
27
+ if (isEmpty) {
28
+ Transforms.setNodes(editor, {
29
+ type: "paragraph"
30
+ }, {
31
+ at: parentNodePath
32
+ });
33
+ Transforms.removeNodes(editor, {
34
+ at: node[1]
35
+ });
36
+ return;
37
+ }
38
+ }
39
+ }
40
+
41
+ // Fall back to default delete behavior if conditions are not met
42
+ deleteBackward(...args);
43
+ };
44
+ return editor;
45
+ };
46
+ export default withCustomDeleteBackward;
@@ -30,7 +30,6 @@ import Title from "../Elements/Title/title";
30
30
  import Form from "../Elements/Form/Form";
31
31
  import FormField from "../Elements/Form/FormField";
32
32
  import InlineIcon from "../Elements/InlineIcon/InlineIcon";
33
- import EmbedLink from "../Elements/Embed/link";
34
33
  import SimpleText from "../Elements/SimpleText";
35
34
  import CheckList from "../Elements/List/CheckList";
36
35
  import { isEmptyTextNode } from "../helper";
@@ -477,8 +476,6 @@ export const getBlock = props => {
477
476
  return /*#__PURE__*/_jsx(InlineIcon, {
478
477
  ...props
479
478
  });
480
- // case "embed":
481
- // return <EmbedLink {...props} />;
482
479
  case "docs":
483
480
  case "pdf":
484
481
  case "xls":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.5.6",
3
+ "version": "3.5.7",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"