2

Hi guys when enabling locker service I get this error, I am using the tinyMCE plugin?

auraError": -{ "name": "TypeError", "message": "Uncaught Action failed: c$EmailEditor$controller$afterScriptsLoaded [Cannot read property 'open' of undefined]\nthrows at https://totaljobsgroup--xforce1.lightning.force.com/auraFW/javascript/vR3RI4HaFe6ZgUzebBGZ9A/aura_proddebug.js:17535:7", "$stackTrace$": " at B.initContentBody (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:19706)\n at B.init (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:19505)\n at n. (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:14550)\n at Array. (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:5:11083)\n at n (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:4:1351)\n at p (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:5:11060)\n at n.loadScripts (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:5:11112)\n at n.loadQueue (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:5:10759)\n at t (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:14516)\n at B.render (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:15817)", "severity": "ALERT", "$component$": "c$EmailEditor$controller$afterScriptsLoaded", "action": null, "id": "52326a7a-c4c1-4a24-91fa-d4264c9fb217", "stackTrace": " at B.initContentBody (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:19706)\n at B.init (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:19505)\n at n. (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:14550)\n at Array. (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:5:11083)\n at n (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:4:1351)\n at p (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:5:11060)\n at n.loadScripts (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:5:11112)\n at n.loadQueue (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:5:10759)\n at t (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:14516)\n at B.render (/resource/1477776332000/TinyMCE/tinymce/tinymce.min.js:12:15817)", "handled": true, "reported": true, "data": null

2 Answers 2

3

I believe that TinyMCE like CKEditor is neither strict mode nor CSP unsafe inline/eval compliant. Salesforce itself is itself switching to Quil - a modern rich text editor that is strict mode and CSP compliant. The next major version of CKEditor (5.x) is also strict mode and CSP compliant but it's in an alpha state last I looked.

Is there a reason you cannot use the built in rich text components?

1
  • ... what is the object with the .open() method expected to be instead of null? Is it a reference to "this" in a an unbound function call (evaluates to undefined in strict mode)? Commented Oct 29, 2016 at 22:41
0

Sorry I have use case to make a custom email html editor, this is primary used when reps want to select an html template but want to edit the template before sending.

Also the ability to copy and paste images, I have a proof of concept done using visualforce using tinymce, which works really well even when pasting images it will host them in sfdc.

Not sure about the error need to dig up the src file for tinyMce

4
  • I am actually taliknig about an issue you have not even hit yet that is a "laws of physics" deal breaker github.com/tinymce/tinymce/issues/1901 . I would recommend either using ui:inputRichText or quilljs.com Commented Oct 30, 2016 at 11:06
  • 1
    You can of course use the Visualforce page in an iframe inside a lightning component that you interact with via window.postMessage/onmessage as a viable option. Commented Oct 30, 2016 at 11:46
  • Hi I am trying the suggestion i.e. using vf page, which has tinymce. But when i try to post message with locker service enabled it does not work? onDoneRendering :function() { var editor = document.getElementById("editor").contentWindow; editor.postMessage({status: "hello world"}, "*"); console.log(editor); }
    – lodoss118
    Commented Nov 2, 2016 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .