fix focusing the text editor component after adding a link, closes #523

This commit is contained in:
zadam 2019-05-13 21:13:04 +02:00
parent 75ef766649
commit 81d10fa605

View file

@ -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