(range, position)
| 186 | } |
| 187 | |
| 188 | moveTextFromRangeToPosition(range, position) { |
| 189 | let text |
| 190 | range = normalizeRange(range) |
| 191 | const [ startPosition, endPosition ] = range |
| 192 | if (startPosition <= position && position <= endPosition) { |
| 193 | return this |
| 194 | } |
| 195 | |
| 196 | let document = this.getDocumentAtRange(range) |
| 197 | let result = this.removeTextAtRange(range) |
| 198 | |
| 199 | const movingRightward = startPosition < position |
| 200 | if (movingRightward) { |
| 201 | position -= document.getLength() |
| 202 | } |
| 203 | |
| 204 | const [ firstBlock, ...blocks ] = document.getBlocks() |
| 205 | if (blocks.length === 0) { |
| 206 | text = firstBlock.getTextWithoutBlockBreak() |
| 207 | if (movingRightward) { |
| 208 | position += 1 |
| 209 | } |
| 210 | } else { |
| 211 | text = firstBlock.text |
| 212 | } |
| 213 | |
| 214 | result = result.insertTextAtRange(text, position) |
| 215 | if (blocks.length === 0) { |
| 216 | return result |
| 217 | } |
| 218 | |
| 219 | document = new this.constructor(blocks) |
| 220 | position += text.getLength() |
| 221 | |
| 222 | return result.insertDocumentAtRange(document, position) |
| 223 | } |
| 224 | |
| 225 | addAttributeAtRange(attribute, value, range) { |
| 226 | let { blockList } = this |
nothing calls this directly
no test coverage detected