Search code examples
javascriptcodemirrorcodemirror-modes

CodeMirror: Is it possible to pass \ register a mode as a delegate function?



I need to change values of tokens dynamically, using custom mode that i wrote.
is it possible to change modes by passing delegate function of the mode, or maybe there is a better way.
I am implementing codemirror using angular 2.
thank you.


Solution

  • Yes, you can wrap a mode to create another mode. See for example the yaml-frontmatter mode in the distribution, or the mode/multiplex and mode/overlay addons.