【发布时间】:2017-05-14 21:23:38
【问题描述】:
我正在为我的企业开发一个使用 ASP.net 的外部模板管理器。
在这个外部模板管理器中,用户可以执行所有的 CRUD 操作,因此他们可以创建/读取/更新/删除。
我企业的许多部门都使用这些模板,所以我在模板管理器中创建了一个类别字段,以便他们可以过滤一下。
我想修改一下,template plugin的plugin.js添加一个动态列表框类别。
所以当用户想要在编辑器中添加模板时,他可以选择他的部门[类别],只有相关的模板会显示在列表框[模板]中。
我从带有 ASP 转发器控件的 MS SQL DB 中获取所有模板定义[标题、内容、描述、类别]。
转发器的结果生成模板插件需要的定义
templates:
[
{"title": "Some title 1", "description": "Some desc 1", "content": "My
content", "category": "support"},
]
所以我只是尝试测试(因为我不擅长 JS ad Oriented Object):
`
赢 = editor.windowManager.open({
title: '插入模板',
布局:'弹性',
方向:'列',
对齐:“拉伸”,
填充:15,
间距:10,
items: [
{
type: 'form', flex: 0, padding: 0, items: [
{
type: 'container', label: 'Templates', items: {
type: 'listbox', label: 'Templates', name: 'template',
values: values, onselect: onSelectTemplate
}
//Added BY ME
type: 'container', label: 'Category', items: {
type: 'listbox', label: 'Category', name:'category', values:
valuesCategory, onselect: onSelectCategory
}
}
]
},
{ type: 'label', name: 'description', label: 'Description', text:
'\u00a0' },
{ type: 'iframe', flex: 1, border: 1 }
],
onsubmit: function () {
insertTemplate(false, templateHtml);
},
minWidth: Math.min(DOMUtils.DOM.getViewPort().w,
editor.getParam('template_popup_width', 600)),
minHeight: Math.min(DOMUtils.DOM.getViewPort().h,
editor.getParam('template_popup_height', 500))
});
win.find('listbox')[0].fire('select');
win.find('listbox')[0].fire('select');
}`
并在其上定义了 valuesCategory 和 onSelectCategory。
对话框中没有显示列表框?
我在互联网上搜索过与 tinymce 类似的东西,但没有找到类似的东西,有人可以帮我开发这个功能吗?
感谢您的回答!
祝你有美好的一天
【问题讨论】:
标签: javascript templates plugins listbox tinymce