Fix scroll events and add minHeight and maxHeight to monaco componet
This commit is contained in:
parent
1ced61a5cd
commit
c367c1e523
2 changed files with 8 additions and 2 deletions
|
|
@ -60,6 +60,9 @@ export default class MonacoEditorComponent extends Component {
|
|||
minimap: {
|
||||
enabled: false,
|
||||
},
|
||||
scrollbar: {
|
||||
alwaysConsumeMouseWheel: false,
|
||||
},
|
||||
};
|
||||
|
||||
if (this.args.uri) {
|
||||
|
|
@ -75,12 +78,14 @@ export default class MonacoEditorComponent extends Component {
|
|||
|
||||
this.editor = editor.create(el, options);
|
||||
|
||||
const minHeight = this.args.minHeight ?? 160;
|
||||
const maxHeight = this.args.maxHeight ?? 420;
|
||||
// Autoresize height of element
|
||||
const onDidContentSizeChangeHandler = this.editor.onDidContentSizeChange(
|
||||
() => {
|
||||
const contentHeight = Math.min(
|
||||
Math.max(this.editor.getContentHeight(), 160),
|
||||
420
|
||||
Math.max(this.editor.getContentHeight(), minHeight),
|
||||
maxHeight
|
||||
);
|
||||
|
||||
el.style.height = `${contentHeight + 1}px`;
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@
|
|||
@value={{json-stringify item}}
|
||||
@language='json'
|
||||
@readOnly={{true}}
|
||||
@minHeight={{0}}
|
||||
class='mb-4'
|
||||
/>
|
||||
{{/each}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue