@flozy/editor 1.4.9 → 1.5.1

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.
@@ -301,7 +301,8 @@ const Form = props => {
301
301
  }), openSetttings ? /*#__PURE__*/_jsx(FormPopup, {
302
302
  element: element,
303
303
  onSave: onSave,
304
- onClose: onClose
304
+ onClose: onClose,
305
+ customProps: customProps
305
306
  }) : null, !readOnly ? /*#__PURE__*/_jsxs(Menu, {
306
307
  className: "editor-btn-options",
307
308
  open: anchorEl !== null,
@@ -6,7 +6,8 @@ const FormPopup = props => {
6
6
  const {
7
7
  element,
8
8
  onSave,
9
- onClose
9
+ onClose,
10
+ customProps
10
11
  } = props;
11
12
  return /*#__PURE__*/_jsx(StyleBuilder, {
12
13
  title: "Form",
@@ -14,7 +15,8 @@ const FormPopup = props => {
14
15
  element: element,
15
16
  onSave: onSave,
16
17
  onClose: onClose,
17
- renderTabs: formStyle
18
+ renderTabs: formStyle,
19
+ customProps: customProps
18
20
  });
19
21
  };
20
22
  export default FormPopup;
@@ -1,4 +1,4 @@
1
- import { Editor, Transforms } from "slate";
1
+ import { Transforms } from "slate";
2
2
  import { createParagraph } from "./paragraph";
3
3
  export const createEmbedNode = (type, {
4
4
  url,
@@ -16,29 +16,9 @@ export const insertEmbed = (editor, embedData, format) => {
16
16
  url
17
17
  } = embedData;
18
18
  if (!url) return;
19
- const {
20
- selection
21
- } = editor;
22
- if (!selection?.focus?.path) return;
23
- const [parent, parentPath] = Editor.parent(editor, selection?.focus?.path);
24
19
  const embed = createEmbedNode(format, embedData);
25
- let removePath = parentPath;
26
- let parentPosition = parentPath;
27
- if (parentPath?.length - 1 > 0) {
28
- removePath = parentPath.slice(0, parentPath?.length - 1);
29
- parentPosition = parentPath.slice(0, parentPath?.length - 1);
30
- }
31
- removePath = removePath.map((elem, i) => {
32
- if (i === removePath.length - 1) {
33
- return elem + 1;
34
- }
35
- return elem;
36
- });
37
20
  Transforms.insertNodes(editor, embed, {
38
- at: parentPosition
39
- });
40
- Transforms.unwrapNodes(editor, {
41
- at: [...removePath]
21
+ select: true
42
22
  });
43
23
  Transforms.insertNodes(editor, createParagraph(""));
44
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "1.4.9",
3
+ "version": "1.5.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"