Assigned
Status Update
Comments
jp...@google.com <jp...@google.com> #2
Information redacted by Android Beta Feedback.
bl...@google.com <bl...@google.com> #3
Could you please let me know if the bug report was captured immediately after reproducing the issue?
jp...@google.com <jp...@google.com> #4
It was within a few minutes of having the issue
Description
Before opening a new issue, please search for other related issues , click the ★ to subscribe to updates, and click
+1
to vote.Description
Script cycles through number of bookmarks in the same document and tab (based on their url) and updates the bookmarked text. However, after the first bookmark is fetched from the documentTab, the following bookmarks do have the proper ids but return the same position, and thus the same textElement. This results in only a single text line being updated.
In the code bellow the surrounding text ends up being the same, although the bookmarks are different.
A workaround resolves the issue by saving and closing the document.
Code
Output
6:51:31 PM Info { "documentId": "DOC_ID_1", "tabId": "TAB_ID_1", "bookmarkId": "id.46t5xnlsxa6m", "text": "A Text 1." } 6:51:31 PM Info { "documentId": "DOC_ID_1", "tabId": "TAB_ID_1", "bookmarkId": "id.p2frhfm62x1g", "text": "? Text 1." } 6:51:31 PM Info { "documentId": "DOC_ID_1", "tabId": "TAB_ID_1", "bookmarkId": "id.mskbt79dkckm", "text": "? Text 1." } 6:51:31 PM Info { "documentId": "DOC_ID_1", "tabId": "TAB_ID_1", "bookmarkId": "id.f12v079xz7jr", "text": "? Text 1." }
Steps
Create test document with one or more tabs.
Select one of the tabs and paste the following text: A Text 1. B Text 2. C Text 3. D Text 4.
Add a bookmark for each of the 4 lines with text.
In the provided code replace the values in 'bookmarkUrls' with the actual bookmark urls.
Execute the 'test_bookmark_text_issue' function.
Verify the changes in the document. Upon execution my script only changes the first bookmarked text.
Reset the text in the first line. Uncomment the .doc.saveAndClose() line in the script and execute again. Upon execution my script changes all bookmarked texts properly.