Work around JS errors when editing image properties


Work around JS errors when editing image properties

When modifying an image, its caption is blanked and then reinserted.
The clearing transaction causes an 'update' event to be emitted on
the image node, which causes GeneratedContentNode to do things and
emit rerender, which causes FocusableNode to call updateDimensions().

However, at the time updateDimensions() is called, the selection
hasn't yet been updated for the transaction, and so out of bounds
exceptions can occur. A proper solution would be to ensure that such
functions aren't called from event handlers that run when the selection
isn't in sync with the document, but for now we're working around this
by ensuring that getRelatedSources() doesn't attempt to look at the
selection on a cache hit, which fixes the immediate problem because
the problematic cases always happen to be cache hits.

Bug: T93204
Change-Id: I610018a6828deb1eafdea4fe82e904c0c186a483