mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 14:09:11 -05:00
14 lines
406 B
TypeScript
14 lines
406 B
TypeScript
|
import { Compartment, EditorState, TransactionSpec } from '@codemirror/state'
|
||
|
|
||
|
const phrasesConf = new Compartment()
|
||
|
|
||
|
export const phrases = (phrases: Record<string, string>) => {
|
||
|
return phrasesConf.of(EditorState.phrases.of(phrases))
|
||
|
}
|
||
|
|
||
|
export const setPhrases = (value: Record<string, string>): TransactionSpec => {
|
||
|
return {
|
||
|
effects: phrasesConf.reconfigure(EditorState.phrases.of(value)),
|
||
|
}
|
||
|
}
|