Skip to content

Commit

Permalink
Merge pull request #350 from ckeditor/i/342
Browse files Browse the repository at this point in the history
Fix: Aligned `window.CKEDITOR_VERSION` type with the community typings. Closes #342.
  • Loading branch information
pomek authored Feb 9, 2023
2 parents 594c044 + 8207ee0 commit 44f3a63
Show file tree
Hide file tree
Showing 6 changed files with 804 additions and 7 deletions.
787 changes: 787 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@angular/platform-browser": "^13.3.11",
"@angular/platform-browser-dynamic": "^13.3.11",
"@angular/router": "^13.3.11",
"@types/ckeditor__ckeditor5-utils": ">=28.0.14",
"core-js": "^3.21.1",
"rxjs": "^6.5.5",
"tslib": "^2.0.3",
Expand Down
10 changes: 5 additions & 5 deletions src/ckeditor/ckeditor.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ describe( 'CKEditorComponent', () => {
beforeEach( () => {
spyOn( console, 'warn' );

CKEDITOR_VERSION = window.CKEDITOR_VERSION;
CKEDITOR_VERSION = ( window as any ).CKEDITOR_VERSION;
} );

afterEach( () => {
fixture.destroy();

window.CKEDITOR_VERSION = CKEDITOR_VERSION;
( window as any ).CKEDITOR_VERSION = CKEDITOR_VERSION;
} );

it( 'should create', () => {
Expand All @@ -42,7 +42,7 @@ describe( 'CKEditorComponent', () => {
} );

it( 'should print a warning if the "window.CKEDITOR_VERSION" variable is not available', () => {
delete window.CKEDITOR_VERSION;
delete ( window as any ).CKEDITOR_VERSION;

fixture = TestBed.createComponent( CKEditorComponent );
component = fixture.componentInstance;
Expand All @@ -52,7 +52,7 @@ describe( 'CKEditorComponent', () => {
} );

it( 'should print a warning if using CKEditor 5 in version lower than 34', () => {
window.CKEDITOR_VERSION = '30.0.0';
( window as any ).CKEDITOR_VERSION = '30.0.0';

fixture = TestBed.createComponent( CKEditorComponent );
component = fixture.componentInstance;
Expand All @@ -62,7 +62,7 @@ describe( 'CKEditorComponent', () => {
} );

it( 'should not print any warning if using CKEditor 5 in version 34 or higher', () => {
window.CKEDITOR_VERSION = '34.0.0';
( window as any ).CKEDITOR_VERSION = '34.0.0';

fixture = TestBed.createComponent( CKEditorComponent );
component = fixture.componentInstance;
Expand Down
4 changes: 3 additions & 1 deletion src/ckeditor/ckeditor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
* For licensing, see LICENSE.md.
*/

import type { version } from 'ckeditor__ckeditor5-utils';

declare global {
interface Window {
CKEDITOR_VERSION?: string;
CKEDITOR_VERSION: typeof version;
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/ckeditor/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"lib": {
"entryFile": "./index.ts"
},
"allowedNonPeerDependencies": [
"@ckeditor/ckeditor5-watchdog",
"@types/ckeditor__ckeditor5-utils"
],
"dest": "../../dist"
}
5 changes: 4 additions & 1 deletion src/ckeditor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
"ckeditor5",
"ckeditor 5"
],
"dependencies": {
"@ckeditor/ckeditor5-watchdog": ">=34.0.0",
"@types/ckeditor__ckeditor5-utils": ">=28.0.14"
},
"peerDependencies": {
"@angular/core": ">=13.0.0",
"@angular/common": ">=13.0.0",
"@angular/forms": ">=13.0.0",
"@ckeditor/ckeditor5-watchdog": ">=34.0.0",
"rxjs": ">=6.0.0"
},
"author": "CKSource (http://cksource.com/)",
Expand Down

0 comments on commit 44f3a63

Please sign in to comment.