angular-froala-wysiwyg icon indicating copy to clipboard operation
angular-froala-wysiwyg copied to clipboard

Angular 9 Support

Open doroncy opened this issue 5 years ago • 16 comments

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.

doroncy avatar Feb 16 '20 13:02 doroncy

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<FroalaEditorDirective>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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>;

1-0-1 avatar Mar 27 '20 16:03 1-0-1

try to reinstall froala package again

npm install
npm install angular-froala-wysiwyg@latest
ng build --prod --aot

d3skdev avatar Apr 05 '20 09:04 d3skdev

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

sheshnathverma avatar May 02 '20 17:05 sheshnathverma

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

blingerson avatar Jun 03 '20 02:06 blingerson

Same Issue here

ngrunfeld avatar Jun 04 '20 13:06 ngrunfeld

FYI, version 2.9.8 works fine with Angular 9.1

steve-tapley avatar Jun 04 '20 23:06 steve-tapley

@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.

blingerson avatar Jun 05 '20 23:06 blingerson

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

steve-tapley avatar Jun 06 '20 06:06 steve-tapley

@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 avatar Jun 07 '20 02:06 blingerson

@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 avatar Jun 07 '20 02:06 blingerson

@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.

blingerson avatar Jun 07 '20 02:06 blingerson

Any updates about this ?

pxcT avatar Jul 22 '20 10:07 pxcT

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?

blingerson avatar Jul 22 '20 20:07 blingerson

any update on this?

vdsheryarshirazi avatar Dec 02 '20 08:12 vdsheryarshirazi

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!

blingerson avatar Dec 07 '20 21:12 blingerson

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

DoanVanThuong avatar Jul 09 '23 11:07 DoanVanThuong