答案 0 :(得分:4)
我建议用CSS隐藏它。唯一的缺点是,这将全局禁用所有支架突出显示,而不仅仅是HTML标签。
.ace_editor .ace_marker-layer .ace_bracket { display: none }
请参阅下面的工作演示:
var editor = ace.edit("editor");
editor.setTheme("ace/theme/dreamweaver");
editor.getSession().setMode("ace/mode/html");

#editor {
position: absolute !important;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
#editor .ace_marker-layer .ace_bracket { display: none }

<script src="https://cdn.jsdelivr.net/g/ace@1.2.3(min/ace.js+min/mode-html.js+min/theme-dreamweaver.js)" type="text/javascript"></script>
<div id="editor"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<style type="text/css" media="screen">
html, body {
height: 100%;
}
</style>
</head>
</html></div>
&#13;
答案 1 :(得分:0)
始终启用匹配标记和括号的突出显示,应该可以添加选项以在此处不突出显示https://github.com/ajaxorg/ace/blob/master/lib/ace/editor.js#L535。
答案 2 :(得分:0)
以下是一种手动禁用它然后再次启用它的方法:
function toggleMatchingTagStyle() {
if (editor.$highlightTagPending == true) {
editor.$highlightTagPending = false;
editor.$highlightPending = false;
}
else {
session.removeMarker(session.$tagHighlight);
session.$tagHighlight = null;
session.removeMarker(session.$bracketHighlight);
session.$bracketHighlight = null;
editor.$highlightTagPending = true;
editor.$highlightPending = true;
}
}
这是一个粗略的补丁,我认为对editor.js有用,可以启用或禁用此功能:
用于旧式getter setter函数
this.setHighlightMatchingTags = function(shouldHighlight) {
this.setOption("highlightMatchingTags", shouldHighlight);
};
this.getHighlightMatchingTags = function() {
return this.getOption("highlightMatchingTags");
};
this.setHighlightMatchingBrackets = function(shouldHighlight) {
this.setOption("highlightMatchingBrackets", shouldHighlight);
};
this.getHighlightMatchingBrackets = function() {
return this.getOption("highlightMatchingBrackets");
};
for editor.js#L2624 add
中的setOption()highlightMatchingTags: {
set: function(shouldHighlight) {this.$onSelectionChange();},
initialValue: true
},
highlightMatchingBrackets: {
set: function(shouldHighlight) {this.$onSelectionChange();},
initialValue: true
},
改变这一点(第505行):
this.$highlightBrackets = function() {
对此:
this.$highlightBrackets = function() {
if (!this.$highlightMatchingBrackets) return;
改变这一点(第534行):
this.$highlightTags = function() {
对此:
this.$highlightTags = function() {
if (!this.$highlightMatchingTags) return;