[英]How to remove indentation on new line in Codemirror
在我的情況下,光標跳過一條空行。 如何解決? 提前致謝。
在角5 +電子。
HTML:
<codemirror
[config]="{
lineWrapping: true,
autofocus: true,
showCursorWhenSelecting: true,
smartIndent: false
}"
(keyup.enter)="removeIndentation()"
#novelEditor>
</codemirror>
TS:
import { CodemirrorComponent } from 'ng2-codemirror';
...
@ViewChild('novelEditor') private novelEditor: CodemirrorComponent;
...
removeIndentation() {
const cm = this.novelEditor.instance;
cm.replaceSelection("\n");
}
我解決了
removeIndentation() {
const cm = this.novelEditor.instance;
cm.execCommand('delLineLeft');
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.