加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – 为什么ace编辑器加载所有文本突出显示以及如何删除

发布时间:2020-12-17 17:45:25 所属栏目:安全 来源:网络整理
导读:我的代码看起来像: $scope.aceIDEs='var hw = new function() {n console.log("Hello world!");n}'$scope.loadAceJSExample = function (_editor) {_editor.setValue($scope.aceIDEs);_editor.getSession().setUseWorker(false);_editor.setHighlightActi
我的代码看起来像:

$scope.aceIDEs='var hw = new function() {n  console.log("Hello world!");n}'

$scope.loadAceJSExample = function (_editor) {
_editor.setValue($scope.aceIDEs);
_editor.getSession().setUseWorker(false);
_editor.setHighlightActiveLine(true);
};

和:

<div class="container fade-in" style='padding: 4em;'>
<div>
      ui-ace="{onLoad : loadAceJSExample,onChange : aceJSExampleChanged,useWrapMode : true,theme : 'github',showGutter: true,mode: 'javascript'

    }" />

我试着调用_editor.getSession().removeMarker();但没有帮助

每次我刷新它看起来像这样,一旦我点击它恢复正常:

解决方法

使用_editor.session.setValue($scope.aceIDEs);这也重置了无人管. 或者,您可以使用_editor.setValue($scope.aceIDEs,cursorPos);.其中cursorPos = -1将光标置于开始处,将cursorPos = 1置于末尾. 或者在设置值后调用_editor.clearSelection().

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读