Skip to content

Commit

Permalink
fix: keyboard not opening on command
Browse files Browse the repository at this point in the history
  • Loading branch information
StrangeGirlMurph committed Jun 9, 2024
1 parent 7c4a26d commit 4cbec0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class WikipediaSearchSettingTab extends PluginSettingTab {

new Setting(containerEl)
.setName("Auto-search note title")
.setDesc("Whether or not to automatically use the active notes title when searching for articles.")
.setDesc("Whether or not to automatically use the active notes title when searching for articles and nothing is selected.")
.addToggle((toggle) =>
toggle.setValue(this.settings.autoSearchNoteTitle).onChange(async (value) => {
this.settings.autoSearchNoteTitle = value;
Expand Down
16 changes: 6 additions & 10 deletions src/utils/searchModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@ export abstract class SearchModal extends SuggestModal<Article> {
}

onOpen(): void {
this.inputEl.value = "";
if (this.editor) {
const selection = this.editor?.getSelection();
if (selection != "") {
this.inputEl.value = selection;
}
}
super.onOpen();
if (this.settings.autoSearchNoteTitle) {
const fileName = this.app.workspace.getActiveFile()?.basename;
if (fileName && fileName != "") {
this.inputEl.value = fileName;
}
if (fileName && fileName != "") this.inputEl.value = fileName;
}
if (this.editor) {
const selection = this.editor.getSelection();
if (selection.trim() != "") this.inputEl.value = selection;
}
//@ts-ignore - private method
super.updateSuggestions();
Expand Down

0 comments on commit 4cbec0b

Please sign in to comment.