mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	fix creating notes into options, #3517
This commit is contained in:
		@@ -1358,7 +1358,7 @@ class Note extends AbstractEntity {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    isOptions() {
 | 
					    isOptions() {
 | 
				
			||||||
        return this.noteId.startsWith("options");
 | 
					        return this.noteId.startsWith("_options");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    get isDeleted() {
 | 
					    get isDeleted() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -108,9 +108,14 @@ function getAndValidateParent(params) {
 | 
				
			|||||||
        throw new ValidationError(`Only 'launcher' notes can be created in parent '${params.parentNoteId}'`);
 | 
					        throw new ValidationError(`Only 'launcher' notes can be created in parent '${params.parentNoteId}'`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!params.ignoreForbiddenParents && (['_lbRoot', '_hidden'].includes(parentNote.noteId) || parentNote.isOptions())) {
 | 
					    if (!params.ignoreForbiddenParents) {
 | 
				
			||||||
 | 
					        if (['_lbRoot', '_hidden'].includes(parentNote.noteId)
 | 
				
			||||||
 | 
					            || parentNote.noteId.startsWith("_lbTpl")
 | 
				
			||||||
 | 
					            || parentNote.isOptions()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`);
 | 
					            throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return parentNote;
 | 
					    return parentNote;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user