mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 23:48:05 +03:00
Use a DocumentFragment to insert all lines at once
This commit is contained in:
parent
a7c5ea08be
commit
0a38793450
@ -202,14 +202,13 @@ class Editor extends View
|
||||
elementsToReplace = @lineCache[startRow...endRow]
|
||||
@lineCache[startRow...endRow] = lineElements?.toArray() or []
|
||||
|
||||
lines = @lines[0]
|
||||
if lineElements
|
||||
fragment = document.createDocumentFragment()
|
||||
lineElements.each -> fragment.appendChild(this)
|
||||
if elementToInsertBefore
|
||||
lineElements.each ->
|
||||
lines.insertBefore(this, elementToInsertBefore)
|
||||
@lines[0].insertBefore(fragment, elementToInsertBefore)
|
||||
else
|
||||
lineElements.each ->
|
||||
lines.appendChild(this)
|
||||
@lines[0].appendChild(fragment)
|
||||
|
||||
$(elementsToReplace).remove()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user