add checkbox in settings to enable line wrapping
This commit is contained in:
parent
aa51c2b6dd
commit
f37a220a05
4 changed files with 34 additions and 11 deletions
|
|
@ -88,13 +88,7 @@ const highlightField = StateField.define({
|
|||
provide: (f) => EditorView.decorations.from(f),
|
||||
});
|
||||
|
||||
const staticExtensions = [
|
||||
javascript(),
|
||||
highlightField,
|
||||
flashField,
|
||||
javascriptLanguage.data.of({ autocomplete: strudelAutocomplete }),
|
||||
EditorView.lineWrapping,
|
||||
];
|
||||
const staticExtensions = [javascript(), highlightField, flashField];
|
||||
|
||||
export default function CodeMirror({
|
||||
value,
|
||||
|
|
@ -105,6 +99,7 @@ export default function CodeMirror({
|
|||
keybindings,
|
||||
isLineNumbersDisplayed,
|
||||
isAutoCompletionEnabled,
|
||||
isLineWrappingEnabled,
|
||||
fontSize = 18,
|
||||
fontFamily = 'monospace',
|
||||
options,
|
||||
|
|
@ -150,8 +145,12 @@ export default function CodeMirror({
|
|||
_extensions.push(autocompletion({ override: [] }));
|
||||
}
|
||||
|
||||
if (isLineWrappingEnabled) {
|
||||
_extensions.push(EditorView.lineWrapping);
|
||||
}
|
||||
|
||||
return _extensions;
|
||||
}, [keybindings, isAutoCompletionEnabled]);
|
||||
}, [keybindings, isAutoCompletionEnabled, isLineWrappingEnabled]);
|
||||
|
||||
return (
|
||||
<div style={{ fontSize, fontFamily }} className="w-full">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue