@flozy/editor 4.4.0 → 4.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/dist/Editor/ChatEditor.js +14 -2
  2. package/dist/Editor/CommonEditor.js +24 -11
  3. package/dist/Editor/Editor.css +1 -7
  4. package/dist/Editor/Elements/AI/PopoverAIInput.js +76 -71
  5. package/dist/Editor/Elements/AI/Styles.js +1 -0
  6. package/dist/Editor/Elements/Button/EditorButton.js +4 -8
  7. package/dist/Editor/Elements/Embed/Embed.css +1 -1
  8. package/dist/Editor/Elements/Embed/Image.js +2 -3
  9. package/dist/Editor/Elements/Embed/Video.js +2 -3
  10. package/dist/Editor/Elements/Form/Form.js +1 -0
  11. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
  12. package/dist/Editor/Elements/Mentions/Mentions.js +3 -2
  13. package/dist/Editor/Elements/SimpleText/index.js +2 -3
  14. package/dist/Editor/Elements/Table/TableRow.js +1 -1
  15. package/dist/Editor/Styles/EditorStyles.js +1 -1
  16. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  17. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +29 -35
  18. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +30 -35
  19. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -0
  20. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +38 -22
  21. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +1 -0
  22. package/dist/Editor/Toolbar/PopupTool/index.js +5 -5
  23. package/dist/Editor/common/FontLoader/FontLoader.js +6 -6
  24. package/dist/Editor/common/Icon.js +1 -1
  25. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +0 -1
  26. package/dist/Editor/common/RnD/index.js +2 -3
  27. package/dist/Editor/common/Section/index.js +1 -11
  28. package/dist/Editor/common/Section/styles.js +0 -14
  29. package/dist/Editor/common/Shorthands/mentions.js +1 -1
  30. package/dist/Editor/helper/index.js +2 -4
  31. package/dist/Editor/hooks/useBreakpoints.js +1 -1
  32. package/dist/Editor/hooks/useMentions.js +39 -13
  33. package/dist/Editor/hooks/withCommon.js +7 -2
  34. package/dist/Editor/plugins/withHTML.js +29 -0
  35. package/dist/Editor/utils/SlateUtilityFunctions.js +0 -9
  36. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +1 -24
  37. package/dist/Editor/utils/customHooks/useResize.js +3 -2
  38. package/dist/Editor/utils/events.js +0 -36
  39. package/package.json +1 -1
  40. package/dist/Editor/helper/RnD/focusNode.js +0 -70
@@ -285,40 +285,4 @@ export const enterEvent = (e, editor, isMobile) => {
285
285
  } catch (err) {
286
286
  console.log(err);
287
287
  }
288
- };
289
- export const upDownArrowKeyEvents = (e, editor) => {
290
- try {
291
- const {
292
- selection
293
- } = editor;
294
- if (!selection || Range.isCollapsed(selection)) {
295
- return;
296
- }
297
- const parentPath = selection.anchor.path.slice(0, -1);
298
- const nextNodePath = [...parentPath];
299
- const index = parentPath[parentPath.length - 1];
300
- const parentNode = Editor.parent(editor, parentPath);
301
- if (parentNode.children[index + 1]) {
302
- nextNodePath[parentPath.length - 1] += 1;
303
- } else {
304
- return;
305
- }
306
- Transforms.move(editor, {
307
- distance: 0,
308
- unit: 'offset',
309
- reverse: false
310
- });
311
- Transforms.select(editor, {
312
- anchor: {
313
- path: nextNodePath,
314
- offset: 0
315
- },
316
- focus: {
317
- path: nextNodePath,
318
- offset: 0
319
- }
320
- });
321
- } catch (err) {
322
- console.log(err);
323
- }
324
288
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.4.0",
3
+ "version": "4.4.2",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -1,70 +0,0 @@
1
- import { Editor, Transforms } from "slate";
2
- import { ReactEditor } from "slate-react";
3
- const TEMP_NODE_ID = "temp-focus-node";
4
- const ensureTemporaryFocusNode = (editor, selectedDOM) => {
5
- // Check if the temporary focus node already exists
6
- const {
7
- left,
8
- top
9
- } = selectedDOM?.getBoundingClientRect();
10
- const [tempNodeEntry] = Editor.nodes(editor, {
11
- at: [],
12
- match: n => n.temp === TEMP_NODE_ID
13
- });
14
- if (!tempNodeEntry) {
15
- // If not, insert the temporary focus node at the start of the editor
16
- Transforms.insertNodes(editor, {
17
- type: "temp",
18
- temp: TEMP_NODE_ID,
19
- children: [{
20
- text: ""
21
- }],
22
- left,
23
- top
24
- }, {
25
- at: [editor.children.length]
26
- });
27
- } else {
28
- Transforms.setNodes(editor, {
29
- type: "temp",
30
- temp: TEMP_NODE_ID,
31
- children: [{
32
- text: ""
33
- }],
34
- left,
35
- top
36
- }, {
37
- at: tempNodeEntry[1]
38
- });
39
- }
40
- };
41
- export const focusUsingTemporaryNode = (editor, selectedDOM) => {
42
- // de-select and select
43
- Transforms.deselect(editor);
44
-
45
- // Ensure the temporary node exists
46
- ensureTemporaryFocusNode(editor, selectedDOM);
47
-
48
- // Select the temporary node without causing scroll
49
- const [tempNodeEntry] = Editor.nodes(editor, {
50
- at: [],
51
- match: n => n.temp === TEMP_NODE_ID
52
- });
53
- if (tempNodeEntry) {
54
- const [, path] = tempNodeEntry;
55
- Transforms.select(editor, path); // Move selection to the temp node
56
- }
57
-
58
- ReactEditor.focus(editor);
59
- };
60
- export const cleanupTemporaryFocusNode = editor => {
61
- // Remove the temporary focus node if it exists
62
- for (const [node, path] of Editor.nodes(editor, {
63
- at: [],
64
- match: n => n.temp === TEMP_NODE_ID
65
- })) {
66
- Transforms.removeNodes(editor, {
67
- at: path
68
- });
69
- }
70
- };