在 The Refactoring Of Logseq 中提到的 hooks 目前可用吗?

我在官方文档中看到一篇文章 The Refactoring Of Logseq, 里面提到新的架构中提供了hooks的能力

The outliner is very simple, so we should find a way to enhance the ability of Logseq to meet various demands. Hook is our final choice. Hooks can plug in the whole lifecycle of outliner operations. For example, we have provided a hook point for reading the block data when a new block inserts or block changes and a hook point to save block when it receives valid block data. These two hooks could provide the ability to connect arbitrary persistent storage, which including but not limited to Markdown, Org-mode, SQLite, Elasticsearch, and so on. Another example is, we have provided a hook that is invoked when the Logseq on load. The Logseq plugin authors can utilize the hook to design widgets, custom the themes, or whatever the user has been privileged. The outliner is very simple, so we should find a way to enhance the ability of Logseq to meet various demands. Hook is our final choice. Hooks can plug in the whole lifecycle of outliner operations. For example, we have provided a hook point for reading the block data when a new block inserts or block changes and a hook point to save block when it receives valid block data. These two hooks could provide the ability to connect arbitrary persistent storage, which including but not limited to Markdown, Org-mode, SQLite, Elasticsearch, and so on. Another example is, we have provided a hook that is invoked when the Logseq on load. The Logseq plugin authors can utilize the hook to design widgets, custom the themes, or whatever the user has been privileged.

大纲很简单,所以我们应该想办法提高 Logseq 满足各种需求的能力。钩子是我们最后的选择。钩子可以插入 outliner 操作的整个生命周期。例如,我们提供了一个钩子点用于在新块插入或块更改时读取块数据,以及钩子点用于在接收到有效块数据时保存块。这两个钩子可以提供连接任意持久存储的能力,包括但不限于 Markdown、 Org-mode、 SQLite、 Elasticsearch 等等。另一个例子是,我们提供了一个钩子,它在 Logseq 加载时被调用。Logseq 插件的作者可以利用钩子来设计小工具,自定义主题,或者任何用户拥有特权的东西

我对这项功能很感兴趣, 因为目前我有几个需求正需要通过这样的hooks来实现

  1. 目前数据的持久化都被保存到了md文件中, 希望可以选择将数据同时持久化保存到某个数据库中, 方便与其他系统进行集成, 作为其他应用的数据源, 从而可以进行数据分析, 二次开发等等
  2. 监听block的内容变化, 订阅某些感兴趣block的编辑事件, 例如新建了一个任务的block, 改变了任务的状态, 为某个block指定了日期等等

但是我试着在插件文档 @logseq/libs 中寻找时, 找不到这样的hooks, 是我没有找到还是目前还没有实现这些hoooks呢?


顺便问下, 插件文档中的 onBlockRendererSlotted IAppProxy | @logseq/libs 和 onPageHeadActionsSlotted IAppProxy | @logseq/libs 事件是如何触发的?我试着各种操作都没有触发过这2个事件