@flozy/editor 10.9.0 → 10.9.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.
@@ -24,6 +24,7 @@ import { wrapThemeBreakpoints } from "../FreeGrid/breakpointConstants";
24
24
  import useCommonStyle from "../../commonStyle";
25
25
  import SettingsIcon from "../../assets/svg/SettingsIcon";
26
26
  import ImageSelector from "../../common/ImageSelector/ImageSelector";
27
+ import { buildUpdateData } from "../../service/fileupload";
27
28
  import { jsx as _jsx } from "react/jsx-runtime";
28
29
  import { jsxs as _jsxs } from "react/jsx-runtime";
29
30
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -366,12 +367,7 @@ const Image = props => {
366
367
  const onSave = data => {
367
368
  try {
368
369
  if (!data?.url?.file) {
369
- const updateData = typeof data?.url?.embedURL === "string" || typeof data === "string" ? {
370
- url: typeof data?.url?.embedURL === "string" ? data?.url?.embedURL : typeof data === "string" ? data : null
371
- } : {
372
- ...data,
373
- url: data?.url && data?.url !== "none" ? data?.url : ""
374
- };
370
+ const updateData = buildUpdateData(data, url);
375
371
  delete updateData.children;
376
372
  Transforms.select(editor, path);
377
373
  ReactEditor.focus(editor);
@@ -66,4 +66,21 @@ export const getFileTypeFromName = fileName => {
66
66
  default:
67
67
  return "docs";
68
68
  }
69
+ };
70
+ export const buildUpdateData = (data, url) => {
71
+ if (typeof data === "string") {
72
+ return {
73
+ url: data
74
+ };
75
+ }
76
+ if (typeof data?.url?.embedURL === "string") {
77
+ return {
78
+ url: data.url.embedURL
79
+ };
80
+ }
81
+ const resolvedUrl = data?.url && data.url !== "none" ? data.url : typeof url === "string" ? url : "";
82
+ return {
83
+ ...data,
84
+ url: resolvedUrl
85
+ };
69
86
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "10.9.0",
3
+ "version": "10.9.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"