Closed prodiphost closed 1 year ago
.cm-scroller::-webkit-scrollbar {
width: 10px;
}
.cm-scroller::-webkit-scrollbar-track {
background: red;
}
.cm-scroller::-webkit-scrollbar-thumb {
background: yellow;
}
.cm-scroller::-webkit-scrollbar-thumb:hover {
background: blue;
}
Or
import { EditorView } from "@codemirror/view";
const scrollbarThemeOption = EditorView.theme({
"& .cm-scroller::-webkit-scrollbar": {
width: "10px !important"
},
"& .cm-scroller::-webkit-scrollbar-track": {
background: "#333"
},
"& .cm-scroller::-webkit-scrollbar-thumb": {
background: "yellow"
},
"& .cm-scroller::-webkit-scrollbar-thumb:hover": {
background: "blue"
}
});
<CodeMirror
value={code}
height="200px"
extensions={[scrollbarThemeOption]}
/>
@jaywcjlove Thanks, but it not working with Firefox. Please give me a way for all latest version browser.
@jaywcjlove Thank you. its good for me.
@jaywcjlove , is there a reason why this cannot work with height='auto' ?
If I want my editor to span the height of the screen, it seems like scrollbars quit being accessible functionally.
To demo this, I simply set the first height={'auto'}
, and suddenly the up/down scroll bar disappeared. Am I doing something wrong?
Hack: I can just set height to be 95% of window.innerHeight
... But, ew.
I want to use simplescrollbars addon with react-codemirror. It save scrollbar space.
Like this https://codemirror.net/5/demo/simplescrollbars.html.
Thank you.