title: How to detect and trim leading/trailing whitespace in Quill (rich text editor)?
body: <p>How can you detect and delete leading/trailing whitespace in <a href="https://quilljs.com/" rel="nofollow noreferrer">Quill</a>, which is a rich text editor?</p>
  <p>For instance, the sample <strong>HTML</strong> below represents <strong>Quill</strong> output for the text <code>&quot;\nHi&quot;</code>.</p>
  <p>We want to detect and delete leading and trailing whitespace for each block of the text created by <strong>Quill</strong> (not for an entire document). Basically, trim leading/trailing whitespace for each embedded <strong>Quill</strong> editor. (We embed multiple editors within the same page.)</p>
  <blockquote>
  <p>The <em>API</em> doesn't seem to offer a simple way to achieve this and would require some hacking?</p>
  <p>Is there an elegant way to trim text with <strong>Quill</strong> effectively?</p>
  </blockquote>
  <pre class="lang-html prettyprint-override"><code>&lt;div class=&quot;ql-editor&quot; 
       data-gramm=&quot;false&quot; 
       contenteditable=&quot;true&quot; 
       spellcheck=&quot;false&quot; 
       autocomplete=&quot;off&quot; 
       autocorrect=&quot;off&quot; 
       autocapitalize=&quot;off&quot;&gt;
     &lt;p style=&quot;align-self: center;&quot;&gt;
         &lt;br&gt;
     &lt;/p&gt;
     &lt;p style=&quot;align-self: center;&quot;&gt;
          &lt;span style=&quot;font-family: Lato; color: rgb(0, 0, 0); font-size: 80px; line-height: 1.5; letter-spacing: 0em; font-weight: 400; font-style: normal;&quot;&gt;Hi&amp;nbsp;&lt;/span&gt;
       &lt;/p&gt;
  &lt;/div&gt;
  </code></pre>