【发布时间】:2015-02-11 14:58:13
【问题描述】:
我已经在我的应用程序中实现了 JQueryTE。除了 JQueryTE 必须提供的常用工具外,我还想包括一个下拉选择器,其中包含一个预定义字段列表,这些字段类似于占位符,例如 [[Title]]、[[FirstName]] 等。我知道它可能CKEditor 使用占位符插件,但可以用 JQueryTE 完成吗?
我想到的最明显的方法是尝试向工具栏添加/附加一个选项菜单,这将触发一些添加字段名称的代码,但运气不佳。
有人可以看看我的 jsfiddle 吗?
jsfiddlehttp://jsfiddle.net/jalz/hou94u8a/2/
$('.jqte-primary').jqte(
{
title: true,
format: true,
fsize: true,
color: true,
b: true,
i: true,
u: true,
ol: true,
ul: true,
sub: true,
sup: true,
outdent: true,
indent: true,
left: true,
center: true,
right: true,
strike: true,
link: true,
unlink: true,
remove: true,
rule: true,
source: false
}
);
$( ".jqte_toolbar" ).append( "<span style=\"margin-left: 12px; padding-top: 6px; vertical-align: middle;\"><a href=\"\" class=\"save_link\">Save</a></span>" );
/* this is the one that does not work - this control does not display in JQueryTE and then figure out how to fire the value chosen in the appropriate place */
selectValues = { "1": "test 1", "2": "test 2" };
$.each(selectValues, function(key, value) {
$('.jqte_toolbar').append($("<option/>", {
value: key,
text: value
}));
});
$( ".jqte_toolbar" ).append( "<span style=\"margin-left: 12px; padding-top: 6px; vertical-align: middle;\"><a href=\"\" class=\"field_list\">End</a></span>" );
$(".field_list").click( function () {
/* Insert the value into */
alert('insert value');
} )
非常感谢
【问题讨论】:
-
请将您的代码添加到这篇文章中。
-
添加了代码,认为是因为我试图在工具栏的顶部添加一个表单元素,但是不知道该怎么做?
-
没关系,我决定使用 TinyMCE,它在我的应用程序外部托管,但内置了此功能。
标签: javascript jquery jquery-plugins