Browse Source

chore(plugin): bump version

charlie 4 years ago
parent
commit
57079a9234
3 changed files with 7 additions and 5 deletions
  1. 1 1
      libs/package.json
  2. 0 2
      libs/src/LSPlugin.user.ts
  3. 6 2
      libs/src/helpers.ts

+ 1 - 1
libs/package.json

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

+ 0 - 2
libs/src/LSPlugin.user.ts

@@ -296,8 +296,6 @@ export function setupPluginUserInstance (
 }
 
 if (window.__LSP__HOST__ == null) { // Entry of iframe mode
-  debug('Entry of iframe mode.')
-
   const caller = new LSPluginCaller(null)
   window.logseq = setupPluginUserInstance({} as any, caller)
 }

+ 6 - 2
libs/src/helpers.ts

@@ -121,8 +121,12 @@ export function invokeHostExportedApi (
   ...args: Array<any>
 ) {
   const method1 = snakeCase(method)
-  const fn = window.api[method1] || window.apis[method1] ||
-    window.api[method] || window.apis[method]
+
+  // @ts-ignore
+  const logseqHostExportedApi = window.logseq?.api || {}
+
+  const fn = logseqHostExportedApi[method1] || window.apis[method1] ||
+    logseqHostExportedApi[method] || window.apis[method]
 
   if (!fn) {
     throw new Error(`Not existed method #${method}`)