title: tinyMCE - get content up to cursor position
body: <p>I am making a little word prediction plugin for tinyMCE and need to extract a bit of text and later insert text from a list of predicted words. The insertion should be no problem, as I know where the cursor is and can use the <code>mceInsertContent</code> command. Getting the text for the prediction however...</p>
  
  <p>I need to extract a subset of the text ending at the letter immediately before the cursor position and starting at, well, the start of the text. I can strip HTML tags myself if neccessary, but I prefer letting tinyMCE do it if possible.</p>
  
  <p>I was thinking of doing it like this:</p>
  
  <ol>
  <li>Insert bookmark at current cursor positon using <code>mceInsertContent</code></li>
  <li>Create a range from start of text up to my bookmark.</li>
  <li>Get the content of the range.</li>
  <li>Delete the bookmark.</li>
  </ol>
  
  <p>Now, since I'm not that well versed in tinyMCE that has proved to be a bit of a challenge for me, so how would one go about doing this?</p>
  
  <p>The code needs to work cross-browser.</p>