Browse Source

improve(plugin): api types & bump libs version

charlie 4 years ago
parent
commit
100b3ee0e8
3 changed files with 18 additions and 19 deletions
  1. 1 1
      libs/package.json
  2. 16 17
      libs/src/LSPlugin.ts
  3. 1 1
      src/main/logseq/api.cljs

+ 1 - 1
libs/package.json

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

+ 16 - 17
libs/src/LSPlugin.ts

@@ -289,8 +289,7 @@ export interface IEditorProxy extends Record<string, any> {
   ) => Promise<void>
   ) => Promise<void>
 
 
   removeBlock: (
   removeBlock: (
-    srcBlock: BlockIdentity,
-    opts?: Partial<{ includeChildren: boolean }>
+    srcBlock: BlockIdentity
   ) => Promise<void>
   ) => Promise<void>
 
 
   getBlock: (
   getBlock: (
@@ -375,17 +374,17 @@ export interface ILSPluginUser extends EventEmitter<LSPluginUserEvents> {
 
 
   /**
   /**
    * The main Logseq app is ready to run the plugin
    * The main Logseq app is ready to run the plugin
-   * 
+   *
    * @param model - same as the model in `provideModel`
    * @param model - same as the model in `provideModel`
    */
    */
-  ready(model?: Record<string, any>): Promise<any>
+  ready (model?: Record<string, any>): Promise<any>
 
 
   /**
   /**
    * @param callback - a function to run when the main Logseq app is ready
    * @param callback - a function to run when the main Logseq app is ready
    */
    */
-  ready(callback?: (e: any) => void | {}): Promise<any>
+  ready (callback?: (e: any) => void | {}): Promise<any>
 
 
-  ready(
+  ready (
     model?: Record<string, any>,
     model?: Record<string, any>,
     callback?: (e: any) => void | {}
     callback?: (e: any) => void | {}
   ): Promise<any>
   ): Promise<any>
@@ -404,12 +403,12 @@ export interface ILSPluginUser extends EventEmitter<LSPluginUserEvents> {
    * })
    * })
    * ```
    * ```
    */
    */
-  provideModel(model: Record<string, any>): this
+  provideModel (model: Record<string, any>): this
 
 
   /**
   /**
    * Set the theme for the main Logseq app
    * Set the theme for the main Logseq app
    */
    */
-  provideTheme(theme: ThemeOptions): this
+  provideTheme (theme: ThemeOptions): this
 
 
   /**
   /**
    * Inject custom css for the main Logseq app
    * Inject custom css for the main Logseq app
@@ -426,7 +425,7 @@ export interface ILSPluginUser extends EventEmitter<LSPluginUserEvents> {
    *
    *
    * ```
    * ```
    */
    */
-  provideStyle(style: StyleString | StyleOptions): this
+  provideStyle (style: StyleString | StyleOptions): this
 
 
   /**
   /**
    * Inject custom UI at specific DOM node.
    * Inject custom UI at specific DOM node.
@@ -445,15 +444,15 @@ export interface ILSPluginUser extends EventEmitter<LSPluginUserEvents> {
    * })
    * })
    * ```
    * ```
    */
    */
-  provideUI(ui: UIOptions): this
+  provideUI (ui: UIOptions): this
 
 
-  updateSettings(attrs: Record<string, any>): void
+  updateSettings (attrs: Record<string, any>): void
 
 
-  setMainUIAttrs(attrs: Record<string, any>): void
+  setMainUIAttrs (attrs: Record<string, any>): void
 
 
   /**
   /**
    * Set the style for the plugin's UI
    * Set the style for the plugin's UI
-   * 
+   *
    * @example
    * @example
    * ```ts
    * ```ts
    * logseq.setMainUIInlineStyle({
    * logseq.setMainUIInlineStyle({
@@ -462,22 +461,22 @@ export interface ILSPluginUser extends EventEmitter<LSPluginUserEvents> {
    * })
    * })
    * ```
    * ```
    */
    */
-  setMainUIInlineStyle(style: CSS.Properties): void
+  setMainUIInlineStyle (style: CSS.Properties): void
 
 
   /**
   /**
    * show the plugin's UI
    * show the plugin's UI
    */
    */
-  showMainUI(): void
+  showMainUI (): void
 
 
   /**
   /**
    * hide the plugin's UI
    * hide the plugin's UI
    */
    */
-  hideMainUI(opts?: { restoreEditingCursor: boolean }): void
+  hideMainUI (opts?: { restoreEditingCursor: boolean }): void
 
 
   /**
   /**
    * toggle the plugin's UI
    * toggle the plugin's UI
    */
    */
-  toggleMainUI(): void
+  toggleMainUI (): void
 
 
   isMainUIVisible: boolean
   isMainUIVisible: boolean
 
 

+ 1 - 1
src/main/logseq/api.cljs

@@ -255,7 +255,7 @@
 
 
 (def ^:export remove_block
 (def ^:export remove_block
   (fn [block-uuid ^js opts]
   (fn [block-uuid ^js opts]
-    (let [{:keys [includeChildren]} (bean/->clj opts)
+    (let [includeChildren true
           repo (state/get-current-repo)]
           repo (state/get-current-repo)]
       (editor-handler/delete-block-aux!
       (editor-handler/delete-block-aux!
        {:block/uuid (medley/uuid block-uuid) :repo repo} includeChildren))))
        {:block/uuid (medley/uuid block-uuid) :repo repo} includeChildren))))