(core) Fix browser history bug with tutorials

Summary:
History wasn't being replaced in some cases, which was
causing a bug where trying to leave a tutorial fork via the
browser's back button would navigate back to the trunk, and
trigger forking again. This effectively made it impossible to
leave a tutorial.

Also adds support for specifying custom CSS classes for
tutorial Markdown images.

Test Plan: Browser test.

Reviewers: JakubSerafin

Reviewed By: JakubSerafin

Differential Revision: https://phab.getgrist.com/D3866
This commit is contained in:
George Gevoian
2023-04-17 22:23:12 -04:00
parent 69fea132de
commit b15ae98349
4 changed files with 40 additions and 9 deletions

View File

@@ -240,9 +240,9 @@ export class DocPageModelImpl extends Disposable implements DocPageModel {
public updateUrlNoReload(
urlId: string,
urlOpenMode: OpenDocMode,
options: {removeSlug?: boolean, replaceUrl?: boolean} = {removeSlug: false, replaceUrl: true}
options: {removeSlug?: boolean, replaceUrl?: boolean} = {}
) {
const {removeSlug, replaceUrl} = options;
const {removeSlug = false, replaceUrl = true} = options;
const state = urlState().state.get();
const nextState = {
...state,