【发布时间】:2012-11-07 00:35:37
【问题描述】:
我正在尝试在Redactor 编辑器中创建一个下拉菜单。最大的问题是使用所选字体系列围绕所选文本创建一个容器。
到目前为止,我已经完成了自定义下拉菜单的基本设置:
$("#text_edit").redactor({
buttons: ['html', '|', 'bold', 'italic', 'deleted', '|', 'table', 'link', '|', 'fontcolor', 'backcolor', '|', 'fontfamily'],
buttonsCustom: {
fontfamily: {
title: "Select Font",
dropdown: {
Arial: {
title: 'Arial',
callback: insertFont
},
Georgia: {
title: 'Georgia',
callback: insertFont
}
}
}
}
});
function insertFont(obj, e, key)
{
// wrap selected text in <span> container with style attribute and selected font
}
实际上想要的方法与内置的 fontcolor 函数非常相似,它也将选中的文本包装在一个容器中,并为其分配正确的颜色样式属性。
【问题讨论】:
-
我也一直在寻找这个,但由于编辑器中的错误而无法使其工作。您找到任何解决方案了吗?我可以更改所有段落的字体和字体大小,但不能更改所选文本...
-
不,我联系了 Redactor 的创建者,但他们说现在不可能。请参阅:redactorjs.tenderapp.com/help/discussions/problems/…。由于其他要求,他们说他们正在努力:):redactorjs.tenderapp.com/help/discussions/problems/…
标签: jquery drop-down-menu wysiwyg text-editor rich-text-editor