You've already forked obsidian-visualiser
Fix UI for mobile render
This commit is contained in:
@@ -184,7 +184,30 @@ export class Content
|
||||
if(!overview)
|
||||
return;
|
||||
|
||||
return { ...overview, content: Content.fromString(overview, (await Content.read(id, { create: true }))!) };
|
||||
let content = await Content.read(id);
|
||||
if(content === undefined)
|
||||
{
|
||||
try
|
||||
{
|
||||
const apiContent = await useRequestFetch()(`/api/file/content/${id}`, { cache: 'no-cache' });
|
||||
if(apiContent)
|
||||
{
|
||||
content = apiContent;
|
||||
if(overview.type !== 'folder')
|
||||
Content.queue.queue(() => Content.write(id, content!, { create: true }));
|
||||
}
|
||||
else
|
||||
{
|
||||
overview.error = true;
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
overview.error = true;
|
||||
}
|
||||
}
|
||||
|
||||
return { ...overview, content: Content.fromString(overview, content!) };
|
||||
}
|
||||
static set(id: string, overview?: Omit<LocalContent, 'content'> | Recursive<Omit<LocalContent, 'content'>>)
|
||||
{
|
||||
@@ -251,20 +274,6 @@ export class Content
|
||||
{
|
||||
Content._overview[file.id] = file;
|
||||
Content._reverseMapping[file.path] = file.id;
|
||||
|
||||
Content.queue.queue(() => {
|
||||
return useRequestFetch()(`/api/file/content/${file.id}`, { cache: 'no-cache' }).then(async (content: string | undefined | null) => {
|
||||
if(content)
|
||||
{
|
||||
if(file.type !== 'folder')
|
||||
Content.queue.queue(() => Content.write(file.id, content, { create: true }));
|
||||
}
|
||||
else
|
||||
Content._overview[file.id]!.error = true;
|
||||
}).catch(e => {
|
||||
Content._overview[file.id]!.error = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
deletable.splice(deletable.findIndex(e => e === file.id), 1);
|
||||
|
||||
Reference in New Issue
Block a user