mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
e025088065
Add documentation for CodeMirror extensions GitOrigin-RevId: e5f07084173f201919272f9d46dcdaef4b817874
16 lines
501 B
TypeScript
16 lines
501 B
TypeScript
import { Compartment, EditorState, TransactionSpec } from '@codemirror/state'
|
|
|
|
const phrasesConf = new Compartment()
|
|
|
|
/**
|
|
* A built-in extension providing a mapping between translation keys and translations.
|
|
*/
|
|
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)),
|
|
}
|
|
}
|