@burger-editor/client 4.0.0-alpha.75 → 4.0.0-alpha.76
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/dist/client.js +178 -160
- package/dist/client.js.map +1 -1
- package/dist/{editable-area-view-DssYcTqQ.js → editable-area-view-S2Uz7pl8.js} +2 -2
- package/dist/{editable-area-view-DssYcTqQ.js.map → editable-area-view-S2Uz7pl8.js.map} +1 -1
- package/dist/{engine-context-gX6mWHke.js → engine-context-D0zt6fhJ.js} +48 -1
- package/dist/engine-context-D0zt6fhJ.js.map +1 -0
- package/dist/file-browser/store.d.ts +5 -0
- package/dist/file-browser/store.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/ui.js +12 -2
- package/dist/ui.js.map +1 -1
- package/package.json +6 -6
- package/dist/engine-context-gX6mWHke.js.map +0 -1
|
@@ -108,6 +108,11 @@ export declare class FileBrowserStore {
|
|
|
108
108
|
* `Preview` can both show it) and selecting the resulting URL once the
|
|
109
109
|
* server responds — a blob URL is selected immediately so the UI has
|
|
110
110
|
* something to show while the upload is in flight.
|
|
111
|
+
*
|
|
112
|
+
* The blob URL is revoked once the upload settles. On failure the
|
|
113
|
+
* selection is restored to what it was before the upload (empty path if
|
|
114
|
+
* nothing was selected), so a revoked blob URL is never left selected
|
|
115
|
+
* for the dialog to confirm.
|
|
111
116
|
* @param fileType - The file type to upload into
|
|
112
117
|
* @param file - The file to upload
|
|
113
118
|
* @throws {Error} When no `postFile` API is configured, or the server
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/file-browser/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,cAAc,EACd,QAAQ,EAER,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,Q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,OAAO,CAEvB;gBAEW,MAAM,EAAE,kBAAkB;IAItC;;;;;;OAMG;IACG,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhE;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAUpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IA4BtD;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,IAAI;IAU5D;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAkD3D;AAID;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,CAOhF"}
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UIStateStore, c as CommandBus, t as EngineProvider } from "./engine-context-
|
|
1
|
+
import { a as UIStateStore, c as CommandBus, t as EngineProvider } from "./engine-context-D0zt6fhJ.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { render } from "@testing-library/react";
|
|
4
4
|
import { afterEach, beforeEach, vi } from "vitest";
|
package/dist/ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as formatDate, n as useEngine, t as EngineProvider, u as formatByteSize } from "./engine-context-
|
|
2
|
-
import { _ as IconTrash, a as BlockMenuButton, c as reportRenderError, d as registerEngineCommands, f as useUIState, g as BlockCatalog, h as BlockOptions, i as BlockMenuView, l as reactMount, m as EditorDialog, n as InitialInsertionButton, o as useCommand, p as ItemEditorHost, r as BlockMenu, s as RootErrorBoundary, t as EditableAreaView, u as DraftSwitcher, v as IconRowInsertBottom, y as createReactComponent } from "./editable-area-view-
|
|
1
|
+
import { d as formatDate, n as useEngine, t as EngineProvider, u as formatByteSize } from "./engine-context-D0zt6fhJ.js";
|
|
2
|
+
import { _ as IconTrash, a as BlockMenuButton, c as reportRenderError, d as registerEngineCommands, f as useUIState, g as BlockCatalog, h as BlockOptions, i as BlockMenuView, l as reactMount, m as EditorDialog, n as InitialInsertionButton, o as useCommand, p as ItemEditorHost, r as BlockMenu, s as RootErrorBoundary, t as EditableAreaView, u as DraftSwitcher, v as IconRowInsertBottom, y as createReactComponent } from "./editable-area-view-S2Uz7pl8.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { Fragment, use, useDeferredValue, useEffect, useEffectEvent, useId, useRef, useState, useSyncExternalStore, useTransition } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -380,6 +380,11 @@ var FileBrowserStore = class {
|
|
|
380
380
|
* `Preview` can both show it) and selecting the resulting URL once the
|
|
381
381
|
* server responds — a blob URL is selected immediately so the UI has
|
|
382
382
|
* something to show while the upload is in flight.
|
|
383
|
+
*
|
|
384
|
+
* The blob URL is revoked once the upload settles. On failure the
|
|
385
|
+
* selection is restored to what it was before the upload (empty path if
|
|
386
|
+
* nothing was selected), so a revoked blob URL is never left selected
|
|
387
|
+
* for the dialog to confirm.
|
|
383
388
|
* @param fileType - The file type to upload into
|
|
384
389
|
* @param file - The file to upload
|
|
385
390
|
* @throws {Error} When no `postFile` API is configured, or the server
|
|
@@ -388,6 +393,7 @@ var FileBrowserStore = class {
|
|
|
388
393
|
async upload(fileType, file) {
|
|
389
394
|
const postFile = this.#engine.serverAPI.postFile;
|
|
390
395
|
const blob = URL.createObjectURL(file);
|
|
396
|
+
const previous = this.#state.selected[fileType];
|
|
391
397
|
this.select(fileType, blob, file.size);
|
|
392
398
|
this.#patch({ uploads: [...this.#state.uploads, {
|
|
393
399
|
fileType,
|
|
@@ -407,8 +413,12 @@ var FileBrowserStore = class {
|
|
|
407
413
|
if (res.error) throw new Error(`Failed to upload file: ${file.name}`);
|
|
408
414
|
this.invalidate(fileType);
|
|
409
415
|
this.select(fileType, res.uploaded.url, res.uploaded.size);
|
|
416
|
+
} catch (error) {
|
|
417
|
+
this.select(fileType, previous?.path ?? "", previous?.fileSize);
|
|
418
|
+
throw error;
|
|
410
419
|
} finally {
|
|
411
420
|
this.#patch({ uploads: this.#state.uploads.filter((u) => u.blob !== blob) });
|
|
421
|
+
URL.revokeObjectURL(blob);
|
|
412
422
|
}
|
|
413
423
|
}
|
|
414
424
|
#emit() {
|