1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Chore: Apply eslint rules

This commit is contained in:
Laurent Cozic
2019-09-19 22:51:18 +01:00
parent ab29d7e872
commit e648392330
185 changed files with 1196 additions and 1196 deletions

View File

@ -22,11 +22,11 @@ function installRule(markdownIt, mdOptions, ruleOptions) {
if (result && resourceStatus !== 'ready') {
const icon = utils.resourceStatusFile(resourceStatus);
return '<a class="not-loaded-resource resource-status-' + resourceStatus + '" data-resource-id="' + resourceId + '">' + '<img src="data:image/svg+xml;utf8,' + htmlentities(icon) + '"/>';
return `<a class="not-loaded-resource resource-status-${resourceStatus}" data-resource-id="${resourceId}">` + `<img src="data:image/svg+xml;utf8,${htmlentities(icon)}"/>`;
} else {
href = 'joplin://' + resourceId;
if (resourceHrefInfo.hash) href += '#' + resourceHrefInfo.hash;
resourceIdAttr = 'data-resource-id=\'' + resourceId + '\'';
href = `joplin://${resourceId}`;
if (resourceHrefInfo.hash) href += `#${resourceHrefInfo.hash}`;
resourceIdAttr = `data-resource-id='${resourceId}'`;
icon = '<span class="resource-icon"></span>';
}
} else {
@ -35,9 +35,9 @@ function installRule(markdownIt, mdOptions, ruleOptions) {
hrefAttr = href;
}
let js = ruleOptions.postMessageSyntax + '(' + JSON.stringify(href) + '); return false;';
let js = `${ruleOptions.postMessageSyntax}(${JSON.stringify(href)}); return false;`;
if (hrefAttr.indexOf('#') === 0 && href.indexOf('#') === 0) js = ''; // If it's an internal anchor, don't add any JS since the webview is going to handle navigating to the right place
return '<a data-from-md ' + resourceIdAttr + ' title=\'' + htmlentities(title) + '\' href=\'' + hrefAttr + '\' onclick=\'' + js + '\'>' + icon;
return `<a data-from-md ${resourceIdAttr} title='${htmlentities(title)}' href='${hrefAttr}' onclick='${js}'>${icon}`;
};
}