improve(plugin): api to create block uuid

This commit is contained in:
charlie
2022-08-19 10:38:45 +08:00
committed by Tienson Qin
parent 51a9c7b2d4
commit eb72f2e3c7
3 changed files with 12 additions and 2 deletions

View File

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

View File

@@ -551,6 +551,12 @@ export interface IEditorProxy extends Record<string, any> {
namespace: BlockPageName
) => Promise<Array<PageEntity> | null>
/**
* Create an uuid string for specific block id(uuid)
* @added 0.0.8
*/
newBlockUUID: () => Promise<string>
/**
* @example https://github.com/logseq/logseq-plugin-samples/tree/master/logseq-reddit-hot-news
*

View File

@@ -189,6 +189,10 @@ const app: Partial<IAppProxy> = {
let registeredCmdUid = 0
const editor: Partial<IEditorProxy> = {
newBlockUUID(this: LSPluginUser): Promise<string> {
return this._execCallableAPIAsync('new_block_uuid')
},
registerSlashCommand(
this: LSPluginUser,
tag: string,
@@ -273,7 +277,7 @@ const editor: Partial<IEditorProxy> = {
} else {
this.App.pushState('page', { name: pageName }, { anchor })
}
},
}
}
const db: Partial<IDBProxy> = {