如何使 Firefox showAlertNotification 文本为多行?
我正在开发邮件通知程序。 这是部分代码:
alertsService=Components.classes["@mozilla.org/alertsservice;1"].getService(Components.interfaces.nsIAlertsService),
alertsService.showAlertNotification("chrome://mailnotifier/skin/sample-small.jpg", info,mail_title, false, "", null, "");
问题是“showAlertNotification”,基于 MDC 中的描述:
文本
显示在文本中的文本 警报,解释警报条件。 文字不能太长, 否则它可能会被截断为 特定于平台的长度。如果文字 太长,尝试使用换行 在文本中将其拆分并 多行显示。*
我尝试了 br,br/,"\n","\r"
.etc 进行行返回,但它们都未能使换行符成功,有谁知道如何解决这个问题?
I'm working on a mail notifier.
Here is part of code:
alertsService=Components.classes["@mozilla.org/alertsservice;1"].getService(Components.interfaces.nsIAlertsService),
alertsService.showAlertNotification("chrome://mailnotifier/skin/sample-small.jpg", info,mail_title, false, "", null, "");
The problem is "showAlertNotification" and based on description in MDC :
text
The text to display in the
alert, explaining the alert condition.
The text must not be too long,
otherwise it might be truncated to a
platform-specific length. If the text
is too long, try to use line returns
in the text to have it split and
displayed over multiple lines.*
I tried br,br/,"\n","\r"
.etc for line return, they all failed to make the line break, Does anyone know how to solve this problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
XUL滑动警报不支持多行文本。我无法谈论 Mac 和 Linux 上可用的特定于平台的实现(安装了适当的软件包)。
您始终可以尝试分叉 XUL 滑动的实现警报; Thunderbird 的新邮件提醒就是这样做的。
The XUL sliding alert does not support multiline text. I can't speak for the platform-specific implementations available (with appropriate packages installed) on the Mac and Linux.
You could always try forking the implementation of the XUL sliding alert; Thunderbird does that for its new mail alert.