oolib 2.187.6 → 2.187.8

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.
@@ -145,11 +145,19 @@ var ImageInputContextProvider = function (_a) {
145
145
  });
146
146
  }
147
147
  }, []);
148
+ console.log({ outside_value: value });
149
+ // Create a ref to always track the latest value
150
+ var valueRef = useRef(value);
151
+ // Keep the ref updated whenever value changes
152
+ (0, react_1.useEffect)(function () {
153
+ valueRef.current = value;
154
+ }, [value]);
148
155
  var handleSingleImageDataChange = function (_a) {
149
156
  var publicUrl = _a.publicUrl, imageData = _a.imageData;
150
157
  //publicUrl is used as an 'id' identifier
151
158
  console.log({ publicUrl: publicUrl, imageData: imageData, valueToUpdate: JSON.parse(JSON.stringify(value)) });
152
- var newValue = __spreadArray([], value, true);
159
+ var currentValue = valueRef.current;
160
+ var newValue = __spreadArray([], currentValue, true);
153
161
  var imgIdxToReplace = newValue.findIndex(function (d) { return d.publicUrl === publicUrl; });
154
162
  console.log({ imgIdxToReplace: imgIdxToReplace, valueAfterFindIndex: JSON.parse(JSON.stringify(value)) });
155
163
  newValue[imgIdxToReplace] = imageData;
@@ -177,10 +177,10 @@ function ImageEditor(_a) {
177
177
  // })
178
178
  : react_1.default.createElement(LexicalTextEditor, { variant: 'simple', disableNewline: true, invert: invert, placeholder: "type caption for image (optional)", readOnly: readOnly, charLimit: 100, typo: "SANS_3", placeholderColor: invert ? themes_1.colors.greyColor70 : themes_1.colors.greyColor40, value: imageData.caption, onChange: function (id, val) {
179
179
  console.log('in lex caption change handler', { imageData: imageData, caption: val, publicUrl: publicUrl });
180
- // handleSingleImageDataChange({
181
- // publicUrl,
182
- // imageData: { ...imageData, caption: val },
183
- // });
180
+ handleSingleImageDataChange({
181
+ publicUrl: publicUrl,
182
+ imageData: __assign(__assign({}, imageData), { caption: val }),
183
+ });
184
184
  } })),
185
185
  readOnly && react_1.default.createElement(Divider_1.Divider, { invert: invert })))))));
186
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.187.6",
3
+ "version": "2.187.8",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",