More multiple-tag case fixes:
* When determining whether a tag is really new or not, look upwards to find
  an ancestor that has the same tag ID as the marked range containing the
  tag (instead of just looking at the immediate parent)
* Only ignore newly inserted tags for calculating elementInsert positions.
* Move textReplace edits back after textInsert edits, so that both kinds
  of text edits can refer to newly inserted tags.