Added some labels for Text Extractor
This commit is contained in:
@@ -25,15 +25,20 @@ async function getIndexedDocument(path: string): Promise<IndexedDocument> {
|
||||
let content: string | null = null
|
||||
|
||||
const extractor = getTextExtractor()
|
||||
// Plain text
|
||||
if (isFilePlaintext(path)) {
|
||||
content = await app.vault.cachedRead(file)
|
||||
} else if (extractor) {
|
||||
}
|
||||
// Image or PDF, with the text-extractor plugin
|
||||
else if (extractor) {
|
||||
if (extractor.canFileBeExtracted(path)) {
|
||||
content = await extractor.extractText(file)
|
||||
} else {
|
||||
throw new Error('Invalid file format: ' + file.path)
|
||||
}
|
||||
} else {
|
||||
}
|
||||
// Image or PDF, without the text-extractor plugin
|
||||
else {
|
||||
if (isFilePDF(path)) {
|
||||
content = await getPdfText(file)
|
||||
} else if (isFileImage(file.path)) {
|
||||
|
||||
@@ -192,15 +192,13 @@ async function cleanOldCacheFiles() {
|
||||
}
|
||||
|
||||
function executeFirstLaunchTasks(plugin: Plugin) {
|
||||
const code = '1.8.0-beta.3'
|
||||
const code = '1.10.0-beta.1'
|
||||
if (settings.welcomeMessage !== code) {
|
||||
const welcome = new DocumentFragment()
|
||||
welcome.createSpan({}, span => {
|
||||
span.innerHTML = `<strong>Omnisearch has been updated</strong>
|
||||
You can now enable "Images Indexing" to use Optical Character Recognition on your scanned documents
|
||||
🔎🖼`
|
||||
span.innerHTML = `🔎 Omnisearch will soon require the <strong>Text Extractor</strong> plugin to index PDF and images. See Omnisearch settings for more information.`
|
||||
})
|
||||
new Notice(welcome, 30000)
|
||||
new Notice(welcome, 20_000)
|
||||
}
|
||||
settings.welcomeMessage = code
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
} from 'obsidian'
|
||||
import { writable } from 'svelte/store'
|
||||
import { database } from './database'
|
||||
import { getTextExtractor } from './globals'
|
||||
import type OmnisearchPlugin from './main'
|
||||
|
||||
interface WeightingSettings {
|
||||
@@ -83,6 +84,20 @@ export class SettingsTab extends PluginSettingTab {
|
||||
|
||||
new Setting(containerEl).setName('Indexing').setHeading()
|
||||
|
||||
if (getTextExtractor()) {
|
||||
new Setting(containerEl).setDesc(
|
||||
'👍 You have installed Text Extractor, Omnisearch will use it to index PDFs and images.'
|
||||
)
|
||||
} else {
|
||||
const label = new DocumentFragment()
|
||||
label.createSpan({}, span => {
|
||||
span.innerHTML =
|
||||
`⚠️ Omnisearch will soon require <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.
|
||||
You can already install it to get a head start.`
|
||||
})
|
||||
new Setting(containerEl).setDesc(label)
|
||||
}
|
||||
|
||||
// PDF Indexing
|
||||
if (!Platform.isMobileApp) {
|
||||
const indexPDFsDesc = new DocumentFragment()
|
||||
|
||||
Reference in New Issue
Block a user