ACEエディタがすべてのテキストが強調表示されているのはなぜそれを削除する方法はなぜですか?
-
21-12-2019 - |
質問
私のコードは次のように見えます:
$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);
を使用して、Undomanagerをリセットします。
代わりに_editor.setValue($scope.aceIDEs, cursorPos);
を使用することもできます。cursorPos=-1
は、最後にStartとcursorPos=1
でカーソルを置きます。
または設定値の後に_editor.clearSelection()
を呼び出します。
所属していません StackOverflow