Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add command that opens in-app browser with the given url #1075

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/ace/commands.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import prompt from "dialogs/prompt";
import fsOperation from "fileSystem";
import actions from "handlers/quickTools";
import keyBindings from "lib/keyBindings";
Expand Down Expand Up @@ -119,6 +120,19 @@ const commands = [
},
readOnly: true,
},
{
name: "openInAppBrowser",
description: "Open In-App Browser",
async exec() {
const url = await prompt("Enter url", "", "url", {
placeholder: "http://",
match: /^https?:\/\/.+/,
});
if (url) {
acode.exec("open-inapp-browser", url);
}
},
},
{
name: "toggleFullscreen",
description: "Toggle full screen mode",
Expand Down
5 changes: 4 additions & 1 deletion src/lib/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import changeEncoding from "palettes/changeEncoding";
import changeMode from "palettes/changeMode";
import commandPalette from "palettes/commandPalette";
import findFile from "palettes/findFile";
import browser from "plugins/browser";
import help from "settings/helpSettings";
import mainSettings from "settings/mainSettings";
import Url from "utils/Url";
Expand Down Expand Up @@ -236,7 +237,9 @@ export default {
"resize-editor"() {
editorManager.editor.resize(true);
},

"open-inapp-browser"(url) {
browser.open(url);
},
run() {
editorManager.activeFile[
appSettings.value.useCurrentFileForPreview ? "runFile" : "run"
Expand Down