Commit 4cfe577
feat(richtext-attachment): Add-menu actions target the document end when unfocused
When the article editor has no caret (not first responder), the Add-menu and
table actions previously applied at offset 0 — a structural slot that touches
no paragraph, so paragraph commands silently no-op'd (Heading did nothing) and
inserts landed at the start.
Now, when there is no cursor, these actions target the END of the document:
capture focus state at menu-open time, and before applying, focus the editor
and drop the caret at the end (`focusEditorAtDocumentEndIfNeeded`). Wired into
Text / Quote / Pull-quote / Code / Formula and table insertion. Heading gets a
dedicated path: with a caret it converts the current paragraph as before; with
no caret it appends a NEW empty paragraph in that heading style and focuses it.
Adds `RichTextEditorView.moveCaretToDocumentEnd()`, which collapses the
selection to a caret at `endOfDocument` (past the closing structural token).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 21ed574 commit 4cfe577
2 files changed
Lines changed: 44 additions & 7 deletions
File tree
- submodules/TelegramUI/Components
- RichTextAttachmentScreen/Sources
- RichTextEditor/Sources/RichTextEditorUIKit
Lines changed: 35 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
672 | 682 | | |
673 | 683 | | |
674 | 684 | | |
675 | 685 | | |
676 | | - | |
| 686 | + | |
677 | 687 | | |
678 | | - | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
679 | 692 | | |
680 | 693 | | |
681 | 694 | | |
| |||
744 | 757 | | |
745 | 758 | | |
746 | 759 | | |
747 | | - | |
748 | | - | |
749 | | - | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
750 | 770 | | |
751 | 771 | | |
752 | 772 | | |
| |||
772 | 792 | | |
773 | 793 | | |
774 | 794 | | |
| 795 | + | |
775 | 796 | | |
776 | 797 | | |
777 | 798 | | |
| |||
784 | 805 | | |
785 | 806 | | |
786 | 807 | | |
787 | | - | |
| 808 | + | |
| 809 | + | |
788 | 810 | | |
789 | 811 | | |
790 | 812 | | |
| |||
804 | 826 | | |
805 | 827 | | |
806 | 828 | | |
| 829 | + | |
807 | 830 | | |
808 | 831 | | |
809 | 832 | | |
| |||
825 | 848 | | |
826 | 849 | | |
827 | 850 | | |
| 851 | + | |
828 | 852 | | |
829 | 853 | | |
830 | 854 | | |
| |||
845 | 869 | | |
846 | 870 | | |
847 | 871 | | |
848 | | - | |
| 872 | + | |
| 873 | + | |
849 | 874 | | |
850 | 875 | | |
851 | 876 | | |
| |||
1353 | 1378 | | |
1354 | 1379 | | |
1355 | 1380 | | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
1356 | 1384 | | |
1357 | 1385 | | |
1358 | 1386 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
603 | 612 | | |
604 | 613 | | |
605 | 614 | | |
| |||
0 commit comments