(core) tweak embedding to play well with forking

Summary:
In the transition from a "pre-fork" to fork, when embedded,
the fork ends up being read-only and changes fail.  This commit
avoids applying the read-only default to forks.

If a user actually wants to specifically embed a fork as read-only,
they can still do so, by explicitly adding `/m/view`.

Test Plan: added test

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2723
This commit is contained in:
Paul Fitzpatrick 2021-02-04 14:28:18 -05:00
parent c9fa13eadc
commit fc56cc7231

View File

@ -257,8 +257,8 @@ export function decodeUrl(gristConfig: Partial<GristLoadConfig>, location: Locat
}
if (sp.has('embed')) {
const embed = state.params!.embed = isAffirmative(sp.get('embed'));
// Turn view mode on if no mode has been specified.
if (embed && !state.mode) { state.mode = 'view'; }
// Turn view mode on if no mode has been specified, and not a fork.
if (embed && !state.mode && !state.fork) { state.mode = 'view'; }
// Turn on light style if no style has been specified.
if (embed && !state.params!.style) { state.params!.style = 'light'; }
}