mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	imported internal links crash ckeditor, #1979
This commit is contained in:
		
							parent
							
								
									3c7232f427
								
							
						
					
					
						commit
						b9639bffce
					
				
							
								
								
									
										2
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -11,7 +11,7 @@ function sanitize(dirtyHtml) {
 | 
				
			|||||||
            'figure', 'span', 'label', 'input'
 | 
					            'figure', 'span', 'label', 'input'
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        allowedAttributes: {
 | 
					        allowedAttributes: {
 | 
				
			||||||
            'a': [ 'href', 'class' ],
 | 
					            'a': [ 'href', 'class', 'data-note-path' ],
 | 
				
			||||||
            'img': [ 'src' ],
 | 
					            'img': [ 'src' ],
 | 
				
			||||||
            'section': [ 'class', 'data-note-id' ],
 | 
					            'section': [ 'class', 'data-note-id' ],
 | 
				
			||||||
            'figure': [ 'class' ],
 | 
					            'figure': [ 'class' ],
 | 
				
			||||||
 | 
				
			|||||||
@ -307,6 +307,14 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
 | 
				
			|||||||
                return `href="#root/${targetNoteId}"`;
 | 
					                return `href="#root/${targetNoteId}"`;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            content = content.replace(/data-note-path="([^"]*)"/g, (match, notePath) => {
 | 
				
			||||||
 | 
					                const noteId = notePath.split("/").pop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                const targetNoteId = noteIdMap[noteId];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return `data-note-path="root/${targetNoteId}"`;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (noteMeta) {
 | 
					            if (noteMeta) {
 | 
				
			||||||
                const includeNoteLinks = (noteMeta.attributes || [])
 | 
					                const includeNoteLinks = (noteMeta.attributes || [])
 | 
				
			||||||
                    .filter(attr => attr.type === 'relation' && attr.name === 'includeNoteLink');
 | 
					                    .filter(attr => attr.type === 'relation' && attr.name === 'includeNoteLink');
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user