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
690 stars 95 forks source link

Using setSelectedDataAsync on multiple lines will result in different format #4526

Open bo-ravnborg opened 6 months ago

bo-ravnborg commented 6 months ago

Your Environment

Expected behavior

When using setSelectedDataAsync with text Coercion Type the inserted text should match surrounding text.

Current behavior

The inserted text has a different formatting compared to the surrounding text

Steps to reproduce

Select multiple lines when composing an Email. Use the function blow to replace the selected text.

Office.context.mailbox.item?.body.setSelectedDataAsync(
  "Text to insert",
  {
    coercionType: Office.CoercionType.Text,
  }
);

Example

The issue is demonstrated in this video, where you can see the different formatting. https://github.com/OfficeDev/office-js/assets/68271198/d31ff563-4615-435d-9f1e-2ce90a0702fc

Provide additional details

If you only select one line of text it will have to correct formatting, it's only an issue when selecting multiple lines. It seems when selecting multiple lines the text is put outside the

where it supposedly should be. image

Context

We have a live application where we can modify text for the user, and right now we are getting negative feedback because this is breaking the formatting of the email when they use this functionality.

mmanjaree-msft commented 5 months ago

Thanks for reporting. We have put this issue in our backlog but unfortunately we donot have any timelines to share at this point. Internal tracking id: 4623257

bo-ravnborg commented 2 months ago

@mmanjaree-msft Any news on this issue? When can we expect a fix?