Skip to content

Commit 32094e8

Browse files
authored
Merge pull request #1075 from angeloyana/main
feat: add command that opens in-app browser with the given url
2 parents fd8e0a9 + 624c278 commit 32094e8

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/ace/commands.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import prompt from "dialogs/prompt";
12
import fsOperation from "fileSystem";
23
import actions from "handlers/quickTools";
34
import keyBindings from "lib/keyBindings";
@@ -119,6 +120,19 @@ const commands = [
119120
},
120121
readOnly: true,
121122
},
123+
{
124+
name: "openInAppBrowser",
125+
description: "Open In-App Browser",
126+
async exec() {
127+
const url = await prompt("Enter url", "", "url", {
128+
placeholder: "http://",
129+
match: /^https?:\/\/.+/,
130+
});
131+
if (url) {
132+
acode.exec("open-inapp-browser", url);
133+
}
134+
},
135+
},
122136
{
123137
name: "toggleFullscreen",
124138
description: "Toggle full screen mode",

src/lib/commands.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import changeEncoding from "palettes/changeEncoding";
1313
import changeMode from "palettes/changeMode";
1414
import commandPalette from "palettes/commandPalette";
1515
import findFile from "palettes/findFile";
16+
import browser from "plugins/browser";
1617
import help from "settings/helpSettings";
1718
import mainSettings from "settings/mainSettings";
1819
import Url from "utils/Url";
@@ -236,7 +237,9 @@ export default {
236237
"resize-editor"() {
237238
editorManager.editor.resize(true);
238239
},
239-
240+
"open-inapp-browser"(url) {
241+
browser.open(url);
242+
},
240243
run() {
241244
editorManager.activeFile[
242245
appSettings.value.useCurrentFileForPreview ? "runFile" : "run"

0 commit comments

Comments
 (0)