improve(plugin): add openExternalLink api

pull/2264/head
charlie 2021-06-22 14:58:30 +08:00 committed by Tienson Qin
parent cd9fc67f30
commit ac5d4b4508
3 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@logseq/libs",
"version": "0.0.1-alpha.20",
"version": "0.0.1-alpha.21",
"description": "Logseq SDK libraries",
"main": "dist/lsplugin.user.js",
"typings": "index.d.ts",

View File

@ -170,6 +170,7 @@ export interface IAppProxy {
// native
relaunch: () => Promise<void>
quit: () => Promise<void>
openExternalLink: (url: string) => Promise<void>
// graph
getCurrentGraph: () => Promise<AppGraphInfo | null>

View File

@ -67,7 +67,7 @@
(fn []
(when-let [repo (state/get-current-repo)]
(when-not (= config/local-repo repo)
(bean/->js {:url repo
(bean/->js {:url repo
:name (util/node-path.basename repo)
:path (config/get-repo-dir repo)})))))
@ -162,6 +162,11 @@
(fn []
(ipc/ipc "quitApp")))
(def ^:export open_external_link
(fn [url]
(when (re-find #"https?://" url)
(js/apis.openExternal url))))
(def ^:export push_state
(fn [^js k ^js params]
(rfe/push-state