Skip to content

Commit

Permalink
Use JS "prompt" while Front.showEditor is broken
Browse files Browse the repository at this point in the history
Also see the following PR for relevant info:

=> brookhong/Surfingkeys#2207
  • Loading branch information
leotaku committed Dec 21, 2024
1 parent 25a2e05 commit 0cb2cd5
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions extensions/surfingkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,24 @@ mapkey("n", "Mouse over elements.", function () {
});

mapkey("y", "Capture with org-capture", function () {
function openUrl(url) {
RUNTIME("openLink", {
tab: {
tabbed: false,
},
url: url,
});
const body = prompt(document.title);
if (body === null) {
return;
}

Front.showEditor(
"",
function (body) {
openUrl(
"org-protocol://capture?" +
new URLSearchParams({
template: "wc",
url: location.href,
title: document.title,
body: body,
}),
);
RUNTIME("openLink", {
tab: {
tabbed: false,
},
"url",
);
url:
"org-protocol://capture?" +
new URLSearchParams({
template: "wc",
url: location.href,
title: document.title,
body: body,
}),
});
});

mapkey("q", "Select previous tab", function () {
Expand Down

0 comments on commit 0cb2cd5

Please sign in to comment.