mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-27 09:39:00 +01:00 
			
		
		
		
	fix focusing the text editor component after adding a link, closes #523
This commit is contained in:
		
							parent
							
								
									75ef766649
								
							
						
					
					
						commit
						81d10fa605
					
				| @ -94,15 +94,16 @@ $form.submit(() => { | |||||||
|             $dialog.modal('hide'); |             $dialog.modal('hide'); | ||||||
| 
 | 
 | ||||||
|             const linkHref = '#' + notePath; |             const linkHref = '#' + notePath; | ||||||
| 
 |  | ||||||
|             if (hasSelection()) { |  | ||||||
|             const editor = noteDetailText.getEditor(); |             const editor = noteDetailText.getEditor(); | ||||||
| 
 | 
 | ||||||
|  |             if (hasSelection()) { | ||||||
|                 editor.execute('link', linkHref); |                 editor.execute('link', linkHref); | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|                 linkService.addLinkToEditor(linkTitle, linkHref); |                 linkService.addLinkToEditor(linkTitle, linkHref); | ||||||
|             } |             } | ||||||
|  | 
 | ||||||
|  |             editor.editing.view.focus(); | ||||||
|         } |         } | ||||||
|         else if (linkType === 'selected-to-active') { |         else if (linkType === 'selected-to-active') { | ||||||
|             const prefix = $clonePrefix.val(); |             const prefix = $clonePrefix.val(); | ||||||
| @ -145,10 +146,6 @@ function linkTypeChanged() { | |||||||
| 
 | 
 | ||||||
| $linkTypes.change(linkTypeChanged); | $linkTypes.change(linkTypeChanged); | ||||||
| 
 | 
 | ||||||
| // return back focus to note text detail after quitting add link
 |  | ||||||
| // the problem is that cursor position is reset
 |  | ||||||
| $dialog.on("hidden.bs.modal", () => noteDetailText.focus()); |  | ||||||
| 
 |  | ||||||
| export default { | export default { | ||||||
|     showDialog, |     showDialog, | ||||||
|     showDialogForClone |     showDialogForClone | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam