1
0
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:
Caleb John 2020-06-16 06:00:58 -06:00 committed by GitHub
parent a4b13be0d1
commit 2f15178ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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');
}
}
}
};