( sharedRoot: Y.XmlText, editorRoot: Node, point: BasePoint, )
| 8 | export const STORED_POSITION_PREFIX = '__editorYjsStoredPosition_' |
| 9 | |
| 10 | export function editorPointToRelativePosition( |
| 11 | sharedRoot: Y.XmlText, |
| 12 | editorRoot: Node, |
| 13 | point: BasePoint, |
| 14 | ): Y.RelativePosition { |
| 15 | const { yTarget, yParent, textRange } = getYTarget(sharedRoot, editorRoot, point.path) |
| 16 | |
| 17 | if (yTarget) { |
| 18 | throw new Error('Editor point points to a non-text element inside sharedRoot') |
| 19 | } |
| 20 | |
| 21 | return Y.createRelativePositionFromTypeIndex( |
| 22 | yParent, |
| 23 | textRange.start + point.offset, |
| 24 | point.offset === textRange.end ? -1 : 0, |
| 25 | ) |
| 26 | } |
| 27 | |
| 28 | export function absolutePositionToEditorPoint( |
| 29 | sharedRoot: Y.XmlText, |
no test coverage detected
searching dependent graphs…