diff options
author | geireann <60007097+geireann@users.noreply.github.com> | 2021-08-02 12:09:22 -0400 |
---|---|---|
committer | geireann <60007097+geireann@users.noreply.github.com> | 2021-08-02 12:09:22 -0400 |
commit | 77c6321843e6f45765155526de49aee4c041a372 (patch) | |
tree | 824aef0756f6bd4d0f8e0b3d1def024455321ed9 /src/fields/Doc.ts | |
parent | 149b2de414812063bc8c81305f284f74a24481cb (diff) | |
parent | 077723a6863bbb537756180450bdf9addeec021a (diff) |
Merge branch 'master' into aubrey-bugfix
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 976bd5ee1..74fa3fd91 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -597,7 +597,7 @@ export namespace Doc { const mapped = cloneMap.get(id); return href + (mapped ? mapped[Id] : id); }; - const regex = `(${Utils.prepend("/doc/")})([^"]*)`; + const regex = `(${Doc.localServerPath()})([^"]*)`; const re = new RegExp(regex, "g"); copy[key] = new RichTextField(field.Data.replace(/("textId":|"audioId":|"anchorId":)"([^"]+)"/g, replacer).replace(re, replacer2), field.Text); }); @@ -897,6 +897,16 @@ export namespace Doc { return true; } + + // converts a document id to a url path on the server + export function globalServerPath(doc: Doc | string = ""): string { + return Utils.prepend("/doc/" + (doc instanceof Doc ? doc[Id] : doc)); + } + // converts a document id to a url path on the server + export function localServerPath(doc?: Doc): string { + return "/doc/" + (doc ? doc[Id] : ""); + } + export function overlapping(doc1: Doc, doc2: Doc, clusterDistance: number) { const doc2Layout = Doc.Layout(doc2); const doc1Layout = Doc.Layout(doc1); |