diff --git a/src/public/javascripts/dialogs/jump_to_note.js b/src/public/javascripts/dialogs/jump_to_note.js
index 5059426f1..421724ded 100644
--- a/src/public/javascripts/dialogs/jump_to_note.js
+++ b/src/public/javascripts/dialogs/jump_to_note.js
@@ -1,10 +1,13 @@
import treeService from '../services/tree.js';
import linkService from '../services/link.js';
import server from '../services/server.js';
+import searchNotesService from '../services/search_notes.js';
const $dialog = $("#jump-to-note-dialog");
const $autoComplete = $("#jump-to-note-autocomplete");
const $form = $("#jump-to-note-form");
+const $jumpToNoteButton = $("#jump-to-note-button");
+const $showInFullTextButton = $("#show-in-full-text-button");
async function showDialog() {
glob.activeDialog = $dialog;
@@ -24,12 +27,6 @@ async function showDialog() {
},
minLength: 2
});
-
- $autoComplete.autocomplete("instance")._renderItem = function(ul, item) {
- return $("
")
- .append("" + item.label + "
")
- .appendTo(ul);
- };
}
function getSelectedNotePath() {
@@ -47,12 +44,32 @@ function goToNote() {
}
}
+function showInFullText(e) {
+ // stop from propagating upwards (dangerous especially with ctrl+enter executable javascript notes)
+ e.preventDefault();
+ e.stopPropagation();
+
+ const searchText = $autoComplete.val();
+
+ searchNotesService.resetSearch();
+ searchNotesService.showSearch();
+ searchNotesService.doSearch(searchText);
+
+ $dialog.dialog('close');
+}
+
$form.submit(() => {
goToNote();
return false;
});
+$jumpToNoteButton.click(goToNote);
+
+$showInFullTextButton.click(showInFullText);
+
+$dialog.bind('keydown', 'ctrl+return', showInFullText);
+
export default {
showDialog
};
\ No newline at end of file
diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js
index 36a51b787..1e67a840c 100644
--- a/src/public/javascripts/services/entrypoints.js
+++ b/src/public/javascripts/services/entrypoints.js
@@ -23,7 +23,7 @@ function registerEntrypoints() {
utils.bindShortcut('ctrl+l', addLinkDialog.showDialog);
- $("#jump-to-note-button").click(jumpToNoteDialog.showDialog);
+ $("#jump-to-note-dialog-button").click(jumpToNoteDialog.showDialog);
utils.bindShortcut('ctrl+j', jumpToNoteDialog.showDialog);
$("#show-note-revisions-button").click(noteRevisionsDialog.showCurrentNoteRevisions);
diff --git a/src/public/javascripts/services/search_notes.js b/src/public/javascripts/services/search_notes.js
index 24521efa6..b8b90d88c 100644
--- a/src/public/javascripts/services/search_notes.js
+++ b/src/public/javascripts/services/search_notes.js
@@ -11,10 +11,14 @@ const $searchBox = $("#search-box");
const $searchResults = $("#search-results");
const $searchResultsInner = $("#search-results-inner");
+function showSearch() {
+ $searchBox.show();
+ $searchInput.focus();
+}
+
function toggleSearch() {
if ($searchBox.is(":hidden")) {
- $searchBox.show();
- $searchInput.focus();
+ showSearch();
}
else {
resetSearch();
@@ -32,8 +36,13 @@ function getTree() {
return $tree.fancytree('getTree');
}
-async function doSearch() {
- const searchText = $searchInput.val();
+async function doSearch(searchText) {
+ if (searchText) {
+ $searchInput.val(searchText);
+ }
+ else {
+ searchText = $searchInput.val();
+ }
const results = await server.get('search/' + encodeURIComponent(searchText));
@@ -81,5 +90,8 @@ $resetSearchButton.click(resetSearch);
$saveSearchButton.click(saveSearch);
export default {
- toggleSearch
+ toggleSearch,
+ resetSearch,
+ showSearch,
+ doSearch
};
\ No newline at end of file
diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css
index fa14759f8..85a36340a 100644
--- a/src/public/stylesheets/style.css
+++ b/src/public/stylesheets/style.css
@@ -371,12 +371,12 @@ div.ui-tooltip {
display: flex;
}
-.btn {
+.btn:not(.btn-primary) {
border-color: #ddd;
background-color: #eee;
}
-.btn.active {
+.btn.active:not(.btn-primary) {
background-color: #ccc;
}
diff --git a/src/views/index.ejs b/src/views/index.ejs
index 8ca85ea7b..17222a466 100644
--- a/src/views/index.ejs
+++ b/src/views/index.ejs
@@ -24,7 +24,7 @@
-
+
@@ -303,7 +303,11 @@
-
+
+
+
+
+