mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-30 10:36:35 +02:00
Desktop: Remove auto-indent for in note html/xml for Code Mirror (#3374)
html/xml inside of a codeblock will still benefit from auto-indent
This commit is contained in:
parent
a4b13be0d1
commit
2f15178ff6
@ -126,7 +126,15 @@ export default function useListIdent(CodeMirror: any) {
|
||||
cm.replaceRange('', { line: anchor.line, ch: 0 }, anchor);
|
||||
}
|
||||
} else {
|
||||
cm.execCommand('newlineAndIndentContinueMarkdownList');
|
||||
// Disable automatic indent for html/xml outside of codeblocks
|
||||
const state = cm.getTokenAt(anchor).state;
|
||||
const mode = cm.getModeAt(anchor);
|
||||
// html/xml inside of a codeblock is fair game for auto-indent
|
||||
if (mode.name !== 'xml' || state.overlay.codeBlock) {
|
||||
cm.execCommand('newlineAndIndentContinueMarkdownList');
|
||||
} else {
|
||||
cm.replaceSelection('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user