(index)
| 74 | this.intro = content + this.intro; |
| 75 | } |
| 76 | split(index) { |
| 77 | const sliceIndex = index - this.start; |
| 78 | const originalBefore = this.original.slice(0, sliceIndex); |
| 79 | const originalAfter = this.original.slice(sliceIndex); |
| 80 | this.original = originalBefore; |
| 81 | const newChunk = new Chunk(index, this.end, originalAfter); |
| 82 | newChunk.outro = this.outro; |
| 83 | this.outro = ''; |
| 84 | this.end = index; |
| 85 | if (this.edited) { |
| 86 | newChunk.edit('', false); |
| 87 | this.content = ''; |
| 88 | } else { |
| 89 | this.content = originalBefore; |
| 90 | } |
| 91 | newChunk.next = this.next; |
| 92 | if (newChunk.next) newChunk.next.previous = newChunk; |
| 93 | newChunk.previous = this; |
| 94 | this.next = newChunk; |
| 95 | return newChunk; |
| 96 | } |
| 97 | toString() { |
| 98 | return this.intro + this.content + this.outro; |
| 99 | } |
no test coverage detected