toSpans() {
    let spans = []
    let chars = ''
    for (const elem of this.elems) {
      if (typeof elem.value === 'string') {
        chars += elem.value
      } else {
        if (chars.length > 0) {
          spans.push(chars)
          chars = ''
        }
        spans.push(elem.value)
      }
    }
    if (chars.length > 0) {
      spans.push(chars)
    }
    return spans
  }
Returns the content of the Text object as a sequence of strings,
interleaved with non-character elements.

For example, the value ['a', 'b', {x: 3}, 'c', 'd'] has spans:
=> ['ab', {x: 3}, 'cd']