How to refresh/re-render after new node added?
Optimized TextEditor.vue file: But the problem persist:โ๏ธ span node replaces the previous content of selection, with font-family and color styles.โ span node isn't recognized by GrapesJS, because there isn't GrapesJS auto-generated styles ID and data-gjs-type='text' attribute.โ getHTML and getJSON to save modification...
Read full answer below โQuestion
I manually add a new node into a rendered component. The visual result is OK, but impossible to save, because my style isn't with the auto-generated GrapesJS ID. To manually resolve this poblem, I double-click on the component to enter to it and I click outside in the canvas body. Then, the GrapesJS ID and data-gjs-type='text' are added to the new node, and save is possible. Vue.js: A part of Main.vue file: A part of TextEditor.vue file:
Answers (3)
Optimized TextEditor.vue file: But the problem persist:โ๏ธ span node replaces the previous content of selection, with font-family and color styles.โ span node isn't recognized by GrapesJS, because there isn't GrapesJS auto-generated styles ID and data-gjs-type='text' attribute.โ getHTML and getJSON...
โน๏ธ Don't works directly with HTML, works only with JSON. Component = JSON node (html element + GrapesJS data) Sources:https://grapesjs.com/docs/modules/Components.htmlhttps://grapesjs.com/docs/api/component.html
Thanks for reporting this, @bgrand-ch. Great question about How to refresh/re-render after new node added?. The recommended approach with ProseMirror is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener method Most op...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3599
@keyframes not adding even after i pass the the keyframes object
Hi @artf, I have added the let cc = editor.CssComposer; cc.setRule('.fadetop-animate', { opacity: 0, 'animation-name': 'fadeTop' }, { atRul...
Issue #3406
How to create a custom storage manager, it doesnt set saved data from canvas, after reloading the page
Hello everyone, i want to save data from canvas to redux store, and it works, but after reloading the page, storage load method , doesnt se...
Issue #6458
Sector.setName doesn't work
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://jsfi...
Issue #6365
Style Manager Fails to Interpret Descendant Selectors Correctly
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 131.0.6778.205 Reproducible...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins โPremium plugins ship with support, regular updates, and production-ready features โ save days of integration work.
Browse premium plugins โRelated tutorials
In-depth guides on the same topic.
Tutorial
GrapesJS DevTools: A Developer Panel Inside Your Editor
If you've ever debugged GrapesJS with console.log(editor.getSelected()) and a dozen throwaway event listeners โ this post is for you.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins โ TinyMCE Inline Text Editor and Placeholder.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.