#802 - Remove async update by retrieving folders from cache

This commit is contained in:
Elio Struyf
2024-06-06 14:35:41 +02:00
parent ec326a74ca
commit a22219c1b4
2 changed files with 9 additions and 6 deletions

View File

@@ -127,11 +127,6 @@ export class Article {
const update = ArticleHelper.generateUpdate(document, updatedArticle);
if (update) {
const editor = window.activeTextEditor;
await editor?.edit((builder) => builder.replace(update.range, update.newText));
}
return [update];
}
@@ -357,7 +352,7 @@ export class Article {
const autoUpdate = Settings.get(SETTING_AUTO_UPDATE_DATE);
// Is article located in one of the content folders
const folders = await Folders.get();
const folders = Folders.getCached();
const documentPath = parseWinPath(document.fileName);
const folder = folders.find((f) => documentPath.startsWith(f.path));
if (!folder) {

View File

@@ -448,6 +448,14 @@ export class Folders {
return Folders._folders;
}
/**
* Get the cached folder settings
* @returns {ContentFolder[]} - The cached folder settings
*/
public static getCached(): ContentFolder[] {
return Folders._folders;
}
/**
* Update the folder settings
* @param folders