@flozy/editor 3.9.6 → 3.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/dist/Editor/ChatEditor.js +45 -55
  2. package/dist/Editor/CommonEditor.js +2 -3
  3. package/dist/Editor/Editor.css +3 -14
  4. package/dist/Editor/Elements/Accordion/Accordion.js +8 -76
  5. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +2 -3
  6. package/dist/Editor/Elements/Accordion/AccordionSummary.js +64 -24
  7. package/dist/Editor/Elements/Embed/Image.js +21 -29
  8. package/dist/Editor/Elements/Embed/Video.js +11 -15
  9. package/dist/Editor/Elements/Emoji/EmojiPicker.js +2 -4
  10. package/dist/Editor/Elements/Form/Form.js +1 -1
  11. package/dist/Editor/Elements/Grid/Grid.js +13 -6
  12. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -5
  13. package/dist/Editor/Elements/Table/Table.js +1 -1
  14. package/dist/Editor/Elements/Table/TableCell.js +1 -1
  15. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -25
  16. package/dist/Editor/common/ColorPickerButton.js +4 -12
  17. package/dist/Editor/common/MentionsPopup/MentionsListCard.js +1 -6
  18. package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
  19. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +8 -9
  20. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
  21. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +20 -26
  22. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +16 -18
  23. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +4 -6
  24. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +3 -14
  25. package/dist/Editor/helper/deserialize/index.js +9 -14
  26. package/dist/Editor/helper/index.js +0 -22
  27. package/dist/Editor/helper/theme.js +1 -2
  28. package/dist/Editor/hooks/useMouseMove.js +1 -0
  29. package/dist/Editor/plugins/withHTML.js +4 -46
  30. package/dist/Editor/plugins/withLayout.js +10 -15
  31. package/dist/Editor/plugins/withTable.js +1 -1
  32. package/dist/Editor/utils/SlateUtilityFunctions.js +8 -2
  33. package/dist/Editor/utils/draftToSlate.js +1 -1
  34. package/dist/Editor/utils/events.js +4 -11
  35. package/dist/Editor/utils/helper.js +12 -43
  36. package/package.json +2 -2
  37. package/dist/Editor/common/EditorCmds.js +0 -35
@@ -32,7 +32,7 @@ import FormField from "../Elements/Form/FormField";
32
32
  import InlineIcon from "../Elements/InlineIcon/InlineIcon";
33
33
  import SimpleText from "../Elements/SimpleText";
34
34
  import CheckList from "../Elements/List/CheckList";
35
- import { getTextColor, isEmptyTextNode } from "../helper";
35
+ import { isEmptyTextNode } from "../helper";
36
36
  import Attachments from "../Elements/Attachments/Attachments";
37
37
  import { getBreakPointsValue } from "../helper/theme";
38
38
  import Variables from "../Elements/Variables/Variable";
@@ -203,7 +203,13 @@ export const getMarked = (leaf, children) => {
203
203
  // cover under single span
204
204
  if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
205
205
  const family = fontFamilyMap[leaf?.fontFamily];
206
- const textStyles = getTextColor(leaf?.color);
206
+ const textStyles = leaf?.color?.indexOf("gradient") >= 0 ? {
207
+ background: leaf?.color?.concat("text"),
208
+ WebkitBackgroundClip: "text",
209
+ WebkitTextFillColor: "transparent"
210
+ } : {
211
+ color: leaf.color
212
+ };
207
213
  children = /*#__PURE__*/_jsx("span", {
208
214
  style: {
209
215
  background: leaf.bgColor
@@ -100,7 +100,7 @@ export const draftToSlate = props => {
100
100
  return a;
101
101
  }, []);
102
102
  return converted;
103
- } else if (data?.length > 0) {
103
+ } else if (data?.length) {
104
104
  return data;
105
105
  } else {
106
106
  return [{
@@ -3,7 +3,6 @@ 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";
7
6
  const HOTKEYS = {
8
7
  b: "bold",
9
8
  i: "italic",
@@ -64,8 +63,7 @@ export const commands = props => {
64
63
  try {
65
64
  const {
66
65
  event,
67
- editor,
68
- needLayout
66
+ editor
69
67
  } = props;
70
68
  if (HOTKEYS[event.key]) {
71
69
  event.preventDefault();
@@ -75,11 +73,6 @@ export const commands = props => {
75
73
  } else {
76
74
  Editor.addMark(editor, HOTKEYS[event.key], true);
77
75
  }
78
- } else if (EDITORCMDS[event.key]) {
79
- EDITORCMDS[event.key](event, {
80
- editor,
81
- needLayout
82
- });
83
76
  }
84
77
  } catch (err) {
85
78
  console.log(err);
@@ -103,7 +96,7 @@ export const indentation = props => {
103
96
  Transforms.wrapNodes(editor, {
104
97
  type: listItem.type,
105
98
  children: [{
106
- text: ""
99
+ text: ''
107
100
  }]
108
101
  });
109
102
  } else {
@@ -160,7 +153,7 @@ const checkListEnterEvent = (editor, type) => {
160
153
  Transforms.insertNodes(editor, {
161
154
  type: "check-list-item",
162
155
  children: [{
163
- text: ""
156
+ text: ''
164
157
  }]
165
158
  }, {
166
159
  at: newPath
@@ -169,7 +162,7 @@ const checkListEnterEvent = (editor, type) => {
169
162
  // focus on the end of the line
170
163
  Transforms.move(editor, {
171
164
  distance: 1,
172
- unit: "line"
165
+ unit: 'line'
173
166
  });
174
167
  } else {
175
168
  toggleBlock(editor, type);
@@ -216,17 +216,6 @@ const getScrollElement = () => {
216
216
  const scrollFrom = isSlateWrapperScroll ? slateWrapper : window;
217
217
  return scrollFrom;
218
218
  };
219
- const handleLinkBtnClick = (e, props) => {
220
- if (e) {
221
- e.preventDefault();
222
- e.stopPropagation();
223
- }
224
- if (props.target) {
225
- window.open(props.href);
226
- } else {
227
- window.location.href = props.href;
228
- }
229
- };
230
219
  export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}) => {
231
220
  const props = {};
232
221
  if (!readOnly) {
@@ -317,22 +306,23 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
317
306
 
318
307
  // for iphone fix
319
308
  if (props.component === "a" && props.href) {
320
- const isMobile = getDevice(window.innerWidth) === "xs";
321
- if (isMobile) {
309
+ if (getDevice(window.innerWidth) === "xs") {
322
310
  props.component = "button"; // iphone is opening two tabs, on open in new tab because of a tag.
323
311
  }
324
312
 
325
- let touchEndClicked = false;
326
313
  props.onTouchEnd = e => {
327
- touchEndClicked = true;
328
- handleLinkBtnClick(e, props);
329
- };
330
- props.onClick = e => {
331
- // This condition is used for mobile preview in the page editor.
332
- // 'touchEnd' will not work in the mobile page preview.
333
- if (!touchEndClicked && isMobile) {
334
- handleLinkBtnClick(e, props);
314
+ if (e) {
315
+ // onTouchEnd will get triggered on web, only for image element, for that case event is getting undefined.
316
+ e.preventDefault();
317
+ e.stopPropagation();
335
318
  }
319
+ if (props.target) {
320
+ window.open(props.href);
321
+ } else {
322
+ window.location.href = props.href;
323
+ }
324
+ };
325
+ props.onClick = () => {
336
326
  return false;
337
327
  };
338
328
  }
@@ -377,25 +367,4 @@ export const decodeString = str => {
377
367
  } catch (err) {
378
368
  console.log(err);
379
369
  }
380
- };
381
- export const onDeleteKey = (event, {
382
- editor
383
- }) => {
384
- try {
385
- const {
386
- selection
387
- } = editor;
388
- if (selection) {
389
- // If text is selected, delete the selection
390
- Transforms.delete(editor);
391
- } else {
392
- // If no text is selected, handle deleting the next character/element
393
- Transforms.delete(editor, {
394
- unit: "character",
395
- reverse: false
396
- });
397
- }
398
- } catch (err) {
399
- console.log(err);
400
- }
401
370
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.9.6",
3
+ "version": "3.9.8",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -64,7 +64,7 @@
64
64
  "storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook dev -p 6006",
65
65
  "build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
66
66
  "publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
67
- "publish:local": "rm -rf /Users/agenciflow08/Documents/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agenciflow08/Documents/flozy/client/node_modules/@flozy/editor/dist --copy-files"
67
+ "publish:local": "rm -rf /Users/agenciflow08/Documents/flozyapp/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agenciflow08/Documents/flozyapp/client/node_modules/@flozy/editor/dist --copy-files"
68
68
  },
69
69
  "eslintConfig": {
70
70
  "extends": [
@@ -1,35 +0,0 @@
1
- import { Editor, Transforms } from "slate";
2
- const selectAll = (event, {
3
- editor,
4
- needLayout
5
- }) => {
6
- try {
7
- if (needLayout) {
8
- event.preventDefault();
9
- // Select the entire document
10
- const {
11
- selection
12
- } = editor;
13
- const [firstNode] = Editor.nodes(editor, {
14
- at: [0]
15
- }); // First node
16
- const [lastNode] = Editor.nodes(editor, {
17
- at: [editor.children.length - 1]
18
- }); // Last node
19
-
20
- if (firstNode && lastNode) {
21
- Transforms.select(editor, {
22
- anchor: Editor.start(editor, [0]),
23
- // Start at the first node
24
- focus: Editor.end(editor, [editor.children.length - 1]) // End at the last node
25
- });
26
- }
27
- }
28
- } catch (err) {
29
- console.log(err);
30
- }
31
- };
32
- const EDITORCMDS = {
33
- a: selectAll
34
- };
35
- export default EDITORCMDS;