@newtonedev/editor 0.1.7 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtonedev/editor",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Shared color system editor for Newtone applications",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -314,26 +314,29 @@ export function useEditorState({
314
314
  if (debounceRef.current) clearTimeout(debounceRef.current);
315
315
  setPublishing(true);
316
316
 
317
- const currentState = latestStateRef.current;
318
- const updatedPresets = publishActivePreset(currentState);
319
- const [calibrations, fontMetrics] = await Promise.all([
320
- measureFontCalibrations(currentState.typography?.fonts),
321
- lookupFontMetrics(currentState.typography?.fonts, manifestUrl),
322
- ]);
323
-
324
- const { error } = await persistence.onPublish({
325
- state: currentState,
326
- presets: updatedPresets,
327
- activePresetId,
328
- calibrations,
329
- fontMetrics,
330
- });
331
-
332
- if (!error) {
333
- setSaveStatus("saved");
334
- setIsPublished(true);
317
+ try {
318
+ const currentState = latestStateRef.current;
319
+ const updatedPresets = publishActivePreset(currentState);
320
+ const [calibrations, fontMetrics] = await Promise.all([
321
+ measureFontCalibrations(currentState.typography?.fonts),
322
+ lookupFontMetrics(currentState.typography?.fonts, manifestUrl),
323
+ ]);
324
+
325
+ const { error } = await persistence.onPublish({
326
+ state: currentState,
327
+ presets: updatedPresets,
328
+ activePresetId,
329
+ calibrations,
330
+ fontMetrics,
331
+ });
332
+
333
+ if (!error) {
334
+ setSaveStatus("saved");
335
+ setIsPublished(true);
336
+ }
337
+ } finally {
338
+ setPublishing(false);
335
339
  }
336
- setPublishing(false);
337
340
  }, [activePresetId, publishActivePreset, persistence, manifestUrl]);
338
341
 
339
342
  // --- beforeunload warning ---