portablemind / grapesjs-code-editor

Code Editor for GrapesJs
BSD 3-Clause "New" or "Revised" License
22 stars 18 forks source link

Could not get this this to work #5

Closed megarg closed 4 years ago

megarg commented 5 years ago

I am getting an error on following statement: window['@truenorthtechnology/grapesjs-code-editor'].codeCommandFactory({inlineCss: true}),

Is there another way? Can I call this function after init() method? Please advice.

russ1985 commented 5 years ago

Hello can you make a JsFiddle so I can see the error.

thanks

megarg commented 5 years ago

I have created the JsFiddle ... As you can see, it behaves very strange when I click the open-code button https://jsfiddle.net/megarg/vx61nfzs/19/

Please let me know what I am doing wrong..

russ1985 commented 5 years ago

I moved the button over to the views button section which is where it was original created to go. I didn't create this plugin but our team took it over because we are using it in our project. When it was created the direction to the creator was to put the button in views button section so I assume he didn't try putting it in the options buttons section.

https://jsfiddle.net/12ato8L7/3/

As you can see from the jsfiddle by moving it over to the views button section it doesn't mess up all the other components. Will take some css updates to make it work in the other buttons section. Feel free to fork and make any updates.

megarg commented 5 years ago

Thanks for response. I am actually using it inside react - the whole Grapesjs library is a react component inside my application. And for some reason, I am still getting this error - see screen shot. I think because I am using react, I am not getting reference to window[...] command. Any ideas on how to solve it.

error