You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	This commit is contained in:
		| @@ -131,4 +131,15 @@ describe('interop/InteropService_Exporter_Md_frontmatter', () => { | ||||
| 		expect(content).not.toContain('longitude'); | ||||
| 		expect(content).not.toContain('altitude'); | ||||
| 	})); | ||||
|  | ||||
| 	test('should export note without tag keyword if the tag has been deleted', (async () => { | ||||
| 		const folder1 = await Folder.save({ title: 'folder1' }); | ||||
| 		const note = await Note.save({ title: 'NoTag', body: '**ma note**', parent_id: folder1.id }); | ||||
| 		const tag = await Tag.save({ title: 'tag' }); | ||||
| 		await Tag.setNoteTagsByIds(note.id, [tag.id]); | ||||
|  | ||||
| 		await Tag.delete(tag.id); | ||||
| 		const content = await exportAndLoad(`${exportDir()}/folder1/NoTag.md`); | ||||
| 		expect(content).not.toContain('tag'); | ||||
| 	})); | ||||
| }); | ||||
|   | ||||
| @@ -127,8 +127,12 @@ export default class InteropService_Exporter_Md_frontmatter extends InteropServi | ||||
| 		const context: FrontMatterContext = this.context(); | ||||
| 		if (context.noteTags[note.id]) { | ||||
| 			const tagIds = context.noteTags[note.id]; | ||||
| 			const tags = tagIds.map((id: string) => context.tagTitles[id]).sort(); | ||||
| 			md['tags'] = tags; | ||||
| 			// In some cases a NoteTag can still exist, while the Tag does not. In this case, tagTitles | ||||
| 			// for that tagId will return undefined, which can't be handled by the yaml library (issue #7782) | ||||
| 			const tags = tagIds.map((id: string) => context.tagTitles[id]).filter(e => !!e).sort(); | ||||
| 			if (tags.length > 0) { | ||||
| 				md['tags'] = tags; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		// This guarentees that fields will always be ordered the same way | ||||
|   | ||||
		Reference in New Issue
	
	Block a user