Skip to content

Commit 7535b91

Browse files
committed
Add comments
1 parent f3a2a97 commit 7535b91

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/web/taskpane.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,23 @@ async function onTypicalReplyButtonClicked() {
195195
}
196196
element.hidden = false;
197197
if (Office.context.mailbox.diagnostics?.hostName === "Outlook") {
198+
// On Classic Outlook, Office.context.mailbox.item is always defined,
199+
// regardless of whether one or multiple messages are selected.
200+
// So we need to check the number of selected items to determine whether
201+
// it is single-select or multi-select.
198202
const selectedItems = await loadSelectedMails();
199203
if (!selectedItems || selectedItems.length > 1) {
200204
await multiMailHandler(buttonConfig);
201205
} else {
202206
await singleMailHandler(buttonConfig);
203207
}
204208
} else {
209+
// On Classic Outlook, Office.context.mailbox.item is defined only when
210+
// a single message is selected.
211+
// singleMailHandler also requires Office.context.mailbox.item to fetch
212+
// the original mail data and to display the reply form. Therefore, when
213+
// Office.context.mailbox.item is undefined, the case must be handled by
214+
// multiMailHandler, which does not rely on Office.context.mailbox.item.
205215
const item = Office.context.mailbox.item;
206216
if (item) {
207217
await singleMailHandler(buttonConfig);

0 commit comments

Comments
 (0)