try to thing

This commit is contained in:
ThatOneCalculator 2022-08-08 15:53:16 -07:00
parent a83adcc5a8
commit 50eb7b693f

View file

@ -7,7 +7,7 @@
<Mfm v-if="title" class="title" :text="title"/> <Mfm v-if="title" class="title" :text="title"/>
<span class="text-count" :class="{ over: remainingLength < 0 }">{{ remainingLength }}</span> <span class="text-count" :class="{ over: remainingLength < 0 }">{{ remainingLength }}</span>
</header> </header>
<textarea v-model="inputValue" autofocus :placeholder="input.placeholder" @keydown="onInputKeydown"></textarea> <textarea id="captioninput" v-model="inputValue" autofocus :placeholder="input.placeholder" @keydown="onInputKeydown"></textarea>
<div v-if="(showOkButton || showCaptionButton || showCancelButton)" class="buttons"> <div v-if="(showOkButton || showCaptionButton || showCancelButton)" class="buttons">
<MkButton inline primary :disabled="remainingLength < 0" @click="ok">{{ $ts.ok }}</MkButton> <MkButton inline primary :disabled="remainingLength < 0" @click="ok">{{ $ts.ok }}</MkButton>
<MkButton inline @click="caption" >{{ $ts.caption }}</MkButton> <MkButton inline @click="caption" >{{ $ts.caption }}</MkButton>
@ -153,7 +153,9 @@ export default defineComponent({
tessedit_pageseg_mode: PSM.SINGLE_BLOCK, tessedit_pageseg_mode: PSM.SINGLE_BLOCK,
}); });
const { data: { text } } = await worker.recognize(img); const { data: { text } } = await worker.recognize(img);
console.log(text); const allowedLength = 512 - this.inputValue.length;
// @ts-ignore
document.getElementById("captioninput").value += text.slice(0, allowedLength);
}, },
}, },
}); });