From 36e22c887d90b1c9b8966edd1f0660ddf96ba573 Mon Sep 17 00:00:00 2001 From: quorafind <951011105@qq.com> Date: Wed, 24 Jan 2024 17:43:38 +0800 Subject: [PATCH] chore: bump version --- manifest.json | 2 +- package.json | 2 +- src/floatSearchIndex.ts | 25 +++++++++++++++++++++++-- versions.json | 3 ++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/manifest.json b/manifest.json index a75561f..1872520 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "float-search", "name": "Floating Search", - "version": "3.4.9", + "version": "3.4.10", "minAppVersion": "0.15.0", "description": "You can use search view in modal/leaf/popout window now.", "author": "Boninall", diff --git a/package.json b/package.json index 5f89682..c77738d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "float-search", - "version": "3.4.9", + "version": "3.4.10", "description": "You can use search view in modal/leaf/popout window now.", "main": "main.js", "scripts": { diff --git a/src/floatSearchIndex.ts b/src/floatSearchIndex.ts index 03c138e..a8ced2c 100644 --- a/src/floatSearchIndex.ts +++ b/src/floatSearchIndex.ts @@ -3,7 +3,7 @@ import { App, debounce, Editor, - ExtraButtonComponent, + ExtraButtonComponent, Keymap, Menu, MenuItem, Modal, @@ -610,6 +610,8 @@ class FloatSearchModal extends Modal { private fileEl: HTMLElement; private viewType: string; + private focusdItem: any; + constructor(cb: (state: any) => void, plugin: FloatSearchPlugin, state: any, viewType: string = "search") { super(plugin.app); this.plugin = plugin; @@ -672,6 +674,11 @@ class FloatSearchModal extends Modal { altEnterIconEl.setText("Alt+↵"); altEnterTextEl.setText("Open File and Close"); + const ctrlEnterIconEl = altEnterInstructionsEl.createSpan({cls: "float-search-modal-instructions-key"}); + const ctrlEnterTextEl = altEnterInstructionsEl.createSpan({cls: "float-search-modal-instructions-text"}); + altEnterIconEl.setText("Ctrl+↵"); + altEnterTextEl.setText("Create File When Not Exist"); + const tabIconEl = tabInstructionsEl.createSpan({cls: "float-search-modal-instructions-key"}); const tabTextEl = tabInstructionsEl.createSpan({cls: "float-search-modal-instructions-text"}); tabIconEl.setText("Tab/Shift+Tab"); @@ -728,10 +735,12 @@ class FloatSearchModal extends Modal { if (currentView.dom.focusedItem.collapsible) { currentView.dom.focusedItem.setCollapse(false); } + this.focusdItem = currentView.dom.focusedItem; } break; } else { currentView.onKeyArrowDownInFocus(e); + this.focusdItem = currentView.dom.focusedItem; break; } case "ArrowUp": @@ -741,10 +750,15 @@ class FloatSearchModal extends Modal { if (currentView.dom.focusedItem.collapseEl) { currentView.dom.focusedItem.setCollapse(true); } + this.focusdItem = currentView.dom.focusedItem; } break; } else { currentView.onKeyArrowUpInFocus(e); + this.focusdItem = currentView.dom.focusedItem; + if (!currentView.dom.focusedItem.content) { + this.focusdItem = undefined; + } break; } case "ArrowLeft": @@ -754,6 +768,14 @@ class FloatSearchModal extends Modal { currentView.onKeyArrowRightInFocus(e); break; case "Enter": + if (Keymap.isModifier(e, 'Mod') && !this.focusdItem) { + e.preventDefault(); + const fileName = inputEl.value; + const real = fileName.replace(/[/\\?%*:|"<>]/g, '-'); + this.plugin.app.workspace.openLinkText(real, "", true); + this.close(); + break; + } currentView.onKeyEnterInFocus(e); if (e.altKey && currentView.dom.focusedItem) { this.close(); @@ -815,7 +837,6 @@ class FloatSearchModal extends Modal { navigator.clipboard.writeText(text); } break; - } }; } diff --git a/versions.json b/versions.json index 2c4a00e..d3075e2 100644 --- a/versions.json +++ b/versions.json @@ -26,5 +26,6 @@ "3.4.6": "0.15.0", "3.4.7": "0.15.0", "3.4.8": "0.15.0", - "3.4.9": "0.15.0" + "3.4.9": "0.15.0", + "3.4.10": "0.15.0" } \ No newline at end of file