如何使用Javascript在CKEditor中查找和替换文本?

如何使用Javascript在CKEditor中查找和替换文本? 谢谢你的建议!

试试这个

editor = CKEDITOR.instances.fck; //fck is just my instance name you will need to replace that with yours var edata = editor.getData(); var replaced_text = edata.replace("idontwant", "iwant this instead"); // you could also use a regex in the replace editor.setData(replaced_text); 

你可能想把它放在模糊事件或其他东西中