Move tokenState to work without backing token, add asset sync

This commit is contained in:
Mitchell McCaffrey
2021-04-23 17:10:10 +10:00
parent a023ef61ed
commit 245a9cee43
13 changed files with 198 additions and 285 deletions

View File

@@ -163,7 +163,8 @@ function SelectTokensModal({ isOpen, onRequestClose }) {
return new Promise((resolve, reject) => {
image.onload = async function () {
let assets = [];
const thumbnail = await createThumbnail(image, file.type);
const thumbnailImage = await createThumbnail(image, file.type);
const thumbnail = { ...thumbnailImage, id: uuid(), owner: userId };
assets.push(thumbnail);
const fileAsset = {
@@ -172,6 +173,7 @@ function SelectTokensModal({ isOpen, onRequestClose }) {
width: image.width,
height: image.height,
mime: file.type,
owner: userId,
};
assets.push(fileAsset);
@@ -186,7 +188,8 @@ function SelectTokensModal({ isOpen, onRequestClose }) {
lastUsed: Date.now(),
owner: userId,
defaultSize: 1,
category: "character",
defaultCategory: "character",
defaultLabel: "",
hideInSidebar: false,
group: "",
width: image.width,