allow multiline annotations
This commit is contained in:
parent
446556ea4f
commit
7fc1944c8b
3 changed files with 13 additions and 3 deletions
|
|
@ -242,6 +242,8 @@
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
white-space: pre-line;
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_folding-enabled > .ace_gutter-cell {
|
.ace_folding-enabled > .ace_gutter-cell {
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
var dom = require("../lib/dom");
|
var dom = require("../lib/dom");
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||||
|
|
||||||
var Gutter = function(parentEl) {
|
var Gutter = function(parentEl) {
|
||||||
|
|
@ -78,12 +79,15 @@ var Gutter = function(parentEl) {
|
||||||
var annotation = annotations[i];
|
var annotation = annotations[i];
|
||||||
var row = annotation.row;
|
var row = annotation.row;
|
||||||
var rowInfo = this.$annotations[row];
|
var rowInfo = this.$annotations[row];
|
||||||
if (!rowInfo) {
|
if (!rowInfo)
|
||||||
rowInfo = this.$annotations[row] = {text: []};
|
rowInfo = this.$annotations[row] = {text: []};
|
||||||
}
|
|
||||||
var annoText = annotation.text.replace(/"/g, """).replace(/'/g, "’").replace(/</g, "<");
|
var annoText = annotation.text;
|
||||||
|
annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
|
||||||
|
|
||||||
if (rowInfo.text.indexOf(annoText) === -1)
|
if (rowInfo.text.indexOf(annoText) === -1)
|
||||||
rowInfo.text.push(annoText);
|
rowInfo.text.push(annoText);
|
||||||
|
|
||||||
var type = annotation.type;
|
var type = annotation.type;
|
||||||
if (type == "error")
|
if (type == "error")
|
||||||
rowInfo.className = " ace_error";
|
rowInfo.className = " ace_error";
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,10 @@ exports.escapeRegExp = function(str) {
|
||||||
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
|
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.escapeHTML = function(str) {
|
||||||
|
return str.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<");
|
||||||
|
};
|
||||||
|
|
||||||
exports.getMatchOffsets = function(string, regExp) {
|
exports.getMatchOffsets = function(string, regExp) {
|
||||||
var matches = [];
|
var matches = [];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue