Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cbSuccessMsg is no more taken into account #299

Closed
MathieuCoupe opened this issue Mar 8, 2022 · 7 comments
Closed

cbSuccessMsg is no more taken into account #299

MathieuCoupe opened this issue Mar 8, 2022 · 7 comments

Comments

@MathieuCoupe
Copy link
Contributor

Starting from release 15.0.x of ngx-clipboard, assigning a string to the field cbSuccessMsg on the button no longer add it on the IClipboardResponse event generated.

eg:

<button ngxClipboard [cbContent]="content" cbSuccessMsg="content successfully copied">

@MathieuCoupe
Copy link
Contributor Author

When testing with cbOnSuccess callback, if found that adding a callback fix the missing field (in the event provided to the callback method and in the global event queue)

<button ngxClipboard [cbContent]="content" cbSuccessMsg="content successfully copied" (cbOnSuccess)="process($event)">

@maxisam
Copy link
Owner

maxisam commented Mar 9, 2022

It is by design.

if (succeeded) {
if (this.cbOnSuccess.observers.length > 0) {
response = Object.assign(response, {
content: copiedContent,
successMessage: this.cbSuccessMsg
});
this.ngZone.run(() => {
this.cbOnSuccess.emit(response);
});
}

@maxisam maxisam closed this as completed Mar 9, 2022
@MathieuCoupe
Copy link
Contributor Author

Thx for the quick response !

My issue is that we observe the global ClipboardService.copyResponse$ to avoid defining a callback for each ngxClipboard instance, and the event does not contain the successMessage field.

Would it be possible to enrich the event even if no local callback is registered ?

Something as :

        let response: IClipboardResponse = {
            isSuccess: succeeded,
            successMessage: this.cbSuccessMsg,
            event
        };

@maxisam
Copy link
Owner

maxisam commented Mar 10, 2022

totally, welcome to make a PR I will merge it. thx!

@maxisam maxisam reopened this Mar 10, 2022
@MathieuCoupe
Copy link
Contributor Author

see #300

@rahuldimri
Copy link

This issue is closed as part of Pull Request #300. Please close the issue.

@MathieuCoupe
Copy link
Contributor Author

issue fixed by #300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants