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:
parent
1275cb7fc5
commit
278eae387c
|
|
@ -274,17 +274,17 @@ const CustomImage = Image.extend({
|
||||||
|
|
||||||
const img = document.getElementById(id)
|
const img = document.getElementById(id)
|
||||||
|
|
||||||
if (!img) return
|
if (!img || !(img instanceof HTMLImageElement)) return
|
||||||
|
|
||||||
if (typeof loadedAttachments.value[cacheKey] === 'undefined') {
|
if (typeof loadedAttachments.value[cacheKey] === 'undefined') {
|
||||||
|
|
||||||
const attachment = new AttachmentModel({taskId: taskId, id: attachmentId})
|
const attachment = new AttachmentModel({taskId: taskId, id: attachmentId})
|
||||||
|
|
||||||
const attachmentService = new AttachmentService()
|
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, {
|
return ['img', mergeAttributes(this.options.HTMLAttributes, {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue