message: Normalize text before typing in document
diff: @@ -30,6 +30,19 @@ form.addEventListener("submit", (event) => {
  event.stopPropagation();
  });
  +/**
  + * Processes the input text into a normalized form for the shared string
  + */
  +function normalizeText(input: string): string {
  + let result = "";
  + const segments = SharedString.loadSegments(input, 0);
  + for (const segment of segments) {
  + result += (<SharedString.TextSegment> segment).text;
  + }
  +
  + return result;
  +}
  +
  /**
  * Types the given file into the shared string - starting at the end of the string
  */
  @@ -44,6 +57,8 @@ function typeFile(sharedString: SharedString.SharedString, fileText: string, int
  let insertPosition = sharedString.client.getLength();
  let readPosition = 0;
  + fileText = normalizeText(fileText);
  +
  sharedString.on("op", (message) => {
  progressBar.style.width = `${Math.round(100 * message.clientSequenceNumber / fileText.length)}%`;
  