是我的话就自己写个BBCode Editor,需要什么功能就自己定制,XSS过滤就用HTML Purifier。
下面是个示例:
BBCode Editor
[code][/code]
[b][/b]
☺
function insertAtCaret(id, val) {
var field = document.getElementById(id);
if (document.selection) {
// IE support
field.focus();
var sel = document.selection.createRange();
sel.text = val;
} else if (field.selectionStart || field.selectionStart == '0') {
// Mozilla support
var startPos = field.selectionStart;
var endPos = field.selectionEnd;
field.value = field.value.substring(0, startPos) + val + field.value.substring(endPos, field.value.length);
field.selectionStart = startPos + val.length;
field.selectionEnd = startPos + val.length;
} else {
// Other browsers
field.value += val;
}
field.focus();
}