Skip to content

Commit

Permalink
Merge pull request #1075 from angeloyana/main
Browse files Browse the repository at this point in the history
feat: add command that opens in-app browser with the given url
  • Loading branch information
bajrangCoder authored Nov 13, 2024
2 parents fd8e0a9 + 624c278 commit 32094e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
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

0 comments on commit 32094e8

Please sign in to comment.