Clear refs and anchors when clearing text. Fixes #2250.

Fixes #2250.