mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-17 18:44:45 +02:00
Desktop, Mobile: Fixes #5687: Fixed issue with parts of HTML notes not being displayed in some cases
This commit is contained in:
parent
f8d9601ff7
commit
4deeed0d5c
@ -0,0 +1,3 @@
|
|||||||
|
<en-note>
|
||||||
|
<h1 style="box-sizing:inherit;font-family:"Guardian TextSans Web", "Helvetica Neue", Helvetica, Arial, sans-serif;margin-top:0.2em;margin-bottom:0.35em;font-size:2.125em;font-weight:600;line-height:1.3;">Association Between mRNA Vaccination and COVID-19 Hospitalization and Disease Severity</h1>
|
||||||
|
</en-note>
|
@ -0,0 +1,3 @@
|
|||||||
|
<en-note>
|
||||||
|
<h1 style="box-sizing:inherit;font-family:"Guardian TextSans Web", "Helvetica Neue", Helvetica, Arial, sans-serif;margin-top:0.2em;margin-bottom:0.35em;font-size:2.125em;font-weight:600;line-height:1.3;">Association Between mRNA Vaccination and COVID-19 Hospitalization and Disease Severity</h1>
|
||||||
|
</en-note>
|
@ -0,0 +1 @@
|
|||||||
|
<a data-from-md href='#'>test</a>
|
@ -0,0 +1 @@
|
|||||||
|
<a>test</a>
|
@ -41,6 +41,11 @@ const beautifyHtml = (html) => {
|
|||||||
* `<content><![CDATA[...]]</content>`.
|
* `<content><![CDATA[...]]</content>`.
|
||||||
*/
|
*/
|
||||||
const compareOutputToExpected = (options) => {
|
const compareOutputToExpected = (options) => {
|
||||||
|
options = {
|
||||||
|
resources: [],
|
||||||
|
...options,
|
||||||
|
};
|
||||||
|
|
||||||
const inputFile = fileWithPath(`${options.testName}.enex`);
|
const inputFile = fileWithPath(`${options.testName}.enex`);
|
||||||
const outputFile = fileWithPath(`${options.testName}.html`);
|
const outputFile = fileWithPath(`${options.testName}.html`);
|
||||||
const testTitle = `should convert from Enex to Html: ${options.testName}`;
|
const testTitle = `should convert from Enex to Html: ${options.testName}`;
|
||||||
@ -62,12 +67,10 @@ describe('EnexToHtml', function() {
|
|||||||
|
|
||||||
compareOutputToExpected({
|
compareOutputToExpected({
|
||||||
testName: 'checklist-list',
|
testName: 'checklist-list',
|
||||||
resources: [],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
compareOutputToExpected({
|
compareOutputToExpected({
|
||||||
testName: 'svg',
|
testName: 'svg',
|
||||||
resources: [],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
compareOutputToExpected({
|
compareOutputToExpected({
|
||||||
@ -96,6 +99,10 @@ describe('EnexToHtml', function() {
|
|||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
compareOutputToExpected({
|
||||||
|
testName: 'quoted-attributes',
|
||||||
|
});
|
||||||
|
|
||||||
// it('fails when not given a matching resource', (async () => {
|
// it('fails when not given a matching resource', (async () => {
|
||||||
// // To test the promise-unexpectedly-resolved case, add `audioResource` to the array.
|
// // To test the promise-unexpectedly-resolved case, add `audioResource` to the array.
|
||||||
// const resources = [];
|
// const resources = [];
|
||||||
|
@ -39,7 +39,7 @@ const imageMimeTypes = [
|
|||||||
'image/vnd.xiff',
|
'image/vnd.xiff',
|
||||||
];
|
];
|
||||||
|
|
||||||
const escapeQuotes = (str) => str.replace(/"/g, '"');
|
const escapeQuotes = (str) => str.replace(/"/g, '"');
|
||||||
|
|
||||||
const attributesToStr = (attributes) =>
|
const attributesToStr = (attributes) =>
|
||||||
Object.entries(attributes)
|
Object.entries(attributes)
|
||||||
|
@ -192,6 +192,15 @@ class HtmlUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For some reason, entire parts of HTML notes don't show up in
|
||||||
|
// the viewer when there's an anchor tag without an "href"
|
||||||
|
// attribute. It doesn't always happen and it seems to depend on
|
||||||
|
// what else is in the note but in any case adding the "href"
|
||||||
|
// fixes it. https://github.com/laurent22/joplin/issues/5687
|
||||||
|
if (name.toLowerCase() === 'a' && !attrs['href']) {
|
||||||
|
attrs['href'] = '#';
|
||||||
|
}
|
||||||
|
|
||||||
let attrHtml = this.attributesHtml(attrs);
|
let attrHtml = this.attributesHtml(attrs);
|
||||||
if (attrHtml) attrHtml = ` ${attrHtml}`;
|
if (attrHtml) attrHtml = ` ${attrHtml}`;
|
||||||
const closingSign = this.isSelfClosingTag(name) ? '/>' : '>';
|
const closingSign = this.isSelfClosingTag(name) ? '/>' : '>';
|
||||||
|
Loading…
Reference in New Issue
Block a user