mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	Allow attachments to be included in the scripts, closes #66
This commit is contained in:
		| @@ -24,7 +24,8 @@ class Note extends Entity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     isJavaScript() { |     isJavaScript() { | ||||||
|         return this.type === "code" && this.mime === "application/javascript"; |         return (this.type === "code" || this.type === "file") | ||||||
|  |             && (this.mime === "application/javascript" || this.mime === "application/x-javascript"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async getAttributes() { |     async getAttributes() { | ||||||
|   | |||||||
| @@ -63,8 +63,10 @@ async function getSubTreeScripts(parentId, includedNoteIds, repository, isJavaSc | |||||||
|                                       SELECT notes.*  |                                       SELECT notes.*  | ||||||
|                                       FROM notes JOIN note_tree USING(noteId) |                                       FROM notes JOIN note_tree USING(noteId) | ||||||
|                                       WHERE note_tree.isDeleted = 0 AND notes.isDeleted = 0 |                                       WHERE note_tree.isDeleted = 0 AND notes.isDeleted = 0 | ||||||
|                                            AND note_tree.parentNoteId = ? AND notes.type = 'code' |                                            AND note_tree.parentNoteId = ? AND (notes.type = 'code' OR notes.type = 'file') | ||||||
|                                            AND (notes.mime = 'application/javascript' OR notes.mime = 'text/html')`, [parentId]); |                                            AND (notes.mime = 'application/javascript'  | ||||||
|  |                                                 OR notes.mime = 'application/x-javascript'  | ||||||
|  |                                                 OR notes.mime = 'text/html')`, [parentId]); | ||||||
|  |  | ||||||
|     let script = "\r\n"; |     let script = "\r\n"; | ||||||
|  |  | ||||||
| @@ -77,7 +79,7 @@ async function getSubTreeScripts(parentId, includedNoteIds, repository, isJavaSc | |||||||
|  |  | ||||||
|         script += await getSubTreeScripts(child.noteId, includedNoteIds, repository); |         script += await getSubTreeScripts(child.noteId, includedNoteIds, repository); | ||||||
|  |  | ||||||
|         if (!isJavaScript && child.mime === 'application/javascript') { |         if (!isJavaScript && child.isJavaScript()) { | ||||||
|             child.content = '<script>' + child.content + '</script>'; |             child.content = '<script>' + child.content + '</script>'; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user