I came across some problem when creating find-replace pluging

the transaction I dispatched didn’t work:

I solved this problem. I should focus the editor before find next