fix loading of string content saved as binary

This commit is contained in:
zadam
2023-06-14 22:21:22 +02:00
parent 8d2958738f
commit 75c6afd1c3
20 changed files with 64 additions and 66 deletions

View File

@@ -295,13 +295,16 @@ async function openDialog($dialog, closeActDialog = true) {
function isHtmlEmpty(html) {
if (!html) {
return true;
} else if (typeof html !== 'string') {
logError(`Got object of type '${typeof html}' where string was expected.`);
return false;
}
html = html.toLowerCase();
return !html.includes('<img')
&& !html.includes('<section')
// line below will actually attempt to load images so better to check for images first
// the line below will actually attempt to load images so better to check for images first
&& $("<div>").html(html).text().trim().length === 0;
}
@@ -579,7 +582,6 @@ export default {
sleep,
escapeRegExp,
formatNoteSize,
escapeRegExp,
areObjectsEqual,
copyHtmlToClipboard
};