Fix type mismatches + set min height and width of code

This commit is contained in:
rijkvanzanten
2020-06-12 10:55:04 -04:00
parent 6ad3aa500b
commit ca49e3fd7a
3 changed files with 14 additions and 8 deletions

View File

@@ -72,7 +72,7 @@ export default defineComponent({
await getImports(cmOptions.value);
codemirror.value = CodeMirror.fromTextArea(codemirrorElVal, cmOptions.value);
codemirror.value.setValue(stringValue.value || props.template);
codemirror.value.setValue(stringValue.value || props.template || '');
await setLanguage();
codemirror.value.on('change', (cm) => {
const content = cm.getValue();
@@ -152,7 +152,7 @@ export default defineComponent({
}
await import(`codemirror/mode/${lang}/${lang}.js`);
await import(`codemirror/addon/lint/${linter}-lint.js`);
codemirror.value.setOption('lint', CodeMirror.lint[linter]);
codemirror.value.setOption('lint', (CodeMirror as any).lint[linter]);
} else {
await import(`codemirror/mode/${lang}/${lang}.js`);
codemirror.value.setOption('mode', { name: lang });
@@ -278,8 +278,8 @@ export default defineComponent({
.interface-code {
position: relative;
width: 100%;
max-width: 620px;
font-size: 12px;
&:focus {
border-color: var(--primary-125);
}

12
src/shims.d.ts vendored
View File

@@ -19,17 +19,21 @@ declare module 'vuedraggable' {
}
declare module 'jsonlint-mod' {
export default any;
const x: any;
export default x;
}
declare module 'jshint' {
export default any;
const x: any;
export default x;
}
declare module 'csslint' {
export default any;
const x: any;
export default x;
}
declare module 'js-yaml' {
export default any;
const x: any;
export default x;
}

View File

@@ -185,7 +185,9 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
.CodeMirror-scroll {
position: relative;
height: 100%; margin-right: -50px;
height: 100%;
min-height: var(--input-height-tall);
margin-right: -50px;
/* 50px is the magic margin used to hide the element's real scrollbars */