(position)
| 550 | } |
| 551 | |
| 552 | getCommonAttributesAtPosition(position) { |
| 553 | let key, value |
| 554 | const { index, offset } = this.locationFromPosition(position) |
| 555 | const block = this.getBlockAtIndex(index) |
| 556 | if (!block) { |
| 557 | return {} |
| 558 | } |
| 559 | |
| 560 | const commonAttributes = attributesForBlock(block) |
| 561 | const attributes = block.text.getAttributesAtPosition(offset) |
| 562 | const attributesLeft = block.text.getAttributesAtPosition(offset - 1) |
| 563 | const inheritableAttributes = Object.keys(config.textAttributes).filter((key) => { |
| 564 | return config.textAttributes[key].inheritable |
| 565 | }) |
| 566 | |
| 567 | for (key in attributesLeft) { |
| 568 | value = attributesLeft[key] |
| 569 | if (value === attributes[key] || inheritableAttributes.includes(key)) { |
| 570 | commonAttributes[key] = value |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | return commonAttributes |
| 575 | } |
| 576 | |
| 577 | getRangeOfCommonAttributeAtPosition(attributeName, position) { |
| 578 | const { index, offset } = this.locationFromPosition(position) |
no test coverage detected