-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: add CodeMirror lineWrap support, fix base styling
- Loading branch information
1 parent
428fb82
commit 51f0082
Showing
4 changed files
with
44 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
apps/codegram/src/components/CustomEditor/CustomEditor.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {CodeMirror} from '@local/solid-codemirror'; | ||
import {createSignal} from 'solid-js'; | ||
import {EditorView} from '@codemirror/view'; | ||
|
||
export const CustomEditor = () => { | ||
const [value, setValue] = createSignal('Hello world'); | ||
const supportsLineWrap = EditorView.lineWrapping; | ||
const baseTheme = EditorView.theme( | ||
{ | ||
'&': { | ||
fontFamily: 'Source Code Pro, monospace', | ||
}, | ||
'.cm-activeLine': { | ||
backgroundColor: 'transparent', | ||
color: 'white', | ||
}, | ||
'.cm-content': { | ||
fontFamily: 'Source Code Pro, monospace', | ||
textAlign: 'left', | ||
}, | ||
'.cm-gutters': { | ||
display: 'none', | ||
}, | ||
}, | ||
{dark: true}, | ||
); | ||
|
||
return ( | ||
<CodeMirror | ||
value={value()} | ||
extensions={[baseTheme, supportsLineWrap]} | ||
editable={true} | ||
basicSetup={true} | ||
onChange={setValue} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters