JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdn.jsdelivr.net/npm/leader-line@1.0.5/leader-line.min.js"></script>
<body>
  <button onclick="position()">Recalculate</button>
  <div class="editor">
    <div id="arrow-container" class="editor-area">
        <div id="node1" class="node-host">
          <p>
           some content here
          </p>
        </div>
        
         <div id="node2" class="node-host">
          <p>
           also some content here
          </p>
        </div>
    </div>
    <div id="wrapper"></div>
  </div>

</body>

CSS

html {
  height: 80%;
}

body {
  height: 100%;
  overflow-y: hidden;
  overflow-x: hidden;
}

.editor-area {
  position: relative;
  height: 1000px;
  width: 1000px;
}

.editor {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  overflow-x: scroll;
}

.node-host {
  width: 100px;
  border: solid 1px #ccc;
  color: rgba(0, 0, 0, 0.87);
  background: #fff;
  position: absolute;
  border-radius: 4px;
  z-index: 10;
  transition: box-shadow 200ms cubic-bezier(0, 0, 0.2, 1);
  box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
  0 2px 2px 0 rgba(0, 0, 0, 0.14),
  0 1px 5px 0 rgba(0, 0, 0, 0.12);
}


/* element got dragged to this position */
#node1 {
  transform: translate3d(40px, 55px, 0px);
}

/* element got dragged to this position */
#node2 {
    transform: translate3d(255px, 135px, 0px);
}

#wrapper {
  width: 0;
  height: 0;
  position: relative; /* Origin of coordinates for lines, and scrolled content (i.e. not `absolute`) */
}

JavaScript

var line = new LeaderLine(
    document.getElementById('node1'),
    document.getElementById('node2')
  ),
  elmWrapper = document.getElementById('wrapper');

function position() {
  elmWrapper.style.transform = 'none';
  var rectWrapper = elmWrapper.getBoundingClientRect();
  // Move to the origin of coordinates as the document
  elmWrapper.style.transform = 'translate(' +
    ((rectWrapper.left + pageXOffset) * -1) + 'px, ' +
    ((rectWrapper.top + pageYOffset) * -1) + 'px)';
  line.position();
}

elmWrapper.appendChild(document.querySelector('.leader-line:last-of-type'));
position();