Skip to content

Commit

Permalink
Enhance: plugin-related improvements (#8787)
Browse files Browse the repository at this point in the history
 - fix: Select and Input elements rendered using provideUI via onMacroRendererSlotted don't function #8374
 - fix: logseq.Editor.getPageBlocksTree does not work when page uuid is passed in as param #4920
 - feat: add a plug-in flag for the plugin slash commands item
 - feat: add logseq.App.setCurrentGraphConfigs: (configs: {}) => Promise<void>
 - feat: add hook logseq.App.onTodayJournalCreated: IUserHook<{ title: string }
 - enhance: auto-check updates for the installed plugins from Marketplace
 - feat: expose template-related APIs to SDK
  • Loading branch information
xyhp915 committed Apr 12, 2023
1 parent 4c7597a commit 60fbfdf
Show file tree
Hide file tree
Showing 35 changed files with 1,228 additions and 907 deletions.
2 changes: 1 addition & 1 deletion bb.edn
Expand Up @@ -131,4 +131,4 @@
{:paths ["src/main"]
;; Ignore namespaces that won't be helpful to document initially
;; e.g. frontend.components.onboarding -> "Onboarding fns"
:ignore-regex "^(frontend.components|frontend.extensions|frontend.modules|frontend.mobile)"}}}
:ignore-regex "^(frontend.components|frontend.extensions|frontend.modules|frontend.mobile|logseq.sdk)"}}}
14 changes: 14 additions & 0 deletions libs/CHANGELOG.md
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.0.15]

### Added
- Support a plug-in flag for the plugin slash commands item
- Support api of `logseq.App.setCurrentGraphConfigs: (configs: {}) => Promise<void>`
- Support hook of `logseq.App.onTodayJournalCreated: IUserHook<{ title: string }`
- Support more template-related APIs
- Support auto-check updates for the installed plugins from Marketplace

### Fixed
- Select and Input elements rendered using provideUI via `onMacroRendererSlotted` don't function [#8374](https://github.com/logseq/logseq/issues/8374)
- `logseq.Editor.getPageBlocksTree` does not work when page uuid is passed in as param [#4920](https://github.com/logseq/logseq/issues/4920)


## [0.0.14]

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion libs/package.json
@@ -1,6 +1,6 @@
{
"name": "@logseq/libs",
"version": "0.0.14",
"version": "0.0.15",
"description": "Logseq SDK libraries",
"main": "dist/lsplugin.user.js",
"typings": "index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions libs/src/LSPlugin.core.ts
Expand Up @@ -23,6 +23,7 @@ import {
PluginLogger,
} from './helpers'
import * as pluginHelpers from './helpers'
import DOMPurify from 'dompurify'
import Debug from 'debug'
import {
LSPluginCaller,
Expand Down Expand Up @@ -1606,6 +1607,7 @@ function setupPluginCore(options: any) {
debug('=== 🔗 Setup Logseq Plugin System 🔗 ===')

window.LSPluginCore = pluginCore
window.DOMPurify = DOMPurify
}

export { PluginLocal, pluginHelpers, setupPluginCore }
24 changes: 22 additions & 2 deletions libs/src/LSPlugin.ts
Expand Up @@ -317,7 +317,10 @@ export interface IPluginSearchServiceHooks {

onIndiceInit: (graph: string) => Promise<SearchIndiceInitStatus>
onIndiceReset: (graph: string) => Promise<void>
onBlocksChanged: (graph: string, changes: { added: Array<SearchBlockItem>, removed: Array<EntityID> }) => Promise<void>
onBlocksChanged: (graph: string, changes: {
added: Array<SearchBlockItem>,
removed: Array<EntityID>
}) => Promise<void>
onGraphRemoved: (graph: string, opts?: {}) => Promise<any>
}

Expand Down Expand Up @@ -425,9 +428,11 @@ export interface IAppProxy {

// graph
getCurrentGraph: () => Promise<AppGraphInfo | null>
getCurrentGraphConfigs: () => Promise<any>
getCurrentGraphConfigs: (...keys: string[]) => Promise<any>
setCurrentGraphConfigs: (configs: {}) => Promise<void>
getCurrentGraphFavorites: () => Promise<Array<string> | null>
getCurrentGraphRecent: () => Promise<Array<string> | null>
getCurrentGraphTemplates: () => Promise<Record<string, BlockEntity> | null>

// router
pushState: (
Expand All @@ -441,6 +446,13 @@ export interface IAppProxy {
query?: Record<string, any>
) => void

// templates
getTemplate: (name: string) => Promise<BlockEntity | null>
existTemplate: (name: string) => Promise<Boolean>
createTemplate: (target: BlockUUID, name: string, opts?: { overwrite: boolean }) => Promise<any>
removeTemplate: (name: string) => Promise<any>
insertTemplate: (target: BlockUUID, name: string) => Promise<any>

// ui
queryElementById: (id: string) => Promise<string | boolean>

Expand Down Expand Up @@ -481,6 +493,7 @@ export interface IAppProxy {
onGraphAfterIndexed: IUserHook<{ repo: string }>
onThemeModeChanged: IUserHook<{ mode: 'dark' | 'light' }>
onThemeChanged: IUserHook<Partial<{ name: string, mode: string, pid: string, url: string }>>
onTodayJournalCreated: IUserHook<{ title: string }>

/**
* provide ui slot to specific block with UUID
Expand Down Expand Up @@ -894,6 +907,13 @@ export interface IAssetsProxy {
* @added 0.0.10
*/
makeSandboxStorage(): IAsyncStorage

/**
* make assets scheme url based on current graph
* @added 0.0.15
* @param path
*/
makeUrl(path: string): Promise<string>
}

export interface ILSPluginThemeManager {
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Expand Up @@ -50,6 +50,7 @@
</script>
<script defer src="/static/js/highlight.min.js"></script>
<script defer src="/static/js/interact.min.js"></script>
<script defer src="/static/js/marked.min.js"></script>
<script defer src="/static/js/html2canvas.min.js"></script>
<script defer src="/static/js/main.js"></script>
<script defer src="/static/js/amplify.js"></script>
Expand Down
1 change: 1 addition & 0 deletions resources/electron.html
Expand Up @@ -50,6 +50,7 @@
</script>
<script defer src="./js/highlight.min.js"></script>
<script defer src="./js/interact.min.js"></script>
<script defer src="./js/marked.min.js"></script>
<script defer src="./js/html2canvas.min.js"></script>
<script defer src="./js/lsplugin.core.js"></script>
<script defer src="./js/main.js"></script>
Expand Down
1 change: 1 addition & 0 deletions resources/index.html
Expand Up @@ -49,6 +49,7 @@
</script>
<script defer src="./js/highlight.min.js"></script>
<script defer src="./js/interact.min.js"></script>
<script defer src="./js/marked.min.js"></script>
<script defer src="./js/html2canvas.min.js"></script>
<script defer src="./js/lsplugin.core.js"></script>
<script defer src="./js/main.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/lsplugin.core.js

Large diffs are not rendered by default.

0 comments on commit 60fbfdf

Please sign in to comment.