mulesoft/api-notebook — pull request #301 by blakeembrey (2014-02-12 18:11:33+00:00)
Title: Text cell focus

Adds logic to convert html back to markdown while preserving the click location. This allows clicks on text cells to be correctly positioned when showing the markdown editor. There are some edge cases, but if something fails it'll gracefully eject and position at the last known character.

In the future, it may be possible to work around coordinating this and instead use a technique like injecting invisible unicode characters to count how many characters we have moved from the original markdown. This should just require updated regexes implemented in the marked module to ignore invisible characters (and ensure a user can't inject any invisible characters). This would improve performance (no need to parse), improve accuracy (we have the exact original position) and also improve the cursor positioning since we can catch before and after characters.

Closes #172.