mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	improvements in frontend sync (WIP)
This commit is contained in:
		| @@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then | |||||||
|     exit 1 |     exit 1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
| n exec 14.17.2 npm run webpack | n exec 14.17.5 npm run webpack | ||||||
|  |  | ||||||
| DIR=$1 | DIR=$1 | ||||||
|  |  | ||||||
| @@ -27,7 +27,7 @@ cp -r electron.js $DIR/ | |||||||
| cp webpack-* $DIR/ | cp webpack-* $DIR/ | ||||||
|  |  | ||||||
| # run in subshell (so we return to original dir) | # run in subshell (so we return to original dir) | ||||||
| (cd $DIR && n exec 14.17.2 npm install --only=prod) | (cd $DIR && n exec 14.17.5 npm install --only=prod) | ||||||
|  |  | ||||||
| # cleanup of useless files in dependencies | # cleanup of useless files in dependencies | ||||||
| rm -r $DIR/node_modules/image-q/demo | rm -r $DIR/node_modules/image-q/demo | ||||||
|   | |||||||
							
								
								
									
										10950
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										10950
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -81,12 +81,12 @@ | |||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "cross-env": "7.0.3", |     "cross-env": "7.0.3", | ||||||
|     "electron": "13.2.1", |     "electron": "13.2.2", | ||||||
|     "electron-builder": "22.11.7", |     "electron-builder": "22.11.7", | ||||||
|     "electron-packager": "15.3.0", |     "electron-packager": "15.3.0", | ||||||
|     "electron-rebuild": "3.2.0", |     "electron-rebuild": "3.2.0", | ||||||
|     "esm": "3.2.25", |     "esm": "3.2.25", | ||||||
|     "jasmine": "3.8.0", |     "jasmine": "3.9.0", | ||||||
|     "jsdoc": "3.6.7", |     "jsdoc": "3.6.7", | ||||||
|     "lorem-ipsum": "2.0.3", |     "lorem-ipsum": "2.0.3", | ||||||
|     "rcedit": "3.0.1", |     "rcedit": "3.0.1", | ||||||
|   | |||||||
| @@ -82,13 +82,14 @@ function processNoteChange(loadResults, ec) { | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     loadResults.addNote(ec.entityId, ec.sourceId); | ||||||
|  |  | ||||||
|     if (ec.isErased || ec.entity?.isDeleted) { |     if (ec.isErased || ec.entity?.isDeleted) { | ||||||
|         delete froca.notes[ec.entityId]; |         delete froca.notes[ec.entityId]; | ||||||
|         return; |  | ||||||
|     } |     } | ||||||
|  |     else { | ||||||
|     note.update(ec.entity); |         note.update(ec.entity); | ||||||
|     loadResults.addNote(ec.entityId, ec.sourceId); |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| function processBranchChange(loadResults, ec) { | function processBranchChange(loadResults, ec) { | ||||||
| @@ -109,12 +110,16 @@ function processBranchChange(loadResults, ec) { | |||||||
|                 delete parentNote.childToBranch[branch.noteId]; |                 delete parentNote.childToBranch[branch.noteId]; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  |             loadResults.addBranch(ec.entityId, ec.sourceId); | ||||||
|  |  | ||||||
|             delete froca.branches[ec.entityId]; |             delete froca.branches[ec.entityId]; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     loadResults.addBranch(ec.entityId, ec.sourceId); | ||||||
|  |  | ||||||
|     const childNote = froca.notes[ec.entity.noteId]; |     const childNote = froca.notes[ec.entity.noteId]; | ||||||
|     const parentNote = froca.notes[ec.entity.parentNoteId]; |     const parentNote = froca.notes[ec.entity.parentNoteId]; | ||||||
|  |  | ||||||
| @@ -125,8 +130,6 @@ function processBranchChange(loadResults, ec) { | |||||||
|         froca.branches[branch.branchId] = branch = new Branch(froca, ec.entity); |         froca.branches[branch.branchId] = branch = new Branch(froca, ec.entity); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     loadResults.addBranch(ec.entityId, ec.sourceId); |  | ||||||
|  |  | ||||||
|     if (childNote) { |     if (childNote) { | ||||||
|         childNote.addParent(branch.parentNoteId, branch.branchId); |         childNote.addParent(branch.parentNoteId, branch.branchId); | ||||||
|     } |     } | ||||||
| @@ -176,25 +179,26 @@ function processAttributeChange(loadResults, ec) { | |||||||
|                 targetNote.targetRelations = targetNote.targetRelations.filter(attributeId => attributeId !== attribute.attributeId); |                 targetNote.targetRelations = targetNote.targetRelations.filter(attributeId => attributeId !== attribute.attributeId); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  |             loadResults.addAttribute(ec.entityId, ec.sourceId); | ||||||
|  |  | ||||||
|             delete froca.attributes[ec.entityId]; |             delete froca.attributes[ec.entityId]; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     loadResults.addAttribute(ec.entityId, ec.sourceId); | ||||||
|  |  | ||||||
|     const sourceNote = froca.notes[ec.entity.noteId]; |     const sourceNote = froca.notes[ec.entity.noteId]; | ||||||
|     const targetNote = ec.entity.type === 'relation' && froca.notes[ec.entity.value]; |     const targetNote = ec.entity.type === 'relation' && froca.notes[ec.entity.value]; | ||||||
|  |  | ||||||
|     if (attribute) { |     if (attribute) { | ||||||
|         attribute.update(ec.entity); |         attribute.update(ec.entity); | ||||||
|         loadResults.addAttribute(ec.entityId, ec.sourceId); |  | ||||||
|     } else if (sourceNote || targetNote) { |     } else if (sourceNote || targetNote) { | ||||||
|         attribute = new Attribute(froca, ec.entity); |         attribute = new Attribute(froca, ec.entity); | ||||||
|  |  | ||||||
|         froca.attributes[attribute.attributeId] = attribute; |         froca.attributes[attribute.attributeId] = attribute; | ||||||
|  |  | ||||||
|         loadResults.addAttribute(ec.entityId, ec.sourceId); |  | ||||||
|  |  | ||||||
|         if (sourceNote && !sourceNote.attributes.includes(attribute.attributeId)) { |         if (sourceNote && !sourceNote.attributes.includes(attribute.attributeId)) { | ||||||
|             sourceNote.attributes.push(attribute.attributeId); |             sourceNote.attributes.push(attribute.attributeId); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -201,7 +201,7 @@ class NoteContext extends Component { | |||||||
|  |  | ||||||
|     async entitiesReloadedEvent({loadResults}) { |     async entitiesReloadedEvent({loadResults}) { | ||||||
|         if (loadResults.isNoteReloaded(this.noteId)) { |         if (loadResults.isNoteReloaded(this.noteId)) { | ||||||
|             const note = await froca.getNote(this.noteId); |             const note = loadResults.getEntity('notes', this.noteId); | ||||||
|  |  | ||||||
|             if (note.isDeleted) { |             if (note.isDeleted) { | ||||||
|                 this.noteId = null; |                 this.noteId = null; | ||||||
|   | |||||||
| @@ -842,12 +842,10 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @return {FancytreeNode[]} */ |     /** @return {FancytreeNode[]} */ | ||||||
|     getNodesByBranchId(branchId) { |     getNodesByBranch(branch) { | ||||||
|         utils.assertArguments(branchId); |         utils.assertArguments(branch); | ||||||
|  |  | ||||||
|         const branch = froca.getBranch(branchId); |         return this.getNodesByNoteId(branch.noteId).filter(node => node.data.branchId === branch.branchId); | ||||||
|  |  | ||||||
|         return this.getNodesByNoteId(branch.noteId).filter(node => node.data.branchId === branchId); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @return {FancytreeNode[]} */ |     /** @return {FancytreeNode[]} */ | ||||||
| @@ -1002,7 +1000,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|             // adding noteId itself to update all potential clones |             // adding noteId itself to update all potential clones | ||||||
|             noteIdsToUpdate.add(branch.noteId); |             noteIdsToUpdate.add(branch.noteId); | ||||||
|  |  | ||||||
|             for (const node of this.getNodesByBranchId(branch.branchId)) { |             for (const node of this.getNodesByBranch(branch)) { | ||||||
|                 if (branch.isDeleted) { |                 if (branch.isDeleted) { | ||||||
|                     if (node.isActive()) { |                     if (node.isActive()) { | ||||||
|                         const newActiveNode = node.getNextSibling() |                         const newActiveNode = node.getNextSibling() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user