(sharedRoot: Y.XmlText)
| 88 | } |
| 89 | |
| 90 | function getStoredPositionsAbsolute(sharedRoot: Y.XmlText) { |
| 91 | assertDocumentAttachment(sharedRoot) |
| 92 | |
| 93 | return Object.fromEntries( |
| 94 | Object.entries(sharedRoot.getAttributes()) |
| 95 | .filter(([key]) => key.startsWith(STORED_POSITION_PREFIX)) |
| 96 | .map( |
| 97 | ([key, position]) => |
| 98 | [ |
| 99 | key.slice(STORED_POSITION_PREFIX.length), |
| 100 | Y.createAbsolutePositionFromRelativePosition( |
| 101 | Y.decodeRelativePosition(position), |
| 102 | sharedRoot.doc, |
| 103 | ), |
| 104 | ] as const, |
| 105 | ) |
| 106 | .filter(([, position]) => position), |
| 107 | ) as Record<string, Y.AbsolutePosition> |
| 108 | } |
| 109 | |
| 110 | export function removeStoredPosition(sharedRoot: Y.XmlText, key: string) { |
| 111 | sharedRoot.removeAttribute(STORED_POSITION_PREFIX + key) |
no test coverage detected
searching dependent graphs…