Static highlighting fix for codesnippets
This commit is contained in:
parent
eb021d957e
commit
f283d34790
2 changed files with 6 additions and 4 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-row { clear: both; }
|
.ace_line { clear: both; }
|
||||||
|
|
||||||
*.ace_gutter-cell {
|
*.ace_gutter-cell {
|
||||||
-moz-user-select: -moz-none;
|
-moz-user-select: -moz-none;
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,9 @@ var baseStyles = require("../requirejs/text!./static.css");
|
||||||
* @returns {object} An object containing: html, css
|
* @returns {object} An object containing: html, css
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.render = function(input, mode, theme) {
|
exports.render = function(input, mode, theme, lineStart) {
|
||||||
|
lineStart = parseInt(lineStart || 1, 10);
|
||||||
|
|
||||||
var session = new EditSession("");
|
var session = new EditSession("");
|
||||||
session.setMode(mode);
|
session.setMode(mode);
|
||||||
session.setUseWorker(false);
|
session.setUseWorker(false);
|
||||||
|
|
@ -71,8 +73,8 @@ exports.render = function(input, mode, theme) {
|
||||||
|
|
||||||
for(var ix = 0; ix < length; ix++) {
|
for(var ix = 0; ix < length; ix++) {
|
||||||
var lineTokens = tokens[ix].tokens;
|
var lineTokens = tokens[ix].tokens;
|
||||||
stringBuilder.push("<div class='ace-row'>");
|
stringBuilder.push("<div class='ace_line'>");
|
||||||
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix+1) + "</span>");
|
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
|
||||||
textLayer.$renderLine(stringBuilder, 0, lineTokens, true);
|
textLayer.$renderLine(stringBuilder, 0, lineTokens, true);
|
||||||
stringBuilder.push("</div>");
|
stringBuilder.push("</div>");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue