aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-03-09 10:50:15 -0500
committerbobzel <zzzman@gmail.com>2021-03-09 10:50:15 -0500
commit72f9988e5750f38d725aa0dd78e9af39a8794808 (patch)
tree3771318fdff2a844d3b3221ff8ca1409b8a36a50 /src/client/documents/Documents.ts
parent2beec2fd2075f210054095dcd028c056dab48e28 (diff)
fixed following portal link to reset camera position. prevent warning errors in loading screen. hide textsidebar until text is selected. fixed link titles to handle case when link anchor is the link document and not infinitely recurse.
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 0da80d2c4..754a0d0f8 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -59,6 +59,7 @@ import { DashWebRTCVideo } from "../views/webcam/DashWebRTCVideo";
import { DocumentType } from "./DocumentTypes";
import { EquationBox } from "../views/nodes/EquationBox";
import { FunctionPlotBox } from "../views/nodes/FunctionPlotBox";
+import { script } from "googleapis/build/src/apis/script";
const path = require('path');
const defaultNativeImageDim = Number(DFLT_IMAGE_NATIVE_DIM.replace("px", ""));
@@ -1135,7 +1136,7 @@ export namespace DocUtils {
linkDoc.hidden = true;
Doc.GetProto(linkDoc)["acl-Public"] = linkDoc["acl-Public"] = SharingPermissions.Add;
linkDoc.layout_linkView = Cast(Cast(Doc.UserDoc()["template-button-link"], Doc, null).dragFactory, Doc, null);
- Doc.GetProto(linkDoc).title = ComputedField.MakeFunction('self.anchor1?.title +" (" + (self.linkRelationship||"to") +") " + self.anchor2?.title');
+ Doc.GetProto(linkDoc).title = ComputedField.MakeFunction("generateLinkTitle(self)");
showPopup && makeLink(linkDoc, showPopup);
return linkDoc;
}
@@ -1416,4 +1417,10 @@ export namespace DocUtils {
}
Scripting.addGlobal("Docs", Docs);
-Scripting.addGlobal(function makeDelegate(proto: any) { const d = Docs.Create.DelegateDocument(proto, { title: "child of " + proto.title }); return d; }); \ No newline at end of file
+Scripting.addGlobal(function makeDelegate(proto: any) { const d = Docs.Create.DelegateDocument(proto, { title: "child of " + proto.title }); return d; });
+Scripting.addGlobal(function generateLinkTitle(self: Doc) {
+ const anchor1title = self.anchor1 && self.anchor1 !== self ? Cast(self.anchor1, Doc, null).title : "<?>";
+ const anchor2title = self.anchor2 && self.anchor2 !== self ? Cast(self.anchor2, Doc, null).title : "<?>";
+ const relation = self.linkRelationship || "to";
+ return `${anchor1title} (${relation}) ${anchor2title}`;
+}) \ No newline at end of file