title: Google Documents: get active paragraph from cursor position
body: <p>I'm trying to write a script that puts the cursor's surrounding text to uppercase and set the enclosing paragraph to HEADING1. 
    I'm able to do the first thing while I can't figure out the way to get the paragraph containing the cursor using the getCursor() method. Here is what I tried:</p>
  
  <pre><code> var cursor = DocumentApp.getActiveDocument().getCursor();
   var element = cursor.getElement();
   var paragraph = element.asParagraph();
  </code></pre>
  
  <p>However, element is a TEXT element and can't be cast as PARAGRAPH. Is there a way to get the paragraph from the text element?</p>
  
  <p>Thanks. </p>