ckeditor5-angular icon indicating copy to clipboard operation
ckeditor5-angular copied to clipboard

Document how to create a universal component with ckeditor5-angular

Open albij-jr opened this issue 4 years ago • 5 comments

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)

albij-jr avatar Aug 01 '21 07:08 albij-jr

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

FilipTokarski avatar Aug 02 '21 07:08 FilipTokarski

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

albij-jr avatar Aug 02 '21 07:08 albij-jr

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 avatar Sep 09 '21 17:09 Syamhere

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

Syamhere avatar Sep 10 '21 14:09 Syamhere

Hi @Syamhere!

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

ma2ciek avatar Sep 12 '21 15:09 ma2ciek