mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	Fix the bug that code can't get the selected text
This commit is contained in:
		
							parent
							
								
									8893e9d4d5
								
							
						
					
					
						commit
						497c24ee1e
					
				@ -159,8 +159,13 @@ export default class FindWidget extends NoteContextAwareWidget {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        this.handler = await this.getHandler();
 | 
					        this.handler = await this.getHandler();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const selectedText = window.getSelection().toString() || "";
 | 
					        let selectedText = '';
 | 
				
			||||||
 | 
					        if (this.note.type === 'code'){
 | 
				
			||||||
 | 
					            const codeEditor = await this.noteContext.getCodeEditor();
 | 
				
			||||||
 | 
					            selectedText = codeEditor.getSelection();
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            selectedText = window.getSelection().toString() || "";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        this.$widget.show();
 | 
					        this.$widget.show();
 | 
				
			||||||
        this.$input.focus();
 | 
					        this.$input.focus();
 | 
				
			||||||
        const isReadOnly = await this.noteContext.isReadOnly();
 | 
					        const isReadOnly = await this.noteContext.isReadOnly();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user