Open Palash-Mandal opened 1 year ago
Better late than never. Check out my pull request. I've found that refactoring these older grapesJS plugins isn't that hard. Too bad the developer of GrapesJS doesn't include backward compatiblity.
@mitcht i have tried your pull request but it still doesn't work.
Below is the error I am getting
Uncaught TypeError: Cannot set property defaults of #<o> which has only a getter at grapes.min.js:2:355393 at Module.Vt (grapes.min.js:2:355609) at Function.q [as extend] (grapes.min.js:2:30147) at d (grapesjs-accordion.min.js:2:2579) at h (grapesjs-accordion.min.js:2:8639) at e.default (grapesjs-accordion.min.js:2:11793) at grapes.min.js:2:989344 at Array.forEach (<anonymous>) at Object.init (grapes.min.js:2:989283) at architecture-development/:179:24
I am using grapesjs version 0.21.11
Hello @Anubhav Thanks to nice plugin.
Right now I have faced issue after upgrading grapesjs to v0.20.1 the current on. Can you please help to solve the issue in where I have made the modification run the plugin again.
`
AccordionContent.js
`export default (dc, { defaultModel, ...config }) => { const type = "accordion-content"; const attrKey = config.attrAccordionContent; const classKey = config.classAccordionContent;
dc.addType(type, { isComponent(el) { if (el.hasAttribute && el.hasAttribute(attrKey)) { return { type }; } }, model: { defaults: { ...defaultModel.prototype.defaults, name: "Accordion Content", draggable:
[${config.attrAccordionContainer}]
, copyable: false, removable: false, selectable: true, ...config.accordionContentProps, },}); }; `
AccordionContainer.js
`export default (dc, { defaultModel, ...config }) => { const type = "accordion-container"; const attrAccordions = config.attrAccordions; const attrKey = config.attrAccordionContainer; const classKey = config.classAccordionContainer; const attrAccordionContent = config.attrAccordionContent; const selectorAccordion = config.selectorAccordion;
dc.addType(type, { isComponent(el) { if (el.hasAttribute && el.hasAttribute(attrKey)) { return { type }; } }, model: { defaults: { ...defaultModel.prototype.defaults, name: "Accordion Container", draggable:
[${attrAccordions}, ${attrAccordionContent}]
, droppable: false, copyable: true, removable: true, ...config.accordionContainerProps, },}); }; `
Accordion.js
`export default (dc, { defaultModel, ...config }) => { const type = "accordion"; const attrKey = config.attrAccordion; const classKey = config.classAccordion; const selectorAccordion = config.selectorAccordion;
dc.addType(type, { isComponent(el) { if (el.hasAttribute && el.hasAttribute(attrKey)) { return { type }; } },
}); }; `