Skip to content

Commit 52f8ac7

Browse files
committed
Improve code-example.
1 parent 2f24458 commit 52f8ac7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,20 +1234,22 @@ gmail.tools.add_compose_button(compose_ref, 'content_html', function() {
12341234
}, 'Custom Style Classes');
12351235
```
12361236

1237-
#### gmail.tools.add_attachment_button(attachment_ref, content_html, customCssClass tooltip, onclick_action)
1237+
#### gmail.tools.add_attachment_button(attachment_ref, content_html, customCssClass, tooltip, onclick_action)
12381238

12391239
Add a button to an attachment in email-view.
12401240

12411241
```js
12421242
var emailDom = gmail.dom.email(gmail.get.email_id());
12431243
var attachments = emailDom.attachments();
1244-
var attachment = attachments[0];
12451244

12461245
var iconUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/1024px-Google_%22G%22_Logo.svg.png";
12471246
var html = '<img src="' + iconUrl + '" width="21" height="21" />';
1248-
gmail.tools.add_attachment_button(attachment, html, null, "Custom button!", function() {
1249-
alert("Attachment " + attachment.name + " clicked!");
1250-
});
1247+
1248+
for (let attachment of attachments) {
1249+
gmail.tools.add_attachment_button(attachment, html, null, "Custom button!", function() {
1250+
alert("Attachment " + attachment.name + " clicked!");
1251+
});
1252+
}
12511253
```
12521254

12531255
#### gmail.tools.add_modal_window(title, content_html, onClickOk, onClickCancel, onClickClose)

0 commit comments

Comments
 (0)