I am working on embedding sprint buttons in the Stackoverflow editor with my favorite WMD, and I came across an odd error. In all versions of IE, the selected text is lost when the button is pressed, so, for example, highlighting a block of text and pressing a code button acts as if you placed the cursor at the end of the selection and pressed the button.
eg. emphasizing this:
This
Is
Code
and by clicking the code button, you:
This
Is
Code`enter code here`
What is really strange is that I left the original line without scrolling, and that works fine. In fact, the ALL buttons and the shortcut code use the same function doClick(button)
!
- Old non-sprint buttons: OK
- Hotkeys: OK
- , IE: OK
- IE: WTF
selection.createRange()
, "". () doClick()
, . , , , . - , - IE?
onclick :
button.onmouseout = function(){
this.style.backgroundPosition = this.XShift + " " + normalYShift;
};
button.onclick = function() {
if (this.onmouseout) {
this.onmouseout();
}
doClick(this);
}
onmouseout
doClick
, , .
EDIT:
, , , . <li>
. , ?
/EDIT
wmd git button-cleanup
.
0d6d1b32bb42a6bd1d4ac4e409a19fdfe8f1ffcc, . - . . setInputAreaSelectionStartEnd()
TextareaState
.
, , , Javascript, , jQuery, .
!