mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
feat(mobile): bring jump to note to mobile
This commit is contained in:
parent
336e298462
commit
57ed133c7f
@ -29,6 +29,7 @@ import AboutDialog from "../widgets/dialogs/about.js";
|
|||||||
import HelpDialog from "../widgets/dialogs/help.js";
|
import HelpDialog from "../widgets/dialogs/help.js";
|
||||||
import AppContext from "../components/app_context.js";
|
import AppContext from "../components/app_context.js";
|
||||||
import TabRowWidget from "../widgets/tab_row.js";
|
import TabRowWidget from "../widgets/tab_row.js";
|
||||||
|
import JumpToNoteDialog from "../widgets/dialogs/jump_to_note.js";
|
||||||
|
|
||||||
const MOBILE_CSS = `
|
const MOBILE_CSS = `
|
||||||
<style>
|
<style>
|
||||||
@ -196,5 +197,6 @@ export default class MobileLayout {
|
|||||||
.id("launcher-pane")))
|
.id("launcher-pane")))
|
||||||
.child(new AboutDialog())
|
.child(new AboutDialog())
|
||||||
.child(new HelpDialog())
|
.child(new HelpDialog())
|
||||||
|
.child(new JumpToNoteDialog())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import appContext from "./components/app_context.js";
|
import appContext from "./components/app_context.js";
|
||||||
|
import noteAutocompleteService from './services/note_autocomplete.js';
|
||||||
import glob from "./services/glob.js";
|
import glob from "./services/glob.js";
|
||||||
|
|
||||||
glob.setupGlobs()
|
glob.setupGlobs()
|
||||||
|
|
||||||
await appContext.earlyInit();
|
await appContext.earlyInit();
|
||||||
|
|
||||||
|
noteAutocompleteService.init();
|
||||||
|
|
||||||
// A dynamic import is required for layouts since they initialize components which require translations.
|
// A dynamic import is required for layouts since they initialize components which require translations.
|
||||||
const MobileLayout = (await import("./layouts/mobile_layout.js")).default;
|
const MobileLayout = (await import("./layouts/mobile_layout.js")).default;
|
||||||
|
|
||||||
|
@ -101,19 +101,11 @@ async function autocompleteSource(term: string, cb: (rows: Suggestion[]) => void
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearText($el: JQuery<HTMLElement>) {
|
function clearText($el: JQuery<HTMLElement>) {
|
||||||
if (utils.isMobile()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$el.setSelectedNotePath("");
|
$el.setSelectedNotePath("");
|
||||||
$el.autocomplete("val", "").trigger('change');
|
$el.autocomplete("val", "").trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
function setText($el: JQuery<HTMLElement>, text: string) {
|
function setText($el: JQuery<HTMLElement>, text: string) {
|
||||||
if (utils.isMobile()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$el.setSelectedNotePath("");
|
$el.setSelectedNotePath("");
|
||||||
$el
|
$el
|
||||||
.autocomplete("val", text.trim())
|
.autocomplete("val", text.trim())
|
||||||
@ -121,10 +113,6 @@ function setText($el: JQuery<HTMLElement>, text: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showRecentNotes($el:JQuery<HTMLElement>) {
|
function showRecentNotes($el:JQuery<HTMLElement>) {
|
||||||
if (utils.isMobile()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$el.setSelectedNotePath("");
|
$el.setSelectedNotePath("");
|
||||||
$el.autocomplete("val", "");
|
$el.autocomplete("val", "");
|
||||||
$el.autocomplete('open');
|
$el.autocomplete('open');
|
||||||
@ -147,7 +135,7 @@ function fullTextSearch($el: JQuery<HTMLElement>, options: Options){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initNoteAutocomplete($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
|
// clear any event listener added in previous invocation of this function
|
||||||
$el.off('autocomplete:noteselected');
|
$el.off('autocomplete:noteselected');
|
||||||
|
|
||||||
|
@ -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',
|
{ 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' } ]},
|
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',
|
{ 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' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -129,6 +129,8 @@
|
|||||||
|
|
||||||
<script src="<%= assetPath %>/node_modules/jquery/dist/jquery.min.js"></script>
|
<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>
|
<script src="<%= assetPath %>/node_modules/dayjs/dayjs.min.js"></script>
|
||||||
|
|
||||||
<link href="<%= assetPath %>/stylesheets/tree.css" rel="stylesheet">
|
<link href="<%= assetPath %>/stylesheets/tree.css" rel="stylesheet">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user