mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-02 19:36:12 +01:00 
			
		
		
		
	don't display mermaid if the note is encrypted without protected session
This commit is contained in:
		@@ -3,6 +3,7 @@ import noteAttributeCache from "../services/note_attribute_cache.js";
 | 
				
			|||||||
import ws from "../services/ws.js";
 | 
					import ws from "../services/ws.js";
 | 
				
			||||||
import options from "../services/options.js";
 | 
					import options from "../services/options.js";
 | 
				
			||||||
import froca from "../services/froca.js";
 | 
					import froca from "../services/froca.js";
 | 
				
			||||||
 | 
					import protectedSessionHolder from "../services/protected_session_holder.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const LABEL = 'label';
 | 
					const LABEL = 'label';
 | 
				
			||||||
const RELATION = 'relation';
 | 
					const RELATION = 'relation';
 | 
				
			||||||
@@ -812,6 +813,10 @@ class NoteShort {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    isContentAvailable() {
 | 
				
			||||||
 | 
					        return !this.isProtected || protectedSessionHolder.isProtectedSessionAvailable()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default NoteShort;
 | 
					export default NoteShort;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -180,8 +180,8 @@ export default class DesktopLayout {
 | 
				
			|||||||
                                .child(new SharedInfoWidget())
 | 
					                                .child(new SharedInfoWidget())
 | 
				
			||||||
                                .child(new NoteUpdateStatusWidget())
 | 
					                                .child(new NoteUpdateStatusWidget())
 | 
				
			||||||
                                .child(new FloatingButtons()
 | 
					                                .child(new FloatingButtons()
 | 
				
			||||||
                                    .child(new BacklinksWidget())
 | 
					 | 
				
			||||||
                                    .child(new RelationMapButtons())
 | 
					                                    .child(new RelationMapButtons())
 | 
				
			||||||
 | 
					                                    .child(new BacklinksWidget())
 | 
				
			||||||
                                )
 | 
					                                )
 | 
				
			||||||
                                .child(new MermaidWidget())
 | 
					                                .child(new MermaidWidget())
 | 
				
			||||||
                                .child(
 | 
					                                .child(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,6 +16,10 @@ const TPL = `
 | 
				
			|||||||
            z-index: 100;
 | 
					            z-index: 100;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        .floating-buttons-children > * {
 | 
				
			||||||
 | 
					            margin-left: 10px;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        .floating-buttons .floating-button {
 | 
					        .floating-buttons .floating-button {
 | 
				
			||||||
            font-size: 130%;
 | 
					            font-size: 130%;
 | 
				
			||||||
            padding: 5px 10px 4px 10px;
 | 
					            padding: 5px 10px 4px 10px;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,9 @@ let idCounter = 1;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export default class MermaidWidget extends NoteContextAwareWidget {
 | 
					export default class MermaidWidget extends NoteContextAwareWidget {
 | 
				
			||||||
    isEnabled() {
 | 
					    isEnabled() {
 | 
				
			||||||
        return super.isEnabled() && this.note && this.note.type === 'mermaid';
 | 
					        return super.isEnabled()
 | 
				
			||||||
 | 
					            && this.note?.type === 'mermaid'
 | 
				
			||||||
 | 
					            && this.note.isContentAvailable();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    doRender() {
 | 
					    doRender() {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user