t.updateCharacterBounds(rangeStart, charBounds);
      }
    });

    // Visually show when we're composing text.
    editContext.addEventListener("compositionstart", e => {
      canvas.classList.add("is-composing");
    });
    editContext.addEventListener("compositionend", e => {
      canvas.classList.remove("is-composing");

      // Clear the composition text formats.
      textFormats = [];
    });

    editContext.addEventListener("textformatupdate", e => {
      // Set the composition text formats 