Discourse GIFs TC 添加 GIF 时为何不使用 toolbarEvent?

我昨天在看 gifs TC 时,注意到这段代码:

它使用了 appEvents 服务。问题是,为什么不能在 action 中传递 toolbarEvent

我试过了,似乎可行。是否有不使用它的原因?

考虑到它在底层使用了 TextManipulation,似乎有一个 insertText 方法。

只是好奇。

谢谢。

再深入挖掘一下,我发现了这一行:

那么……应用程序事件是否仍然像文本操作一样执行?在 TC 中有什么额外的好处?

有人有什么想法吗?我正在考虑 event 和 toolbarEvent,了解(如果有的话)它们的区别将很有帮助。

我认为 discourse-gifs 是这样做的,因为模态框也是从工具栏外部启动的:

如果你的新功能完全基于工具栏,那么我同意 toolbarEvents 是更简洁的方法 :ok_hand:

1 个赞

啊,就这样。感谢您的澄清,我将继续使用 toolbarEvent。

1 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.