From 39489376d0a10c5e51290551d4610109d637dd18 Mon Sep 17 00:00:00 2001 From: FavorMylikes Date: Sun, 16 Aug 2020 17:20:34 +0800 Subject: [PATCH] Make setAnnotations could use custom className ### Example ```css .ace_gutter-cell.ace_my_class_name{ background: darkorange no-repeat 2px center; } ``` ```js inputEditor.session.setAnnotations([{ row: 0, text: ["some message will show when mouse hover"], className: "ace_error" // show the error icon }, { row: 0, text: ["other message"], className: "ace_my_class_name" // show the background color instead of the default icon }]) ``` --- lib/ace/layer/gutter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ace/layer/gutter.js b/lib/ace/layer/gutter.js index 0c17e0b5039..befadb04817 100644 --- a/lib/ace/layer/gutter.js +++ b/lib/ace/layer/gutter.js @@ -93,7 +93,10 @@ var Gutter = function(parentEl) { rowInfo.text.push(annoText); var type = annotation.type; - if (type == "error") + var className = annotation.className; + if (className) + rowInfo.className = className; + else if (type == "error") rowInfo.className = " ace_error"; else if (type == "warning" && rowInfo.className != " ace_error") rowInfo.className = " ace_warning";