froala / angular-froala-wysiwyg

Angular 4, 5, 6, 7, 8 and 9 plugin for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
734 stars 201 forks source link

Angular 9 Support #378

Open doroncy opened 4 years ago

doroncy commented 4 years ago

When building a library with Angular 9, I get the following error

Compiling TypeScript sources through ngc
ERROR: node_modules/angular-froala-wysiwyg/editor/editor.module.d.ts:3:23 - error NG6005: FroalaEditorModule.forRoot returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.

looks like the editor ModuleWithProviders does not contain a type definition.

1-0-1 commented 4 years ago

With Angular 9.1 I am getting the following error: ERROR: node_modules/angular-froala-wysiwyg/editor/editor.directive.d.ts:37:18 - error TS2314: Generic type '??FactoryDef' requires 2 type argument(s).

37 static ?fac: ?ngcc0.??FactoryDef;


node_modules/angular-froala-wysiwyg/view/view.directive.d.ts:9:18 - error TS2314
: Generic type '??FactoryDef' requires 2 type argument(s).

9     static ?fac: ?ngcc0.??FactoryDef<FroalaViewDirective>;
d3skdev commented 4 years ago

try to reinstall froala package again

npm install
npm install angular-froala-wysiwyg@latest
ng build --prod --aot
sheshnathverma commented 4 years ago

I have stuck with this error from three months and I'm not able to build my app for production so plz provide update and ETA.

image

blingerson commented 4 years ago

I also ran into the same issue as @sheshnathverma. Both the FroalaEditorModule and FroalaViewModule need the generics added. In addition the FroalaEditorDirective imports Renderer which obviously no longer exists in @angular/core v9.x. I have tried to publish a fork with these three fixes, but IVY still doesn't appear to compile correctly with ngcc as I get the following error after making the above changes:

error NG6002: Appears in the NgModule.imports of FroalaModule, but could not be resolved to an NgModule class.

This likely means that the library (angular-froala-wysiwyg-ivy) which declares FroalaEditorModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

What is the roadmap for Angular 9 / Ivy support for angular-froala-wysiwyg?

You can see my changes which may fix the issue here:

https://github.com/blingerson/angular-froala-wysiwyg/commits/master

ngrunfeld commented 4 years ago

Same Issue here

steve-tapley commented 4 years ago

FYI, version 2.9.8 works fine with Angular 9.1

blingerson commented 4 years ago

@steve-tapley it does not work when IVY is enabled, it only works with angular 9 when IVY is disabled (which is non-default).

The three issues mentioned above prevent it from running with IVY enabled.

steve-tapley commented 4 years ago

@blingerson We are using V2.9.8 in angular 9.1 with Ivy enabled. V2.9.6 and earlier did not support angular 9

blingerson commented 4 years ago

@steve-tapley, v2.9.8 does not compile in our app. The bugs are still in the master branch:

  1. https://github.com/froala/angular-froala-wysiwyg/blob/84d39464509de08c403dfb2a047137b936da355c/src/editor/editor.module.ts#L11 as you can see this will throw a type error because public static forRoot(): ModuleWithProviders { should be public static forRoot(): ModuleWithProviders<FroalaEditorModule> {
  2. https://github.com/froala/angular-froala-wysiwyg/blob/84d39464509de08c403dfb2a047137b936da355c/src/view/view.module.ts#L10 similarly public static forRoot(): ModuleWithProviders { should be public static forRoot(): ModuleWithProviders<FroalaViewModule> { and it is currently throwing a type error.
  3. https://github.com/froala/angular-froala-wysiwyg/blob/84d39464509de08c403dfb2a047137b936da355c/src/editor/editor.directive.ts#L2 this is importing Render which does not exist with IVY. All three fo these issues fail type checking and one completely errors out because when IVY is enabled it cannot import Renderer.

Perhaps you haven't check with the latest angular code? I can assure you that, in my situation, along with others here it definitely does not support angular 9. I got our app working by copying the directives and modules into our codebase and fixing the above issues. We are using angular 9.1.7.

blingerson commented 4 years ago

@steve-tapley you may also want to check with:

import { ɵivyEnabled as ivyEnabled } from '@angular/core';

Many custom webpack configurations seem like ivy is enabled, but this "ivyEnabled" flag ends up being false. It should be true in both development and production mode. You may want to give it a sanity check to make sure it is truly enabled in your testcase.

blingerson commented 4 years ago

@steve-tapley I have created a pull request with the pertinent changes:

https://github.com/froala/angular-froala-wysiwyg/pull/400

It is very possible that since we and others here are using custom webpack configurations that these issues could be due to different tsconfig or webpack loaders. Please consider this pull request to alleviate those issues in the cases where people are having issues. Thanks.

pxcT commented 4 years ago

Any updates about this ?

blingerson commented 4 years ago

It would be great to get the fixes in so we can remove our hacks and get this working with Angular 9. Is there anything I can do to help facilitate getting my pull request merged in?

vdsheryarshirazi commented 3 years ago

any update on this?

blingerson commented 3 years ago

Sorry for not circling back on this sooner, but I just removed my hack and installed v3.2.3 which has my pull request I believe. All is working fine and this issue seems like it can be closed. Thanks!

DoanVanThuong commented 1 year ago

any update on this, i getting this error in angular 11 "angular-froala-wysiwyg": "^2.8.1",