Skip to content

Commit

Permalink
Merge pull request #218 from maxisam/hotfix/ios-scroll-issue
Browse files Browse the repository at this point in the history
fix: ios scroll issue
  • Loading branch information
maxisam authored Nov 27, 2019
2 parents 785d2e2 + 1df62e7 commit acb448c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@angular/platform-browser-dynamic": "~7.2.15",
"@angular/router": "~7.2.15",
"core-js": "^2.5.4",
"ngx-clipboard": "12.1.2",
"ngx-clipboard": "12.2.2",
"ngx-window-token": "2.0.1",
"rxjs": "~6.5.2",
"tslib": "^1.9.0",
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-clipboard/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ngx-clipboard",
"description": "angular 2 clipboard",
"version": "12.2.1",
"version": "12.3.0",
"author": {
"name": "Sam Lin",
"email": "[email protected]"
Expand Down
14 changes: 10 additions & 4 deletions projects/ngx-clipboard/src/lib/ngx-clipboard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export class ClipboardService {
/**
* Attempts to copy from an input `targetElm`
*/
public copyFromInputElement(targetElm: HTMLInputElement | HTMLTextAreaElement): boolean {
public copyFromInputElement(targetElm: HTMLInputElement | HTMLTextAreaElement, isFocus = true): boolean {
try {
this.selectTarget(targetElm);
const re = this.copyText();
this.clearSelection(targetElm, this.window);
this.clearSelection(isFocus ? targetElm : undefined, this.window);
return re && this.isCopySuccessInIE11();
} catch (error) {
return false;
Expand Down Expand Up @@ -94,7 +94,7 @@ export class ClipboardService {
}
this.tempTextArea.value = content;

const toReturn = this.copyFromInputElement(this.tempTextArea);
const toReturn = this.copyFromInputElement(this.tempTextArea, false);
if (this.config.cleanUpAfterCopy) {
this.destroy(this.tempTextArea.parentElement);
}
Expand Down Expand Up @@ -129,7 +129,6 @@ export class ClipboardService {
* Moves focus away from `target` and back to the trigger, removes current selection.
*/
private clearSelection(inputElement: HTMLInputElement | HTMLTextAreaElement, window: Window): void {
// tslint:disable-next-line:no-unused-expression
inputElement && inputElement.focus();
window.getSelection().removeAllRanges();
}
Expand Down Expand Up @@ -164,4 +163,11 @@ export class ClipboardService {
public pushCopyResponse(response: IClipboardResponse): void {
this.copySubject.next(response);
}

/**
* @deprecated use pushCopyResponse instead.
*/
public pushCopyReponse(response: IClipboardResponse): void {
this.pushCopyResponse(response);
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5534,10 +5534,10 @@ ng-packagr@^4.2.0:
uglify-js "^3.0.7"
update-notifier "^2.3.0"

ngx-clipboard@12.1.2:
version "12.1.2"
resolved "https://registry.yarnpkg.com/ngx-clipboard/-/ngx-clipboard-12.1.2.tgz#69077d928a20b061ef22b51bd871633bb4d6af0a"
integrity sha512-tctOooh9WWvK7tVKV+CAGN5nNAhnL7oqEoJmJO4TmkHHwVbL0QQFWdWB5yiMYTRQ/ZXV3bCpufiVM8F4clXthw==
ngx-clipboard@12.2.2:
version "12.2.2"
resolved "https://registry.yarnpkg.com/ngx-clipboard/-/ngx-clipboard-12.2.2.tgz#84de257d6a1cfbae1f17db25080ffdf0fe9b51aa"
integrity sha512-YCeAGJGt7DYXIgfnItud+oM2S1ze1JVUH+3wXTyJpjei+17RLv9OvqshntKfsMkDFskXEe/fpCAlth08JInIzw==
dependencies:
ngx-window-token "^2.0.0"
tslib "^1.9.0"
Expand Down

0 comments on commit acb448c

Please sign in to comment.