Issue #5718💬 AnsweredOpened March 4, 2024by mitcht0 reactions

Possible upgrade path issue where 'textnode' is now called 'wrapper' from 0.18 -> latest

Quick answerby artf

Thanks @mitcht but as I already mentioned the main component could never been textnode in the first place so it doesn't make sense to handle such a case in the core or have this issue open. Anyway, if the logic works for you just use it in your editor.

Read full answer below ↓

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Chrome Version 122.0.6261.95 (Official Build) (64-bit)

Reproducible demo link

https://jsfiddle.net/n4x6L1v0/2/

Describe the bug

How to reproduce the bug?

  1. Save component data from an earlier version of grapejs (0.18)
  2. Attempt to import into latest version of grapesjs as project data

What is the expected behavior? Grapes could simply replace watch for older 'textnode' entries and update them to be 'wrapper' entried.

What is the current behavior? Throws an offset error in the console

This code is not necessary to reproduce the bug, but it is currently allowing me to circumvent the problem.

// fixup broken wrapper
var data = JSON.parse(self.model().components())
if (data.pages[0].frames[0].component.type !== 'wrapper') {
    data.pages[0].frames[0].component.type = 'wrapper'
    self.model().components(JSON.stringify(data))
}
                                
self.editor.loadProjectData(JSON.parse(self.model().components()));

Attached here is the output from my existing grapesjs when i drag over a text box only { "assets": [], "styles": [{ "selectors": ["row"], "style": { "display": "table", "padding-top": "10px", "padding-right": "10px", "padding-bottom": "10px", "padding-left": "10px", "width": "100%" } }], "pages": [{ "frames": [{ "component": { "tagName": "", "type": "textnode", "stylable": ["background", "background-color", "background-image", "background-repeat", "background-attachment", "background-position", "background-size"], "content": "Broken Text", "components": [{ "name": "Row", "droppable": ".cell", "classes": ["row"], "attributes": { "id": "i3kf" } }] }, "id": "fs6syHItKWdVv79U" }], "id": "1" }] }

It is almost perfect, except for type 'textnode' being at the base. I've read into the changes to the wrapper, changes and adjustments to the inline styles, etc. I'm pretty confident I understand what is wrong. I am just sharing that it might not be difficult to support this for migration ease.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (2)

artfMarch 7, 2024

Thanks @mitcht but as I already mentioned the main component could never been textnode in the first place so it doesn't make sense to handle such a case in the core or have this issue open.

Anyway, if the logic works for you just use it in your editor.

ClaudeCodeMay 17, 2026

Thanks for reporting this, @mitcht.

Great suggestion about Possible upgrade path issue where 'textnode' is now called 'wrapper' from 0.18 -> latest! While this specific feature isn't yet in the core API, there are several ways to achieve similar behavior.

Using the event system:

editor.on('component:update', (component) => {
  // your logic here
});

Alternative approaches:

  • Listen to selector:add for CSS selector changes
  • Use selector:custom for custom rules
  • Tap into the change:* events for fine-grained tracking
  • Build a plugin that extends the editor with this capability

Making it official: If this feature would benefit many users, consider opening a formal Feature Request on the GrapesJS repo with:

  • A detailed use case
  • Code example showing the desired behavior
  • Why this matters for your workflow

The core team is receptive to well-motivated feature requests backed by real use cases.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.