Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add more options to codemirror running inside grapesjs #209

Closed
rgcarrasqueira opened this issue Aug 4, 2017 · 5 comments
Closed
Labels

Comments

@rgcarrasqueira
Copy link

Hi Art!

I'm doing great progress with Grapesjs. I've found a way to edit the code inside a modal window and it reflects immediately on canvas. But I'm facing some problems in how setup the codemirror to work with Grapes.

For example, i'm trying to add the plugin that allows search and replace inside the code, I'm just calling the JS and nothing is happening.

If I add a setting like that:

odeViewer = editor.CodeManager.getViewer('CodeMirror').clone();
    
    
    codeViewer.set({
        codeName: 'htmlmixed',
        readOnly: 0,
        theme: 'hopscotch',
        autoBeautify: true,
        autoCloseTags: true,
        autoCloseBrackets: true,
        //lineWrapping: true,
        styleActiveLine: true,
        smartIndent: true
       # Where I'm trying to add:
        indentWithTabs: true,
    });
    
    codeViewer.init(document.getElementById('code'));
    viewer = codeViewer.editor;

The editor stops to work. Any clue about this?

Thanks

@adamdyson
Copy link

@rgcarrasqueira Could this simply be because the object data being set is malformed?

odeViewer = editor.CodeManager.getViewer('CodeMirror').clone();
    
    
    codeViewer.set({
        codeName: 'htmlmixed',
        readOnly: 0,
        theme: 'hopscotch',
        autoBeautify: true,
        autoCloseTags: true,
        autoCloseBrackets: true,
        //lineWrapping: true,
        styleActiveLine: true,
        smartIndent: true // Missing comma
       # Where I'm trying to add:
        indentWithTabs: true, // Remove trailing comma just to be safe
    });
    
    codeViewer.init(document.getElementById('code'));
    viewer = codeViewer.editor;

@artf
Copy link
Member

artf commented Aug 8, 2017

@rgcarrasqueira unfortunately, the code viewer part is not so well designed and should be definitely refactored, at the moment few options available are just hard-coded and it's not possible to add other options

@2uncle-code
Copy link

so there is nothing we can do about this code editor? @artf

@artf
Copy link
Member

artf commented Sep 29, 2017

not yet

@artf artf closed this as completed in 0920d6b Dec 1, 2017
@lock
Copy link

lock bot commented Sep 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the outdated label Sep 18, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants