问题
I'm trying to build a Firefox add-on based on their SDK and I wanna use panel for this. The panel is connected to a widget, so every time I click on the widget icon the panel shows up. My problem is that I want the panel to stay visible even if I click on an area outside the panel and to be able to close only based on a certain situations. Can this be achieved, or the panel API doesn't support this?
Thanks
回答1:
It can't be achieved through the SDK API. However, you could actually "hack" the panel in order to be persistent, the problem is that you will face with other issue – basically won't go away, and other small stuff.
You can get additional details on Bugzilla if you're interested: Add a "isPersistent" attribute for panels. Notice that the bug is a WONTFIX, but it will give you an idea about the issue you could face. Also, there are some new widgets that will coming in the future, that could mitigate the needs to have the panel "persistent" (they're mentioned and linked in the bug above).
回答2:
This is the offical sdk method of doing it:
let myPanel = Panel({.....})
let { getActiveView }=require("sdk/view/core");
getActiveView(myPanel).setAttribute("noautohide", true);
回答3:
Floating panels are not supported by the SDK
来源:https://stackoverflow.com/questions/13494722/firefox-add-on-sdk-make-panel-to-stay-visible