mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	frontend now correctly changes folder status during moving / creating / deleting notes
This commit is contained in:
		@@ -289,6 +289,11 @@
 | 
				
			|||||||
                      url: baseUrl + 'notes/' + node.key,
 | 
					                      url: baseUrl + 'notes/' + node.key,
 | 
				
			||||||
                      type: 'DELETE',
 | 
					                      type: 'DELETE',
 | 
				
			||||||
                      success: function(result) {
 | 
					                      success: function(result) {
 | 
				
			||||||
 | 
					                        if (node.getParent() != null && node.getParent().getChildren().length <= 1) {
 | 
				
			||||||
 | 
					                          node.getParent().folder = false;
 | 
				
			||||||
 | 
					                          node.getParent().renderTitle();
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        node.remove();
 | 
					                        node.remove();
 | 
				
			||||||
                      }
 | 
					                      }
 | 
				
			||||||
                  });
 | 
					                  });
 | 
				
			||||||
@@ -325,6 +330,11 @@
 | 
				
			|||||||
                      type: 'PUT',
 | 
					                      type: 'PUT',
 | 
				
			||||||
                      contentType: "application/json",
 | 
					                      contentType: "application/json",
 | 
				
			||||||
                      success: function(result) {
 | 
					                      success: function(result) {
 | 
				
			||||||
 | 
					                        if (node.getParent() != null && node.getParent().getChildren().length <= 1) {
 | 
				
			||||||
 | 
					                          node.getParent().folder = false;
 | 
				
			||||||
 | 
					                          node.getParent().renderTitle();
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        node.moveTo(node.getParent(), 'after');
 | 
					                        node.moveTo(node.getParent(), 'after');
 | 
				
			||||||
                      }
 | 
					                      }
 | 
				
			||||||
                  });
 | 
					                  });
 | 
				
			||||||
@@ -342,6 +352,9 @@
 | 
				
			|||||||
                        node.moveTo(prevSibling);
 | 
					                        node.moveTo(prevSibling);
 | 
				
			||||||
                  
 | 
					                  
 | 
				
			||||||
                        prevSibling.setExpanded(true);
 | 
					                        prevSibling.setExpanded(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        prevSibling.folder = true;
 | 
				
			||||||
 | 
					                        prevSibling.renderTitle();
 | 
				
			||||||
                      }
 | 
					                      }
 | 
				
			||||||
                  });
 | 
					                  });
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -391,6 +404,9 @@
 | 
				
			|||||||
          }
 | 
					          }
 | 
				
			||||||
          else {
 | 
					          else {
 | 
				
			||||||
            node.addChildren(newNode).setActive(true);
 | 
					            node.addChildren(newNode).setActive(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            node.folder = true;
 | 
				
			||||||
 | 
					            node.renderTitle();
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          message("Created!");
 | 
					          message("Created!");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user