refactor: enhance image uploading feedback in message editors with new class handling

This commit is contained in:
mlogclub
2026-04-25 18:15:46 +08:00
parent 65d8a9267c
commit 7945fc32f6
3 changed files with 17 additions and 2 deletions
+11
View File
@@ -40,9 +40,20 @@ export function markEditorImageUploadedByTitle(
image.setAttribute("data-provider", uploaded.provider)
image.setAttribute("data-storage-key", uploaded.storageKey)
image.setAttribute("alt", uploaded.filename || image.getAttribute("alt") || "image")
image.classList.remove("cs-agent-editor-image-uploading")
image.removeAttribute("data-uploading")
image.removeAttribute("title")
}
export function setEditorImageUploadingByTitle(editor: Editor, title: string) {
const image = findEditorImageElementByTitle(editor, title)
if (!image) {
return
}
image.classList.add("cs-agent-editor-image-uploading")
image.setAttribute("data-uploading", "true")
}
export function buildSendableEditorHTML(
html: string,
uploadedImages?: UploadedEditorImageMap