如何在tinymce编辑器中突出显示部分文字时发出警报? 像这样的东西
$('textarea').select(function(){
alert('123');
});
答案 0 :(得分:1)
以下demo使用onMouseUp event来显示the currently selected content(如果非空)
使用Javascript:
tinyMCE.init({
// General options
mode: "exact",
elements: "second",
// Skin options
skin: "o2k7",
skin_variant: "silver",
setup: function (ed) {
// on mouse uo get selected text
ed.onMouseUp.add(function (ed, e) {
var highlighted = tinyMCE.activeEditor.selection.getContent();
if (highlighted) alert(highlighted);
});
}
});
HTML:
<textarea rows="10" cols="30" id="second"></textarea>