我在我的Asp.net MVC 3应用程序中使用CKEditor ver.3.6。
我的要求是在Google doc中创建Paint格式选项。我需要在ckeditor中实现Paint格式选项。
在Ckeditor中如何复制/获取所有格式,如字体,字体效果,居中段落对齐,从选定的文本(源)到新选择的文本(目标)。
请提出正确的解决方案。
答案 0 :(得分:1)
使用此功能可将选定html的内容替换为一个字段中的文本。单击按钮,调用此函数:
function Replace()
{
var sel = editor.getSelection();
var ele=sel.getStartElement();
if(ele.hasAttributes())
{
var insertele= editor.document.createElement('span');
ele.copyAttributes(insertele,{type:1,value:1})
insertele.setHtml($("#repTxt").val());
editor.insertElement(insertele);
}
}