Skip to content

Commit

Permalink
fix: search focus bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jambo2018 committed Apr 7, 2024
1 parent 915ebaa commit c57fefc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,19 @@ export default class TypingAsstPlugin extends Plugin {

this.registerDomEvent(document, "mouseup", (evt: MouseEvent) => {
// prevent title selection
if ((evt?.target as any)?.getAttribute?.('class')?.includes('inline-title')) return;
if (!(evt?.target as any)?.getAttribute?.('class')?.includes('cm-active')) return;
// desable seletion menu in mobile env
if (isMobile) return;
handleSelection();
});

this.registerDomEvent(document, "keydown", (evt: KeyboardEvent) => {
if ((evt?.target as any)?.getAttribute?.('class')?.includes('inline-title')) return;
const view =
this.app.workspace.getActiveViewOfType(MarkdownView);
if (view) {
view.editor.focus();
if ((evt?.target as any)?.getAttribute?.('class')?.includes('command-option')) {
const view =
this.app.workspace.getActiveViewOfType(MarkdownView);
if (view) {
view.editor.focus();
}
}
})

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "typing-assistant",
"name": "Typing Assistant",
"version": "0.2.6-beta.0",
"version": "0.2.6-beta.1",
"minAppVersion": "0.15.0",
"description": "Support multiple shortcut menus to improve input efficiency",
"author": "Jambo",
Expand Down

0 comments on commit c57fefc

Please sign in to comment.