code: function saveText() {
    if (input.value.trim().length > 0) {
      let clientX = parseInt(input.style.left, 10);
      let clientY = parseInt(input.style.top, 10);
      let svg = findSVGAtPoint(clientX, clientY);
      if (!svg) {
        return;
      }
  
      let { documentId, pageNumber } = getMetadata(svg);
      let rect = svg.getBoundingClientRect();
      let annotation = Object.assign({
          type: 'textbox',
          size: _textSize,
          color: _textColor,
          content: input.value.trim()
        }, scaleDown(svg, {
          x: clientX - rect.left,
          y: clientY -  rect.top,
          width: input.offsetWidth,
          height: input.offsetHeight
        })
      );
  
      PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation)
        .then((annotation) => {
          appendChild(svg, annotation);
        });
    }
    
    closeInput();
  }
docs: Save a text annotation from input