fix(components): add type guards and assertions in TipTap.vue

- Add HTMLImageElement instanceof check before accessing src property
- Add type assertions for getBlobUrl return value and cache access
This commit is contained in:
kolaente
2025-11-22 16:21:44 +01:00
parent 1275cb7fc5
commit 278eae387c

View File

@@ -274,17 +274,17 @@ const CustomImage = Image.extend({
const img = document.getElementById(id)
if (!img) return
if (!img || !(img instanceof HTMLImageElement)) return
if (typeof loadedAttachments.value[cacheKey] === 'undefined') {
const attachment = new AttachmentModel({taskId: taskId, id: attachmentId})
const attachmentService = new AttachmentService()
loadedAttachments.value[cacheKey] = await attachmentService.getBlobUrl(attachment)
loadedAttachments.value[cacheKey] = await attachmentService.getBlobUrl(attachment) as string
}
img.src = loadedAttachments.value[cacheKey]
img.src = loadedAttachments.value[cacheKey] as string
})
return ['img', mergeAttributes(this.options.HTMLAttributes, {