title: How to select text in tinymce editor, if I know it's position in html content?
body: <p>The question is pretty simple, but I'm struggling to find any simple solution to make it work. I'm working with TinyMCE in the Wordpress.</p>
  
  <p>Let's say that I have a position of some word in the html content, which I can get from editor like this: </p>
  
  <pre><code>tinymce.activeeditor.getContent();
  </code></pre>
  
  <p>So i need to select this word and move to selection (scroll to it).
  For example, if content contains something like this: </p>
  
  <pre><code>...Bla bla bla some &lt;strong&gt;text&lt;/strong&gt; and more text and banana and &lt;img src=.../&gt; more text bla blaa...
  </code></pre>
  
  <p>You can see the word "banana" out there, which, for example, I want to select. I know its position, let's say its start_pos = 30, end_pos = 35. It's not necessary a word, it can be a phrase (several words), but I know it's position, so there is no difference. </p>
  
  <p>I need a way to select it in the Visual Editor (or Rich Editor), like I do for textarea (if Text mode is active) like this:</p>
  
  <pre><code>    // cl_editor_lastfocus is textarea
      cl_editor_lastfocus.setSelectionRange(start, end);
  
      let charsPerRow = cl_editor_lastfocus.cols;
      let selectionRow = (start - (start % charsPerRow)) / charsPerRow;
      let lineHeight = cl_editor_lastfocus.clientHeight / cl_editor_lastfocus.rows;
  
      // scroll !!
      cl_editor_lastfocus.scrollTop = lineHeight * selectionRow;
      cl_editor_lastfocus.focus();
  </code></pre>
  
  <p>Is it possible? As far as I can see, most answers here suggest to select textnode with this text and then set selection range. But I have no idea which textnode I have to select because my desired word can be anywhere in the document. Also, I can do that by wrapping the word with a span and then select this span node, but I don't want to keep that span afterwards, when selection will be changed or not needed anymore.</p>