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",
|
"name": "calckey",
|
||||||
"version": "12.119.0-calc.6.1",
|
"version": "12.119.0-calc.6.2",
|
||||||
"codename": "aqua",
|
"codename": "aqua",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
<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>
|
||||||
<br/>
|
<br/>
|
||||||
<span id="recognized-text"></span>
|
|
||||||
</header>
|
</header>
|
||||||
<textarea id="captioninput" 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">
|
||||||
|
@ -142,12 +141,11 @@ export default defineComponent({
|
||||||
|
|
||||||
caption() {
|
caption() {
|
||||||
const img = document.getElementById('imgtocaption') as HTMLImageElement;
|
const img = document.getElementById('imgtocaption') as HTMLImageElement;
|
||||||
|
const ta = document.getElementById('captioninput') as HTMLTextAreaElement;
|
||||||
os.api('drive/files/caption-image', {
|
os.api('drive/files/caption-image', {
|
||||||
url: img.src,
|
url: img.src,
|
||||||
}).then(text => {
|
}).then(text => {
|
||||||
document.getElementById('recognized-text').innerText = text;
|
ta.value += text.slice(0, (512 - ta.value.length));
|
||||||
const allowedLength = 512 - this.inputValue.length;
|
|
||||||
this.inputValue += text.slice(0, allowedLength);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue