fix ctrl+enter navigation for reference links, closes #2932

This commit is contained in:
zadam
2022-06-20 23:11:52 +02:00
parent 6b3077df0e
commit 2e1bef2df7
3 changed files with 187 additions and 2 deletions

View File

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

View File

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