Michael
Michael

Reputation: 717

How is the caret emulated in Etherpad?

How is the blinking caret emulated in Etherpad? (See a live version at ietherpad.com) The way I would do it, is to create a div and position it absolutely where the caret should be. Then, display and remove it in regular intervals. However they seem to do it differently.

The text of a row is in

<div id="magicdomid2" class="">...</div>

I can't see anything changing around the div. How is it done?

Upvotes: 5

Views: 357

Answers (1)

Ryan Tenney
Ryan Tenney

Reputation: 1841

It isn't emulated. In modern browsers, Etherpad creates an iframe containing a document with the tag:

<body contenteditable="true">

Which tells the browser to allow editing of the contained HTML document. The carat is one of the effects of including that attribute.

Upvotes: 3

Related Questions