1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Desktop: Add support for OCR (#8975)

This commit is contained in:
Laurent Cozic
2023-12-13 19:24:58 +00:00
committed by GitHub
parent 0e847685ff
commit bce94f1775
79 changed files with 2381 additions and 445 deletions

View File

@@ -346,16 +346,21 @@ class BaseModel {
});
}
public static modelSelectAll(sql: string, params: any[] = null) {
public static modelSelectAll<T = any>(sql: string, params: any[] = null): Promise<T[]> {
if (params === null) params = [];
return this.db()
.selectAll(sql, params)
// eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied
.then((models: any[]) => {
return this.filterArray(this.addModelMd(models));
return this.filterArray(this.addModelMd(models)) as T[];
});
}
protected static selectFields(options: LoadOptions): string {
if (!options || !options.fields) return '*';
return this.db().escapeFieldsToString(options.fields);
}
public static loadByField(fieldName: string, fieldValue: any, options: LoadOptions = null) {
if (!options) options = {};
if (!('caseInsensitive' in options)) options.caseInsensitive = false;