")
- .addClass("input-group-append")
- .append($clearTextButton)
- .append($showRecentNotesButton);
-
- if (!options.hideGoToSelectedNoteButton) {
- $sideButtons.append($goToSelectedNoteButton);
- }
-
- $el.after($sideButtons);
-
- $clearTextButton.click(() => clearText($el));
-
- $showRecentNotesButton.click(e => {
- showRecentNotes($el);
-
- // this will cause the click not give focus to the "show recent notes" button
- // this is important because otherwise input will lose focus immediatelly and not show the results
- return false;
- });
-
- $el.autocomplete({
- appendTo: document.querySelector('body'),
- hint: false,
- autoselect: true,
- openOnFocus: true,
- minLength: 0,
- tabAutocomplete: false
- }, [
- {
- source: autocompleteSource,
- displayKey: 'title',
- templates: {
- suggestion: function(suggestion) {
- return suggestion.highlighted;
- }
- },
- // we can't cache identical searches because notes can be created / renamed, new recent notes can be added
- cache: false
- }
- ]);
-
- $el.on('autocomplete:selected', (event, suggestion) => $el.setSelectedPath(suggestion.path));
- $el.on('autocomplete:closed', () => {
- if (!$el.val().trim()) {
- clearText($el);
- }
- });
+ if ($el.hasClass("note-autocomplete-input") || utils.isMobile()) {
+ return $el;
}
+ options = options || {};
+
+ $el.addClass("note-autocomplete-input");
+
+ const $clearTextButton = $("
")
+ .addClass("input-group-text go-to-selected-note-button jam jam-arrow-right")
+ .attr("data-action", "note");
+
+ const $sideButtons = $("")
+ .addClass("input-group-append")
+ .append($clearTextButton)
+ .append($showRecentNotesButton);
+
+ if (!options.hideGoToSelectedNoteButton) {
+ $sideButtons.append($goToSelectedNoteButton);
+ }
+
+ $el.after($sideButtons);
+
+ $clearTextButton.click(() => clearText($el));
+
+ $showRecentNotesButton.click(e => {
+ showRecentNotes($el);
+
+ // this will cause the click not give focus to the "show recent notes" button
+ // this is important because otherwise input will lose focus immediatelly and not show the results
+ return false;
+ });
+
+ $el.autocomplete({
+ appendTo: document.querySelector('body'),
+ hint: false,
+ autoselect: true,
+ openOnFocus: true,
+ minLength: 0,
+ tabAutocomplete: false
+ }, [
+ {
+ source: autocompleteSource,
+ displayKey: 'title',
+ templates: {
+ suggestion: function(suggestion) {
+ return suggestion.highlighted;
+ }
+ },
+ // we can't cache identical searches because notes can be created / renamed, new recent notes can be added
+ cache: false
+ }
+ ]);
+
+ $el.on('autocomplete:selected', (event, suggestion) => $el.setSelectedPath(suggestion.path));
+ $el.on('autocomplete:closed', () => {
+ if (!$el.val().trim()) {
+ clearText($el);
+ }
+ });
+
return $el;
}
diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js
index 4a8f45b65..2221dfec9 100644
--- a/src/public/javascripts/services/tab_context.js
+++ b/src/public/javascripts/services/tab_context.js
@@ -75,7 +75,10 @@ class TabContext {
treeService.setNoteTitle(this.noteId, title);
});
- this.$noteTitle.bind('keydown', 'return', () => this.getComponent().focus());
+ if (utils.isDesktop()) {
+ // keyboard plugin is not loaded in mobile
+ this.$noteTitle.bind('keydown', 'return', () => this.getComponent().focus());
+ }
this.$protectButton = this.$tabContent.find(".protect-button");
this.$protectButton.click(protectedSessionService.protectNoteAndSendToServer);
diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.js
index 417e1d88f..58efee20b 100644
--- a/src/public/javascripts/services/tree.js
+++ b/src/public/javascripts/services/tree.js
@@ -649,9 +649,8 @@ async function createNote(node, parentNoteId, target, extraOptions = {}) {
if (!node.getChildren() && node.isFolder()) {
await node.setExpanded();
}
- else {
- node.addChildren(newNode);
- }
+
+ node.addChildren(newNode);
await node.getLastChild().setActive(true);