Skip to content

Commit

Permalink
make fixes for jothei
Browse files Browse the repository at this point in the history
  • Loading branch information
clairefro committed Mar 13, 2024
1 parent bbad4a5 commit 7565e2a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
12 changes: 6 additions & 6 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class EtymologyLookupPlugin extends Plugin {
"sprout",
"Etymology Lookup",
(event: MouseEvent) => {
this.lookup(getCurrentSelectedText());
this.lookup(getCurrentSelectedText(this.app));
}
);

Expand All @@ -61,14 +61,14 @@ export default class EtymologyLookupPlugin extends Plugin {
id: "search",
name: "Search",
callback: () => {
this.lookup(getCurrentSelectedText());
this.lookup(getCurrentSelectedText(this.app));
},
});

// Adds to right click menu
this.registerEvent(
this.app.workspace.on("editor-menu", (menu) => {
const selection = getCurrentSelectedText();
const selection = getCurrentSelectedText(this.app);
menu.addItem((item) => {
item.setTitle(
`Get etymology of "${ellipsis(selection, 18)}"`
Expand All @@ -89,8 +89,8 @@ export default class EtymologyLookupPlugin extends Plugin {
}
}

function getCurrentSelectedText() {
const editor = this.app.workspace.activeEditor?.editor;
function getCurrentSelectedText(app: App): string {
const editor = app.workspace.activeEditor?.editor;

if (editor) {
if (editor && editor.somethingSelected()) {
Expand All @@ -99,5 +99,5 @@ function getCurrentSelectedText() {
}
}

return null;
return "";
}
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "etymology-lookup",
"name": "Etymology Lookup",
"version": "1.0.1",
"version": "1.0.2",
"minAppVersion": "0.15.0",
"description": "Get the etymology of words in your notes",
"author": "Claire Froelich",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-plugin-etymology-lookup",
"version": "1.0.1",
"version": "1.0.2",
"description": "Get the etymology of words in your Obsidian notes",
"main": "main.js",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"1.0.0": "0.15.0"
"1.0.0": "0.15.0",
"1.0.1": "0.15.0",
"1.0.2": "0.15.0"
}

0 comments on commit 7565e2a

Please sign in to comment.