I have made a draggable split panel by https://github.com/johnwalley/allotment.
In the panel panel, I have a monaco editor. when I hover on the monaco editor, a diagnostic window appears. At the moment, the diagnostic window does not exceed the first panel even with .monaco-hover { z-index: 1000 !important }
in style.css
. Does anyone know how I could make the diagnostic window exceed the first panel?
CodeSandbox: https://codesandbox.io/s/reset-forked-7wvrbj?file=/src/App.js
import React from "react";
import { Allotment } from "allotment";
import "allotment/dist/style.css";
import "./style.css";
import Editor, { monaco } from "@monaco-editor/react";
monaco
.init()
.then((monaco) => {
monaco.languages.registerHoverProvider("html", {
provideHover: function (model, position) {
console.log(position);
return {
range: new monaco.Range(
1,
1,
model.getLineCount(),
model.getLineMaxColumn(model.getLineCount())
),
contents: [
{ value: "**SOURCE**" },
{ value: "hey man, how are you?" }
]
};
}
});
})
.catch((error) =>
console.error("An error occurred during initialization of Monaco: ", error)
);
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
toExpand: true
};
this.myRef = React.createRef();
}
handleChange = (sizes) => {
if (sizes.length > 1) {
if (sizes[1] < 31) {
this.setState({ toExpand: true });
} else {
this.setState({ toExpand: false });
}
}
};
render() {
return (
<div
style={{
minWidth: 200,
height: "100vh",
overflowX: "auto",
width: "auto",
margin: "0px 0px 0px 0px"
}}
>
<Allotment
vertical
onChange={this.handleChangeAllotment}
ref={this.myRef}
>
<Allotment.Pane>
<Editor
height="30vh"
language="html"
value={`
<section>
<div>
<span>
{{ some_value }}
</span>
</div>
</section>
`}
options={{
selectOnLineNumber: true,
lineNumbersMinChars: 0,
glyphMargin: true,
readOnly: true,
hover: {
enabled: true
}
}}
/>
</Allotment.Pane>
<Allotment.Pane preferredSize="0%" minSize={20}>
short <br /> short <br />
short <br /> short <br />
short <br /> short <br />
short <br /> short <br />
short <br /> short <br />
short <br /> short <br />
</Allotment.Pane>
</Allotment>
</div>
);
}
}