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

@ -0,0 +1,170 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: exports</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: exports</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>exports<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">TODO: rename, it's not collapsible anymore</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="exports"><span class="type-signature"></span>new exports<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line15">line 15</a>
</li></ul></dd>
</dl>
</div>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

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 {