ExtJS中HtmlEditor怎么获取选中的文本

2025-04-12 23:56:28
推荐回答(1个)
回答1:

用htmleidtor的el来操作 也就是用原始的document来操作
function getSelectedVal() {
var userSelection;
if (window.getSelection) {
// 现代浏览器
userSelection = window.getSelection();
} else if (document.selection) {
// IE浏览器
userSelection = document.selection.createRange();
}
return userSelection.text;
}