Avoid panel to autoHide in Firefox extension

痴心易碎 提交于 2019-11-26 09:57:43

问题


I am actually trying to develop a Firefox extension using the high level apis, and specifically trying to avoid a panel to autohide when you pick a file or when you click outside of the panel itself.

Does somebody has an idea of how to do this?

I know that it is possible using XUL, so why is this not easy using the apis?

Thank you in advance for your answers.


回答1:


This is the offical sdk method of doing it:

let myPanel = Panel({.....})

let { getActiveView }=require("sdk/view/core");
getActiveView(myPanel).setAttribute("noautohide", true);



回答2:


Idea from this

var toolbarbuttonPanel = doc.createElement('panel');
toolbarbuttonPanel.setAttribute('id', 'toolbarbutton-panel');
toolbarbuttonPanel.setAttribute('type', 'arrow');
toolbarbuttonPanel.setAttribute('noautohide', 'true'); // This is important

var toolbarbuttonLabel = doc.createElement('label');
toolbarbuttonLabel.setAttribute('value', 'toolbarbutton panel');
toolbarbuttonPanel.appendChild(toolbarbuttonLabel);

var mainPopupSet = document.querySelector('#mainPopupSet');
mainPopupSet.appendChild(toolbarbuttonPanel);

Then add this on sdk action/toggle button click:

toolbarbuttonPanel.openPopup(btn);

And Noitidart's comment



来源:https://stackoverflow.com/questions/21509460/avoid-panel-to-autohide-in-firefox-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!