Share toolbox components and fix image and calendar updates
Some checks failed
Deploy Sokko G / deploy (push) Failing after 2s
Some checks failed
Deploy Sokko G / deploy (push) Failing after 2s
This commit is contained in:
parent
865a4ffd97
commit
34524d2961
13 changed files with 117 additions and 93 deletions
|
|
@ -86,7 +86,6 @@ export function useToolboxActions({ store, notify, creationTemplate, setConfirmM
|
|||
async function addImageFiles(toolboxId, moduleId, files) {
|
||||
const imageFiles = [...files].filter((file) => file?.type?.startsWith("image/"));
|
||||
if (!imageFiles.length) return false;
|
||||
const data = store.getModuleData(toolboxId, moduleId, { images: [] });
|
||||
const images = [];
|
||||
for (const file of imageFiles) {
|
||||
const image = { id: uid("image"), dataUrl: await compressImage(file) };
|
||||
|
|
@ -94,6 +93,7 @@ export function useToolboxActions({ store, notify, creationTemplate, setConfirmM
|
|||
if (label) image.label = label;
|
||||
images.unshift(image);
|
||||
}
|
||||
const data = store.getModuleData(toolboxId, moduleId, { images: [] });
|
||||
return store.updateModuleData(toolboxId, moduleId, {
|
||||
...data,
|
||||
images: [...images, ...(Array.isArray(data.images) ? data.images : [])]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue