提问人:volpe 提问时间:9/24/2019 更新时间:6/1/2020 访问量:248
如何在Thunderbird Addon中添加没有XUL的onload监听器?
How to add onload listener without XUL in Thunderbird Addon?
问:
我的目标是在使用 Thunderbird 撰写消息时访问编辑器中的当前文本。
在 Thunderbird 68 之前,我的扩展可以通过以下方式访问文本
chrome.manifest文件:
overlay chrome://editor/content/editorOverlay.xul chrome://ext/content/extEditor.xul
extEditor.xul:
<overlay id="x" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" charset="UTF-8" src="chrome://ext/content/extEditor.js"/>
</overlay>
extEditor.js:
document.getElementById("content-frame").addEventListener("keypress",
function(e) {
// do stuff;
},
false);
截至目前,mozilla想要摆脱XUL。我正在重写扩展以使其适应新的 MailExtension 系统。
有谁知道如何在没有XUL的情况下像这样向msgcomposeWindow添加一个onload监听器?我想我需要这样的声明
document.getElementById("msgcomposeWindow").addEventListener("onload", function (e) {
///
});
在主信使窗口中,但它给了我空返回,因为显然在启动 Thunderbird 时还没有 msgcomposeWindow。
答:
0赞
opto
6/1/2020
#1
XUL:为 Windows 做一个观察者。测试其窗口类型。如果它适合撰写窗口,请添加您的侦听器。您可以在撰写窗口的调试器/检查器中查看窗口类型。
对于新的 Web 扩展,添加了对 compose 的新访问权限,因为: https://thunderbird-webextensions.readthedocs.io/en/latest/compose.html#onbeforesend-tab-details
另请参阅 ComposeAction
评论