BUG: Possible upgrade path issue where 'textnode' is now called 'wrapper' from 0.18 -> latest
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?
- Save component data from an earlier version of grapejs (0.18)
- 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 (1)
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #4323
BUG: Performance issue while dragging component to canvas when you have 2k component on canvas
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Google Chrome Version 101.0.4951.41 (Officia...
Issue #4752
BUG: Component with pointer-events: 'all' (except wrapper) or editable component are draggable & droppable to itself.
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome 107.0.5304.121 (Official Build) (arm6...
Issue #5689
BUG: <> is introduced at the beginning editor.getHtml()
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome Version 121.0.6167.185 (Official Buil...
Issue #4449
BUG: Lists not working with default RTE
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 102.0.5005.115 (Official Bu...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.