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.