Mozilla“Jetpack”附加组件:锚定面板到Widget [英] Mozilla "Jetpack" Add-On: Anchor Panel to Widget
问题描述
我正在做一个Jetpack扩展,其中一个小部件打开一个面板。点击小部件按预期打开面板(锚定在小部件的右下角)。但是,如果我从我的代码调用widget.panel.show(),面板将打开从窗口小部件分离,在屏幕居中,漂浮在空间。
总之,我可以如何解决这个问题?
$ ol
我可以在widget上模拟点击事件(不知何故),而不是调用widget.panel。 show()?
我可以强制面板锚定到小部件吗? b
$ b
这个问题有一个在以前的Jetpack API中有效的解决方案,但是我不能翻译成新的接口: 适用于Addon SDK 1.8.1 I'm making a Jetpack extension in which a widget opens a panel. Clicking the widget opens the panel as expected (anchored in the lower-right corner to the widget). But if I call widget.panel.show() from my code, the panel opens detached from the widget, centered in the screen, floating in space. In short, how can I fix this? Can I simulate a click event on the widget (somehow) instead of calling widget.panel.show()? Can I force the panel to anchor to the widget? This question has a solution that worked in the previous Jetpack API, but I can't translate to the new interface:
Using positioning 'Panel' in new Jetpack API Works for me with Addon SDK 1.8.1 这篇关于Mozilla“Jetpack”附加组件:锚定面板到Widget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
panel.show(require(tab-browser)。activeTab.ownerDocument.getElementById('widget:yourAddonId@package.json-yourWidgetId'));
其中:
yourAddonId@package.json - 您的来自package.json的插件ID
yourWidgetId - 您的小部件ID
panel.show(require("tab-browser").activeTab.ownerDocument.getElementById('widget:yourAddonId@package.json-yourWidgetId'));
Where:
yourAddonId@package.json - your addon id from package.json
yourWidgetId - your widget id