(composition)
| 1 | export default class LineBreakInsertion { |
| 2 | constructor(composition) { |
| 3 | this.composition = composition |
| 4 | this.document = this.composition.document |
| 5 | const selectedRange = this.composition.getSelectedRange() |
| 6 | this.startPosition = selectedRange[0] |
| 7 | this.endPosition = selectedRange[1] |
| 8 | |
| 9 | this.startLocation = this.document.locationFromPosition(this.startPosition) |
| 10 | this.endLocation = this.document.locationFromPosition(this.endPosition) |
| 11 | |
| 12 | this.block = this.document.getBlockAtIndex(this.endLocation.index) |
| 13 | this.breaksOnReturn = this.block.breaksOnReturn() |
| 14 | this.previousCharacter = this.block.text.getStringAtPosition(this.endLocation.offset - 1) |
| 15 | this.nextCharacter = this.block.text.getStringAtPosition(this.endLocation.offset) |
| 16 | } |
| 17 | |
| 18 | shouldInsertBlockBreak() { |
| 19 | if (this.block.hasAttributes() && this.block.isListItem() && !this.block.isEmpty()) { |
nothing calls this directly
no test coverage detected