OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
677 stars 95 forks source link

[Outlook][Mac] Office.context.mailbox.item.body.setAsync breaks signature replacement and causes app freeze with a certain signature #1272

Closed amegan closed 7 months ago

amegan commented 4 years ago

Message from office-js bot: We’re closing this issue because it has been inactive for a long time. We’re doing this to keep the issues list manageable and useful for everyone. If this issue is still relevant for you, please create a new issue. Thank you for your understanding and continued feedback.

Signature insertion usually replaces the inserted signature if it is called more than once. This signature insertion does not replace existing signature but insert another signature after we call Office.context.mailbox.item.body.setAsync() API.

Expected Behavior

Signature replacement should replace existing signature even after we call Office.context.mailbox.item.body.setAsync().

Current Behavior

After we call Office.context.mailbox.item.body.setAsync() API even we set back the exact same HTML we got from Office.context.mailbox.item.body.getAsync(), signature insertion does not replace existing signature but insert another signature .

And if the signature contains an image inside the table and has a text with empty lines after the table, the message composing pane becomes unresponsive to the user edit and eventually hangs after signature replacement.

Steps to Reproduce, or Live Example

Signature replacement not working

  1. create 2 signatures. the design does not matter.
  2. start composing a new message
  3. insert a signature
  4. insert another signature. the signature inserted in step 3 should be replaced with a newly inserted signature
  5. open one of the outlook plugins and open web inspector
  6. evaluate the following code in the console
    Office.context.mailbox.item.body.getAsync(Office.CoercionType.Html,
    (readResult) =>
       Office.context.mailbox.item.body.setAsync(readResult.value, {coercionType: Office.CoercionType.Html},
          (writeResult) => console.log(writeResult)
    )
    );
  7. insert a signature again. It does not replace the existing signature.

App unresponsive

  1. create a signature. It must have an image in the table and has text and empty lines after the table. Below is the sample, 1x1 table, insert image in the table cell. text and 3 empty lines under the table.

image

  1. start composing a new message
  2. insert a signature
  3. open one of the outlook plugins and open web inspector
  4. evaluate the following code in the console
    Office.context.mailbox.item.body.getAsync(Office.CoercionType.Html,
    (readResult) =>
       Office.context.mailbox.item.body.setAsync(readResult.value, {coercionType: Office.CoercionType.Html},
          (writeResult) => console.log(writeResult)
    )
    );
  5. insert the same signature again. It does not replace the existing signature and HTML rendering around the signature is broken. Also, message compose pane becomes unresponsive to user input and eventually showing rainbow cursor and application freezes.

image

Context

Our plugin keeps monitoring the composing body and updates the composing body using body.setAsync(). The user typically sets a default signature but sometimes wants to use a different one. After our plugin calls body.setAsync(), selecting different signature breaks a message content. Especially, crashing with a certain type of signature affects a lot on customer experience. The crash issue was reported by our customer and I made it simpler to reproduce. Using a table for layout information including the company logo and put some text under it is a common type of it.

Your Environment

Useful logs

exextoc commented 4 years ago

Hi, we followed your repro steps, and are able to partially reproduce this. The compose area does become unresponsive, but the rendering doesn't appear broken - and the application does not crash or hang. We will take this issue up. Are you in Insiders Ring, or using the production version of Outlook?

amegan commented 4 years ago

Hi, I am on insider fast but the issue has happened on prod as well. We originally received the issue last year with the customer's real signature and it is still happening. My sample might not be enough on happening the issue constantly but hopefully, you got something from it. Maybe a little bit more complicated signature design might help to reproduce the issue constantly.

exextoc commented 4 years ago

@amegan We will go ahead with the partial repro of bug with compose area becoming unresponsive. We have added it to our backlog. Thanks for reporting this issue. We unfortunately have no timelines to share at this point.