GrapesJS Issues

Search parsed GitHub issues, see highlighted answers, and open the original discussion when needed.

3464 issues found

#494November 8, 2017by z-vr3 answers
0 reactions

Place block as component programmatically

I've created a custom type, and a block is it possible to insert it into DomComponents by name or any other means? I don't want to be drag'n'dropping the block manually each time. Thanks.

z-vr

Oh I found out how to do it -- via editor.addComponents({ type: 'MyComponent' }). Is there a way to insert it into a specific element by a CSS selector? Found this snippet, but how would i find the correct index?

z-vr

ok so what i've done is and then I think traversing the model tree would be a very good feature -- I'll work on the PR at some point. Cheers!

artf

You can actually get the model from the cash element instance with view.$el.data('model'), so you might make it work with less code

#493November 8, 2017by bungambohlah3 answers
0 reactions

[QUESTION] Can i set content dynamically from block API ?

Hi @artf , very great web builder framework and keep it up :+1: code : As you can see, can i make tag dynamically from my backend? i use EJS template for my view render engine and can passing data to ejs. Thank you very much and have a nice day

artf

You can update the block's content in this way

bungambohlah

Oh i see , thank a lot @artf

bungambohlah

Hi, @artf I have a problem, my dynamic-nav's block works now, but when I give some script to that component its give me an error . May I correct? if not please correct me, thank you very much That's my script :

#492November 8, 2017by sarathksasi3 answers
2 reactions

Insert Text at cursor position inside text

Hi, We are evaluating GrapesJS for one of requirement. As part of the evaluation i am creating custom command 'insert placeholder', what it does is ( what i am planning to do ) is when a select Text and when i click this command , it should insert text at the selected cursor position. Initially i had done this var exi...

mathieuk

Duplicate with #481

sarathksasi

Thanks

edwardjiawei

Similar to what I did in grapesjs-plugin-customrte. But I no propose my code to be based on, at it is mess. You should able to test the code in design,html in my repo. Also can set lower priority for implement el.contentEditable, so that t...

#491November 8, 2017by ryandeba3 answers
3 reactions

Asset Manager replacement

Is it possible to replace the asset manager with something completely different (such as CKFinder - https://ckeditor.com/ckeditor-4/ckfinder/)? Alternatively, would it be possible to launch the included asset manager outside the context of grapesjs?

artf

Well, never tried it before but I think you can achieve it just by replacing the current command This is how the command is called https://github.com/artf/grapesjs/blob/e921165a8d681b5d1056c816f88dd7719d4f61e0/src/dom_components/view/Compo...

ryandeba

Thanks @artf! I was able to get this working very quickly with your suggestion.

lock[bot]

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.

#490November 8, 2017by ryandeba3 answers
0 reactions

Prevent modifying specific image components

I have a use case where I would like to make some specific components completely locked down (i.e. not resizable, not draggable, not copyable, not removable, etc). I have this mostly working, but I'm having a problem with images - I cannot seem to prevent the double-click functionality that opens the asset manager mod...

artf

Yeah, you're right, I use editable only for text components, but what you're asking actually make sense. I'd be happy to accept your PR. You should add editable: true, to the model https://github.com/artf/grapesjs/blob/dev/src/domcomponent...

ryandeba

Thanks @artf! Here's the pull request: https://github.com/artf/grapesjs/pull/496

artf

Merged https://github.com/artf/grapesjs/pull/496 👍

#488November 7, 2017by richieteh943 answers
4 reactions

editor.setComponents auto generate unwanted css

I'm used the html and css editor that mention in #324 . After I edited the html and css it will generate a CSS where I suspect caused by editor.setComponents() Not sure this is a bug or normal behavior. grapesjs version - 0.12.8 grapesjs preset - gjs-preset-newsletter 0.2.15

thecodefish

In my use case I am constantly getting & setting the html/css inside the editor, and what I found is that it would end up duplicating the 'default' styles (see the * and body styles in the image above - they appear twice). I managed to sol...

thecodefish

@chiqui3d I think whenever you need to modify the css from some external source, you'll probably want to reset the css composer first. So if you have something like editor.setStyle(css); in your code, you may need to call editor.CssCompose...

artf

First of all, update your grapesjs version, then be more specific about your changes. What did you change? What do you mean with unwanted css?

#486November 6, 2017by krunal0392 answers
0 reactions

Custom Component not editable and also after traits update canvas does not update

below is code i used for traits and custom section but after adding component via block, cannot edit text or trait update does not update canvas. I have extended 'text', Also I do not get html back when I use editor.html(), Also when I click on image it does not open asset manager. I am sure I must be missing somethin...

artf

In your model, you don't need defining data-gjs-* it's only make sense for importing from HTML, so remove this: and you don't need type: 'section', either. From what I see you should define addType like this You can't edit this because it'...

lock[bot]

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.

#485November 6, 2017by YairHadari2 answers
0 reactions

Translation option

Hi, Is there an option to translate the system? Regards, Yair

artf

Discussed it several times (eg. #26) Next time, try to search before opening a new issue (eg. translation was already enough) thanks

lock[bot]

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.

#484November 5, 2017by roytang3 answers
1 reactions

Can I restrict what blocks that can be dropped into a container

My intent is to create a block that should allow only image components (I'm using the default one from grapes-blocks-basic) to be dropped inside it. I have the following test code: However, when I run the above code, what happens is that I can't drop an image component inside the Image Container. The green drop cursor...

roytang

This fix works. Thanks!

artf

@roytang your code seems ok, probably the problem is just because your component is "too much empty" so the mouse pointer just can't get in. Try to add a little bit of padding and see if it works

roytang

Mmm. I have image-container styled with width and height 100px. Also, removing the droppable property in the extended model allows me to drop text and images inside it.

#482November 3, 2017by krunal0393 answers
0 reactions

Default asset manager in custom component

I am in process to create custom component for below template and we want to have user enter text,link,hover text and select image and want to use default asset manager to select image but not sure how to get selected image in custom component? below is code I have used view: defaultType.view.extend({ init() { this.li...

artf

@krunal039 Why do you need a custom component? Your template seems to be pretty simple, what about just a simple block?

krunal039

@artf thanks for reply, we need user input for hover text, background image and text and hyperlink at bottom and thought to use custom component, but if we can prompt user to enter above then happy to create just block, can you pease guide...

artf

Try to create a block with your template, drag it inside the canvas and you will be able to change all that stuff