mirror of
https://github.com/zadam/trilium.git
synced 2025-11-09 06:45:49 +01:00
fix ctrl+enter navigation for reference links, closes #2932
This commit is contained in:
@@ -136,7 +136,7 @@ const TPL = `
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>Monospace font</h5>
|
||||
<h5>Monospace (code) font</h5>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-4">
|
||||
|
||||
@@ -266,10 +266,25 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
|
||||
await this.initialized;
|
||||
|
||||
const selection = this.textEditor.model.document.selection;
|
||||
if (!selection.hasAttribute('linkHref')) return;
|
||||
const selectedElement = selection.getSelectedElement();
|
||||
|
||||
if (selectedElement?.name === 'reference') {
|
||||
// reference link
|
||||
const notePath = selectedElement.getAttribute('notePath');
|
||||
|
||||
if (notePath) {
|
||||
await appContext.tabManager.getActiveContext().setNote(notePath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!selection.hasAttribute('linkHref')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedLinkUrl = selection.getAttribute('linkHref');
|
||||
const notePath = link.getNotePathFromUrl(selectedLinkUrl);
|
||||
|
||||
if (notePath) {
|
||||
await appContext.tabManager.getActiveContext().setNote(notePath);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user