tinymce / tinymce-angular

Official TinyMCE Angular Component
MIT License
330 stars 92 forks source link

Uncaught Reference Error: tinymce is not defined #87

Closed bhaidar closed 5 years ago

bhaidar commented 5 years ago

What is the current behavior? I am using this component in an Angular CLI project. When running ng test I am getting these errors:

 "str": "Uncaught ReferenceError: tinymce is not defined\nat
http://localhost:9876/_karma_webpack_/vendor.js:215043:51\n\nReferenceError: tinymce
is not defined\n    at http://localhost:9876/_karma_webpack_/vendor.js:215043:51\n  
at Object.../../../node_modules/tinymce/plugins/autoresize/plugin.js
(http://localhost:9876/_karma_webpack_/vendor.js:215375:3)\n    at
__webpack_require__ (http://localhost:9876/_karma_webpack_/main.js:79:30)\n    at
Object.../../../node_modules/tinymce/plugins/autoresize/index.js
(http://localhost:9876/_karma_webpack_/vendor.js:214914:1)\n    at
__webpack_require__ (http://localhost:9876/_karma_webpack_/main.js:79:30)\n    at
Object../src/lib/components/admin-wysiwyg/admin-wysiwyg.component.ts
(http://localhost:9876/_karma_webpack_/main.js:7461:1)\n    at __webpack_require__
(http://localhost:9876/_karma_webpack_/main.js:79:30)\n    at
Object../src/lib/admin-ui.module.ts
(http://localhost:9876/_karma_webpack_/main.js:4320:33)\n    at __webpack_require__
(http://localhost:9876/_karma_webpack_/main.js:79:30)\n    at
Object../src/lib/admin-ui.module.spec.ts
(http://localhost:9876/_karma_webpack_/main.js:4253:25)"

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or tinymce-angular?

"@tinymce/tinymce-angular": "^2.3.2",
"tinymce": "4.7.4",
SimonFc commented 5 years ago

Hi @bhaidar, are you loading Tiny properly in your tests? If you have a karma config file you should be able to do it similarly to how it's done here

Since you're using Tiny4 the themes part should load one of the Tiny4 themes(inline/mobile/modern) and the skins part should load lightgray. Let me know if you got any questions!

bhaidar commented 5 years ago

Thanks @SimonFc

In fact, I've created an ngx-formly wrapper around tinymce and I am using this wrapper component in multiple places and in multiple libs.

I will go over all the libs and add the files section.

Thanks again