diff --git a/src/file-io.ts b/src/file-io.ts index 06916e8..4d5ea88 100644 --- a/src/file-io.ts +++ b/src/file-io.ts @@ -12,27 +12,6 @@ export abstract class FileIO { abstract insertLine(lineNumber: number, text: string): Promise; abstract getLine(lineNumber: number): Promise; abstract getRange(position: Pos): Promise; - /** - * Check if the line at `lineNumber` can be safely overwritten. - * It was necessary for sure before, but I'm not sure if it is now, - * because now the JSON metadata of theorem callouts are hidden by a view plugin. - * I'll check it later. - * @param lineNumber - */ - abstract isSafe(lineNumber: number): boolean; - - async getBlockTextFromID(blockID: string, cache?: CachedMetadata): Promise { - cache = cache ?? this.plugin.app.metadataCache.getFileCache(this.file) ?? undefined; - if (cache) { - const sectionCache = cache.sections?.find( - (sectionCache) => sectionCache.id == blockID - ); - const position = sectionCache?.position; - if (position) { - return await this.getRange(position); - } - } - } } @@ -71,11 +50,6 @@ export class ActiveNoteIO extends FileIO { const text = this.editor.getRange(from, to); return text; } - - isSafe(lineNumber: number): boolean { - const cursorPos = this.editor.getCursor(); - return cursorPos.line != lineNumber; - } } @@ -90,10 +64,6 @@ export class NonActiveNoteIO extends FileIO { super(plugin, file); } - async getData(): Promise { - return this._data ?? (this._data = await this.plugin.app.vault.cachedRead(this.file)); - } - async setLine(lineNumber: number, text: string): Promise { this.plugin.app.vault.process(this.file, (data: string): string => { const lines = splitIntoLines(data); @@ -126,10 +96,6 @@ export class NonActiveNoteIO extends FileIO { const content = await this.plugin.app.vault.cachedRead(this.file); return content.slice(position.start.offset, position.end.offset); } - - isSafe(lineNumber: number): boolean { - return true; - } }