feat: Append caption to textarea

This commit is contained in:
ThatOneCalculator 2022-10-27 15:28:02 -07:00
parent 2f8255cd5a
commit d459cb8ba2
2 changed files with 3 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{
"name": "calckey",
"version": "12.119.0-calc.6.1",
"version": "12.119.0-calc.6.2",
"codename": "aqua",
"repository": {
"type": "git",

View file

@ -7,7 +7,6 @@
<Mfm v-if="title" class="title" :text="title"/>
<span class="text-count" :class="{ over: remainingLength < 0 }">{{ remainingLength }}</span>
<br/>
<span id="recognized-text"></span>
</header>
<textarea id="captioninput" v-model="inputValue" autofocus :placeholder="input.placeholder" @keydown="onInputKeydown"></textarea>
<div v-if="(showOkButton || showCaptionButton || showCancelButton)" class="buttons">
@ -142,12 +141,11 @@ export default defineComponent({
caption() {
const img = document.getElementById('imgtocaption') as HTMLImageElement;
const ta = document.getElementById('captioninput') as HTMLTextAreaElement;
os.api('drive/files/caption-image', {
url: img.src,
}).then(text => {
document.getElementById('recognized-text').innerText = text;
const allowedLength = 512 - this.inputValue.length;
this.inputValue += text.slice(0, allowedLength);
ta.value += text.slice(0, (512 - ta.value.length));
});
},
},