GrapesJS Issues

3,464 parsed GitHub issues 370 solved · 90 open. Search, filter and explore battle-tested answers.

466 issues found

🔍 components
#3326Mar 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!

GJSBlock

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()...

#3325Mar 9, 2021by mmotov4 answers
0 reactions

JSON.stringify(this.editor.getComponents()) Error

Version: 0.16.44 Hi there! I have remote storage for pages, and recently I faced an issue when saving page, JSON.stringify(editor.getComponents()) started to throw error Uncaught TypeError: e[M].getId is not a function. I investigated the already saved JSON representation of the page and found out that it fails on thi...

yucomds

Same error here ... do you have a solution? [EDIT] Downgrading seems to be the only solution for now

josfh2005

Same problem here, if I preprocess the components and remove that attribute (__symbol) before load the Editor the template works fine. Is the a way @artf to disable the symbols for now?

artf

Yeah unfortunately the previous version of grapesjs had a bug that created symbols involuntary. In the current version, the bug is fixed and symbols are disabled, but unfortunately, this still happens if you try to load a component with a...

#3322Mar 7, 2021by Andrew-Chen-Wang1 answer
0 reactions

How to update built-in component's traits?

nvm You have to put component overriding in the plugins.

GJSBlock

Thanks for reporting this, @Andrew-Chen-Wang. Great question about How to update built-in component's traits?. The recommended approach with Components is to use the event-driven API. Start here: Check the GrapesJS documentation for your s...

#3317Mar 5, 2021by martijnc3 answers
0 reactions

Add support for promises to custom RTE API

What are you trying to add to GrapesJS? Support for richtext editors with promise based APIs. Describe your feature request detailed CKEditor5's Editor.create and Editor.destroy methods return a Promise that resolves when the editor has been fully created or destroyed. This causes an issue when destroying the editor (...

artf

Yeah, makes sense, probably I'd try to check if it's possible to make enable/disable methods (from ComponentTextView) async by default without breaking stuff, but checking if are thennable is always an option.

artf

This should be already possible.

GJSBlock

Thanks for reporting this, @martijnc. Great suggestion about FEAT: Add support for promises to custom RTE API! While this specific feature isn't yet in the core API, there are several ways to achieve similar behavior. Using the event syste...

#3316Mar 5, 2021by am1rb4 answers
1 reactions

The editor does not remove the dead script blocks

Version: 0.16.34 Are you able to reproduce the bug from the demo? [ ] Yes [x ] No As I understand the code import dialog skips all the HTML scripts, so I can not reproduce the issue on the demo What is the expected behavior? The editor must remove dead script blocks before appending a new script block at the end of th...

Ju99ernaut

I'm unable to reproduce this, maybe you can provide more information on the custom component itself, anyway I suspect this is a storage related issue. Are you storing then loading pages from the generated html?

Andrew-Chen-Wang

Typically inline scripts go in the body at the bottom. Try putting it there maybe?

am1rb

I do not append anything by myself. The editor appends the scripts related to my components in a new script tag at the end of the generated HTML. Please take a look at this file: https://github.com/artf/grapesjs/blob/dev/src/editor/model/E...

#3309Mar 4, 2021by jcamejo4 answers
0 reactions

TextNodes interfere when changing content on element

Version: 0.16.44 Hi @artf I have a custom block with a custom button component, which its content is similar to this one. <a data-gjs-type="custom_button" class="btn btn-1" href="">Click here</a> Additionally, I've added a text trait to change the button content, in this particular case I do not want to use the editor...

artf

Hi Juan, thanks for the report, are you able to show me how your text trait works? I'd expect it to work correctly if you update your component in this way component.components(e.target.value)

jcamejo

This was my trait I have changed it to And now it works without overriding update content or render children, thanks! I would have never arrived to the conclusion of using the components method. Now i don't like text nodes 😅 I think we ca...

artf

I don't think you need this one target.set('content', value);. For the rest all good 👍

#3298Mar 1, 2021by neon123452 answers
1 reactions

Hide component labels while editing text

For text placed at the top of the page, component labels can overlap and hide the text while editing. Also the label can overlap the text editing tools when not at the top. Hiding the labels while editing text would avoid this.

RutujaBadbe

You can hide the labels using badgable : false https://grapesjs.com/docs/api/components.html#parameters-3

GJSBlock

Thanks for reporting this, @neon12345. Thanks for sharing your report about FEAT: hide component labels while editing text. To help the team investigate and prioritize this: Please provide: A minimal reproducible example (CodeSandbox/JSFid...

#3295Mar 1, 2021by marcepoblet4 answers
0 reactions

BUG (v0.16.41): Button component with draggable property is not working properly

Version: v0.16.41 Are you able to reproduce the bug from the demo? [ ] Yes [ ] No What is the expected behavior? When we have a button with the property data-gjs-draggable in false, this button not should be dragged in the canvas. Describe the bug detailed StepsSet a button component with draggable property in falseDr...

artf

I guess you're doing something wrong, how do you create those components and their properties?? You shouldn't even see those attributes in the inspector.

marcepoblet

@artf In our codes we have not changed anything. The only difference is that we update the GrapesJs version. Before I had version v0.16.18 and it worked correctly, but now we update GrapesJs to v0.16.41 and it doesn't work for buttons.

marcepoblet

we set the properties with this: editor.getSelected().attributes.attributes["data-gjs-editable"] = 'false' editor.getSelected().attributes.attributes["data-gjs-copyable"] = 'false' editor.getSelected().attributes.attributes["data-gjs-dropp...

#3292Feb 26, 2021by sudiptochoudhury3 answers
1 reactions

Is there a event per component before save which the component can listen to?

Much grateful to you for this library. Background: I am building an editor where I intend to define most of the components from an existing set of Vuejs components which I have developed earlier and use in my applications. Most of these are UI based simple and complex components. For example, I have simple vuejs compo...

Ju99ernaut

I'm not sure if such hooks exist per component but you can try to take advantage to the toHtml property of a component. It's already been discussed elsewhere so you search it in the issues as there are quite a few.

artf

Yeap, you can define your components with a custom toHTML/toJSON function (in model), in order to customize their output

GJSBlock

Thanks for reporting this, @sudiptochoudhury. The issue with Is there a event per component before save which the component can listen to? appears to be a race condition or state management timing problem. This typically happens when compo...

#3289Feb 23, 2021by bgrand-ch4 answers
2 reactions

Components have lost their styles

Version: 0.16.41 Are you able to reproduce the bug from the demo? [X] Yes [ ] No What is the expected behavior? 1) Copy selected parent component (container) to the clipboard. 2) Paste selected parent component (container) from the clipboard (into the same page or an other page). 3) All components keep ID styles and i...

artf

That because you've updated original commands with your versions (incorrectly). Indeed, if I remove your plugin from the demo everything works as expected. Please check the original copy and paste command, you should clone components befor...

artf

Just check the original commands https://github.com/artf/grapesjs/blob/dev/src/commands/view/CopyComponent.js https://github.com/artf/grapesjs/blob/dev/src/commands/view/PasteComponent.js

bgrand-ch

@artf Thanks for your answer. A link or an example or more explanations please? 😅

Browse all topics