communication-react-19
Version:
React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)
23 lines • 835 B
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/* @conditional-compile-remove(rich-text-editor-image-upload) */
/**
* @private
*/
export const getImageAttachmentsFromHTMLContent = (content) => {
let imageAttachments;
// get image attachments from content,
// for the editing scenario, this includes the ones before editing and the newly added ones during editing.
const document = new DOMParser().parseFromString(content, 'text/html');
document.querySelectorAll('img').forEach((img) => {
if (imageAttachments === undefined) {
imageAttachments = [];
}
imageAttachments.push({
id: img.id,
attachmentType: 'image'
});
});
return imageAttachments;
};
//# sourceMappingURL=getImageAttachmentsFromHTMLContent.js.map