LincZero / obsidian-any-block

A Obsidian Plugin. You can flexibility to create a 'Block' by some means. It also provides some useful features, like `list to table`.
https://linczero.github.io/MdNote_Public/ProductDoc/AnyBlock/
GNU Affero General Public License v3.0
171 stars 8 forks source link

[docs] 修复buttons插件不适应AnyBlock的bug (fix buttons plugin does not work with plugin AnyBlock) #66

Open LincZero opened 6 days ago

LincZero commented 6 days ago

存在问题 (existing problem)

https://github.com/LincZero/obsidian-any-block/discussions/14#discussioncomment-10753629

原因分析 (analysis of causes)

可以看到控制台有报错:

图片

判断是ob的重渲染,会导致button获取file值失败,进而报错。应该由buttons插件那边修。 看了下那边的issue也有类似的问题:https://github.com/shabegom/buttons/issues/212


You can see that the console is reporting an error

Judging that it is ob rerender will cause button to fail to obtain the file value and then report an error. It should be fixed by the buttons plugin

修复方法 (restorative procedure)

在箭头所指位置添加这么一行就好了,修复后在实时/阅读模式下均正常,显示正确,点击效果也正确(仅测试了 link button)

图片


Add this line at the point of the arrow. After repair, it is normal in live/reading mode, the display is correct, and the click effect is correct (only the link button was tested).

(The upper, middle and lower parts of the picture are: modification method, the effect before modification, and the effect after modification)

LincZero commented 6 days ago

有空去那边PR一下,但我看他那边也挺久没更新了,也还有两个PR没合并……

LincZero commented 6 days ago

TestDemo

::: mditTabs

@tab tab1

ButtonTest1

```button
name ButtonLinkDemo
type link
action https://forum.obsidian.md/t/buttons-showcase/18044/3
color blue

ButtonTest2

[card|addClass(ab-col2)]

@tab tab2

test2

:::



![图片](https://github.com/user-attachments/assets/54b4ea1d-1334-421b-ac3a-2f63bf01fd3c)