Skip to content

Commit

Permalink
Merge pull request #241 from maxisam/hotfix/strictTemplates
Browse files Browse the repository at this point in the history
fix: strictTemplates issue #239
  • Loading branch information
maxisam committed May 5, 2020
2 parents 3b1cb50 + 74bef3b commit 25aa1a0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -29,7 +29,7 @@
"@clr/icons": "^2.3.7",
"@clr/ui": "^2.3.7",
"core-js": "^2.5.4",
"ngx-clipboard": "13.0.0-beta06",
"ngx-clipboard": "^13.0.1",
"ngx-window-token": "3.0.0-beta01",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-clipboard/package.json
@@ -1,7 +1,7 @@
{
"name": "ngx-clipboard",
"description": "angular 2 clipboard",
"version": "13.0.0",
"version": "13.0.1",
"author": {
"name": "Sam Lin",
"email": "maxisam@gmail.com"
Expand All @@ -22,7 +22,7 @@
"copy"
],
"dependencies": {
"ngx-window-token": ">= 3.0.0-beta01 || >= 3.0.0"
"ngx-window-token": ">=3.0.0"
},
"peerDependencies": {
"@angular/common": ">=9.0.0",
Expand Down
5 changes: 3 additions & 2 deletions projects/ngx-clipboard/src/lib/ngx-clipboard.directive.ts
Expand Up @@ -7,14 +7,15 @@ import { ClipboardService } from './ngx-clipboard.service';
selector: '[ngxClipboard]'
})
export class ClipboardDirective implements OnInit, OnDestroy {
// https://github.com/maxisam/ngx-clipboard/issues/239#issuecomment-623330624
// tslint:disable-next-line:no-input-rename
@Input('ngxClipboard')
public targetElm: HTMLInputElement | HTMLTextAreaElement;
public targetElm: HTMLInputElement | HTMLTextAreaElement | undefined | '';
@Input()
public container: HTMLElement;

@Input()
public cbContent: string;
public cbContent: string | undefined;

@Input()
public cbSuccessMsg: string;
Expand Down
8 changes: 4 additions & 4 deletions projects/ngx-clipboard/src/lib/ngx-clipboard.service.ts
Expand Up @@ -81,7 +81,7 @@ export class ClipboardService {
// check if the temp textarea still belongs to the current container.
// In case we have multiple places using ngx-clipboard, one is in a modal using container but the other one is not.
if (this.tempTextArea && !container.contains(this.tempTextArea)) {
this.destroy(this.tempTextArea.parentElement);
this.destroy(this.tempTextArea.parentElement || undefined);
}

if (!this.tempTextArea) {
Expand All @@ -96,7 +96,7 @@ export class ClipboardService {

const toReturn = this.copyFromInputElement(this.tempTextArea, false);
if (this.config.cleanUpAfterCopy) {
this.destroy(this.tempTextArea.parentElement);
this.destroy(this.tempTextArea.parentElement || undefined);
}
return toReturn;
}
Expand Down Expand Up @@ -128,9 +128,9 @@ export class ClipboardService {
/**
* Moves focus away from `target` and back to the trigger, removes current selection.
*/
private clearSelection(inputElement: HTMLInputElement | HTMLTextAreaElement, window: Window): void {
private clearSelection(inputElement: HTMLInputElement | HTMLTextAreaElement | undefined, window: Window): void {
inputElement && inputElement.focus();
window.getSelection().removeAllRanges();
window.getSelection()?.removeAllRanges();
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Expand Up @@ -10,6 +10,7 @@
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"strictNullChecks": true,
"target": "es2015",
"typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"],
Expand All @@ -19,6 +20,7 @@
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
"strictInjectionParameters": true,
"strictTemplates": true
}
}
17 changes: 11 additions & 6 deletions yarn.lock
Expand Up @@ -6767,18 +6767,23 @@ ng-packagr@^9.0.0:
terser "^4.3.8"
update-notifier "^4.0.0"

ngx-clipboard@13.0.0-beta06:
version "13.0.0-beta06"
resolved "https://registry.yarnpkg.com/ngx-clipboard/-/ngx-clipboard-13.0.0-beta06.tgz#97e0dc6864c65c2222c278917cabbf35982a1924"
integrity sha512-sT2ZSHUczXhjxBxhtpry2BPn55LUOfk6Cz0i2Cc43SLYurMw3Q5W432mUu5kiRWIIB/zg/TVEacRFcSq2umx8w==
ngx-clipboard@^13.0.1:
version "13.0.1"
resolved "https://registry.yarnpkg.com/ngx-clipboard/-/ngx-clipboard-13.0.1.tgz#393239d1a8f0ada8b99ef2d3ac80bc245c9ba3fe"
integrity sha512-e7QBsw7bX5ajhVR2++NAaYZYw90hKeEBlb006TW85WDUA3kmlrXpMDwOvVJuRewU6Nh+U1QiQMJq5a0ivk0zWg==
dependencies:
ngx-window-token ">= 3.0.0-beta01 || >= 3.0.0"
ngx-window-token ">=3.0.0"

ngx-window-token@3.0.0-beta01, "ngx-window-token@>= 3.0.0-beta01 || >= 3.0.0":
ngx-window-token@3.0.0-beta01:
version "3.0.0-beta01"
resolved "https://registry.yarnpkg.com/ngx-window-token/-/ngx-window-token-3.0.0-beta01.tgz#8cd0e9103b435f3b0da72e4d039988b62989c2fc"
integrity sha512-EOH0SMhqwl4916W9rAo4o58egqbWSMeIhNhO2zDaLT5YfTtULjhFf+kWeOrgT1MLnNo0fRt5XvWxZtimB1hETw==

ngx-window-token@>=3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ngx-window-token/-/ngx-window-token-3.0.0.tgz#a5419befb133c6226e3e570737a247e66c825ab7"
integrity sha512-MDVIQB2SqFCbpoTqEXhO2529hsvpCYyw/iogjU6uskKqUKh79XVKWSMpRH9S1yTr0Ucgh8nFeNcpv2DnFdikJA==

nice-try@^1.0.4:
version "1.0.5"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
Expand Down

0 comments on commit 25aa1a0

Please sign in to comment.