title: Is there a way to add entity in draftjs that are unbreakable?
body: <p>I'm using the draftjs editor. I have a decorator that detects some pieces of text by regex and generate a homemade component. This one is calling an API and returning the result by replacing the initial piece of text with the result of the API. </p>
  
  <p>And i would like to have this result as a non breakable, non editable entity, and i don't know how to do it.</p>
  
  <p>Here is the function i use to replace value</p>
  
  <pre><code>/**
     * Replace text in editor
     *
     * @param {Object} editorState  - State of the editor
     * @param {string} search       - Search value
     * @param {string} replaceValue - replacement value
     *
     * @returns {Object} Returns the new editorState with link removed
     */
    static replace(editorState, search, replaceValue) {
  
      if (typeof search === 'undefined' || search === null) {
        return editorState;
      }
  
      const regex = new RegExp(escapeStringRegexp(search), 'g');
      const blockMap = editorState.getCurrentContent().getBlockMap();
      const selectionsToReplace = [];
      blockMap.forEach((contentBlock) =&gt; (
        findWithRegex(regex, contentBlock, (start, end) =&gt; {
          const blockKey = contentBlock.getKey();
          const blockSelection = SelectionState
            .createEmpty(blockKey)
            .merge({
              anchorOffset: start,
              focusOffset: end,
            });
  
          selectionsToReplace.push(blockSelection)
        })
      ));
  
      let contentState = editorState.getCurrentContent();
  
      selectionsToReplace.forEach(selectionState =&gt; {
        contentState = Modifier.replaceText(contentState, selectionState, replaceValue)
      });
  
      return draftEditorState.push(editorState, contentState);
    }
  </code></pre>
  
  <p>What i would like is that the result can be moved or removed as a global part and can not be changed.</p>
  
  <p>Thank's for your help.</p>