(transaction, parent, currPos, negatedAttributes)
| 186 | * @function |
| 187 | */ |
| 188 | const insertNegatedAttributes = (transaction, parent, currPos, negatedAttributes) => { |
| 189 | // check if we really need to remove attributes |
| 190 | while ( |
| 191 | currPos.right !== null && ( |
| 192 | (currPos.right.deleted && (currPos.am === noAttributionsManager || currPos.am.contentLength(currPos.right) === 0)) || ( |
| 193 | currPos.right.content.constructor === ContentFormat && |
| 194 | equalAttrs(negatedAttributes.get(/** @type {ContentFormat} */ (currPos.right.content).key), /** @type {ContentFormat} */ (currPos.right.content).value) |
| 195 | ) |
| 196 | ) |
| 197 | ) { |
| 198 | if (!currPos.right.deleted) { |
| 199 | negatedAttributes.delete(/** @type {ContentFormat} */ (currPos.right.content).key) |
| 200 | } |
| 201 | currPos.forward() |
| 202 | } |
| 203 | const doc = transaction.doc |
| 204 | const ownClientId = doc.clientID |
| 205 | negatedAttributes.forEach((val, key) => { |
| 206 | const left = currPos.left |
| 207 | const right = currPos.right |
| 208 | const nextFormat = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)) |
| 209 | nextFormat.integrate(transaction, 0) |
| 210 | currPos.right = nextFormat |
| 211 | currPos.forward() |
| 212 | }) |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * @param {Map<string,any>} currentAttributes |
no test coverage detected
searching dependent graphs…