From 5b5c8c06e355422e66c1361e7278b68f184f3368 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 16 Apr 2026 12:59:38 +0200 Subject: [PATCH] feat: properly impl find for files (#5741) * Initial file search impl * Add replace functionality * Rename to find, remove extra icon * Put into seperate component * Fix lint * Change remaining search stuff to find * Use ButtonStyled for buttons, use types from ace editor * Make results label oriented left, add clear button to replace input * Run fix --------- Signed-off-by: Arthur Co-authored-by: Creeperkatze <178587183+Creeperkatze@users.noreply.github.com> --- .../files-tab/components/FileNavbar.vue | 39 ++- .../components/editor/EditorFindReplace.vue | 246 ++++++++++++++++++ .../components/editor/FileEditor.vue | 142 +++++++++- .../src/layouts/shared/files-tab/layout.vue | 2 + packages/ui/src/locales/en-US/index.json | 33 +++ 5 files changed, 441 insertions(+), 21 deletions(-) create mode 100644 packages/ui/src/layouts/shared/files-tab/components/editor/EditorFindReplace.vue diff --git a/packages/ui/src/layouts/shared/files-tab/components/FileNavbar.vue b/packages/ui/src/layouts/shared/files-tab/components/FileNavbar.vue index e7ec4fabd..f6e48bab7 100644 --- a/packages/ui/src/layouts/shared/files-tab/components/FileNavbar.vue +++ b/packages/ui/src/layouts/shared/files-tab/components/FileNavbar.vue @@ -179,16 +179,30 @@ -
- + + - - + +
@@ -212,7 +226,6 @@ import { } from '@modrinth/assets' import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue' -import Button from '#ui/components/base/Button.vue' import ButtonStyled from '#ui/components/base/ButtonStyled.vue' import OverflowMenu from '#ui/components/base/OverflowMenu.vue' import StyledInput from '#ui/components/base/StyledInput.vue' @@ -274,6 +287,10 @@ const messages = defineMessages({ id: 'files.navbar.share-to-mclogs', defaultMessage: 'Share to mclo.gs', }, + findInFile: { + id: 'files.navbar.find-in-file', + defaultMessage: 'Find in file', + }, }) const props = defineProps<{ @@ -282,6 +299,7 @@ const props = defineProps<{ editingFileName?: string editingFilePath?: string isEditingImage?: boolean + isEditorFindOpen?: boolean searchQuery: string showRefreshButton?: boolean showInstallFromUrl?: boolean @@ -301,6 +319,7 @@ const emit = defineEmits<{ unzipFromUrl: [cf: boolean] refresh: [] share: [] + find: [] }>() const refreshing = ref(false) diff --git a/packages/ui/src/layouts/shared/files-tab/components/editor/EditorFindReplace.vue b/packages/ui/src/layouts/shared/files-tab/components/editor/EditorFindReplace.vue new file mode 100644 index 000000000..2eb1d23af --- /dev/null +++ b/packages/ui/src/layouts/shared/files-tab/components/editor/EditorFindReplace.vue @@ -0,0 +1,246 @@ + + + + + diff --git a/packages/ui/src/layouts/shared/files-tab/components/editor/FileEditor.vue b/packages/ui/src/layouts/shared/files-tab/components/editor/FileEditor.vue index 9e9fe6215..7f8a9ebb8 100644 --- a/packages/ui/src/layouts/shared/files-tab/components/editor/FileEditor.vue +++ b/packages/ui/src/layouts/shared/files-tab/components/editor/FileEditor.vue @@ -1,8 +1,21 @@