Example of view plugin

In order to benefit from stylus/pen input, I am trying to migrate our rather involved collaborative editor based on CodeMirror 5 to CodeMirror 6. I can see that stylus/pen input is accepted after my partial migration to CM6, which is encouraging. Some things become much easier to do now, such as the position in the document. However, the existing editor relies heavily on listening to changes (for saving in the background etc.), and I cannot find a worked-out example of a view plugin, which is supposed to substitute for the event listeners.

In fact, I would like to see as complete an example as possible of an entire editor based on CM6. I am having problems with the linewrapping extension and with decorations, too, and an example might be helpful.

Did you go through the examples on the websites? There’s several small view plugins in there. It’s not clear what an “entire editor” means. Maybe you’re looking for updateListener?

Thanks for answering. The Zebra stripes example is the most complete one. I would simply appreciate an example of a whole editor: initialization, configuration, decorations, listening for updates and manually changing the editor state. When it’s a complete running example, one can step through it and look at each stage what is happening.

1 Like