Compare commits

..

No commits in common. "c6ad8bf11128408780880a73e537682c70ae95ce" and "3b594476029737aa1a810f6a35bda4feb0ce6e83" have entirely different histories.

4 changed files with 6 additions and 65 deletions

16
.vscode/settings.json vendored
View file

@ -1,20 +1,8 @@
{ {
"[typescript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.format.enable": true, "eslint.format.enable": true,
"eslint.codeActionsOnSave.mode": "problems", "eslint.codeActionsOnSave.mode": "problems",
"eslint.options": { "eslint.options": {
"overrideConfigFile": "eslint.config.mjs" "overrideConfigFile": "eslint.config.mjs"
}, }
} }

View file

@ -44,15 +44,9 @@ Copy emojis to your clipboard from Gauntlet!
[[supported_system]] [[supported_system]]
os = 'linux' os = 'linux'
[[supported_system]]
os = 'macos'
[[supported_system]]
os = 'windows'
[permissions] [permissions]
main_search_bar = ["read"] main_search_bar = ["read"]
clipboard = ["write"] clipboard = ["write"]
[permissions.exec] [permissions.exec]
command = ["xdg-open", "open", "start", "firefox"] command = ["xdg-open"]

View file

@ -2,18 +2,14 @@ import { List } from "@project-gauntlet/api/components";
import React, { ReactElement, useState } from "react"; import React, { ReactElement, useState } from "react";
import documentation from "./documentation/tailwind-css"; import documentation from "./documentation/tailwind-css";
import { Clipboard } from "@project-gauntlet/api/helpers"; import { Clipboard } from "@project-gauntlet/api/helpers";
import open from "../../utils/open-url"; //import { open } from "@opensrc/deno-open"; # pending a fix for https://github.com/project-gauntlet/gauntlet/issues/28
// @ts-expect-error gauntlet uses deno and not node
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const denoCore: DenoCore = Deno[Deno.internal].core;
export default function SearchDocumentation(): ReactElement { export default function SearchDocumentation(): ReactElement {
const [searchText, setSearchText] = useState<string | undefined>(""); const [searchText, setSearchText] = useState<string | undefined>("");
const onClick = async (url: string) => { const onClick = async (url: string) => {
await open(url); //await open(url);
//await Clipboard.writeText(url); await Clipboard.writeText(url);
}; };
return ( return (

View file

@ -1,37 +0,0 @@
const getOpenCommand = (platform: typeof Deno.build.os): string => {
const commands = {
windows: "start",
darwin: "open",
linux: "xdg-open",
freebsd: "xdg-open",
netbsd: "xdg-open",
android: "open",
solaris: "firefox", //FIXME - use a different command that doesn't force a specific browser
aix: "firefox",
illumos: "firefox",
} as const;
return commands[platform] || commands.linux;
};
/**
* Open a URL in the user's configured default browser
* @param url The url you want to open in the default browser
* @returns Promise<Deno.CommandStatus> The status of the command
*/
const open = async (url: string) => {
// Yes, this function uses Deno. Yes, this repository uses Node.js for tooling.
// Gauntlet runs loaded plugins in a Deno runtime, so this works fine.
// Hop off Copilot I know this isn't using Node.js APIs
const platform = Deno.build.os;
const cmd = getOpenCommand(platform);
const process = new Deno.Command(cmd, {
args: [url],
env: {
LD_LIBRARY_PATH: "",
},
});
const child = process.spawn();
return await child.status;
};
export default open;