No event is fired when closing a dialog via ESC

佐手、 提交于 2019-12-06 14:05:28

问题


This issue is occurring using Outlook Web App on OSX. It has been replicated using Chrome, Firefox, and Safari.

Scenario

UI.displayDialogAsync() is used with the displayInIframe: true option.

If a user hits the ESC key, the dialog will close but not trigger Office.EventType.DialogEventReceived.

On top of this, the same dialog can not be opened again (probably because somewhere an opened flag is still set to true or something).


Expected Behavior

The dialog closes and emits an event with error 12006 (dialog closed by user).


Current Behavior

The dialog closes, and does not emit anything and dialog cannot be reopened.


Code

All our OfficeJs related calls are wrapped inside a service, and inside that service we have an openDialog method that wraps ui.displayDialogAsync:

public openDialog(dialog: string, width: number, height: number, displayInIframe: boolean = true) : Promise < Office.DialogHandler > {
    return new Promise((resolve, reject) => {
        this.ui.displayDialogAsync(`https://${OWA_HOST}/${dialog}`, { width, height, displayInIframe }, (result) => {
            //... error handling + reject(result.value)
            resolve(result.value)
        });
    });
}

openDialog is then used somwhere else in our Angular app:

this.owaService.openDialog('dialog-access-rights.html', 60, 50, true)
    .then((handler: Office.DialogHandler) => {
        this.handler = handler;
        handler.addEventHandler(Office.EventType.DialogMessageReceived, this.messageHandler.bind(this));
        handler.addEventHandler(Office.EventType.DialogEventReceived, this.eventHandler.bind(this));
    })
    .catch(error => {
        this.log.error('Error opening AR dialog', {
            error
        });
    });

error returned by Office :


I've posted this in the Office.js CDN/NPM GitHub as well.

This issue: OWA: Dialog API support is similar, though I've left my question as-is since it is a more barebone description of the same bug.

来源:https://stackoverflow.com/questions/46037829/no-event-is-fired-when-closing-a-dialog-via-esc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!