@flozy/editor 10.9.0 → 10.9.2

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);
@@ -65,7 +65,9 @@ function SelectFontSize(props) {
65
65
  }
66
66
  };
67
67
  useEffect(() => {
68
- setSizeValue(getSizeVal());
68
+ if (value) {
69
+ setSizeValue(getSizeVal());
70
+ }
69
71
  }, [value]);
70
72
  const onChange = e => {
71
73
  clearTimeout(timerRef.current);
@@ -124,19 +124,25 @@ export const formStyle = [{
124
124
  key: "alignment",
125
125
  type: "alignment"
126
126
  }]
127
- }, {
128
- tab: "Background",
129
- value: "backgroundImage",
130
- fields: [{
131
- label: "URL",
132
- key: "backgroundImage",
133
- type: "text"
134
- }, {
135
- label: "Background Image",
136
- key: "backgroundImage",
137
- type: "backgroundImage"
138
- }]
139
- }, {
127
+ },
128
+ // Commented out because the background functionality for forms has not been implemented yet
129
+ // {
130
+ // tab: "Background",
131
+ // value: "backgroundImage",
132
+ // fields: [
133
+ // {
134
+ // label: "URL",
135
+ // key: "backgroundImage",
136
+ // type: "text",
137
+ // },
138
+ // {
139
+ // label: "Background Image",
140
+ // key: "backgroundImage",
141
+ // type: "backgroundImage",
142
+ // },
143
+ // ],
144
+ // },
145
+ {
140
146
  tab: "Add to Boards",
141
147
  value: "metadatamapping",
142
148
  fields: [{
@@ -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.2",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"