Closed sureshjoshi closed 8 months ago
Thank you for reporting this issue regarding Range.insertFootnote
API. The issue is confirmed and tracked as ADO#5539077 in our backlog.
@sureshjoshi Thanks for reaching us. The focus will be in the footnote body so the second footnote cannot be inserted. We will take a look at this behavior. Currently, you may consider to set focus to the next footnote's range and insert.
Thanks @RuoyingLiang !
But question, isn't that what should happen when I select the context.document.body.insertParagraph
? Wouldn't that re-focus my range back to the doc?
What you've described is what I assumed was happening, but I guess I assumed that my code automatically re-shifted focus. How would I do this explicitly?
The team has reported that the issue has been fixed in code and the fix is currently in the release process. We'll come back to this thread when it is publicly available.
Thanks @chiz-ms !
Some information about this fix for @sureshjoshi .
The focus won't be shifted when you call getRange().
For insertfootnote(), we added an optional parameter called "keepCurrentFocus: boolean" to decide whether to keep the current focus. The default value is false which indicates that the footnote editor will be opened and the focus will be shifted to the editor.
You can set it true which indicates the editor won't be opened and the focus won't be changed, then you can insert the next footnote. It is same for endnote.
Thanks @xiaoyuMS - I'll test it out when it reaches production
Hi @xiaoyuMS and @chiz-ms
Has this fixed reached production? Or is it still in the works?
It is still in the works of CDN deployment. I will come back for any update.
Hi @sureshjoshi The fix is expected to reach production ring by the end of February.
Hi @sureshjoshi Sorry for those poor experiences with these APIs and also thank you for your valuable feedback. Good news is that the fix has reached the production ring, please have a try.
We change the default behavior of insertFootnote/Endnote() to make sure that it can be called multiple times in a row. Before: The footnote/endnote editor will be opened and the focus will be switched to the editor after a footnote/endnote is inserted. Now: There is no UI action invoked after a footnote/endnote is inserted.
No parameter change for insertFootnote/Endnote().
@xiaoyu03 Thanks! I'll take a look at them later this week to test!
This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!
Bumping to avoid auto-close
While using the footnote API, I'm unable to insert more than 1 footnote. I've attached an example where I create 2 paragraphs, and add a footnote to the end of each with every permutation (no footnotes, one on the first, one on the second, both).
The "both" use case fails with the attached error. However, the paragraphs are always inserted correctly.
Maybe I'm not using the API in the correct way? Or perhaps that functionality is not implemented yet.
Your Environment
Expected behavior
Footnotes can be created in the same fashion as paragraphs, meaning multiple can be created together.
Current behavior
One can be created without any problems, however, the second causes a RichAPI error
Script Lab example
Context
Just testing out the new API for an application being developed (in order to replace a lot of nasty
insertOOXML
).Useful logs