mirror of
https://github.com/zadam/trilium.git
synced 2026-05-06 17:06:46 +02:00
fix(ocr): use correct officeparser v6.1.0 API
v6.1.0 renamed parseOfficeAsync to OfficeParser.parseOffice (static method) and returns an AST object with toText() instead of a plain string. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import officeparser from 'officeparser';
|
||||
import type { OfficeParserConfig } from 'officeparser';
|
||||
import { OfficeParser, type OfficeParserConfig } from 'officeparser';
|
||||
|
||||
import log from '../../log.js';
|
||||
import { OCRProcessingOptions, OCRResult } from '../ocr_service.js';
|
||||
@@ -45,8 +44,8 @@ export class OfficeProcessor extends FileProcessor {
|
||||
|
||||
log.info(`Starting Office document text extraction for ${mimeType}...`);
|
||||
|
||||
const text = await officeparser.parseOfficeAsync(buffer, PARSER_CONFIG);
|
||||
const trimmed = text.trim();
|
||||
const ast = await OfficeParser.parseOffice(buffer, PARSER_CONFIG);
|
||||
const trimmed = ast.toText().trim();
|
||||
|
||||
return {
|
||||
text: trimmed,
|
||||
|
||||
Reference in New Issue
Block a user