mirror of
https://github.com/zadam/trilium.git
synced 2025-02-20 21:13:11 +08:00
fix focusing the text editor component after adding a link, closes #523
This commit is contained in:
parent
75ef766649
commit
81d10fa605
1 changed files with 3 additions and 6 deletions
|
@ -94,15 +94,16 @@ $form.submit(() => {
|
|||
$dialog.modal('hide');
|
||||
|
||||
const linkHref = '#' + notePath;
|
||||
const editor = noteDetailText.getEditor();
|
||||
|
||||
if (hasSelection()) {
|
||||
const editor = noteDetailText.getEditor();
|
||||
|
||||
editor.execute('link', linkHref);
|
||||
}
|
||||
else {
|
||||
linkService.addLinkToEditor(linkTitle, linkHref);
|
||||
}
|
||||
|
||||
editor.editing.view.focus();
|
||||
}
|
||||
else if (linkType === 'selected-to-active') {
|
||||
const prefix = $clonePrefix.val();
|
||||
|
@ -145,10 +146,6 @@ function 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 {
|
||||
showDialog,
|
||||
showDialogForClone
|
||||
|
|
Loading…
Reference in a new issue