我正在尝试为 Alfresco.util.PopupManager.displayPrompt()
配置宽度,但我不知道该怎么做。
YUI Dialog 有一个 width 属性,但我设法看到的唯一配置,defaultDisplayPromptConfig
对象,似乎并没有太注意我的困惑有了它。
具体来说,我尝试设置 Alfresco.util.PopupManager.defaultDisplayPromptConfig.width
但它不起作用:)
我还尝试对正在加载的面板进行样式设置(create-site 样式注入(inject)面板),但目前不起作用。
有没有办法配置 PopupManager Prompt 对象?
TIA
最佳答案
如果您查看 alfresco.js
中包含的 Alfresco.util.PopupManager.displayPrompt()
源代码然后您将看到该方法创建了一个 YAHOO.widget.SimpleDialog
实例,它确实支持宽度属性。
问题是 displayPrompt()
仅采用传递给 SimpleDialog
的特定配置选项,因此添加一个额外的 width
参数如您所见,对您的配置不会产生任何影响。
// Create the SimpleDialog that will display the text
var prompt = new YAHOO.widget.SimpleDialog("prompt",
{
close: c.close,
constraintoviewport: c.constraintoviewport,
draggable: c.draggable,
effect: c.effect,
modal: c.modal,
visible: c.visible,
zIndex: this.zIndex++
});
// Show the title if it exists
if (c.title)
{
prompt.setHeader($html(c.title));
}
// Show the prompt text
prompt.setBody(c.noEscape ? c.text : $html(c.text));
// Show the icon if it exists
if (c.icon)
{
prompt.cfg.setProperty("icon", c.icon);
}
// Add the buttons to the dialog
if (c.buttons)
{
prompt.cfg.queueProperty("buttons", c.buttons);
}
// Add the dialog to the dom, center it and show it.
prompt.render(parent);
prompt.center();
prompt.show();
我喜欢增强函数以支持 width
属性以及可能的其他属性的想法,但与此同时,您最好直接在自己的代码中使用 SimpleDialog
,修改上面的内容以添加 width
参数。
关于modal-dialog - 配置 Alfresco.util.PopupManagers YUI 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16225926/