public/be-assets/node_modules/@yaireo/tagify/dist/tagify.esm.js
/**
   * For mixed-mode: replaces a text starting with a prefix with a wrapper element (tag or something)
   * First there *has* to be a "this.state.tag" which is a string that was just typed and is staring with a prefix
   */
For mixed-mode: replaces a text starting with a prefix with a wrapper element (tag or something)
First there *has* to be a "this.state.tag" which is a string that was just typed and is staring with a prefix
For mixed - mode : replaces a text starting with a prefix with a wrapper element ( tag or something ) First there * has * to be a " this . state . tag " which is a string that was just typed and is staring with a prefix
replaceTextWithNode(newWrapperNode, strToReplace) {
    if (!this.state.tag && !strToReplace) return;
    strToReplace = strToReplace || this.state.tag.prefix + this.state.tag.value;
    var idx,
        nodeToReplace,
        selection = window.getSelection(),
        nodeAtCaret = selection.anchorNode,
        firstSplitOffset = this.state.tag.delimiters ? this.state.tag.delimiters.length : 0; 
    nodeAtCaret.splitText(selection.anchorOffset - firstSplitOffset); 
    idx = nodeAtCaret.nodeValue.lastIndexOf(strToReplace);
    if (idx == -1) return true;
    nodeToReplace = nodeAtCaret.splitText(idx); 
    newWrapperNode && nodeAtCaret.parentNode.replaceChild(newWrapperNode, nodeToReplace); 
    return true;
  }
replaceTextWithNode ( newWrapperNode , strToReplace ) { if ( ! this . state . tag && ! strToReplace ) return ; strToReplace = strToReplace || this . state . tag . prefix + this . state . tag . value ; var idx , nodeToReplace , selection = window . getSelection ( ) , nodeAtCaret = selection . anchorNode , firstSplitOffset = this . state . tag . delimiters ? this . state . tag . delimiters . length : 0 ; nodeAtCaret . splitText ( selection . anchorOffset - firstSplitOffset ) ; idx = nodeAtCaret . nodeValue . lastIndexOf ( strToReplace ) ; if ( idx == - 1 ) return true ; nodeToReplace = nodeAtCaret . splitText ( idx ) ; newWrapperNode && nodeAtCaret . parentNode . replaceChild ( newWrapperNode , nodeToReplace ) ; return true ; }
For mixed-mode: replaces a text starting with a prefix with a wrapper element (tag or something)
 First there *has* to be a "this.state.tag" which is a string that was just typed and is staring with a prefix
For mixed - mode : replaces a text starting with a prefix with a wrapper element ( tag or something ) First there * has * to be a " this . state . tag " which is a string that was just typed and is staring with a prefix
// STEP 1: ex. replace #ba with the tag "bart" where "|" is where the caret is: // CURRENT STATE: "foo #ba #ba| #ba" // split the text node at the index of the caret // node 0: "foo #ba #ba|" // node 1: " #ba" // get index of LAST occurence of "#ba" // node 0: "foo #ba " // node 1: "#ba"    <- nodeToReplace // must NOT normalize contenteditable or it will cause unwanted issues: // https://monosnap.com/file/ZDVmRvq5upYkidiFedvrwzSswegWk7 // nodeAtCaret.parentNode.normalize()