Desktop: Fixes #10224: Images from behind a login cannot be pasted in RTE

This commit is contained in:
Laurent Cozic
2024-05-28 14:33:23 +01:00
parent 2386f583e8
commit d2a33b006b
+5 -2
View File
@@ -429,13 +429,16 @@ export const htmlDocIsImageOnly = (html: string) => {
let nonImageFound = false;
let textFound = false;
// Ignore these tags that do not result in any Markdown (or HTML) code being generated.
const ignoredTags = ['meta', 'head', 'body', 'html'];
const parser = new htmlparser2.Parser({
onopentag: (name: string) => {
if (name === 'img') {
imageCount++;
} else if (['meta'].includes(name)) {
// We allow these tags since they don't print anything
} else if (ignoredTags.includes(name)) {
// Skip
} else {
nonImageFound = true;
}