mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
mobile: fix attachment progress not working
This commit is contained in:
@@ -163,6 +163,15 @@ if (typeof statusBar !== "undefined") {
|
||||
// `);
|
||||
};
|
||||
|
||||
setLoading = async (loading?: boolean, tabId?: number) => {
|
||||
await this.doAsync(`
|
||||
const editorController = editorControllers[${
|
||||
tabId || useTabStore.getState().currentTab
|
||||
}];
|
||||
editorController.setLoading(${loading})
|
||||
`);
|
||||
};
|
||||
|
||||
setInsets = async (insets: EdgeInsets) => {
|
||||
await this.doAsync(`
|
||||
if (typeof safeAreaController !== "undefined") {
|
||||
@@ -252,7 +261,7 @@ editor && editor.commands.insertAttachment(${JSON.stringify(attachment)})`
|
||||
) => {
|
||||
await this.doAsync(
|
||||
`const editor = editors[${tabId}];
|
||||
editor && editor.commands.setAttachmentProgress(${JSON.stringify(
|
||||
editor && editor.commands.updateAttachment(${JSON.stringify(
|
||||
attachmentProgress
|
||||
)}, {
|
||||
preventUpdate: true,
|
||||
@@ -273,7 +282,8 @@ editor && editor.commands.setAttachmentProgress(${JSON.stringify(
|
||||
`const editor = editors[${tabId}];
|
||||
|
||||
const image = toBlobURL("${image.dataurl}", "${image.hash}");
|
||||
editor && editor.commands.insertImage({
|
||||
|
||||
editor && editor.commands.insertImage({
|
||||
...${JSON.stringify({
|
||||
...image,
|
||||
dataurl: undefined
|
||||
@@ -283,39 +293,6 @@ const image = toBlobURL("${image.dataurl}", "${image.hash}");
|
||||
);
|
||||
};
|
||||
|
||||
updateWebclip = async (
|
||||
{ src, hash }: Partial<ImageAttributes>,
|
||||
tabId: number
|
||||
) => {
|
||||
await this.doAsync(
|
||||
`const editor = editors[${tabId}];
|
||||
editor && editor.commands.updateWebClip(${JSON.stringify({
|
||||
hash
|
||||
})},${JSON.stringify({ src })})`
|
||||
);
|
||||
};
|
||||
|
||||
updateImage = async (
|
||||
{
|
||||
hash,
|
||||
dataurl
|
||||
}: Partial<Omit<ImageAttributes, "bloburl">> & {
|
||||
dataurl: string;
|
||||
},
|
||||
tabId: number
|
||||
) => {
|
||||
await this.doAsync(
|
||||
`const editor = editors[${tabId}];
|
||||
const image = toBlobURL("${dataurl}", "${hash}");
|
||||
editor && editor.commands.updateImage(${JSON.stringify({
|
||||
hash
|
||||
})}, {
|
||||
...${JSON.stringify({ hash, preventUpdate: true })},
|
||||
bloburl: image
|
||||
})`
|
||||
);
|
||||
};
|
||||
|
||||
handleBack = async () => {
|
||||
return this.doAsync<boolean>(
|
||||
'response = window.dispatchEvent(new Event("handleBackPress",{cancelable:true}));'
|
||||
|
||||
Reference in New Issue
Block a user