Codemirror Editor

Hey, just another editor request :)
I would like to see codemirror as a third option with selectable syntax highlighting (Markdown, HTML, YAML)
Or is there a way to extend that myself?

Best, Marcus

Comments

  • You could create your own custom field type mapping that uses it.
    http://docs.getfuelcms.com/general/forms#association_parameters

  • you thought of everything, did you? :) Thanks. I will explore this option.
    Is that also possible for Site Variables?

  • Site variables are a little more generic and operate as a name/value only.

  • Hey,
    I managed to implement Codemirror as custom field. It works great for Markdown fields, config fields (with json or yaml content) or just html.

    The steps are laid out here: https://gist.github.com/marcus-at-localhorst/90a5bfa41e5affcb2d664b402d0ecb23 I hope it works.

    I would appreciate if you could review the code and maybe point out any potential pitfalls.

    Three things are still bothering me and maybe you have an answer:

    1. I get an VM11081:135 Uncaught TypeError: Cannot read property 'previewParserPath' of undefined error when there is a Markitup field defined.

    The error happens here:

            var createMarkItUp = function(elem){
    
                //...
    
                config.previewParserPath = config.previewParserPath + '?' + createPreviewParams(elem);
    
    1. I had to set 'ignore_representative' => TRUE because else it became a markit up field. How

    2. The Codemirror CSS is the full path to a CDN. I could not point the the CSS to the js path in the field setting. Any idea how to do that, without ripping the codemirror.css out of it's original folder?

    And since I asked for the editor of site variables - where can I go and change the textfield to my custom textfield? Is that possible?

    Thanks

Sign In or Register to comment.