mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	generate css classes for each mime type, #328
This commit is contained in:
		
							parent
							
								
									f88cdac000
								
							
						
					
					
						commit
						6a3e7a5a8e
					
				| @ -168,9 +168,24 @@ async function getExtraClasses(note) { | |||||||
| 
 | 
 | ||||||
|     extraClasses.push(note.type); |     extraClasses.push(note.type); | ||||||
| 
 | 
 | ||||||
|  |     if (note.mime) { // some notes should not have mime type (e.g. render)
 | ||||||
|  |         extraClasses.push(getMimeTypeClass(note.mime)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     return extraClasses.join(" "); |     return extraClasses.join(" "); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function getMimeTypeClass(mime) { | ||||||
|  |     const semicolonIdx = mime.indexOf(';'); | ||||||
|  | 
 | ||||||
|  |     if (semicolonIdx !== -1) { | ||||||
|  |         // stripping everything following the semicolon
 | ||||||
|  |         mime = mime.substr(0, semicolonIdx); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return 'mime-' + mime.toLowerCase().replace(/[\W_]+/g,"-"); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| export default { | export default { | ||||||
|     prepareTree, |     prepareTree, | ||||||
|     prepareBranch, |     prepareBranch, | ||||||
|  | |||||||
| @ -802,3 +802,8 @@ div[data-notify="container"] { | |||||||
|         transform: rotate(360deg); |         transform: rotate(360deg); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | .ck-content .image > figcaption { | ||||||
|  |     color: var(--main-text-color); | ||||||
|  |     background-color: var(--accented-background-color); | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner