Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.

Commit

Permalink
Fix issues in IE8+9 (fixes #59)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiff committed Sep 24, 2012
1 parent cab478a commit f75cb5a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,13 @@ wysihtml5.browser = (function() {
*/
hasInsertNodeIssue: function() {
return isOpera;
},

/**
* IE 8+9 don't fire the focus event of the <body> when the iframe gets focused (even though the caret gets set into the <body>)
*/
hasIframeFocusIssue: function() {
return isIE;
}
};
})();
17 changes: 17 additions & 0 deletions src/views/composer.observe.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,24 @@
event.preventDefault();
}
});

// --------- IE 8+9 focus the editor when the iframe is clicked (without actually firing the 'focus' event on the <body>) ---------
if (browser.hasIframeFocusIssue()) {
dom.observe(this.iframe, "focus", function() {
setTimeout(function() {
if (that.doc.querySelector(":focus") !== that.element) {
that.focus();
}
}, 0);
});

dom.observe(this.element, "blur", function() {
setTimeout(function() {
that.selection.getSelection().removeAllRanges();
}, 0);
});
}

// --------- Show url in tooltip when hovering links or images ---------
var titlePrefixes = {
IMG: "Image: ",
Expand Down
2 changes: 1 addition & 1 deletion src/views/composer.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
],
ADDITIONAL_CSS_RULES = [
"html { height: 100%; }",
"body { min-height: 100%; padding: 0; margin: 0; margin-top: -1px; padding-top: 1px; }",
"body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }",
"body > p:first-child { margin-top: 0; }",
"._wysihtml5-temp { display: none; }",
wysihtml5.browser.isGecko ?
Expand Down

2 comments on commit f75cb5a

@tiff
Copy link
Owner Author

@tiff tiff commented on f75cb5a Sep 24, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction: This doesn't fix #59. Instead it fixes #136.

@hrach
Copy link

@hrach hrach commented on f75cb5a Sep 25, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try commit -ammend and push force.

Please sign in to comment.