She was heartbroken by ___?

She was heartbroken by ___?

Explanation

The phrase "What she had written" follows the correct word order for a noun clause.

It functions as the object of the preposition "by" in the sentence.