@flozy/editor 4.8.2 → 4.8.4

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.
Files changed (50) hide show
  1. package/dist/Editor/CommonEditor.js +6 -6
  2. package/dist/Editor/Editor.css +8 -1
  3. package/dist/Editor/Elements/AI/AIInput.js +4 -5
  4. package/dist/Editor/Elements/AI/PopoverAIInput.js +78 -62
  5. package/dist/Editor/Elements/AI/Styles.js +1 -0
  6. package/dist/Editor/Elements/Divider/Divider.js +9 -4
  7. package/dist/Editor/Elements/Embed/EmbedPopup.js +7 -1
  8. package/dist/Editor/Elements/Form/Form.js +38 -2
  9. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +7 -1
  10. package/dist/Editor/Elements/Form/FormElements/FormDate.js +7 -1
  11. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +7 -1
  12. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +7 -1
  13. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +7 -1
  14. package/dist/Editor/Elements/Form/FormElements/FormText.js +7 -1
  15. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +6 -1
  16. package/dist/Editor/Elements/Form/FormPopup.js +12 -9
  17. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
  18. package/dist/Editor/Elements/Grid/GridItem.js +7 -2
  19. package/dist/Editor/Elements/Search/SearchAttachment.js +98 -0
  20. package/dist/Editor/Elements/Search/SearchButton.js +111 -0
  21. package/dist/Editor/Elements/Search/SearchList.js +207 -0
  22. package/dist/Editor/Styles/EditorStyles.js +1 -1
  23. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
  24. package/dist/Editor/Toolbar/Toolbar.js +8 -0
  25. package/dist/Editor/Toolbar/toolbarGroups.js +5 -0
  26. package/dist/Editor/assets/svg/BrainIcon.js +37 -0
  27. package/dist/Editor/assets/svg/DocsIcon.js +38 -0
  28. package/dist/Editor/assets/svg/UserIcon.js +23 -0
  29. package/dist/Editor/common/Icon.js +7 -1
  30. package/dist/Editor/common/MentionsPopup/index.js +4 -2
  31. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +0 -1
  32. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -1
  33. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +144 -12
  34. package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -3
  35. package/dist/Editor/common/Section/index.js +2 -4
  36. package/dist/Editor/common/Shorthands/elements.js +13 -0
  37. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +1 -1
  38. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +5 -2
  39. package/dist/Editor/common/StyleBuilder/formStyle.js +206 -119
  40. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +5 -0
  41. package/dist/Editor/common/StyleBuilder/index.js +123 -10
  42. package/dist/Editor/plugins/withCustomDeleteBackward.js +53 -2
  43. package/dist/Editor/utils/Decorators/highlightSelection.js +22 -0
  44. package/dist/Editor/utils/Decorators/index.js +3 -2
  45. package/dist/Editor/utils/SlateUtilityFunctions.js +14 -0
  46. package/dist/Editor/utils/brains.js +16 -0
  47. package/dist/Editor/utils/font.js +11 -4
  48. package/dist/Editor/utils/formfield.js +8 -4
  49. package/dist/Editor/utils/helper.js +15 -2
  50. package/package.json +1 -1
@@ -1,38 +1,187 @@
1
- import { fontOptions } from "../../utils/font";
1
+ import { fontOptions, fontWeightOptions } from "../../utils/font";
2
2
  import Icon from "../Icon";
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
- const formStyle = [{
5
- tab: "General",
6
- value: "general",
4
+ export const formStyle = [{
5
+ tab: "Form Settings",
6
+ value: "FormSetting",
7
+ hasChildrenTabs: true,
7
8
  fields: [{
8
- label: "Form Name",
9
- key: "formName",
10
- type: "text"
9
+ tab: "General",
10
+ value: "general",
11
+ fields: [{
12
+ label: "Form Name",
13
+ key: "formName",
14
+ type: "text"
15
+ }, {
16
+ label: "Send Form to Email",
17
+ key: "email",
18
+ type: "text",
19
+ placeholder: "Enter Email to send the response..."
20
+ }, {
21
+ label: "Save Response",
22
+ key: "saveResponse",
23
+ type: "selectBox",
24
+ placeholder: "Save Response"
25
+ }]
11
26
  }, {
12
- label: "Send Form to Email",
13
- key: "email",
14
- type: "text",
15
- placeholder: "Enter Email to send the response..."
27
+ tab: "Form Title",
28
+ value: "formTitle",
29
+ fields: [{
30
+ label: "Title",
31
+ key: "formTitle",
32
+ type: "text"
33
+ }, {
34
+ label: "Font Family",
35
+ key: "fontFamily",
36
+ type: "textOptions",
37
+ hideMetaDataOptions: true,
38
+ options: fontOptions,
39
+ webFont: true,
40
+ width: 7,
41
+ renderOption: option => {
42
+ return /*#__PURE__*/_jsx("span", {
43
+ style: {
44
+ fontFamily: option.value
45
+ },
46
+ children: option.text
47
+ });
48
+ }
49
+ }, {
50
+ label: "Font Size",
51
+ key: "textSize",
52
+ type: "fontSize",
53
+ width: 5,
54
+ placeholder: "16px"
55
+ }, {
56
+ label: "Text Align",
57
+ key: "textAlign",
58
+ type: "textAlign",
59
+ placeholder: "16px or 1em"
60
+ }]
61
+ }, {
62
+ tab: "Banner Spacing",
63
+ value: "bannerSpacing",
64
+ fields: [{
65
+ label: "Banner Spacing",
66
+ key: "bannerSpacing",
67
+ type: "bannerSpacing"
68
+ }]
69
+ }, {
70
+ tab: "Border",
71
+ value: "border",
72
+ fields: [{
73
+ label: "Border Radius",
74
+ key: "borderRadius",
75
+ type: "borderRadius"
76
+ }, {
77
+ label: "Border Width",
78
+ key: "borderWidth",
79
+ type: "text",
80
+ placeholder: "1px"
81
+ }, {
82
+ label: "Border Style",
83
+ key: "borderStyle",
84
+ type: "textOptions",
85
+ hideMetaDataOptions: true,
86
+ options: [{
87
+ text: "Solid",
88
+ value: "solid"
89
+ }, {
90
+ text: "Dotted",
91
+ value: "dotted"
92
+ }, {
93
+ text: "Dashed",
94
+ value: "dashed"
95
+ }],
96
+ renderOption: option => {
97
+ return /*#__PURE__*/_jsx("span", {
98
+ children: option.text
99
+ });
100
+ }
101
+ }]
102
+ }, {
103
+ tab: "Colors",
104
+ value: "colors",
105
+ fields: [{
106
+ label: "Text Color",
107
+ key: "textColor",
108
+ type: "color",
109
+ needPreview: true
110
+ }, {
111
+ label: "Background Color",
112
+ key: "bgColor",
113
+ type: "color"
114
+ }, {
115
+ label: "Border Color",
116
+ key: "borderColor",
117
+ type: "color"
118
+ }]
119
+ }, {
120
+ tab: "Position",
121
+ value: "position",
122
+ fields: [{
123
+ label: "Set Postion (Vertical & Horizantal)",
124
+ key: "alignment",
125
+ type: "alignment"
126
+ }]
127
+ }, {
128
+ tab: "Background",
129
+ value: "backgroundImage",
130
+ fields: [{
131
+ label: "URL",
132
+ key: "backgroundImage",
133
+ type: "text"
134
+ }, {
135
+ label: "Background Image",
136
+ key: "backgroundImage",
137
+ type: "backgroundImage"
138
+ }]
139
+ }, {
140
+ tab: "Add to Boards",
141
+ value: "metadatamapping",
142
+ fields: [{
143
+ label: "Add response to contacts board",
144
+ key: "metadatamapping",
145
+ type: "metadatamapping",
146
+ compType: "card",
147
+ content: "By default, form responses are added as separate cards on the default contact board.",
148
+ value: "mappingToContactBoard",
149
+ infoIcon: /*#__PURE__*/_jsx(Icon, {
150
+ icon: "info"
151
+ })
152
+ }, {
153
+ label: "Create a separate board",
154
+ key: "metadatamapping",
155
+ type: "metadatamapping",
156
+ compType: "card",
157
+ content: "By default, form responses are added as separate cards on a new board (Contact Us).",
158
+ value: "mappingToSeparateBoard",
159
+ infoIcon: /*#__PURE__*/_jsx(Icon, {
160
+ icon: "info"
161
+ })
162
+ }]
16
163
  }, {
17
- label: "Save Response",
18
- key: "saveResponse",
19
- type: "selectBox",
20
- placeholder: "Save Response"
164
+ tab: "Save As Template",
165
+ value: "saveAsTemplate",
166
+ needActions: false,
167
+ hideOnFGS: true,
168
+ fields: [{
169
+ label: "Template Image",
170
+ key: "saveAsTemplate",
171
+ type: "saveAsTemplate"
172
+ }]
21
173
  }]
22
174
  }, {
23
- tab: "Form Title",
24
- value: "formTitle",
175
+ tab: "Field Settings",
176
+ value: "FieldSetting",
177
+ hasChildrenTabs: false,
25
178
  fields: [{
26
- label: "Title",
27
- key: "formTitle",
28
- type: "text"
29
- }, {
30
179
  label: "Font Family",
31
- key: "fontFamily",
180
+ key: "fieldFontFamily",
32
181
  type: "textOptions",
182
+ hideMetaDataOptions: true,
33
183
  options: fontOptions,
34
184
  webFont: true,
35
- width: 7,
36
185
  renderOption: option => {
37
186
  return /*#__PURE__*/_jsx("span", {
38
187
  style: {
@@ -41,42 +190,52 @@ const formStyle = [{
41
190
  children: option.text
42
191
  });
43
192
  }
193
+ }, {
194
+ label: "Font Weight",
195
+ key: "fieldFontWeight",
196
+ type: "textOptions",
197
+ width: 5,
198
+ options: fontWeightOptions,
199
+ hideMetaDataOptions: true,
200
+ renderOption: option => {
201
+ return /*#__PURE__*/_jsx("span", {
202
+ style: {
203
+ fontWeight: option.value
204
+ },
205
+ children: option.text
206
+ });
207
+ }
44
208
  }, {
45
209
  label: "Font Size",
46
- key: "textSize",
210
+ key: "fieldTextSize",
47
211
  type: "fontSize",
48
212
  width: 5,
49
213
  placeholder: "16px"
50
214
  }, {
51
- label: "Text Align",
52
- key: "textAlign",
53
- type: "textAlign",
54
- placeholder: "16px or 1em"
55
- }]
56
- }, {
57
- tab: "Banner Spacing",
58
- value: "bannerSpacing",
59
- fields: [{
60
- label: "Banner Spacing",
61
- key: "bannerSpacing",
62
- type: "bannerSpacing"
63
- }]
64
- }, {
65
- tab: "Border",
66
- value: "border",
67
- fields: [{
68
- label: "Border Radius",
69
- key: "borderRadius",
70
- type: "borderRadius"
215
+ label: "Text Color",
216
+ key: "fieldTextColor",
217
+ type: "color",
218
+ needPreview: true
219
+ }, {
220
+ label: "Background Color",
221
+ key: "fieldBgColor",
222
+ type: "color"
223
+ }, {
224
+ label: "Border Color",
225
+ key: "fieldBorderColor",
226
+ type: "color"
71
227
  }, {
72
228
  label: "Border Width",
73
- key: "borderWidth",
229
+ key: "fieldBorderWidth",
74
230
  type: "text",
231
+ width: 5,
75
232
  placeholder: "1px"
76
233
  }, {
77
234
  label: "Border Style",
78
- key: "borderStyle",
235
+ key: "fieldBorderStyle",
79
236
  type: "textOptions",
237
+ hideMetaDataOptions: true,
238
+ width: 5,
80
239
  options: [{
81
240
  text: "Solid",
82
241
  value: "solid"
@@ -93,76 +252,4 @@ const formStyle = [{
93
252
  });
94
253
  }
95
254
  }]
96
- }, {
97
- tab: "Colors",
98
- value: "colors",
99
- fields: [{
100
- label: "Text Color",
101
- key: "textColor",
102
- type: "color",
103
- needPreview: true
104
- }, {
105
- label: "Background Color",
106
- key: "bgColor",
107
- type: "color"
108
- }, {
109
- label: "Border Color",
110
- key: "borderColor",
111
- type: "color"
112
- }]
113
- }, {
114
- tab: "Position",
115
- value: "position",
116
- fields: [{
117
- label: "Set Postion (Vertical & Horizantal)",
118
- key: "alignment",
119
- type: "alignment"
120
- }]
121
- }, {
122
- tab: "Background",
123
- value: "backgroundImage",
124
- fields: [{
125
- label: "URL",
126
- key: "backgroundImage",
127
- type: "text"
128
- }, {
129
- label: "Background Image",
130
- key: "backgroundImage",
131
- type: "backgroundImage"
132
- }]
133
- }, {
134
- tab: "Add to Boards",
135
- value: "metadatamapping",
136
- fields: [{
137
- label: "Add response to contacts board",
138
- key: "metadatamapping",
139
- type: "metadatamapping",
140
- compType: "card",
141
- content: "By default, form responses are added as separate cards on the default contact board.",
142
- value: "mappingToContactBoard",
143
- infoIcon: /*#__PURE__*/_jsx(Icon, {
144
- 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: /*#__PURE__*/_jsx(Icon, {
154
- icon: "info"
155
- })
156
- }]
157
- }, {
158
- tab: "Save As Template",
159
- value: "saveAsTemplate",
160
- needActions: false,
161
- hideOnFGS: true,
162
- fields: [{
163
- label: "Template Image",
164
- key: "saveAsTemplate",
165
- type: "saveAsTemplate"
166
- }]
167
- }];
168
- export default formStyle;
255
+ }];
@@ -79,6 +79,11 @@ const gridItemStyle = [{
79
79
  label: "Width Size",
80
80
  key: "grid",
81
81
  type: "gridSize"
82
+ }, {
83
+ label: "Force Full Width on Mobile",
84
+ key: "forceFullWidth",
85
+ type: "selectBox",
86
+ placeholder: "Force Full Width on Mobile"
82
87
  }, {
83
88
  label: "Height",
84
89
  key: "cellGHeight",
@@ -1,12 +1,31 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { DialogTitle, DialogContent, DialogActions, Button, Grid, IconButton, Typography, Drawer, SwipeableDrawer } from "@mui/material";
2
+ import { DialogTitle, DialogContent, DialogActions, Button, Grid, IconButton, Typography, Drawer, SwipeableDrawer, Accordion, AccordionSummary, AccordionDetails, createTheme } from "@mui/material";
3
3
  import FieldMap from "./fieldTypes";
4
4
  import CloseIcon from "@mui/icons-material/Close";
5
5
  import useCommonStyle from "../../commonStyle";
6
6
  import { useEditorContext } from "../../hooks/useMouseMove";
7
+ import { ThemeProvider } from "@mui/material/styles";
8
+ import { ExpandMoreOutlined, Height } from "@mui/icons-material";
7
9
  import { jsx as _jsx } from "react/jsx-runtime";
8
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
11
  import { Fragment as _Fragment } from "react/jsx-runtime";
12
+ const muiTheme = createTheme({
13
+ components: {
14
+ MuiAccordion: {
15
+ styleOverrides: {
16
+ root: {
17
+ padding: "0px",
18
+ "&.Mui-expanded": {
19
+ margin: "0"
20
+ }
21
+ }
22
+ },
23
+ defaultProps: {
24
+ elevation: 0
25
+ }
26
+ }
27
+ }
28
+ });
10
29
  export const StyleContent = props => {
11
30
  const {
12
31
  value,
@@ -73,6 +92,9 @@ const StyleBuilder = props => {
73
92
  } = tabVal || {
74
93
  needActions: true
75
94
  };
95
+ const {
96
+ hideTools
97
+ } = customProps || {};
76
98
  useEffect(() => {
77
99
  if (customProps?.onDrawerOpen) {
78
100
  customProps?.onDrawerOpen(true);
@@ -140,17 +162,108 @@ const StyleBuilder = props => {
140
162
  }), /*#__PURE__*/_jsx(DialogContent, {
141
163
  sx: {
142
164
  maxHeight: isMobile ? `500px` : `${window.innerHeight - 125}px`,
143
- padding: "8px"
165
+ padding: "0px"
144
166
  },
145
167
  children: renderTabs.map((m, i) => {
146
- return /*#__PURE__*/_jsx(StyleContent, {
147
- renderTabs: renderTabs,
148
- value: m.value,
149
- element: elementProps,
150
- onChange: onElementPropsChange,
151
- customProps: customProps,
152
- handleClose: handleClose
153
- }, `tab_${m.value}_$${i}`);
168
+ if (m?.hasChildrenTabs) {
169
+ return /*#__PURE__*/_jsx(ThemeProvider, {
170
+ theme: muiTheme,
171
+ children: /*#__PURE__*/_jsxs(Accordion, {
172
+ defaultExpanded: true,
173
+ children: [/*#__PURE__*/_jsx(AccordionSummary, {
174
+ expandIcon: /*#__PURE__*/_jsx(ExpandMoreOutlined, {}),
175
+ sx: {
176
+ padding: "0px"
177
+ },
178
+ children: /*#__PURE__*/_jsx(Typography, {
179
+ variant: "h3",
180
+ className: "settingsHeader",
181
+ color: "primary",
182
+ style: {
183
+ fontSize: "14px !important",
184
+ fontWeight: "400"
185
+ },
186
+ children: m?.tab
187
+ })
188
+ }), /*#__PURE__*/_jsx(AccordionDetails, {
189
+ sx: {
190
+ padding: "5px"
191
+ },
192
+ children: m?.fields.filter(f => (hideTools || []).indexOf(f.value) === -1).map((field, index) => {
193
+ return /*#__PURE__*/_jsx(ThemeProvider, {
194
+ theme: muiTheme,
195
+ children: /*#__PURE__*/_jsxs(Accordion, {
196
+ defaultExpanded: true,
197
+ children: [/*#__PURE__*/_jsx(AccordionSummary, {
198
+ expandIcon: /*#__PURE__*/_jsx(ExpandMoreOutlined, {}),
199
+ sx: {
200
+ padding: "0px"
201
+ },
202
+ children: /*#__PURE__*/_jsx(Typography, {
203
+ variant: "h3",
204
+ className: "settingsHeader",
205
+ color: "primary",
206
+ style: {
207
+ fontSize: "14px !important",
208
+ fontWeight: "400"
209
+ },
210
+ children: field?.tab
211
+ })
212
+ }), /*#__PURE__*/_jsx(AccordionDetails, {
213
+ sx: {
214
+ padding: "0px"
215
+ },
216
+ children: /*#__PURE__*/_jsx(StyleContent, {
217
+ renderTabs: [field],
218
+ value: field.value,
219
+ element: elementProps,
220
+ onChange: onElementPropsChange,
221
+ customProps: customProps,
222
+ handleClose: handleClose
223
+ }, `tab_${field.value}_${index}`)
224
+ })]
225
+ }, `accordion_${index}`)
226
+ }, index);
227
+ })
228
+ })]
229
+ }, `accordion_${i}`)
230
+ }, i);
231
+ } else {
232
+ return /*#__PURE__*/_jsx(ThemeProvider, {
233
+ theme: muiTheme,
234
+ children: /*#__PURE__*/_jsxs(Accordion, {
235
+ defaultExpanded: true,
236
+ children: [/*#__PURE__*/_jsx(AccordionSummary, {
237
+ expandIcon: /*#__PURE__*/_jsx(ExpandMoreOutlined, {}),
238
+ sx: {
239
+ padding: "0px"
240
+ },
241
+ children: /*#__PURE__*/_jsx(Typography, {
242
+ variant: "h3",
243
+ className: "settingsHeader",
244
+ color: "primary",
245
+ style: {
246
+ fontSize: "14px !important",
247
+ fontWeight: "400"
248
+ },
249
+ children: m?.tab
250
+ })
251
+ }), /*#__PURE__*/_jsx(AccordionDetails, {
252
+ sx: {
253
+ padding: "0px"
254
+ },
255
+ children: /*#__PURE__*/_jsx(StyleContent, {
256
+ renderTabs: renderTabs,
257
+ value: m.value,
258
+ element: elementProps,
259
+ onChange: onElementPropsChange,
260
+ customProps: customProps,
261
+ handleClose: handleClose
262
+ }, `tab_${m.value}_$${i}`)
263
+ })]
264
+ }, `accordion_${i}`)
265
+ }, i);
266
+ }
154
267
  })
155
268
  }), needActions ? /*#__PURE__*/_jsxs(DialogActions, {
156
269
  sx: {
@@ -1,11 +1,13 @@
1
- import { Editor, Node, Path, Transforms } from "slate";
1
+ import { Editor, Node, Path, Point, Transforms } from "slate";
2
+ import { getNextNode } from "../utils/helper";
2
3
  const isNodeTextEmpty = node => {
3
4
  const nodeText = Node.string(node);
4
5
  return nodeText.trim() === "";
5
6
  };
6
7
  const withCustomDeleteBackward = editor => {
7
8
  const {
8
- deleteBackward
9
+ deleteBackward,
10
+ deleteForward
9
11
  } = editor;
10
12
 
11
13
  // Override deleteBackward
@@ -14,6 +16,19 @@ const withCustomDeleteBackward = editor => {
14
16
  selection
15
17
  } = editor;
16
18
  if (selection) {
19
+ // get the current node
20
+ const [freeGridItemNode] = Editor.nodes(editor, {
21
+ match: n => n.type === "freegridItem" // Adjust based on your list item type
22
+ });
23
+
24
+ // if it is freegrid
25
+ if (freeGridItemNode && freeGridItemNode[0]) {
26
+ const hasText = Node.string(freeGridItemNode[0]);
27
+ if (!hasText) {
28
+ return;
29
+ }
30
+ }
31
+
17
32
  // Check if current node is a list item and is the last one
18
33
  const [node] = Editor.nodes(editor, {
19
34
  match: n => n.type === "list-item" // Adjust based on your list item type
@@ -41,6 +56,42 @@ const withCustomDeleteBackward = editor => {
41
56
  // Fall back to default delete behavior if conditions are not met
42
57
  deleteBackward(...args);
43
58
  };
59
+ editor.deleteForward = (...args) => {
60
+ const {
61
+ selection
62
+ } = editor;
63
+ if (selection) {
64
+ const {
65
+ nextPath,
66
+ nextNode
67
+ } = getNextNode(editor) || {};
68
+
69
+ // Restrict deletion of page-settings
70
+ if (nextNode?.type === "page-settings") {
71
+ const isEndLine = Point.equals(selection.focus, Editor.end(editor, selection.focus.path));
72
+ if (isEndLine) {
73
+ const lastEditorChild = editor?.children?.length;
74
+ const isLastNode = lastEditorChild - 1 === nextPath[0];
75
+ if (isLastNode) {
76
+ return;
77
+ }
78
+
79
+ // move the page-settings node to last
80
+ Transforms.moveNodes(editor, {
81
+ at: nextPath,
82
+ to: [lastEditorChild]
83
+ });
84
+
85
+ // Node present after page-settings, will now merged to current node
86
+ Transforms.mergeNodes(editor, {
87
+ at: nextPath
88
+ });
89
+ return;
90
+ }
91
+ }
92
+ }
93
+ deleteForward(...args);
94
+ };
44
95
  return editor;
45
96
  };
46
97
  export default withCustomDeleteBackward;
@@ -0,0 +1,22 @@
1
+ import { Editor, Range, Text } from "slate";
2
+ const highlightSelection = ([node, path], editor = {}) => {
3
+ if (Text.isText(node) && editor?.selection) {
4
+ const intersection = Range.intersection(editor.selection, Editor.range(editor, path));
5
+ if (!intersection) {
6
+ return [];
7
+ }
8
+
9
+ // Avoid applying highlight if the range only includes line breaks
10
+ const rangeText = Editor.string(editor, intersection);
11
+ if (!rangeText.trim()) {
12
+ return [];
13
+ }
14
+ const range = {
15
+ highlight: true,
16
+ ...intersection
17
+ };
18
+ return [range];
19
+ }
20
+ return [];
21
+ };
22
+ export default highlightSelection;
@@ -1,5 +1,6 @@
1
+ import highlightSelection from "./highlightSelection";
1
2
  import link from "./link";
2
- const decorators = d => {
3
- return [...link(d)];
3
+ const decorators = (d, editor) => {
4
+ return [...link(d, editor), ...highlightSelection(d, editor)];
4
5
  };
5
6
  export default decorators;
@@ -43,6 +43,7 @@ import Code from "../Elements/EmbedScript/Code";
43
43
  import FreeGrid from "../Elements/FreeGrid/FreeGrid";
44
44
  import FreeGridItem from "../Elements/FreeGrid/FreeGridItem";
45
45
  import FreeGridBox from "../Elements/FreeGrid/FreeGridBox";
46
+ import SearchAttachment from "../Elements/Search/SearchAttachment";
46
47
  // import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
47
48
  import { jsx as _jsx } from "react/jsx-runtime";
48
49
  const alignment = ["alignLeft", "alignRight", "alignCenter", "alignJustify"];
@@ -242,6 +243,15 @@ export const getMarked = (leaf, children, theme) => {
242
243
  })
243
244
  });
244
245
  }
246
+ if (leaf.highlight) {
247
+ children = /*#__PURE__*/_jsx("span", {
248
+ style: {
249
+ background: "#EAEBFE",
250
+ color: "inherit"
251
+ },
252
+ children: children
253
+ });
254
+ }
245
255
  if (leaf.decoration === "link") {
246
256
  children = /*#__PURE__*/_jsx("a", {
247
257
  style: {
@@ -519,6 +529,10 @@ export const getBlock = props => {
519
529
  return /*#__PURE__*/_jsx(Attachments, {
520
530
  ...props
521
531
  });
532
+ case "brains":
533
+ return /*#__PURE__*/_jsx(SearchAttachment, {
534
+ ...props
535
+ });
522
536
  case "variables":
523
537
  return /*#__PURE__*/_jsx(Variables, {
524
538
  ...props