mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 05:57:32 -07:00
feat: ✨ Append caption to textarea
This commit is contained in:
parent
dc70a33545
commit
b3de04c164
2 changed files with 3 additions and 5 deletions
|
@ -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",
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue