aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-07-08 18:06:38 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-07-08 18:06:38 -0400
commitbe993c7bfd441a3a7d581371337c94fe692f0c65 (patch)
tree8e0f2a70d082327744ba885d922da4fd73fcf640 /src/client/views/nodes/FormattedTextBox.tsx
parentb2dc1c1d5e31a6241851d418db3a64ae6ca4dde8 (diff)
Added some stuff to GC and sped it up
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index bf6f4c764..af11e1524 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -89,9 +89,8 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
}
public static GetDocFromUrl(url: string) {
if (url.startsWith(document.location.origin)) {
- let start = url.indexOf(window.location.origin);
- let path = url.substr(start, url.length - start);
- let docid = path.replace(DocServer.prepend("/doc/"), "").split("?")[0];
+ const split = new URL(url).pathname.split("doc/");
+ const docid = split[split.length - 1];
return docid;
}
return "";