-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If possible, Suggested changes should omit Deleted text and only include Inserted text #194
Comments
Oh, interesting! I hadn't looked at how edits in suggest changes mode show up at all. I will see what I can do. Alternatively, feel free to file a PR! |
Well, the bad news is that I don’t think this is going to be possible in Safari. It should be do-able in most other browsers, but it might be a little complex and take some time. The basic setup here is that Google Docs doesn’t put anything in the rich text/HTML representation of the document that differentiates between the suggested and normal text. However, there is some info about the suggestions in the "Docs Slice" proprietary format of the data. Safari’s security restrictions prevent us from reading that data from the pasteboard (since it comes from a different domain, we only get the standardized formats and nothing proprietary/custom), but we can check it in most other browsers. In the docs slice, we have For example, the text (where
Has slice clip data like: {
"resolved": {
"dsl_spacers": "This is a test of suggested changes toin documents.",
"dsl_suggestedinsertions": {
"sgsl_sugg": [
[],
null, // repeated nulls for indexes 1-17
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
["suggest.36xzw8xfadwd"], // at index 18
null, // repeated nulls for indexes 19-27
null,
null,
null,
null,
null,
null,
null,
null,
[], // at index 28
null, // repeated nulls for indexes 29-35
null,
null,
null,
null,
null,
null,
["suggest.mtgbiqaxvzgz"], // at index 36
null,
[] // at index 38
]
},
"dsl_suggesteddeletions": {
"sgsl_sugg": [
[],
null, // repeated nulls for indexes 1-37
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
["suggest.mtgbiqaxvzgz"], // at index 38
null,
[] // at index 40
]
}
// ...other properties...
}
} The values are in the form: |
@hftf in the mean time (or if you are in Safari), I think the best you can really do is switch the doc to “viewing” mode (instead of “editing” or “suggesting”) and copy from there. Unfortunately that hides the suggestions, rather than taking/using them. |
Thank you for investigating! I don't think I have the bandwidth to learn the codebase and make a PR at the moment, so will await progress if there is any! |
This adds handling for suggested changes in a Google Doc. Before, if there were suggestions in the text, we'd show them in a totally undifferentiated way right next to the original text, which could make things appear totally garbled. This also adds a settings UI for choosing how to convert the suggestions: you can show them marked up as insertions and deletions in the markdown, accept them and render them as normal text, or reject them and render the markdown as if they weren’t there (the default). Settings are saved in localStorage so it’s consistent across uses and page loads. I've been meaning to add settings like this for a while, and a followup change will add the ability to choose how heading IDs are handled. This also has infrastructure we can re-use in the future for linking to bookmarks in the text. Fixes #194.
Currently, both are concatenated one after the other, sometimes causing incomprehensible output.
The text was updated successfully, but these errors were encountered: