0

I was wondering, how do the buttons above the textarea for questions and answers work?

What I mean is that upon a click on the button, the text in the textarea is modified, at exactly the position where the cursor is, or where some text is marked etc. How is that accomplished? Is that code downloaded from elsewhere, or was it developed for SO?

Also: The preview field reacts upon every keypress, is Markdown implemented in JavaScript?

1 Answer 1

2

This is implemented using DOM ranges created from the current selection. The implementation differs between Internet Explorer and standards based browsers, but the end result is the same.

For more information:

The post creation editor is a customized WMD Editor, a markdown editor implemented in JavaScript. WMD provides the preview feature, as you can see from the demo.

2
  • Yeah, but I believe I've seen those buttons somewhere else, so my question is, is that SO code or taken from somewhere else, like TextArea Resizer or Markdown?
    – polemon
    Commented Oct 4, 2010 at 2:46
  • @polemon: are you perhaps confusing this with the (similar yet different) toolbar that textareas have over at Wikipedia?
    – ЯegDwight
    Commented Dec 2, 2010 at 20:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .