mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 11:39:01 +01:00 
			
		
		
		
	fix(in-app-help): style error when loading a note
This commit is contained in:
		
							parent
							
								
									3796818a78
								
							
						
					
					
						commit
						d901a0f787
					
				| @ -41,16 +41,15 @@ export default class DocTypeWidget extends TypeWidget { | |||||||
| 
 | 
 | ||||||
|     #loadContent(note: FNote) { |     #loadContent(note: FNote) { | ||||||
|         return new Promise<void>((resolve) => { |         return new Promise<void>((resolve) => { | ||||||
|             const docName = note.getLabelValue("docName"); |             let docName = note.getLabelValue("docName"); | ||||||
| 
 | 
 | ||||||
|             if (docName) { |             if (docName) { | ||||||
|                 // find doc based on language
 |                 // find doc based on language
 | ||||||
|                 const lng = i18next.language; |                 const url = this.#getUrl(docName, i18next.language); | ||||||
|                 const url = `${window.glob.appPath}/doc_notes/${lng}/${docName}.html`.replaceAll(" ", "%20"); |  | ||||||
|                 this.$content.load(url, (response, status) => { |                 this.$content.load(url, (response, status) => { | ||||||
|                     // fallback to english doc if no translation available
 |                     // fallback to english doc if no translation available
 | ||||||
|                     if (status === "error") { |                     if (status === "error") { | ||||||
|                         const fallbackUrl = `${window.glob.appPath}/doc_notes/en/${docName}.html`; |                         const fallbackUrl = this.#getUrl(docName, "en"); | ||||||
|                         this.$content.load(fallbackUrl, () => this.#processContent(fallbackUrl)); |                         this.$content.load(fallbackUrl, () => this.#processContent(fallbackUrl)); | ||||||
|                         resolve(); |                         resolve(); | ||||||
|                         return; |                         return; | ||||||
| @ -65,6 +64,19 @@ export default class DocTypeWidget extends TypeWidget { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #getUrl(docNameValue: string, language: string) { | ||||||
|  |         // For help notes, we only get the content to avoid loading of styles and meta.
 | ||||||
|  |         let suffix = ""; | ||||||
|  |         if (docNameValue?.startsWith("User Guide")) { | ||||||
|  |             suffix = " .content"; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // Cannot have spaces in the URL due to how JQuery.load works.
 | ||||||
|  |         docNameValue = docNameValue.replaceAll(" ", "%20"); | ||||||
|  | 
 | ||||||
|  |         return `${window.glob.appPath}/doc_notes/${language}/${docNameValue}.html${suffix}`; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     #processContent(url: string) { |     #processContent(url: string) { | ||||||
|         const dir = url.substring(0, url.lastIndexOf("/")); |         const dir = url.substring(0, url.lastIndexOf("/")); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran