Skip to content

Commit 0aa5d93

Browse files
INT-3378: Support Angular v21 (#442)
* INT-3381: Support Angular v21 * Update readme * Only update moduleresolution for storybook * Add ngzone detection to fix tests as angular v21 is zoneless * Fix storybook and project builds * Update readme * Correct the target version of not yet zoneless heading
1 parent fd562c7 commit 0aa5d93

7 files changed

Lines changed: 1095 additions & 1121 deletions

File tree

.storybook/tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// ERROR in @ephox/sugar/lib/main/ts/ephox/sugar/api/dom/Replication.d.ts
88
"skipLibCheck": true,
99
"types": ["node"],
10+
"moduleResolution": "bundler",
11+
"module": "ES2022",
1012
"allowSyntheticDefaultImports": true,
1113
"resolveJsonModule": true,
1214
"target": "ES2022"

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,31 @@ This package is a thin wrapper around [TinyMCE](https://github.com/tinymce/tinym
1313

1414
|Angular version|`tinymce-angular` version|
1515
|--- |--- |
16-
|>=16.x <=20.x |8+ |
16+
|>=16.x <=21.x |8+ |
1717
|14+ |7.x |
1818
|13+ |6.x |
1919
|9+ |4.x |
2020
|<= 8 |3.x |
2121
|< 5 | Not supported |
2222

23+
### Not yet Zoneless ( >=Angular v20.2 )
24+
* This integration still requires `zone.js` to ensure backward compatibility to older Angular versions. Therefore, your application will need to include `provideZoneDetection()` its providers like below:
25+
26+
```jsx
27+
import { NgModule, provideZoneChangeDetection } from '@angular/core';
28+
29+
@NgModule({
30+
declarations: [
31+
// ...
32+
],
33+
imports: [
34+
// ...
35+
],
36+
providers: [ provideZoneChangeDetection() ],
37+
bootstrap: [ AppComponent ]
38+
})
39+
```
40+
2341
### Issues
2442

2543
Have you found an issue with tinymce-angular or do you have a feature request?

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
},
1616
"private": true,
1717
"devDependencies": {
18-
"@angular-devkit/build-angular": "^20",
19-
"@angular-devkit/core": "^20",
20-
"@angular/animations": "^20",
21-
"@angular/cdk": "^20",
22-
"@angular/cli": "^20",
23-
"@angular/common": "^20",
24-
"@angular/compiler": "^20",
25-
"@angular/compiler-cli": "^20",
26-
"@angular/core": "^20",
27-
"@angular/forms": "^20",
28-
"@angular/language-service": "^20",
29-
"@angular/material": "^20",
30-
"@angular/platform-browser": "^20",
18+
"@angular-devkit/build-angular": "^21.0.5",
19+
"@angular-devkit/core": "^21.0.5",
20+
"@angular/animations": "^21.0.8",
21+
"@angular/cdk": "^21.0.6",
22+
"@angular/cli": "^21.0.5",
23+
"@angular/common": "^21.0.8",
24+
"@angular/compiler": "^21.0.8",
25+
"@angular/compiler-cli": "^21.0.8",
26+
"@angular/core": "^21.0.8",
27+
"@angular/forms": "^21.0.8",
28+
"@angular/language-service": "^21.0.8",
29+
"@angular/material": "^21.0.6",
30+
"@angular/platform-browser": "^21.0.8",
3131
"@babel/core": "^7.24.9",
3232
"@ephox/agar": "^8.0.1",
3333
"@ephox/bedrock-client": "^14.1.1",

tinymce-angular-component/src/test/ts/alien/InitTestEnvironment.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ import 'zone.js/plugins/fake-async-test';
44

55
import { TestBed } from '@angular/core/testing';
66
import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';
7+
import { NgModule, provideZoneChangeDetection } from '@angular/core';
78

8-
TestBed.initTestEnvironment(BrowserTestingModule, platformBrowserTesting(), {
9-
teardown: { destroyAfterEach: true },
10-
});
9+
@NgModule({
10+
providers: [ provideZoneChangeDetection() ],
11+
})
12+
class AppTestingModule {}
13+
14+
TestBed.initTestEnvironment(
15+
[ BrowserTestingModule, AppTestingModule ], platformBrowserTesting(),
16+
{
17+
teardown: { destroyAfterEach: true },
18+
}
19+
);

tinymce-angular-component/src/test/ts/alien/TestHooks.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const editorHook = <T = unknown>(component: Type<T>, moduleDef: TestModul
6969
fixture.detectChanges();
7070

7171
return firstValueFrom(
72+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
7273
editorComponent.onInit.pipe(
7374
throwTimeout(10000, `Timed out waiting for editor to load`),
7475
switchMap(
@@ -79,10 +80,10 @@ export const editorHook = <T = unknown>(component: Type<T>, moduleDef: TestModul
7980
// after global tinymce is removed in a clean up. Specifically, it happens when unloading/loading different versions of TinyMCE
8081
if (editor.licenseKeyManager) {
8182
editor.licenseKeyManager.validate({}).then(() => {
82-
resolve(editor);
83+
resolve(editor as Editor);
8384
}).catch((reason) => console.warn(reason));
8485
} else {
85-
resolve(editor);
86+
resolve(editor as Editor);
8687
}
8788
});
8889
})

tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"baseUrl": ".",
55
"sourceMap": true,
66
"declaration": false,
7-
"moduleResolution": "node",
7+
"moduleResolution": "nodenext",
88
"noUnusedLocals": true,
99
"strict": true,
1010
"emitDecoratorMetadata": true,
1111
"experimentalDecorators": true,
1212
"target": "es5",
13-
"module": "es2015",
13+
"module": "nodenext",
1414
"typeRoots": [
15-
"node_modules/@types"
15+
"node_modules/@types"
1616
],
1717
"lib": [
1818
"es2017",

0 commit comments

Comments
 (0)