mirror of
https://github.com/meld-cp/obsidian-build.git
synced 2026-07-22 07:30:25 +00:00
use cachedRead instead of read
This commit is contained in:
parent
214df0d6fb
commit
26181f02dc
3 changed files with 7 additions and 10 deletions
|
|
@ -12,7 +12,7 @@ export class Parser {
|
|||
const result: NamedCodeBlock[] = [];
|
||||
|
||||
const file = view.file;
|
||||
const fileContent = await view.app.vault.read(file);
|
||||
const fileContent = await view.app.vault.cachedRead(file);
|
||||
const fileCache = view.app.metadataCache.getFileCache( file );
|
||||
|
||||
if ( fileCache == null ){
|
||||
|
|
@ -210,7 +210,7 @@ export class Parser {
|
|||
} = {};
|
||||
|
||||
const file = view.file;
|
||||
const fileContent = await view.app.vault.read(file);
|
||||
const fileContent = await view.app.vault.cachedRead(file);
|
||||
const fileCache = view.app.metadataCache.getFileCache( file );
|
||||
|
||||
if ( fileCache == null ){
|
||||
|
|
@ -232,9 +232,6 @@ export class Parser {
|
|||
}
|
||||
if ( section.type == 'table' ){
|
||||
|
||||
// const from = editor.offsetToPos(section.position.start.offset);
|
||||
// const to = editor.offsetToPos(section.position.end.offset);
|
||||
// const table = editor.getRange( from, to );
|
||||
const table = fileContent.slice(
|
||||
section.position.start.offset,
|
||||
section.position.end.offset
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ export class IoRunContextImplementation implements TIoRunContext {
|
|||
if (file instanceof TFile){
|
||||
|
||||
if ( file.extension == 'csv'){
|
||||
const csvdata = await this.vault.read( file );
|
||||
const dataSet = pzr.loadCsv(csvdata);
|
||||
const csvData = await this.vault.cachedRead( file );
|
||||
const dataSet = pzr.loadCsv(csvData);
|
||||
this.data[name??file.basename] = dataSet;
|
||||
return dataSet;
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ export class IoRunContextImplementation implements TIoRunContext {
|
|||
}
|
||||
|
||||
if ( file.extension == 'md' ){
|
||||
const content = await this.vault.read( file );
|
||||
const content = await this.vault.cachedRead( file );
|
||||
const pzr = new Parser();
|
||||
pzr.applyMarkdownContent(
|
||||
file.basename,
|
||||
|
|
@ -94,7 +94,7 @@ export class IoRunContextImplementation implements TIoRunContext {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
return await this.vault.read(af)
|
||||
return await this.vault.cachedRead(af)
|
||||
}
|
||||
|
||||
async load_data(path: string, name?: string | undefined): Promise<DataSet> {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export class MarkerRunContextImplementation implements TMarkerRunContext {
|
|||
|
||||
private async getTargetContents() : Promise<string>{
|
||||
const targetFile = this.getTargetFileOrThrow();
|
||||
return await this.vault.read( targetFile );
|
||||
return await this.vault.cachedRead( targetFile );
|
||||
}
|
||||
|
||||
async fetch(): Promise<MarkerValue[]> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue