Fix code interface not staging values in plain text mode

Fixes #3296
This commit is contained in:
rijkvanzanten
2020-12-08 18:32:53 -05:00
parent ea1853acfb
commit d893e44bf7
2 changed files with 7 additions and 2 deletions

View File

@@ -55,7 +55,7 @@ export default defineComponent({
},
language: {
type: String,
default: 'text/plain',
default: 'plaintext',
},
type: {
type: String,
@@ -154,7 +154,7 @@ export default defineComponent({
}
return found;
});
} else if (lang === 'text/plain') {
} else if (lang === 'plaintext') {
codemirror.value.setOption('mode', { name: null });
} else {
await import(`codemirror/mode/${lang}/${lang}.js`);

View File

@@ -9,11 +9,16 @@ const choicesMap = CodeMirror.modeInfo.reduce((acc: Record<string, string>, choi
return acc;
}
if (choice.mode == null || choice.mode == 'null') {
choice.mode = 'plaintext';
}
if (choice.mode in acc) {
acc[choice.mode] += ' / ' + choice.name;
} else {
acc[choice.mode] = choice.name;
}
return acc;
}, {});