Amaimersion / google-docs-utils

Utilities for interaction with Google Docs.
https://www.npmjs.com/package/google-docs-utils
MIT License
40 stars 9 forks source link

Lines in documents can have multiple word elements #4

Closed Raffinate closed 3 years ago

Raffinate commented 3 years ago

If text in the line has multiple fonts or various formatting, the line is split in multiple word elements.

In that case GoogleDocsUtils.getWordElements() will find only first word node in the line and other word nodes won't be found.

This breaks all functions that are related to word nodes, such as getCaret() e.t.c.

Steps to reproduce:

  1. Create text document in google docs
  2. Write several lines of text
  3. Format middle word in any line with different font
  4. Place caret in that word
  5. Execute GoogleDocsUtils.getCaret()

Expected properly initialized caret, but instead we have all fields as null

Raffinate commented 3 years ago

Created pull request with fix

Amaimersion commented 3 years ago

Solved in 2.2.0 version.