Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(mobile): bring jump to note to mobile
Elian Doran57ed133c7f3c
diff --git a/src/public/app/layouts/mobile_layout.ts b/src/public/app/layouts/mobile_layout.tsindex ba61f24003..2fbe874f42 100644--- a/src/public/app/layouts/mobile_layout.ts+++ b/src/public/app/layouts/mobile_layout.ts@@ -29,6 +29,7 @@ import AboutDialog from "../widgets/dialogs/about.js";import HelpDialog from "../widgets/dialogs/help.js";import AppContext from "../components/app_context.js";import TabRowWidget from "../widgets/tab_row.js";+import JumpToNoteDialog from "../widgets/dialogs/jump_to_note.js";const MOBILE_CSS = `<style>@@ -196,5 +197,6 @@ export default class MobileLayout {.id("launcher-pane"))).child(new AboutDialog()).child(new HelpDialog())+ .child(new JumpToNoteDialog())}}diff --git a/src/public/app/mobile.js b/src/public/app/mobile.jsindex 1c95324f50..2319d7f9e1 100644--- a/src/public/app/mobile.js+++ b/src/public/app/mobile.js@@ -1,10 +1,13 @@import appContext from "./components/app_context.js";+import noteAutocompleteService from './services/note_autocomplete.js';import glob from "./services/glob.js";glob.setupGlobs()await appContext.earlyInit();+noteAutocompleteService.init();+// A dynamic import is required for layouts since they initialize components which require translations.const MobileLayout = (await import("./layouts/mobile_layout.js")).default;diff --git a/src/public/app/services/note_autocomplete.ts b/src/public/app/services/note_autocomplete.tsindex 52aeab1bbe..67a01969f9 100644--- a/src/public/app/services/note_autocomplete.ts+++ b/src/public/app/services/note_autocomplete.ts@@ -101,19 +101,11 @@ async function autocompleteSource(term: string, cb: (rows: Suggestion[]) => void}function clearText($el: JQuery<HTMLElement>) {- if (utils.isMobile()) {- return;- }-$el.setSelectedNotePath("");$el.autocomplete("val", "").trigger('change');}function setText($el: JQuery<HTMLElement>, text: string) {- if (utils.isMobile()) {- return;- }-$el.setSelectedNotePath("");$el.autocomplete("val", text.trim())@@ -121,10 +113,6 @@ function setText($el: JQuery<HTMLElement>, text: string) {}function showRecentNotes($el:JQuery<HTMLElement>) {- if (utils.isMobile()) {- return;- }-$el.setSelectedNotePath("");$el.autocomplete("val", "");$el.autocomplete('open');@@ -147,7 +135,7 @@ function fullTextSearch($el: JQuery<HTMLElement>, options: Options){}function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {- if ($el.hasClass("note-autocomplete-input") || utils.isMobile()) {+ if ($el.hasClass("note-autocomplete-input")) {// clear any event listener added in previous invocation of this function$el.off('autocomplete:noteselected');diff --git a/src/services/hidden_subtree.ts b/src/services/hidden_subtree.tsindex e0275c31d2..71afab079d 100644--- a/src/services/hidden_subtree.ts+++ b/src/services/hidden_subtree.ts@@ -281,7 +281,8 @@ function buildHiddenSubtreeDefinition(): Item {{ id: '_lbMobileBackInHistory', title: t("hidden-subtree.go-to-previous-note-title"), type: 'launcher', builtinWidget: 'backInHistoryButton', icon: 'bx bxs-chevron-left',attributes: [ { type: 'label', name: 'docName', value: 'launchbar_history_navigation' } ]},{ id: '_lbMobileForwardInHistory', title: t("hidden-subtree.go-to-next-note-title"), type: 'launcher', builtinWidget: 'forwardInHistoryButton', icon: 'bx bxs-chevron-right',- attributes: [ { type: 'label', name: 'docName', value: 'launchbar_history_navigation' } ]}+ attributes: [ { type: 'label', name: 'docName', value: 'launchbar_history_navigation' } ]},+ { id: '_lbMobileJumpTo', title: t("hidden-subtree.jump-to-note-title"), type: 'launcher', command: 'jumpToNote', icon: 'bx bx-plus-circle' }]}]diff --git a/src/views/mobile.ejs b/src/views/mobile.ejsindex d54263a06e..31c6a6802f 100644--- a/src/views/mobile.ejs+++ b/src/views/mobile.ejs@@ -129,6 +129,8 @@<script src="<%= assetPath %>/node_modules/jquery/dist/jquery.min.js"></script>+<script src="<%= assetPath %>/node_modules/autocomplete.js/dist/autocomplete.jquery.min.js"></script>+<script src="<%= assetPath %>/node_modules/dayjs/dayjs.min.js"></script><link href="<%= assetPath %>/stylesheets/tree.css" rel="stylesheet">