diff options
| author | Bob Zeleznik <zzzman@gmail.com> | 2019-10-09 23:30:36 -0400 |
|---|---|---|
| committer | Bob Zeleznik <zzzman@gmail.com> | 2019-10-09 23:30:36 -0400 |
| commit | 5617124a794b8d256e3d24b143b8dd2403cce993 (patch) | |
| tree | 673a288cdbc853d697c2d8294312f563ae9f4e60 /src/client/util/History.ts | |
| parent | 2cc7ca6b267d9dd6b1683d59b6966a021339bc18 (diff) | |
| parent | 3b1345616bf2f7101a21c182e0c9719b1e31f899 (diff) | |
merged
Diffstat (limited to 'src/client/util/History.ts')
| -rw-r--r-- | src/client/util/History.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/util/History.ts b/src/client/util/History.ts index e9ff21b22..899abbe40 100644 --- a/src/client/util/History.ts +++ b/src/client/util/History.ts @@ -16,8 +16,10 @@ export namespace HistoryUtil { initializers?: { [docId: string]: DocInitializerList; }; + safe?: boolean; readonly?: boolean; nro?: boolean; + sharing?: boolean; } export type ParsedUrl = DocUrl; @@ -52,7 +54,9 @@ export namespace HistoryUtil { } export function getState(): ParsedUrl { - return copyState(history.state); + let state = copyState(history.state); + state.initializers = state.initializers || {}; + return state; } // export function addHandler(handler: (state: ParsedUrl | null) => void) { @@ -141,7 +145,7 @@ export namespace HistoryUtil { }; } - addParser("doc", {}, { readonly: true, initializers: true, nro: true }, (pathname, opts, current) => { + addParser("doc", {}, { readonly: true, initializers: true, nro: true, sharing: true }, (pathname, opts, current) => { if (pathname.length !== 2) return undefined; current.initializers = current.initializers || {}; @@ -156,7 +160,7 @@ export namespace HistoryUtil { export function parseUrl(location: Location | URL): ParsedUrl | undefined { const pathname = location.pathname.substring(1); const search = location.search; - const opts = qs.parse(search, { sort: false }); + const opts = search.length ? qs.parse(search, { sort: false }) : {}; let pathnameSplit = pathname.split("/"); const type = pathnameSplit[0]; |
