fix: set cursor inside block after input rule
Summary
Fix cursor position after creating a block via input rules (e.g., typing ``` + space for code block). Previously, the cursor would move to the next paragraph instead of inside the newly created block.
Rationale
When users type ``` followed by a space to create a code block, they expect the cursor to be positioned inside the code block so they can immediately start typing code. However, the cursor was incorrectly placed in the paragraph below the code block, requiring users to manually click inside the code block to start typing.
Changes
- Added TextSelection import to ExtensionManager/index.ts
- After updateBlockTr() is called in the input rule handler, explicitly set the cursor position inside the newly created block using TextSelection.create()
Impact
Testing
- Manual testing: Type ``` + space in the editor and verify cursor is inside the code block
Screenshots/Video
before https://github.com/user-attachments/assets/1aeb3742-fbff-428b-8616-a21096f72b47
after https://github.com/user-attachments/assets/7c683737-e823-4a16-b969-b7f237f0b5ef
Checklist
- [x] Code follows the project's coding standards.
- [ ] Unit tests covering the new feature have been added.
- [x] All existing tests pass.
- [ ] The documentation has been updated to reflect the new feature
Additional Notes
Related issue: The comment in updateBlock.ts:255-258 mentions that selection should be reset after replaceWith, but this was not implemented. This PR addresses that by handling it in the input rule handler.