(direction, { length } = {})
| 205 | } |
| 206 | |
| 207 | deleteInDirection(direction, { length } = {}) { |
| 208 | let attachment, deletingIntoPreviousBlock, selectionSpansBlocks |
| 209 | const locationRange = this.getLocationRange() |
| 210 | let range = this.getSelectedRange() |
| 211 | const selectionIsCollapsed = rangeIsCollapsed(range) |
| 212 | |
| 213 | if (selectionIsCollapsed) { |
| 214 | deletingIntoPreviousBlock = direction === "backward" && locationRange[0].offset === 0 |
| 215 | } else { |
| 216 | selectionSpansBlocks = locationRange[0].index !== locationRange[1].index |
| 217 | } |
| 218 | |
| 219 | if (deletingIntoPreviousBlock) { |
| 220 | if (this.canDecreaseBlockAttributeLevel()) { |
| 221 | const block = this.getBlock() |
| 222 | |
| 223 | if (block.isListItem()) { |
| 224 | this.decreaseListLevel() |
| 225 | } else { |
| 226 | this.decreaseBlockAttributeLevel() |
| 227 | } |
| 228 | |
| 229 | this.setSelection(range[0]) |
| 230 | if (block.isEmpty()) { |
| 231 | return false |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | if (selectionIsCollapsed) { |
| 237 | range = this.getExpandedRangeInDirection(direction, { length }) |
| 238 | if (direction === "backward") { |
| 239 | attachment = this.getAttachmentAtRange(range) |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | if (attachment) { |
| 244 | this.editAttachment(attachment) |
| 245 | return false |
| 246 | } else { |
| 247 | this.setDocument(this.document.removeTextAtRange(range)) |
| 248 | this.setSelection(range[0]) |
| 249 | if (deletingIntoPreviousBlock || selectionSpansBlocks) { |
| 250 | return false |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | moveTextFromRange(range) { |
| 256 | const [ position ] = Array.from(this.getSelectedRange()) |
nothing calls this directly
no test coverage detected