HomePhabricator

Don't break the editor if paste handling fails

Description

Don't break the editor if paste handling fails

Wrap the code re-enabling the SurfaceObserver and re-enabling
pasting in try-finally so it runs even if afterPaste failed.

Also call beforePaste() earlier so that if it fails, we won't
already have disabled the SurfaceObserver and disabled pasting.

Bug: T68229
Change-Id: I02b6df232853178d63c737eb90026175d31233e7