|
@@ -30,6 +30,7 @@ type Message =
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export class HunspellManager {
|
|
export class HunspellManager {
|
|
|
|
|
+ baseAssetPath: string
|
|
|
dictionariesRoot: string
|
|
dictionariesRoot: string
|
|
|
hunspellWorker!: Worker
|
|
hunspellWorker!: Worker
|
|
|
abortController: AbortController | undefined
|
|
abortController: AbortController | undefined
|
|
@@ -42,16 +43,13 @@ export class HunspellManager {
|
|
|
private readonly language: string,
|
|
private readonly language: string,
|
|
|
private readonly learnedWords: string[]
|
|
private readonly learnedWords: string[]
|
|
|
) {
|
|
) {
|
|
|
- const baseAssetPath = new URL(
|
|
|
|
|
|
|
+ this.baseAssetPath = new URL(
|
|
|
getMeta('ol-baseAssetPath'),
|
|
getMeta('ol-baseAssetPath'),
|
|
|
window.location.href
|
|
window.location.href
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- this.dictionariesRoot = new URL(
|
|
|
|
|
- getMeta('ol-dictionariesRoot'),
|
|
|
|
|
- baseAssetPath
|
|
|
|
|
).toString()
|
|
).toString()
|
|
|
|
|
|
|
|
|
|
+ this.dictionariesRoot = getMeta('ol-dictionariesRoot')
|
|
|
|
|
+
|
|
|
createWorker(() => {
|
|
createWorker(() => {
|
|
|
this.hunspellWorker = new Worker(
|
|
this.hunspellWorker = new Worker(
|
|
|
new URL('./hunspell.worker.ts', import.meta.url),
|
|
new URL('./hunspell.worker.ts', import.meta.url),
|
|
@@ -97,6 +95,7 @@ export class HunspellManager {
|
|
|
type: 'init',
|
|
type: 'init',
|
|
|
lang: this.language,
|
|
lang: this.language,
|
|
|
learnedWords: this.learnedWords, // TODO: add words
|
|
learnedWords: this.learnedWords, // TODO: add words
|
|
|
|
|
+ baseAssetPath: this.baseAssetPath,
|
|
|
dictionariesRoot: this.dictionariesRoot,
|
|
dictionariesRoot: this.dictionariesRoot,
|
|
|
})
|
|
})
|
|
|
for (const message of this.pendingMessages) {
|
|
for (const message of this.pendingMessages) {
|