You are not logged in.
I'm looking for a way to detect when the user 'blurs' off the entire area owned by Xinha (not just the iframe). It looks like xinha is a table containing buttons, an iframe, and a status bar. When user clicks anywhere outside the entire area created by xinha (including the table), I want to be able to detect this. What I'm trying to do grab the editor's contents, strip markup from the contents, save contents to a db, and then put the modified contents back into editor (basically doing an auto-save for the user on a blur event). The problem here is that when user clicks the insert hyperlink button, I do the autosave (because of the blur event on the iframe), which causes me to LOSE the user's current selection within the editor's contents, thus insert hyperlinks fails. I am losing the selection when I restore the editor's contents after stripping markup.
So I want to move wiring of the blur event off of the iframe or even perhaps if I can detect that it's the 'insert hyperlinks' button I'm blurring to within the event handler I could avoid grabbing and restoring the editor's contents (thus losing the user's current selection). Then the insert hyperlinks would work.
...
// blur handler.
var onBlur = function(event) {
self._removeMarkupAndPutContents();
return true;
};
// you have to wait until every thing is initialized
this.myEditor.whenDocReady (
function() {
Xinha._addEvent(self.myEditor._iframe, "blur", onBlur); // IE
Xinha._addEvent(self.myEditor._doc, "blur", onBlur); // FF, chrome
}
);
Thank you.
Offline