Function
createConfig
(
doc: string,
theme: 'light' | 'dark',
extensions: Array<Extension | LRLanguage>,
)
Source from the content-addressed store, hash-verified
| 122 | } |
| 123 | |
| 124 | function createConfig( |
| 125 | doc: string, |
| 126 | theme: 'light' | 'dark', |
| 127 | extensions: Array<Extension | LRLanguage>, |
| 128 | ) { |
| 129 | const maybeDark = theme === 'dark' ? [oneDark] : [] |
| 130 | return { |
| 131 | doc, |
| 132 | extensions: [ |
| 133 | [...basicSetup], |
| 134 | EditorView.editable.of(false), |
| 135 | EditorState.readOnly.of(true), |
| 136 | ...maybeDark, |
| 137 | [...(doc === '' ? [] : extensions)], // no need for any extensions if template is empty |
| 138 | ], |
| 139 | } |
| 140 | } |
Tested by
no test coverage detected