Closed conoremclaughlin closed 3 years ago
Going to bump this but if I get time will try and create a pr.
Sorry for long waiting.
Actually, highlight
method of original project didn't interacted with Google Docs. That method manually created some HTML element with some CSS style. https://github.com/JensPLarsen/ChromeExtension-GoogleDocsUtil/blob/7f32ef2df624c8355b829d4eec7e176dd1311101/googleDocsUtil.js#L373
It was fine for just "create and see", but not fine "create, see and interact". Google Docs will not recognize such selection, and will not interact with it. This library provides some methods for interaction with Google Docs (for example, GoogleDocsUtils.pressOn.Delete()
). Using pressOn.Delete()
you will expect removing of created selection, but you will be not able to observe such behavior, because Google Docs will know nothing about that created selection. That was the reason why I didn't ported original highlight
method.
I tried to create copy of original highlight
that will also allow to interact with created selection, but it was not successful. Though, I will try to create it again, because I see that there is a demand for this.
By the way, at the moment you not able to complete your task using pressOn
?
Do you mind if I jump in here?
Congrats for the remarkable work here!
It would be really awesome to have the highlighting feature. I'm currently using JensPLarsen's one to do this. I'm building a chrome extension to run with the Google Docs editor, so I don't really need the editor to interact with highlights, just the user. For me the feature works just fine.
I'm having some trouble with the way that it handles different text alignments, such as right and justified.
I would be happy to contribute with some parts of the highlight feature here :)
Hello! I'm sorry for long awaiting.
In 2.3.0 release I've added some methods to work with actual selection. Here is a list: All
, PrevCharacter
, NextCharacter
, PrevWord
, NextWord
, PrevLine
, NextLine
, PrevParagraph
, NextParagraph
, TextBetweenCursorAndLineStart
, TextBetweenCursorAndLineEnd
, TextBetweenCursorAndDocumentStart
, TextBetweenCursorAndDocumentEnd
.
You can combine usage of these methods with moveCursorTo
module, which allows you to move cursor over document. You can see further documentation here: select and moveCursorTo.
Combined usage of these two modules satisfies your purposes or you need something more specific?
I'm closing this. Feel free to reopen if implemented things don't solves your issue.
This is amazing. Thanks so much for your hard work :)
Awesome library! Excited to check it out. Is there a setSelection method within? I saw the original project can set the highlight and selection:
https://github.com/JensPLarsen/ChromeExtension-GoogleDocsUtil
Any methods I can use or will this need to wait for a future release?
Thanks for the hard work!