mirror of
https://github.com/zadam/trilium.git
synced 2025-01-16 12:08:03 +08:00
fix jumping cursor position after closing a dialog, fixes #3325
This commit is contained in:
parent
a7f4bf8289
commit
7a8c69a6f9
1 changed files with 14 additions and 2 deletions
|
@ -230,7 +230,19 @@ function focusSavedElement() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastFocusedElement.focus();
|
if ($lastFocusedElement.hasClass("ck")) {
|
||||||
|
// must handle CKEditor separately because of this bug: https://github.com/ckeditor/ckeditor5/issues/607
|
||||||
|
// the bug manifests itself in resetting the cursor position to the first character - jumping above
|
||||||
|
|
||||||
|
const editor = $lastFocusedElement
|
||||||
|
.closest('.ck-editor__editable')
|
||||||
|
.prop('ckeditorInstance');
|
||||||
|
|
||||||
|
editor.editing.view.focus();
|
||||||
|
} else {
|
||||||
|
$lastFocusedElement.focus();
|
||||||
|
}
|
||||||
|
|
||||||
$lastFocusedElement = null;
|
$lastFocusedElement = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +253,7 @@ async function openDialog($dialog, closeActDialog = true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveFocusedElement();
|
saveFocusedElement();
|
||||||
-
|
|
||||||
$dialog.modal();
|
$dialog.modal();
|
||||||
|
|
||||||
$dialog.on('hidden.bs.modal', () => {
|
$dialog.on('hidden.bs.modal', () => {
|
||||||
|
|
Loading…
Reference in a new issue