From d7733adab166b09b7d45b3b1bb1a7c71fb3be7a0 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 13 Jun 2017 17:08:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99code=20editor=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=A0=87=E7=BA=A2=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/editor/editor.code.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/base/single/editor/editor.code.js b/src/base/single/editor/editor.code.js index 3a8292d0c..3acb4b164 100644 --- a/src/base/single/editor/editor.code.js +++ b/src/base/single/editor/editor.code.js @@ -85,7 +85,11 @@ BI.CodeEditor = BI.inherit(BI.Single, { var from = this.editor.getCursor(); this.editor.replaceSelection(param); var to = this.editor.getCursor(); - this.editor.markText(from, to, {className: 'param', atomic: true}); + var options = {className: 'param', atomic: true}; + if(BI.isNotNull(param.match(//))){ + options.className = 'error-param'; + } + this.editor.markText(from, to, options); this.editor.replaceSelection(" "); this.editor.focus(); }, @@ -102,6 +106,7 @@ BI.CodeEditor = BI.inherit(BI.Single, { _.forEach(line.markedSpans, function (i, ms) { switch (i.marker.className) { case "param": + case "error-param": var fieldNameLength = i.to - i.from; value = value.substr(0, i.from + num) + "$\{" + value.substr(i.from + num, fieldNameLength) + "\}" + value.substr(i.to + num, value.length); num += 3;