(editor: Editor, at?: Range)
| 766 | }, |
| 767 | |
| 768 | findNextLinePoint(editor: Editor, at?: Range): Point | null { |
| 769 | const { selection } = editor |
| 770 | if (!at && selection) at = selection |
| 771 | if (!at) return null |
| 772 | const startPoint = Range.start(at) |
| 773 | const endPoint = Range.end(at) |
| 774 | const startRange = Editable.toDOMRange(editor, { anchor: startPoint, focus: startPoint }) |
| 775 | const endRange = Editable.toDOMRange(editor, { anchor: endPoint, focus: endPoint }) |
| 776 | |
| 777 | const startRects = startRange.getClientRects() |
| 778 | const endRects = endRange.getClientRects() |
| 779 | |
| 780 | let blockEntry = Editor.above(editor, { |
| 781 | at: at.focus, |
| 782 | match: n => Editor.isBlock(editor, n), |
| 783 | }) |
| 784 | let bottom = endRects[0].bottom |
| 785 | let isFind = false |
| 786 | let isSameLine = true |
| 787 | let domBlock: DOMElement | null = null |
| 788 | while (blockEntry && !isFind) { |
| 789 | const [block, path] = blockEntry |
| 790 | domBlock = Editable.toDOMNode(editor, block) |
| 791 | const lowestElements = Editable.findLowestDOMElements(editor, block) |
| 792 | for (let l = 0; l < lowestElements.length && !isFind; l++) { |
| 793 | const lowestElement = lowestElements[l] |
| 794 | const rects = lowestElement.getClientRects() |
| 795 | for (let i = 0; i < rects.length; i++) { |
| 796 | const rect = rects[i] |
| 797 | if (rect.height === 0) continue |
| 798 | if (rect.top >= bottom) { |
| 799 | isFind = true |
| 800 | bottom = rect.top + rect.height / 2 |
| 801 | break |
| 802 | } |
| 803 | } |
| 804 | } |
| 805 | if (!isFind) { |
| 806 | blockEntry = Editor.next(editor, { |
| 807 | at: path, |
| 808 | match: n => Editor.isBlock(editor, n), |
| 809 | }) |
| 810 | isSameLine = false |
| 811 | } |
| 812 | } |
| 813 | if (!domBlock) return null |
| 814 | |
| 815 | return Editable.findClosestPoint( |
| 816 | editor, |
| 817 | domBlock, |
| 818 | isFind && !isSameLine ? startRects[0].x : 99999, |
| 819 | bottom, |
| 820 | ) |
| 821 | }, |
| 822 | |
| 823 | findTextOffsetOnLine(editor: Editor, point: Point) { |
| 824 | const blockEntry = Editor.above(editor, { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…