-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Open
Description
again, im working on a github clone except i want to hide the caret shown. how do i do this?
const c = {
lineNumbers: true,
mode: "javascript",
theme: "csmpt-code", // custom theme
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
lineWrapping: true,
readOnly: true,
autoCloseBrackets: {
pairs: "()[]{}''\"\"``<>",
triples: "",
explode: "[]{}()<>",
},
};
const e = CodeMirror.fromTextArea(textArea, c);
// Ensure that the editor is properly initialized
e.refresh(); // Refresh to handle any layout issues
// Focus the editor programmatically after initialization
e.focus(); // Focus the editor
// Set the code content
e.setValue(snippet.code);
// Function to remove 'CodeMirror-focused' class
const removeFocusedClass = () => {
const wrapper = e.getWrapperElement();
wrapper.classList.remove('CodeMirror-focused');
};
// Remove class initially
setTimeout(removeFocusedClass, 0);
// Continuously remove the 'CodeMirror-focused' class on focus
e.getWrapperElement().addEventListener('focus', removeFocusedClass, true);
Metadata
Metadata
Assignees
Labels
No labels