Mozilla "Jetpack" Add-On: Anchor Panel to Widget
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 positio开发者_开发问答ning 'Panel' in new Jetpack API
panel.show(require("tab-browser").activeTab.ownerDocument.getElementById('widget:yourAddonId@package.json-yourWidgetId'));
Works for me with Addon SDK 1.8.1
Where:
yourAddonId@package.json - your addon id from package.json
yourWidgetId - your widget id
panel.show(widget)
isn't working?
精彩评论