@flozy/editor 3.7.2 → 3.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/dist/Editor/CommonEditor.js +169 -111
  2. package/dist/Editor/Elements/Accordion/Accordion.js +74 -7
  3. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +3 -2
  4. package/dist/Editor/Elements/Accordion/AccordionSummary.js +4 -60
  5. package/dist/Editor/Elements/AppHeader/AppHeader.js +26 -4
  6. package/dist/Editor/Elements/Button/EditorButton.js +25 -14
  7. package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -17
  8. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  9. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  10. package/dist/Editor/Elements/Color Picker/Styles.js +2 -1
  11. package/dist/Editor/Elements/Embed/Frames/ImageFrame.js +1 -0
  12. package/dist/Editor/Elements/Embed/Image.js +28 -20
  13. package/dist/Editor/Elements/Embed/Video.js +15 -11
  14. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
  15. package/dist/Editor/Elements/Grid/Grid.js +2 -0
  16. package/dist/Editor/Elements/Grid/GridItem.js +3 -1
  17. package/dist/Editor/Elements/Link/Link.js +6 -1
  18. package/dist/Editor/Elements/Link/LinkButton.js +4 -2
  19. package/dist/Editor/Elements/Link/LinkPopup.js +11 -3
  20. package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
  21. package/dist/Editor/Elements/Table/TableCell.js +1 -1
  22. package/dist/Editor/MiniEditor.js +3 -1
  23. package/dist/Editor/Toolbar/Basic/index.js +4 -2
  24. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +26 -2
  25. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  26. package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -11
  27. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
  28. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
  29. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
  30. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +20 -13
  31. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +52 -7
  32. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
  33. package/dist/Editor/Toolbar/PopupTool/index.js +4 -2
  34. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  35. package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
  36. package/dist/Editor/common/ColorPickerButton.js +25 -9
  37. package/dist/Editor/common/CustomColorPicker/index.js +106 -0
  38. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  39. package/dist/Editor/common/CustomDialog/index.js +94 -0
  40. package/dist/Editor/common/CustomDialog/style.js +67 -0
  41. package/dist/Editor/common/CustomSelect.js +33 -0
  42. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  43. package/dist/Editor/common/EditorCmds.js +35 -0
  44. package/dist/Editor/common/Icon.js +30 -2
  45. package/dist/Editor/common/MentionsPopup/Styles.js +5 -2
  46. package/dist/Editor/common/Shorthands/elements.js +54 -0
  47. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +7 -7
  48. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
  49. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  50. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +13 -3
  51. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  52. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +31 -7
  53. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
  54. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
  55. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  56. package/dist/Editor/helper/theme.js +190 -4
  57. package/dist/Editor/hooks/useEditorTheme.js +139 -0
  58. package/dist/Editor/hooks/useMouseMove.js +4 -2
  59. package/dist/Editor/plugins/withEmbeds.js +1 -1
  60. package/dist/Editor/plugins/withHTML.js +47 -5
  61. package/dist/Editor/plugins/withLayout.js +15 -10
  62. package/dist/Editor/plugins/withTable.js +2 -2
  63. package/dist/Editor/theme/ThemeList.js +50 -173
  64. package/dist/Editor/theme/index.js +144 -0
  65. package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
  66. package/dist/Editor/themeSettings/buttons/index.js +290 -0
  67. package/dist/Editor/themeSettings/buttons/style.js +21 -0
  68. package/dist/Editor/themeSettings/colorTheme/index.js +290 -0
  69. package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
  70. package/dist/Editor/themeSettings/fonts/PreviewElement.js +123 -0
  71. package/dist/Editor/themeSettings/fonts/index.js +213 -0
  72. package/dist/Editor/themeSettings/fonts/style.js +44 -0
  73. package/dist/Editor/themeSettings/icons.js +60 -0
  74. package/dist/Editor/themeSettings/index.js +320 -0
  75. package/dist/Editor/themeSettings/style.js +152 -0
  76. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  77. package/dist/Editor/themeSettingsAI/index.js +356 -0
  78. package/dist/Editor/themeSettingsAI/saveTheme.js +190 -0
  79. package/dist/Editor/themeSettingsAI/style.js +247 -0
  80. package/dist/Editor/utils/SlateUtilityFunctions.js +157 -25
  81. package/dist/Editor/utils/button.js +1 -17
  82. package/dist/Editor/utils/events.js +11 -4
  83. package/dist/Editor/utils/font.js +40 -37
  84. package/dist/Editor/utils/helper.js +71 -12
  85. package/package.json +1 -1
@@ -0,0 +1,247 @@
1
+ const style = () => ({
2
+ ".fs-12": {
3
+ fontSize: "12px"
4
+ },
5
+ ".fs-14": {
6
+ fontSize: "14px"
7
+ },
8
+ ".fw-500": {
9
+ fontWeight: "500"
10
+ },
11
+ ".fw-600": {
12
+ fontWeight: "600"
13
+ },
14
+ ".pointer": {
15
+ cursor: "pointer"
16
+ },
17
+ ".transformNone": {
18
+ textTransform: "none"
19
+ },
20
+ ".settingsContainer": {
21
+ width: "340px",
22
+ padding: "16px 16px",
23
+ background: "#fff",
24
+ ".header": {
25
+ borderBottom: `1px solid #DCE4EC`,
26
+ paddingBottom: "8px"
27
+ // marginBottom: "16px",
28
+ }
29
+ },
30
+
31
+ ".title": {
32
+ fontWeight: "700",
33
+ fontSize: "14px"
34
+ },
35
+ ".closeBtn": {
36
+ width: "26px",
37
+ height: "26px",
38
+ BorderRadius: "4px",
39
+ flexShrik: "0",
40
+ padding: "4px",
41
+ background: " #F8FAFC",
42
+ borderRadius: "4px"
43
+ },
44
+ ".MuiTabs-scroller": {
45
+ borderBottom: `1px solid #DCE4EC`
46
+ },
47
+ ".themeCardWrapper": {
48
+ borderRadius: "4px",
49
+ ".active": {
50
+ background: "#ECF2FF"
51
+ }
52
+ },
53
+ ".primaryCard, .secondaryCard": {
54
+ width: "44px",
55
+ height: "44px",
56
+ borderRadius: "5px",
57
+ border: `1px solid #929292`
58
+ },
59
+ ".flexAlign": {
60
+ display: "flex",
61
+ alignItems: "center"
62
+ },
63
+ ".activeColorBox, .xsColorBox": {
64
+ width: "24px",
65
+ height: "24px",
66
+ borderRadius: "5px",
67
+ border: `1px solid #929292`
68
+ },
69
+ ".themeCard": {
70
+ borderRadius: "7px",
71
+ padding: "16px",
72
+ border: "1px solid #F3F3F3",
73
+ boxShadow: "1px 2px 5px 0px #00000014",
74
+ position: "relative",
75
+ flexWrap: "nowrap",
76
+ ".tickIcon": {
77
+ visibility: "hidden",
78
+ opacity: "0",
79
+ position: "absolute",
80
+ right: "-8px",
81
+ top: "-8px"
82
+ },
83
+ "&.selected": {
84
+ ".tickIcon": {
85
+ visibility: "visible",
86
+ opacity: "1"
87
+ }
88
+ }
89
+ },
90
+ ".otherColors": {
91
+ display: "flex",
92
+ flexWrap: "wrap",
93
+ width: "48px",
94
+ ".smallCard": {
95
+ width: "20px",
96
+ height: "20px",
97
+ borderRadius: "5px",
98
+ border: `1px solid #929292`
99
+ }
100
+ },
101
+ ".imageUpload": {
102
+ background: "#F3F3F3",
103
+ borderRadius: "12px",
104
+ padding: "10px",
105
+ height: "208px",
106
+ position: "relative",
107
+ "& .resetIcon": {
108
+ position: "absolute",
109
+ right: "10px",
110
+ top: "10px"
111
+ },
112
+ ".changeImgText": {
113
+ position: "absolute",
114
+ left: "50%",
115
+ top: "50%",
116
+ transform: "translate(-50%, -50%)",
117
+ zIndex: 1,
118
+ background: "#0000004D",
119
+ color: "#fff",
120
+ padding: "6px",
121
+ borderRadius: "6px",
122
+ fontSize: "12px",
123
+ fontWeight: 600,
124
+ opacity: "0",
125
+ visibility: "hidden"
126
+ },
127
+ "&:hover": {
128
+ ".changeImgText": {
129
+ opacity: "1",
130
+ visibility: "visible"
131
+ }
132
+ }
133
+ },
134
+ ".imgUploadInner": {
135
+ background: "#fff",
136
+ borderRadius: "10px",
137
+ border: "0.79px dashed #8360FD",
138
+ height: "100%"
139
+ },
140
+ ".outlineBtn": {
141
+ color: "#2563EB",
142
+ borderRadius: "8px",
143
+ boxShadow: "0px 4px 10px 0px #00000026",
144
+ border: "1px solid #2563EB",
145
+ background: "#EBF1F9",
146
+ height: "34px",
147
+ textTransform: "unset"
148
+ },
149
+ ".seondaryOutlineBtn": {
150
+ border: "1px solid #D8DDE1",
151
+ borderRadius: "8px",
152
+ // boxShadow: "0px 4px 10px 0px #00000026",
153
+ height: "34px",
154
+ textTransform: "unset",
155
+ background: "#eceef3",
156
+ color: "#64748B"
157
+ },
158
+ ".blueBtn": {
159
+ boxShadow: "0px 4px 10px 0px #00000026",
160
+ background: "#2563EB",
161
+ borderRadius: "8px",
162
+ textTransform: "unset",
163
+ height: "34px",
164
+ color: "#fff",
165
+ "&.disabled": {
166
+ background: "#D9D9DD !important",
167
+ color: "#fff !important"
168
+ }
169
+ },
170
+ ".generatedItem": {
171
+ border: "1px solid #E4E6E9",
172
+ borderRadius: "7px",
173
+ padding: "14px",
174
+ display: "flex",
175
+ gap: "16px",
176
+ position: "relative",
177
+ justifyContent: "space-between",
178
+ marginBottom: "12px",
179
+ ".tickIcon": {
180
+ visibility: "hidden",
181
+ opacity: "0",
182
+ position: "absolute",
183
+ right: "-8px",
184
+ top: "-8px"
185
+ },
186
+ "&.selected": {
187
+ border: "1px solid #2563EB",
188
+ boxShadow: " 3px 3px 8px 0px #2563EB40",
189
+ ".tickIcon": {
190
+ visibility: "visible",
191
+ opacity: "1"
192
+ }
193
+ },
194
+ ".colorBox": {
195
+ border: "1px solid #929292",
196
+ height: "28px",
197
+ width: "28px",
198
+ borderRadius: "5px"
199
+ }
200
+ },
201
+ ".textArea": {
202
+ background: "#F3F3F3",
203
+ borderRadius: "12px",
204
+ padding: "10px",
205
+ height: "208px",
206
+ "& textarea": {
207
+ width: "100%",
208
+ height: "100% !important",
209
+ border: "0.79px solid #8360FD",
210
+ background: "#FFFFFF",
211
+ borderRadius: "8px",
212
+ padding: "10px"
213
+ }
214
+ },
215
+ ".imageUrl": {
216
+ height: "auto !important",
217
+ ".MuiOutlinedInput-root": {
218
+ border: "0.79px solid #8360FD",
219
+ background: "#FFFFFF",
220
+ borderRadius: "8px",
221
+ ".tickIcon": {
222
+ width: "18px"
223
+ }
224
+ },
225
+ "&.invalidUrl": {
226
+ ".MuiInputAdornment-root": {
227
+ ".tickIcon": {
228
+ ".fillPath": {
229
+ fill: "#D9D9DD!important"
230
+ }
231
+ }
232
+ }
233
+ }
234
+ },
235
+ ".saveThemeContainer": {
236
+ ".MuiOutlinedInput-root": {
237
+ borderRadius: "8px",
238
+ boxShadow: "0px 4px 16px 0px #0000000D"
239
+ }
240
+ },
241
+ ".uploadedImage": {
242
+ width: "126px",
243
+ height: "126px",
244
+ borderRadius: "126px"
245
+ }
246
+ });
247
+ export default style;
@@ -1,4 +1,4 @@
1
- import { Editor, Transforms, Element as SlateElement } from "slate";
1
+ import { Editor, Transforms, Element as SlateElement, Range } from "slate";
2
2
  import { Box } from "@mui/material";
3
3
  import { fontFamilyMap, sizeMap } from "./font";
4
4
  import Link from "../Elements/Link/Link";
@@ -34,12 +34,12 @@ import SimpleText from "../Elements/SimpleText";
34
34
  import CheckList from "../Elements/List/CheckList";
35
35
  import { isEmptyTextNode } from "../helper";
36
36
  import Attachments from "../Elements/Attachments/Attachments";
37
- import { getBreakPointsValue } from "../helper/theme";
37
+ import { getBreakPointsValue, textThemeFields } from "../helper/theme";
38
38
  import Variables from "../Elements/Variables/Variable";
39
- import insertNewLine from "./insertNewLine";
40
39
  import Divider from "../Elements/Divider/Divider";
41
40
  import { getBorderColor } from "./helper";
42
41
  import Code from "../Elements/EmbedScript/Code";
42
+ import { ReactEditor } from "slate-react";
43
43
  import { jsx as _jsx } from "react/jsx-runtime";
44
44
  const alignment = ["alignLeft", "alignRight", "alignCenter"];
45
45
  const list_types = ["orderedList", "unorderedList"];
@@ -47,7 +47,17 @@ const LIST_FORMAT_TYPE = {
47
47
  orderedList: "list-item",
48
48
  unorderedList: "list-item"
49
49
  };
50
- const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
50
+
51
+ // const NEWLINESAFTER = [
52
+ // "headingOne",
53
+ // "headingTwo",
54
+ // "headingThree",
55
+ // "headingFour",
56
+ // "headingFive",
57
+ // "headingSix",
58
+ // ];
59
+
60
+ const THEME_BLOCK_FIELDS = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "paragraphOne", "paragraphTwo", "paragraphThree"];
51
61
  export const toggleBlock = (editor, format, selection = true, attr = {}) => {
52
62
  const isActive = isBlockActive(editor, format);
53
63
  const isList = list_types.includes(format);
@@ -80,8 +90,9 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
80
90
  if (!selection) {
81
91
  Transforms.insertText(editor, "");
82
92
  }
93
+ const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
83
94
  Transforms.setNodes(editor, {
84
- type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
95
+ type: isActive ? forActiveType : isList ? LIST_FORMAT_TYPE[format] : format,
85
96
  ...attr
86
97
  });
87
98
  if (isList && !isActive) {
@@ -90,10 +101,12 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
90
101
  children: []
91
102
  });
92
103
  }
93
- if (NEWLINESAFTER.indexOf(format) > -1) {
94
- insertNewLine(editor);
95
- }
104
+
105
+ // if (NEWLINESAFTER.indexOf(format) > -1) {
106
+ // insertNewLine(editor);
107
+ // }
96
108
  };
109
+
97
110
  export const addMarkData = (editor, data) => {
98
111
  try {
99
112
  Editor.addMark(editor, data.format, data.value);
@@ -102,9 +115,14 @@ export const addMarkData = (editor, data) => {
102
115
  }
103
116
  };
104
117
  export const toggleMark = (editor, format) => {
105
- const isActive = isMarkActive(editor, format);
118
+ const isActive = isMarkBtnActive(editor, format);
106
119
  if (isActive) {
107
- Editor.removeMark(editor, format);
120
+ const isThemeSupportedMark = textThemeFields.some(f => f === format);
121
+ if (isThemeSupportedMark) {
122
+ Editor.addMark(editor, format, false);
123
+ } else {
124
+ Editor.removeMark(editor, format);
125
+ }
108
126
  } else {
109
127
  Editor.addMark(editor, format, true);
110
128
  }
@@ -118,6 +136,49 @@ export const isMarkActive = (editor, format) => {
118
136
  return null;
119
137
  }
120
138
  };
139
+ export const isMarkBtnActive = (editor, format) => {
140
+ switch (format) {
141
+ case "bold":
142
+ {
143
+ const style = getSelectedElementStyle("font-weight", editor);
144
+ return style === "700";
145
+ }
146
+ case "italic":
147
+ {
148
+ const style = getSelectedElementStyle("font-style", editor);
149
+ return style === format;
150
+ }
151
+ // case "underline": {
152
+ // const style = getSelectedElementStyle("text-decoration");
153
+
154
+ // return style?.includes(format);
155
+ // }
156
+ // case "strikethrough": {
157
+ // const style = getSelectedElementStyle("text-decoration");
158
+
159
+ // return style?.includes("line-through");
160
+ // }
161
+ default:
162
+ return isMarkActive(editor, format);
163
+ }
164
+ };
165
+ export const getSelectedElementStyle = (styleProperty, editor) => {
166
+ if (!editor.selection) {
167
+ return "";
168
+ }
169
+ if (Range.isCollapsed(editor.selection)) {
170
+ return "";
171
+ }
172
+ const domRange = ReactEditor.toDOMRange(editor, editor.selection);
173
+ const selectedDomNode = domRange.commonAncestorContainer;
174
+
175
+ // If it's a text node, get its parent element
176
+ const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
177
+ if (selectedElement) {
178
+ const computedStyle = window.getComputedStyle(selectedElement);
179
+ return computedStyle.getPropertyValue(styleProperty) || "";
180
+ }
181
+ };
121
182
  export const isBlockActive = (editor, format) => {
122
183
  const [match] = Editor.nodes(editor, {
123
184
  match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
@@ -160,6 +221,31 @@ export const activeMark = (editor, format) => {
160
221
  return null;
161
222
  }
162
223
  };
224
+
225
+ // to avoid the styles, that automatically assign from themes
226
+ const getThemeMarkedLeaf = (leaf, children) => {
227
+ const {
228
+ italic,
229
+ bold
230
+ } = leaf || {};
231
+ const style = {};
232
+ if (italic === false) {
233
+ style.fontStyle = "normal";
234
+ }
235
+ if (bold === false) {
236
+ style.fontWeight = "normal";
237
+ }
238
+ if (Object.keys(style).length) {
239
+ children = /*#__PURE__*/_jsx(Box, {
240
+ component: "span",
241
+ sx: {
242
+ "& span": style
243
+ },
244
+ children: children
245
+ });
246
+ }
247
+ return children;
248
+ };
163
249
  export const getMarked = (leaf, children) => {
164
250
  const className = leaf?.doublequote ? "doublequote" : "";
165
251
  if (leaf.bold) {
@@ -177,6 +263,7 @@ export const getMarked = (leaf, children) => {
177
263
  children: children
178
264
  });
179
265
  }
266
+ children = getThemeMarkedLeaf(leaf, children);
180
267
  if (leaf.strikethrough) {
181
268
  children = /*#__PURE__*/_jsx("span", {
182
269
  style: {
@@ -210,17 +297,22 @@ export const getMarked = (leaf, children) => {
210
297
  } : {
211
298
  color: leaf.color
212
299
  };
300
+ const fontSize = {
301
+ lg: sizeMap[leaf.fontSize] || leaf.fontSize,
302
+ ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
303
+ };
304
+ const fontSizesImportant = {};
305
+ Object.entries(fontSize).forEach(([key, value]) => {
306
+ fontSizesImportant[key] = `${value} !important`;
307
+ });
213
308
  children = /*#__PURE__*/_jsx("span", {
214
- style: {
215
- background: leaf.bgColor
216
- },
217
309
  children: /*#__PURE__*/_jsx(Box, {
218
310
  className: className,
219
311
  component: "span",
220
312
  sx: {
221
- fontSize: {
222
- lg: sizeMap[leaf.fontSize] || leaf.fontSize,
223
- ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
313
+ "& span": {
314
+ fontSize: fontSizesImportant,
315
+ background: leaf.bgColor
224
316
  },
225
317
  ...textStyles,
226
318
  fontFamily: family,
@@ -250,31 +342,71 @@ export const getBlock = props => {
250
342
  } = props;
251
343
  const attributes = props.attributes ?? {};
252
344
  const isEmpty = isEmptyTextNode(element);
345
+ const commonHeadingProps = () => ({
346
+ ...attributes,
347
+ ...element.attr,
348
+ className: `content-editable ${isEmpty ? "empty" : ""} theme-element`
349
+ });
350
+ const commonParaProps = paraType => ({
351
+ ...attributes,
352
+ ...element.attr,
353
+ className: `content-editable ${isEmpty ? "empty" : ""} theme-element ${paraType}`
354
+ });
253
355
  switch (element.type) {
254
356
  case "headingOne":
255
357
  return /*#__PURE__*/_jsx("h1", {
256
- ...attributes,
257
- ...element.attr,
258
- className: `content-editable ${isEmpty ? "empty" : ""}`,
358
+ ...commonHeadingProps(),
259
359
  placeholder: "Heading 1",
260
360
  children: children
261
361
  });
262
362
  case "headingTwo":
263
363
  return /*#__PURE__*/_jsx("h2", {
264
- ...attributes,
265
- ...element.attr,
266
- className: `content-editable ${isEmpty ? "empty" : ""}`,
364
+ ...commonHeadingProps(),
267
365
  placeholder: "Heading 2",
268
366
  children: children
269
367
  });
270
368
  case "headingThree":
271
369
  return /*#__PURE__*/_jsx("h3", {
272
- ...attributes,
273
- ...element.attr,
274
- className: `content-editable ${isEmpty ? "empty" : ""}`,
370
+ ...commonHeadingProps(),
275
371
  placeholder: "Heading 3",
276
372
  children: children
277
373
  });
374
+ case "headingFour":
375
+ return /*#__PURE__*/_jsx("h4", {
376
+ ...commonHeadingProps(),
377
+ placeholder: "Heading 4",
378
+ children: children
379
+ });
380
+ case "headingFive":
381
+ return /*#__PURE__*/_jsx("h5", {
382
+ ...commonHeadingProps(),
383
+ placeholder: "Heading 5",
384
+ children: children
385
+ });
386
+ case "headingSix":
387
+ return /*#__PURE__*/_jsx("h6", {
388
+ ...commonHeadingProps(),
389
+ placeholder: "Heading 6",
390
+ children: children
391
+ });
392
+ case "paragraphOne":
393
+ return /*#__PURE__*/_jsx("p", {
394
+ ...commonParaProps("para1"),
395
+ placeholder: "Paragraph 1",
396
+ children: children
397
+ });
398
+ case "paragraphTwo":
399
+ return /*#__PURE__*/_jsx("p", {
400
+ ...commonParaProps("para2"),
401
+ placeholder: "Paragraph 2",
402
+ children: children
403
+ });
404
+ case "paragraphThree":
405
+ return /*#__PURE__*/_jsx("p", {
406
+ ...commonParaProps("para3"),
407
+ placeholder: "Paragraph 3",
408
+ children: children
409
+ });
278
410
  case "blockquote":
279
411
  return /*#__PURE__*/_jsx("blockquote", {
280
412
  ...attributes,
@@ -1,6 +1,5 @@
1
1
  import { Transforms } from "slate";
2
2
  import insertNewLine from "./insertNewLine";
3
- import { windowVar } from "./helper";
4
3
  export const insertButton = editor => {
5
4
  const button = {
6
5
  type: "button",
@@ -10,22 +9,7 @@ export const insertButton = editor => {
10
9
  buttonLink: {
11
10
  linkType: "webAddress"
12
11
  },
13
- iconPosition: "start",
14
- bgColor: "#2563EB",
15
- textColor: "#FFF",
16
- borderRadius: {
17
- topLeft: 30,
18
- topRight: 30,
19
- bottomLeft: 30,
20
- bottomRight: 30
21
- },
22
- bannerSpacing: {
23
- left: 16,
24
- top: 8,
25
- right: 16,
26
- bottom: 8
27
- },
28
- ...(windowVar.lastButtonProps || {})
12
+ iconPosition: "start"
29
13
  };
30
14
  Transforms.insertNodes(editor, button);
31
15
  Transforms.move(editor);
@@ -3,6 +3,7 @@ import { toggleBlock } from "./SlateUtilityFunctions";
3
3
  import insertNewLine from "./insertNewLine";
4
4
  import { insertAccordion } from "./accordion";
5
5
  import { isListItem } from "./helper";
6
+ import EDITORCMDS from "../common/EditorCmds";
6
7
  const HOTKEYS = {
7
8
  b: "bold",
8
9
  i: "italic",
@@ -63,7 +64,8 @@ export const commands = props => {
63
64
  try {
64
65
  const {
65
66
  event,
66
- editor
67
+ editor,
68
+ needLayout
67
69
  } = props;
68
70
  if (HOTKEYS[event.key]) {
69
71
  event.preventDefault();
@@ -73,6 +75,11 @@ export const commands = props => {
73
75
  } else {
74
76
  Editor.addMark(editor, HOTKEYS[event.key], true);
75
77
  }
78
+ } else if (EDITORCMDS[event.key]) {
79
+ EDITORCMDS[event.key](event, {
80
+ editor,
81
+ needLayout
82
+ });
76
83
  }
77
84
  } catch (err) {
78
85
  console.log(err);
@@ -96,7 +103,7 @@ export const indentation = props => {
96
103
  Transforms.wrapNodes(editor, {
97
104
  type: listItem.type,
98
105
  children: [{
99
- text: ''
106
+ text: ""
100
107
  }]
101
108
  });
102
109
  } else {
@@ -153,7 +160,7 @@ const checkListEnterEvent = (editor, type) => {
153
160
  Transforms.insertNodes(editor, {
154
161
  type: "check-list-item",
155
162
  children: [{
156
- text: ''
163
+ text: ""
157
164
  }]
158
165
  }, {
159
166
  at: newPath
@@ -162,7 +169,7 @@ const checkListEnterEvent = (editor, type) => {
162
169
  // focus on the end of the line
163
170
  Transforms.move(editor, {
164
171
  distance: 1,
165
- unit: 'line'
172
+ unit: "line"
166
173
  });
167
174
  } else {
168
175
  toggleBlock(editor, type);