Coder Social home page Coder Social logo

Comments (4)

microsoft-github-policy-service avatar microsoft-github-policy-service commented on August 10, 2024

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

from office-js.

jipyua avatar jipyua commented on August 10, 2024

hi @greysteil thanks for let us know this issue. But unfortunatelly with the following code, I can't reproduce the issue you mentioned, undo/redo is working correctly if I inserted a comment on each of more than 6 paragraphs using the following code. Can you help confirm what's the missing information? thanks.

const pars = context.document.body.paragraphs;
pars.load();
await context.sync();
for (var i=0; i<pars.items.length; i++)
{
  pars.items[i].getRange().insertComment("abc");
}
await context.sync();
console.log("comments inserted");

from office-js.

greysteil avatar greysteil commented on August 10, 2024

Oh interesting - I thought this was any time four or more comments were inserted, but it looks like there are some caveats.

@jipyua can you replicate that Word hangs when undoing the following?

Word.run(async (context) => {
  myLoc = context.document.body.paragraphs.getFirst().getRange("Content")
  // myLoc = context.document.body.getRange().search("some text").getFirst()

  for (var i=0; i<4; i++) {
    myLoc.insertComment("abcde");
  }

  await context.sync();
  console.log("comments inserted");
})

That's the simplest snippet that causes the problem for me. A couple of notes:

  • The comments have to be 5 characters or longer (hence abcde). Undo works fine if they're shorter. In reality, almost all comments are 5 characters or longer, so this doesn't help our users.
  • I have to narrow the paragraph's range by passing "Content" to getRange to get the bug. Undo works fine if I don't specify that. Again, in reality, most production use cases insert comments based on a search(...) result, which gives ranges that don't include the end of paragraph break.

I've included a commented out line of code that replicates the bug in the more common case where the location you're commenting on comes from search(...). It expects the doc you're running on to have the words "some text" in the document body.

from office-js.

jipyua avatar jipyua commented on August 10, 2024

Thanks for sharing the detailed code, I am able to replicate the issue you mentioned earlier and have opened an internal item 9072602 to track this. We will triage the priority based on the impact and severity and share here if we have some progress. thanks.

from office-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.