I'm using the following code to edit a text in contenteditable div by changing its font. when clicking on a div which is a stylized dropdown menu the selection disappears in chrome. It works fine in firefox, opera and even in IE!
Rangy doesn't find any selected text to deal with. I'm wondering why!
Note: it works fine when using 'mouseover' instead of 'click'
DropDown.prototype = {
initEvents : function() {
var obj = this;
obj.dt.on('click', function(event){
$(this).toggleClass('active');
if (savedSel) {
rangy.removeMarkers(savedSel);
}
savedSel = rangy.saveSelection();
savedSelActiveElement = document.activeElement;
return false;
});
}
}