1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-18 23:07:45 +02:00

Desktop, Cli: Fixed various bugs related to the import of ENEX files as HTML

This commit is contained in:
Laurent Cozic
2020-06-15 17:10:51 +01:00
parent 6a41d6e85a
commit fcd00b3212
7 changed files with 62 additions and 38 deletions

View File

@ -7,6 +7,28 @@ const htmlentities = new Entities().encode;
const imageRegex = /<img([\s\S]*?)src=["']([\s\S]*?)["']([\s\S]*?)>/gi;
const anchorRegex = /<a([\s\S]*?)href=["']([\s\S]*?)["']([\s\S]*?)>/gi;
const selfClosingElements = [
'area',
'base',
'basefont',
'br',
'col',
'command',
'embed',
'frame',
'hr',
'img',
'input',
'isindex',
'keygen',
'link',
'meta',
'param',
'source',
'track',
'wbr',
];
class HtmlUtils {
headAndBodyHtml(doc) {
const output = [];
@ -15,6 +37,10 @@ class HtmlUtils {
return output.join('\n');
}
isSelfClosingTag(tagName) {
return selfClosingElements.includes(tagName.toLowerCase());
}
extractImageUrls(html) {
if (!html) return [];