mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
add quick search in mobile layout (#2360)
Co-authored-by: jasongwq <jasongwq@126.com>
This commit is contained in:
parent
7a383a1314
commit
db9e35a7e1
@ -1,6 +1,7 @@
|
|||||||
import FlexContainer from "../widgets/containers/flex_container.js";
|
import FlexContainer from "../widgets/containers/flex_container.js";
|
||||||
import NoteTitleWidget from "../widgets/note_title.js";
|
import NoteTitleWidget from "../widgets/note_title.js";
|
||||||
import NoteDetailWidget from "../widgets/note_detail.js";
|
import NoteDetailWidget from "../widgets/note_detail.js";
|
||||||
|
import QuickSearchWidget from "../widgets/quick_search.js";
|
||||||
import NoteTreeWidget from "../widgets/note_tree.js";
|
import NoteTreeWidget from "../widgets/note_tree.js";
|
||||||
import MobileGlobalButtonsWidget from "../widgets/mobile_widgets/mobile_global_buttons.js";
|
import MobileGlobalButtonsWidget from "../widgets/mobile_widgets/mobile_global_buttons.js";
|
||||||
import CloseDetailButtonWidget from "../widgets/mobile_widgets/close_detail_button.js";
|
import CloseDetailButtonWidget from "../widgets/mobile_widgets/close_detail_button.js";
|
||||||
@ -27,13 +28,19 @@ kbd {
|
|||||||
padding-right: 0.5em;
|
padding-right: 0.5em;
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
}
|
}
|
||||||
|
.quick-search {
|
||||||
|
margin: 55px 0px 0px 0px;
|
||||||
|
}
|
||||||
|
.quick-search .dropdown-menu {
|
||||||
|
max-width: 350px;
|
||||||
|
}
|
||||||
</style>`;
|
</style>`;
|
||||||
|
|
||||||
const FANCYTREE_CSS = `
|
const FANCYTREE_CSS = `
|
||||||
<style>
|
<style>
|
||||||
.tree-wrapper {
|
.tree-wrapper {
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
margin-top: 55px;
|
margin-top: 0px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
contain: content;
|
contain: content;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
@ -95,6 +102,7 @@ export default class MobileLayout {
|
|||||||
.css('padding-left', 0)
|
.css('padding-left', 0)
|
||||||
.css('contain', 'content')
|
.css('contain', 'content')
|
||||||
.child(new MobileGlobalButtonsWidget())
|
.child(new MobileGlobalButtonsWidget())
|
||||||
|
.child(new QuickSearchWidget())
|
||||||
.child(new NoteTreeWidget("main")
|
.child(new NoteTreeWidget("main")
|
||||||
.cssBlock(FANCYTREE_CSS)))
|
.cssBlock(FANCYTREE_CSS)))
|
||||||
.child(new ScreenContainer("detail", "column")
|
.child(new ScreenContainer("detail", "column")
|
||||||
|
@ -52,6 +52,20 @@ export default class QuickSearchWidget extends BasicWidget {
|
|||||||
|
|
||||||
this.$widget.find('.input-group-prepend').on('shown.bs.dropdown', () => this.search());
|
this.$widget.find('.input-group-prepend').on('shown.bs.dropdown', () => this.search());
|
||||||
|
|
||||||
|
if(utils.isMobile()) {
|
||||||
|
this.$searchString.keydown(e =>{
|
||||||
|
if(e.which==13) {
|
||||||
|
if (this.$dropdownMenu.is(":visible")) {
|
||||||
|
this.search(); // just update already visible dropdown
|
||||||
|
} else {
|
||||||
|
this.$dropdownToggle.dropdown('show');
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
utils.bindElShortcut(this.$searchString, 'return', () => {
|
utils.bindElShortcut(this.$searchString, 'return', () => {
|
||||||
if (this.$dropdownMenu.is(":visible")) {
|
if (this.$dropdownMenu.is(":visible")) {
|
||||||
this.search(); // just update already visible dropdown
|
this.search(); // just update already visible dropdown
|
||||||
|
Loading…
x
Reference in New Issue
Block a user