Cannot drag drop in mobile screen even add grapejs-touch
screencast-www.lovepoptestsite.com-2023.06.01-001711.webm This is video of bug
Read full answer below ↓Question
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Chrome, IOS
Reproducible demo link
https://www.lovepoptestsite.com/products/disney-s-hocus-pocus-black-flame-candle-pop-up-card?variant=40356218077273&preview_link=124907487321 password: ilovecards
Describe the bug
How to reproduce the bug? I tried to drag and drop in mobile screen with grapejs editor alone everything is fine. But when i tried to do it after inject editor to test store it's not working as expected.
What is the expected behavior? ... It should allow drag and drop components
What is the current behavior? ... It's only grey out component and cannot drag
If is necessary to execute some code in order to reproduce the bug, paste it here below:
const editor = grapesjs.init({
container: editorId ? `#${editorId} #gjs` : `#editor_container #gjs`,
height: editorHeight,
width: editorWidth,
avoidInlineStyle: true,
fromElement: true,
canvasCss: 'border-radius: 50px',
noticeOnUnload: false,
selectorManager: {
componentFirst: true,
},
storageManager: {
type: 'remote',
autosave: true,
autoload: false,
stepsBeforeSave: 3
},
colorPicker: {
appendTo: 'parent',
offset: { top: 26, left: -166, },
},
panels: {
defaults: [
// {
// buttons: [
// {
// id: 'myNewButton',
// className: 'fa-solid fa-eraser',
// command: 'Clear',
// attributes: {
// title: 'Some title',
// },
// active: false,
// }
// ]
// }
],
},
commands: {
// defaults: [
// {
// id: 'Clear',
// async run() {
// await editor.load({});
// },
// }
// ],
},
plugins: [plugin, grapesjsTouch],
richTextEditor: {
actions: ['bold', 'italic', 'underline', 'strikethrough']
},
styleManager: {
appendTo: editorId ? `#${editorId} .styles-container` : '.styles-container',
sectors: []
},
blockManager: {
appendTo: editorId ? `#${editorId} #blocks` : '#blocks',
blocks: []
}
});
editor.Storage.add('remote', {
load: handleLoad,
store: handleStore
});
const updateStyleManager = (model) => {
const typoStyleElement: any = document.querySelector('.gjs-sm-sector__typography');
if (model.attributes.type !== 'text') {
typoStyleElement.style.display = 'none';
} else {
typoStyleElement.style.display = 'block';
}
editor.refresh();
}
// Triggers on component change
editor.on('component:selected', updateStyleManager);
(editor.Blocks.getCategories() as any).forEach(x => {
x.on('change:open', (e) => {
// editor.DomComponents.clear();
// editor.setStyle([{}])
editor.refresh();
})
});
(editor.StyleManager.getSectors() as any).forEach(x => {
x.on('change:open', (e) => {
editor.refresh();
})
});
editor.on("load", () => {
if (card && card.id > 0) {
editor.load({});
}
const categories = editor.BlockManager.getCategories();
(categories as any).each(category => {
category.set('open', false).on('change:open', opened => {
opened.get('open') && (categories as any).each(category => {
category !== opened && category.set('open', false)
})
})
})
});
// editor.on('change:changesCount', (e) => {
// var count = editor.getDirtyCount();
// });
setEditor(editor);
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (3)
screencast-www.lovepoptestsite.com-2023.06.01-00_17_11.webm
This is video of bug
I see the touch plugin works properly, ensure to have the mobile device enabled on load (eg. not simulated post load) so the polyfill could be loaded properly.
Thanks for reporting this, @loclovepop.
Great suggestion about Cannot drag drop in mobile screen even add grapejs-touch! 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:addfor CSS selector changes - Use
selector:customfor 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.
Issue #4503
Missing inline styles used by CKEditor when adding raw html components
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chromium v96 Reproducible demo link https:...
Issue #6674
Anchor links with hash navigation don't work in preview mode
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 143.0.7499.41 Reproducible demo lin...
Issue #5718
Possible upgrade path issue where 'textnode' is now called 'wrapper' from 0.18 -> latest
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 122.0.6261.95 (Official Bui...
Issue #4225
BUG : The facebook plugin is not working in the grapes js
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome v9Reproducible demo link Not thereDes...
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 →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.