You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Desktop, Mobile: Fixes #5687: Fixed issue with parts of HTML notes not being displayed in some cases
This commit is contained in:
		| @@ -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>`. | ||||
|  */ | ||||
| const compareOutputToExpected = (options) => { | ||||
| 	options = { | ||||
| 		resources: [], | ||||
| 		...options, | ||||
| 	}; | ||||
|  | ||||
| 	const inputFile = fileWithPath(`${options.testName}.enex`); | ||||
| 	const outputFile = fileWithPath(`${options.testName}.html`); | ||||
| 	const testTitle = `should convert from Enex to Html: ${options.testName}`; | ||||
| @@ -62,12 +67,10 @@ describe('EnexToHtml', function() { | ||||
|  | ||||
| 	compareOutputToExpected({ | ||||
| 		testName: 'checklist-list', | ||||
| 		resources: [], | ||||
| 	}); | ||||
|  | ||||
| 	compareOutputToExpected({ | ||||
| 		testName: 'svg', | ||||
| 		resources: [], | ||||
| 	}); | ||||
|  | ||||
| 	compareOutputToExpected({ | ||||
| @@ -96,6 +99,10 @@ describe('EnexToHtml', function() { | ||||
| 		}], | ||||
| 	}); | ||||
|  | ||||
| 	compareOutputToExpected({ | ||||
| 		testName: 'quoted-attributes', | ||||
| 	}); | ||||
|  | ||||
| 	// it('fails when not given a matching resource', (async () => { | ||||
| 	// 	// To test the promise-unexpectedly-resolved case, add `audioResource` to the array. | ||||
| 	// 	const resources = []; | ||||
|   | ||||
| @@ -39,7 +39,7 @@ const imageMimeTypes = [ | ||||
| 	'image/vnd.xiff', | ||||
| ]; | ||||
|  | ||||
| const escapeQuotes = (str) => str.replace(/"/g, '"'); | ||||
| const escapeQuotes = (str) => str.replace(/"/g, '"'); | ||||
|  | ||||
| const attributesToStr = (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); | ||||
| 				if (attrHtml) attrHtml = ` ${attrHtml}`; | ||||
| 				const closingSign = this.isSelfClosingTag(name) ? '/>' : '>'; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user