Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

The "selectedText" returns incorrect value when document is open in multiple sessions (e.g. collaborative mode) #16

Open
volpav opened this issue Jan 8, 2020 · 3 comments

Comments

@volpav
Copy link

volpav commented Jan 8, 2020

Noticed this when playing around with the tool.

Steps to reproduce:

  1. Open a document in a new browser tab and select a piece of text;
  2. Observe googleDocsUtil.getGoogleDocument().selectedText returning the correct selection;
  3. Open the same document in a different browser tab (keep the current tab open), navigate to it;
  4. Select another piece of text which appears after the one which is already selected in a first tab;
  5. Observe googleDocsUtil.getGoogleDocument().selectedText still returning the text selected in a first tab, even when the code is executed in a second tab;

By looking at the DOM, there doesn't seem to be a great way to distinguish between the two selections (i.e. to determine which one is from the current session).

@LeZuse
Copy link

LeZuse commented Mar 17, 2020

I can reproduce the same issue.

@LeZuse
Copy link

LeZuse commented Mar 17, 2020

From my observation it seems like the active user's highlight does not have a background color set when active, and then on blur it gets set to RGB(0,0,0). Additionally, highlights from other tabs seem to have some gradual fading feature meaning their opacity value is decreasing overtime. That is how they achieve a "recency" feature which collapses the highlight to a carret when the opacity reaches 0.
Screenshot 2020-03-17 21 03 22

EDIT:
I suppose that tweaking the query for the selection DIV to filter for the right css values might do the trick: https://github.com/JensPLarsen/ChromeExtension-GoogleDocsUtil/blob/master/googleDocsUtil.js#L61

@bdvorianov
Copy link

Working on it now in free time, wait for the releases in future. 👌🏻

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants