@pretextbook/web-editor 0.5.4 → 0.6.0
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/components/AssetManagerModal.d.ts +8 -3
- package/dist/components/Editors.d.ts +19 -4
- package/dist/index.es.js +3690 -510
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/sectionUtils.d.ts +1 -0
- package/dist/store/editorStore.d.ts +1 -0
- package/package.json +2 -2
|
@@ -12,12 +12,17 @@ export interface AssetManagerModalProps {
|
|
|
12
12
|
onAddFromLibrary?: (asset: Asset) => Promise<void> | void;
|
|
13
13
|
/** Upload an image file; host returns the created asset. */
|
|
14
14
|
onUpload?: (file: File) => Promise<Asset>;
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Fetch an external URL on the user's behalf (server-side, to avoid CORS)
|
|
17
|
+
* and return the raw file bytes. Must not create a persisted asset — the
|
|
18
|
+
* returned file is then committed via `onUpload`, the same as a local
|
|
19
|
+
* file pick, so there is a single code path that creates project assets.
|
|
20
|
+
*/
|
|
21
|
+
onFetchUrl?: (url: string) => Promise<File>;
|
|
17
22
|
/** Create a new Doenet activity; host returns the created asset. */
|
|
18
23
|
onCreateDoenet?: (name: string, ref: string) => Promise<Asset>;
|
|
19
24
|
/** Remove an asset from the project. */
|
|
20
25
|
onRemoveAsset?: (asset: Asset) => void;
|
|
21
26
|
}
|
|
22
|
-
declare const AssetManagerModal: ({ open, onClose, onLoadAssets, onLoadLibraryAssets, onInsert, onAddFromLibrary, onUpload,
|
|
27
|
+
declare const AssetManagerModal: ({ open, onClose, onLoadAssets, onLoadLibraryAssets, onInsert, onAddFromLibrary, onUpload, onFetchUrl, onCreateDoenet, onRemoveAsset, }: AssetManagerModalProps) => import("react").JSX.Element | null;
|
|
23
28
|
export default AssetManagerModal;
|
|
@@ -94,9 +94,19 @@ export interface editorProps {
|
|
|
94
94
|
*/
|
|
95
95
|
onDivisionSelect?: (xmlId: string) => void;
|
|
96
96
|
/**
|
|
97
|
-
* Called when the user creates a new division via the TOC UI
|
|
97
|
+
* Called when the user creates a new division via the TOC UI (including
|
|
98
|
+
* an auto-create triggered by typing a new `<plus:TYPE ref="..."/>`
|
|
99
|
+
* placeholder). `division` is the full local record — including the
|
|
100
|
+
* `xmlId` the editor picked — and should be persisted as-is.
|
|
101
|
+
*
|
|
102
|
+
* The division is added to the local pool synchronously and immediately,
|
|
103
|
+
* before this is called, so the host's `id` provisioning never blocks the
|
|
104
|
+
* UI. If a host needs to mint its own stable `id` (e.g. a Rails record
|
|
105
|
+
* id) for the division, it can return that id here; once the returned
|
|
106
|
+
* promise resolves, the editor patches it into the division's `id` field
|
|
107
|
+
* in place. `xmlId` is unaffected and is never remapped.
|
|
98
108
|
*/
|
|
99
|
-
onDivisionAdd?: (division: Division) => void;
|
|
109
|
+
onDivisionAdd?: (division: Division) => Promise<string> | void;
|
|
100
110
|
/**
|
|
101
111
|
* Called when the user deletes a division via the TOC UI.
|
|
102
112
|
*/
|
|
@@ -127,8 +137,13 @@ export interface editorProps {
|
|
|
127
137
|
onAssetAddFromLibrary?: (asset: Asset) => Promise<void> | void;
|
|
128
138
|
/** Called when the user uploads an image file. */
|
|
129
139
|
onAssetUpload?: (file: File) => Promise<Asset>;
|
|
130
|
-
/**
|
|
131
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Called when the user adds an image by URL. Should fetch the URL
|
|
142
|
+
* server-side (to avoid CORS) and return the raw file bytes — it must
|
|
143
|
+
* NOT create a persisted asset. The returned file is then committed via
|
|
144
|
+
* `onAssetUpload`, the same as a local file pick.
|
|
145
|
+
*/
|
|
146
|
+
onAssetFetchUrl?: (url: string) => Promise<File>;
|
|
132
147
|
/** Called when the user creates a new Doenet activity. */
|
|
133
148
|
onCreateDoenet?: (name: string, ref: string) => Promise<Asset>;
|
|
134
149
|
/** Called when the user removes an asset from the project. */
|