GrapesJS Issues

3,464 parsed GitHub issues โ€” 370 solved ยท 90 open. Search, filter and explore battle-tested answers.

569 issues found

๐Ÿ” canvas
#3405April 20, 2021by chrisijoyah4 answers
0 reactions

FEAT: An event to hook into before a block in dropped into the canvas

WARNING READ and FOLLOW next 3 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grapesjs/blob/master/CONTRIBUTING.mdDo a quick SEARCH first, to see if someone else didn't open the same issueAll relative statements/questions have to be filled/answered, otherwise, th...

artf

Hi @chrisijoyah did you try using canvas:dragdata? Here an example of usage https://jsfiddle.net/artur_arseniev/87rcb24n/

chrisijoyah

Hi @chrisijoyah did you try using canvas:dragdata? Here an example of usage https://jsfiddle.net/artur_arseniev/87rcb24n/ Does this mean I can prevent the dropped model from being added to the Canvas. Ideally I want to carry out some check...

artf

Can I do something like result.content= '' Yeah, you should be able to do that with that trick. Can you tell me more about your use case, what kind of check are you trying to perform?

#3390April 6, 2021by christosapos2 answers
0 reactions

Change checked trait of checkbox component with click inside component.

Is it possible to change 'checked' trait of checkbox component simple by clicking on component inside canvas?

artf

Yeah sure, the trait reads the value from the component model, so if you change the binded value, the trait should change

ClaudeCode

Thanks for reporting this, @christosapos. Great question about Change checked trait of checkbox component with click inside component.. The recommended approach with Canvas is to use the event-driven API. Start here: Check the GrapesJS doc...

#3374March 31, 2021by FacuCarbon2 answers
1 reactions

images and videos are not focused

Hello, I have a problem which is that when adding a video or an image to the canvas, it is not centered, but to the left. With the help of the panel I set the alignment but it does not center it either.

Ju99ernaut

Try placing it inside a container, you can probably centre it using something like flexbox.

ClaudeCode

Thanks for reporting this, @FacuCarbon. Thanks for sharing your report about images and videos are not focused. To help the team investigate and prioritize this: Please provide: A minimal reproducible example (CodeSandbox/JSFiddle) Your Gr...

#3342March 17, 2021by RutujaBadbe2 answers
0 reactions

jQuery not working for script in component

Hi! I have tried adding jquery in canvas as well as in index.html I am adding it in canvas like this- canvas = editor.Canvas; const script1 = document.createElement('script'); script1.src = 'https://code.jquery.com/jquery-3.6.0.min.js'; canvas.getDocument().head.appendChild(script1); and in html page I have added it a...

artf

Here you can see how to load dependencies properly https://grapesjs.com/docs/modules/Components-js.html#template-related

ClaudeCode

Thanks for reporting this, @RutujaBadbe. The error ReferenceError: $ is not defined occurs when Canvas attempts to access properties before the component lifecycle is fully initialized. This is a common race condition in GrapesJS. Immediat...

#3337March 12, 2021by wfcheng4 answers
0 reactions

Question: Use arrow keys to move blocks in canvas configured in absolute positioning mode

Hi, I am building a solution for students to tell their high school experiences as slides built from grapejs editor (similar to canva), and have configured the editor in 'absolute' mode, which works wonderfully. However I can't seem to find a way to move the dropped block in the editor with the arrow keys. I am aware...

artf

No, unfortunately, for such a case, the custom keymap would be the only solution. You should just get the selected component and update its style.

michaelhofer

I have found a working solution for this as follows: The commands are being added as follows: The moveSelectedElements method just does the following: However, when moving the elements with arrow keys, the canvas scrolls as well, which is...

sathudeva7

keymaps.add('ns:my-keymap', 'โŒ˜+s, ctrl+s', 'some-gjs-command', { // Prevent the default browser action prevent: true, });

#3334March 11, 2021by KernelDeimos2 answers
0 reactions

Attempts to load scripts to canvas maybe breaks javascript??

Version: 0.16.44 Are you able to reproduce the bug from the demo? [ ] Yes [x] No What is the expected behavior? Legit anything else Describe the bug detailed I was attempting to load scripts into the canvas. My first attempt was scripts: [] and then I ran into the synchronization issue mentioned in this PR's thread: h...

KernelDeimos

I haven't used inline <script> tags in a while and forgot about this caveat of the HTML parser. Closing this.

ClaudeCode

Thanks for reporting this, @KernelDeimos. The issue with Attempts to load scripts to canvas maybe breaks javascript?? appears to be a race condition or state management timing problem. This typically happens when component lifecycle events...

#3326March 9, 2021by devtechk3 answers
2 reactions

canvas style css

Hi guys instead of styling in the init in this way... it's possibile to use a scss file in canvas? canvas { style:['FILE.SCSS'] } or simple make it cleaner with a single init css? Thank you! myComponent.append(<style> body { background: rgb(204,204,204); } .footer { position: absolute; bottom: 5mm; width: auto; left:...

artf

You can use canvasCSS option if you don't want to use files.

devtechk

Thank you very much! This config file is gonna help me a lot!

ClaudeCode

Thanks for reporting this, @devtechk. Great question about canvas style css. The recommended approach with StyleManager is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on()...

#3319March 5, 2021by anatoli-dp3 answers
0 reactions

layers text does not center after creating a new line

Version: current? You can get the version by typing grapesjs.version into the console Are you able to reproduce the bug from the demo? [ ] Yes [ x] No // to be fair never tried in the demo What is the expected behavior? when editing the layers text and adding a new line then backspacing i would expect the edited text...

artf

Ok, I'll push a fix for the editing of layers name, probably it doesn't make sense having new lines enabled there (I'll make stop the editing on Enter/Esc). For the second issue, If you're using something yours to resize the canvas, probab...

anatoli-dp

yeah I didn't realize editor.refresh() was a thing until after. otherwise thanks. awesome project

ClaudeCode

Thanks for reporting this, @anatoli-dp. Great question about layers text does not center after creating a new line. The recommended approach with Canvas is to use the event-driven API. Start here: Check the GrapesJS documentation for your...

#3310March 5, 2021by Andrew-Chen-Wang3 answers
3 reactions

Tablet and mobile view not resizing

Version: The one in the demo Are you able to reproduce the bug from the demo? [X] Yes [ ] No What is the expected behavior? Mobile and tablet view should resize the canvas when window resizes. Describe the bug detailed The desktop view properly resizes the canvas when resizing the window What is the current behavior?...

Ju99ernaut

The mobile and tablet devices are pixel pased, so they just resize the canvas to a certain number of pixels regardless of window size. I believe desktop just sets canvas to 100%.

artf

As mentioned by @Ju99ernaut this is how devices work. Honestly, I don't even see the reason behind such a case, why the user should resize the window? You might also start to see/update styles not related to the proper device and that woul...

ClaudeCode

Thanks for reporting this, @Andrew-Chen-Wang. The issue with Tablet and mobile view not resizing appears to be a race condition or state management timing problem. This typically happens when component lifecycle events and DOM modification...

#3305March 3, 2021by RaresVlaiduc3 answers
11 reactions

(v0.16.41) Button not set as active on click

Version: v0.16.41 Are you able to reproduce the bug from the demo? [ ] Yes [x] No What is the expected behavior? When I click on a button, the gjs-pn-active class should be added. Describe the bug detailed I have 3 buttons for 3 different devices (desktop, tablet and mobile). I have them on a top panel and when I clic...

Ju99ernaut

Grapesjs requires your commands to have the run and stop functions for them to toggle panel buttons automatically, so maybe that might be the issue:

kerryj89

@Ju99ernaut Thank you for that. Active state is now working for me when creating devices-c panel through grapesjs.init().

ClaudeCode

Thanks for reporting this, @RaresVlaiduc. The issue with (v0.16.41) Button not set as active on click appears to be a race condition or state management timing problem. This typically happens when component lifecycle events and DOM modific...