(core) support a ?compare=<docId2> option in document landing pages

Summary:
If a `compare` query parameter is supplied, this diff will load
the difference between the referenced document and the current
document into an observable in the GristDoc.

Nothing is done with the comparison yet.  Comparisons are not
yet live - they don't get updated if either document changes.

For convenience, `window.gristDocPageModel` is set as an easy
way to access the DocPageModel from the browser console.

Test Plan: added test

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2615
pull/4/head
Paul Fitzpatrick 4 years ago
parent dfdb54fcbd
commit b33641dd0c

@ -65,6 +65,7 @@ export interface IGristUrlState {
billingTask?: BillingTask;
embed?: boolean;
style?: InterfaceStyle;
compare?: string;
};
hash?: HashLink; // if present, this specifies an individual row within a section of a page.
}
@ -256,6 +257,9 @@ export function decodeUrl(gristConfig: Partial<GristLoadConfig>, location: Locat
// Turn on light style if no style has been specified.
if (embed && !state.params!.style) { state.params!.style = 'light'; }
}
if (sp.has('compare')) {
state.params!.compare = sp.get('compare')!;
}
if (location.hash) {
const hash = location.hash;
const hashParts = hash.split('.');

Loading…
Cancel
Save