react-email-editor icon indicating copy to clipboard operation
react-email-editor copied to clipboard

Cannot read property location of undefined

Open SamratLuintel opened this issue 5 years ago • 6 comments

It works perfectly on development mode. But when I have pushed it to heroku it gives following error(it is coming from editor.js) TypeError: Cannot read property 'location' of undefined at Function.mapToProps (editor.js:formatted:43314) at r (editor.js:formatted:12784) at Function.r.mapToProps (editor.js:formatted:12790) at r (editor.js:formatted:12784) at editor.js:formatted:13038 at Object.run (editor.js:formatted:11949) at o.initSelector (editor.js:formatted:11961) at new o (editor.js:formatted:11888) at constructClassInstance (editor.js:formatted:8912) at beginWork (editor.js:formatted:9021)

SamratLuintel avatar Oct 14 '18 15:10 SamratLuintel

a solution anyone ?

diplodonovan avatar Dec 03 '20 14:12 diplodonovan

Just installed it in vue and gives me this error.

mahfuzdiu avatar Dec 10 '20 10:12 mahfuzdiu

@diplodonovan hey there its working if you change the editorLoaded method to like this instead of en empty json.

editorLoaded() { this.$refs.emailEditor.editor.loadDesign({"counters":{"u_column":1,"u_row":1},"body":{"rows":[{"cells":[1],"columns":[{"contents":[],"values":{"backgroundColor":"","padding":"0px","border":{},"_meta":{"htmlID":"u_column_1","htmlClassNames":"u_column"}}}],"values":{"displayCondition":null,"columns":false,"backgroundColor":"","columnsBackgroundColor":"","backgroundImage":{"url":"","fullWidth":true,"repeat":false,"center":true,"cover":false},"padding":"0px","hideDesktop":false,"hideMobile":false,"noStackMobile":false,"_meta":{"htmlID":"u_row_1","htmlClassNames":"u_row"},"selectable":true,"draggable":true,"duplicatable":true,"deletable":true}}],"values":{"backgroundColor":"#e7e7e7","backgroundImage":{"url":"","fullWidth":true,"repeat":false,"center":true,"cover":false},"contentWidth":"500px","fontFamily":{"label":"Arial","value":"arial,helvetica,sans-serif"},"preheaderText":"","linkStyle":{"body":true,"linkColor":"#0000ee","linkHoverColor":"#0000ee","linkUnderline":true,"linkHoverUnderline":true},"_meta":{"htmlID":"u_body","htmlClassNames":"u_body"}}},"schemaVersion":5}); }

mahfuzdiu avatar Dec 10 '20 10:12 mahfuzdiu

just got it working by first checking if data & editor is loaded first <EmailEditor ref={emailEditorRef} minHeight={800} appearance={{theme: 'dark'}} onLoad={isLoaded ? onLoad(json) : null} // here ternary checking />

and using the onLoad Method with the json template as an argument const onLoad = (design) => { emailEditorRef.current.loadDesign(design) }

diplodonovan avatar Dec 10 '20 10:12 diplodonovan

@diplodonovan shouldn't onLoad get called when the editor is loaded? It seems strange to me that you need to check for that...

fabdrol avatar Apr 11 '21 21:04 fabdrol

@diplodonovan Can you post your full code as I am having the same problem using React class component? Thanks

KevinMull avatar Jul 08 '22 15:07 KevinMull