restore setInnerHtml optimization for text layer
This commit is contained in:
parent
0ddf25b27b
commit
2c9404224b
1 changed files with 17 additions and 5 deletions
|
|
@ -286,12 +286,24 @@ var Text = function(parentEl) {
|
|||
this.config = config;
|
||||
|
||||
var html = [];
|
||||
var tokens = this.session.getTokens(config.firstRow, config.lastRow)
|
||||
var fragment = this.$renderLinesFragment(config, config.firstRow, config.lastRow);
|
||||
var firstRow = config.firstRow, lastRow = config.lastRow;
|
||||
var tokens = this.session.getTokens(firstRow, lastRow)
|
||||
|
||||
// Clear the current content of the element and add the rendered fragment.
|
||||
this.element.innerHTML = "";
|
||||
this.element.appendChild(fragment);
|
||||
for (var row=firstRow; row<=lastRow; row++) {
|
||||
html.push("<div class='ace_line' style='height:",
|
||||
this.session.getRowHeight(config, row) + "px;", "width", config.width + "px'>"
|
||||
)
|
||||
// Get the tokens per line as there might be some lines in between
|
||||
// beeing folded.
|
||||
// OPTIMIZE: If there is a long block of unfolded lines, just make
|
||||
// this call once for that big block of unfolded lines.
|
||||
var tokens = this.session.getTokens(row, row);
|
||||
if (tokens.length == 1)
|
||||
this.$renderLine(html, row, tokens[0].tokens);
|
||||
html.push("</div>")
|
||||
row = this.session.getRowFoldEnd(row);
|
||||
}
|
||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||
};
|
||||
|
||||
this.$textToken = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue