Skip to content

Commit

Permalink
Allow page in global and add search
Browse files Browse the repository at this point in the history
  • Loading branch information
gabber235 committed Nov 29, 2023
1 parent 7523cfe commit 5c00727
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/lib/pages/page_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class PageEditor extends HookConsumerWidget {
SearchIntent(),
SmartSingleActivator(LogicalKeyboardKey.space, control: true):
SearchIntent(),
const SingleActivator(LogicalKeyboardKey.keyP, control: true):
const PreviousFocusIntent(),
const SingleActivator(LogicalKeyboardKey.keyN, control: true):
const NextFocusIntent(),
},
child: Actions(
actions: {
Expand Down
5 changes: 4 additions & 1 deletion app/lib/widgets/components/app/page_search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ class PageSearchElement extends SearchElement {
String get title => page.pageName.formatted;

@override
String description(BuildContext context) => page.type.name;
String description(BuildContext context) {
if (page.chapter.isEmpty) return page.type.name;
return "~${page.chapter}";
}

@override
Widget icon(BuildContext context) => Icon(page.type.icon);
Expand Down
4 changes: 4 additions & 0 deletions app/lib/widgets/components/app/search_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import "package:text_scroll/text_scroll.dart";
import "package:typewriter/utils/debouncer.dart";
import "package:typewriter/utils/passing_reference.dart";
import "package:typewriter/widgets/components/app/entry_search.dart";
import "package:typewriter/widgets/components/app/page_search.dart";
import "package:typewriter/widgets/components/general/context_menu_region.dart";
import "package:typewriter/widgets/components/general/decorated_text_field.dart";
import "package:typewriter/widgets/components/general/focused_notifier.dart";
Expand Down Expand Up @@ -58,10 +59,13 @@ class SearchNotifier extends StateNotifier<Search?> {
void startGlobalSearch() => asBuilder()
..fetchNewEntry()
..fetchEntry()
..fetchPage()
..fetchAddPage()
..open();

void startAddSearch() => asBuilder()
..fetchNewEntry()
..fetchAddPage()
..open();

void endSearch() {
Expand Down

0 comments on commit 5c00727

Please sign in to comment.