ckeditor / ckeditor5-angular

Official CKEditor 5 Angular 5+ component.
https://ckeditor.com/ckeditor-5
Other
202 stars 111 forks source link

Document how to create a universal component with ckeditor5-angular #270

Open albij-jr opened 3 years ago

albij-jr commented 3 years ago

ReferenceError: window is not defined at Object../node_modules/@ckeditor/ckeditor5-build-classic/build/translations/ar.js (D:\project\angular\project\dist\project\server\main.js:129171:2024) at webpack_require (D:\project\angular\project\dist\project\server\main.js:26:30) at Module../src/app/views/components/modal/add-offer-modal/add-offer-modal.component.ts (D:\project\angular\project\dist\project\server\main.js:405301:113) at webpack_require (D:\project\angular\project\dist\project\server\main.js:26:30) at Module../src/app/app.module.ts (D:\project\angular\project\dist\project\server\main.js:400607:124) at webpack_require (D:\project\angular\project\dist\project\server\main.js:26:30) at Module../src/app/app.server.module.ts (D:\project\angular\project\dist\project\server\main.js:400936:69) at webpack_require (D:\project\angular\project\dist\project\server\main.js:26:30) at Module../src/main.server.ts (D:\project\angular\project\dist\project\server\main.js:411870:80) at __webpack_require__ (D:\project\angular\project\dist\project\server\main.js:26:30)

FilipTokarski commented 3 years ago

Hi, could you describe the problem in detail and provide a step-by-step description to reproduce it?

albij-jr commented 3 years ago

first i installed ckeditor package in angular project the installed angular universal of the following version "@ckeditor/ckeditor5-angular": "^2.0.1", "@ckeditor/ckeditor5-build-classic": "^23.1.0", and when i try to build ssr build i get the following error. The package seems incompatible with ssr. semsaro_bug

Syamhere commented 3 years ago

I had the same issue, Then I added a few updates to the server.ts file as below

`const domino = require('domino'); const fs = require('fs'); const template = fs.readFileSync('dist/aprayzWeb/browser/index.html').toString(); const win = domino.createWindow(template);

global['window'] = win; global['document'] = win.document; global['DOMTokenList'] = win.DOMTokenList; global['Node'] = win.Node; global['Text'] = win.Text; global['HTMLElement'] = win.HTMLElement; global['navigator'] = win.navigator;`

Now the 'window is not defined' issue is cleared instead of that it's showing:

TypeError: Cannot set property 'ckeFiller' of undefined

Any solution for this?

Syamhere commented 3 years ago

This works for me!!! @albij-jr Please check this comment https://github.com/ckeditor/ckeditor5-angular/issues/99#issuecomment-578936859

ma2ciek commented 3 years ago

Hi @Syamhere!

As it's hardly discoverable I'll rename this issue to make sure that it can be found in our dcs.