feat: Insert text at cursor for caption

This commit is contained in:
ThatOneCalculator 2022-12-16 10:25:05 -08:00
parent e2dbed7ec7
commit 7e076cff75
No known key found for this signature in database
GPG key ID: 8703CACD01000000
3 changed files with 4 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "calckey", "name": "calckey",
"version": "13.0.0", "version": "13.0.1",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -31,6 +31,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import insertTextAtCursor from 'insert-text-at-cursor';
import { length } from 'stringz'; import { length } from 'stringz';
import * as os from '@/os'; import * as os from '@/os';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
@ -147,7 +148,7 @@ export default defineComponent({
os.api('drive/files/caption-image', { os.api('drive/files/caption-image', {
url: img.src, url: img.src,
}).then(text => { }).then(text => {
ta.value += text.slice(0, (512 - ta.value.length)); insertTextAtCursor(text.slice(0, (512 - ta.value.length)));
}); });
}, },
}, },

View file

@ -22,7 +22,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { watch } from 'vue'; import { watch } from 'vue';
import * as misskey from 'calckey-js'; import type * as misskey from 'calckey-js';
import { getStaticImageUrl } from '@/scripts/get-static-image-url'; import { getStaticImageUrl } from '@/scripts/get-static-image-url';
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue'; import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';