mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 04:29:01 +01:00
refactor(client): use different hiding mechanism for quick search
This commit is contained in:
parent
d2d2620742
commit
91d23bae8e
@ -61,12 +61,7 @@ export default class LauncherWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.innerWidget) {
|
if (!this.innerWidget) {
|
||||||
if (launcherType === "builtinWidget") {
|
throw new Error(`Unknown initialization error for note '${note.noteId}', title '${note.title}'`);
|
||||||
// This allows filtering of builtin widgets based on the layout (horizontal / vertical)
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
throw new Error(`Unknown initialization error for note '${note.noteId}', title '${note.title}'`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.child(this.innerWidget);
|
this.child(this.innerWidget);
|
||||||
@ -118,7 +113,7 @@ export default class LauncherWidget extends BasicWidget {
|
|||||||
case "todayInJournal":
|
case "todayInJournal":
|
||||||
return new TodayLauncher(note);
|
return new TodayLauncher(note);
|
||||||
case "quickSearch":
|
case "quickSearch":
|
||||||
return this.isHorizontalLayout ? new QuickSearchLauncherWidget() : null;
|
return new QuickSearchLauncherWidget(this.isHorizontalLayout);
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unrecognized builtin widget ${builtinWidget} for launcher ${note.noteId} "${note.title}"`);
|
throw new Error(`Unrecognized builtin widget ${builtinWidget} for launcher ${note.noteId} "${note.title}"`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,8 +11,19 @@ import QuickSearchWidget from "./quick_search.js";
|
|||||||
*/
|
*/
|
||||||
export default class QuickSearchLauncherWidget extends QuickSearchWidget {
|
export default class QuickSearchLauncherWidget extends QuickSearchWidget {
|
||||||
|
|
||||||
|
constructor(isHorizontalLayout) {
|
||||||
|
super();
|
||||||
|
this.isHorizontalLayout = isHorizontalLayout;
|
||||||
|
}
|
||||||
|
|
||||||
isEnabled() {
|
isEnabled() {
|
||||||
|
if (!this.isHorizontalLayout) {
|
||||||
|
// The quick search widget is added somewhere else on the vertical layout.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (utils.isMobile()) {
|
if (utils.isMobile()) {
|
||||||
|
// The widget takes too much spaces to be included in the mobile layout.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user