diff options
| author | bob <bcz@cs.brown.edu> | 2019-09-16 17:13:16 -0400 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2019-09-16 17:13:16 -0400 |
| commit | 999cd7deb87ce5c6430a5f8e0e1721033736bbab (patch) | |
| tree | 5e78a64c44f3e12c6595ca6b41e58549df6fbc81 /src/client/views/collections/collectionFreeForm | |
| parent | 2f1741cf291c69ce55b87116bd24edd2f940141d (diff) | |
cleaned up titling of icons and summaries.
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/MarqueeView.tsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx index 5cab6f8e0..d74fbafb3 100644 --- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx +++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx @@ -23,6 +23,8 @@ import { SchemaHeaderField, RandomPastel } from "../../../../new_fields/SchemaHe import { string } from "prop-types"; import { listSpec } from "../../../../new_fields/Schema"; import { CurrentUserUtils } from "../../../../server/authentication/models/current_user_utils"; +import { CompileScript } from "../../../util/Scripting"; +import { ComputedField } from "../../../../new_fields/ScriptField"; interface MarqueeViewProps { getContainerTransform: () => Transform; @@ -309,7 +311,7 @@ export class MarqueeView extends React.Component<MarqueeViewProps> defaultBackgroundColor: this.props.container.isAnnotationOverlay ? undefined : chosenColor, width: bounds.width, height: bounds.height, - title: e.key === "s" || e.key === "S" ? "-summary-" : "a nested collection", + title: "a nested collection", }); let dataExtensionField = Doc.CreateDocumentExtensionForField(newCollection, "data"); dataExtensionField.ink = inkData ? new InkField(this.marqueeInkSelect(inkData)) : undefined; @@ -325,9 +327,11 @@ export class MarqueeView extends React.Component<MarqueeViewProps> }); newCollection.chromeStatus = "disabled"; let summary = Docs.Create.TextDocument({ x: bounds.left, y: bounds.top, width: 300, height: 100, autoHeight: true, backgroundColor: "#e2ad32" /* yellow */, title: "-summary-" }); - summary.proto!.maximizeLocation = "inTab"; // or "inPlace", or "onRight" - newCollection.proto!.summaryDoc = summary; + Doc.GetProto(summary).maximizeLocation = "inTab"; // or "inPlace", or "onRight" + Doc.GetProto(newCollection).summaryDoc = summary; newCollection.x = bounds.left + bounds.width; + let computed = CompileScript(`return summaryTitle(this);`, { params: { this: "Doc" }, typecheck: false }); + computed.compiled && (Doc.GetProto(newCollection).title = new ComputedField(computed)); if (e.key === "s") { // summary is wrapped in an expand/collapse container that also contains the summarized documents in a free form view. let container = Docs.Create.FreeformDocument([summary, newCollection], { x: bounds.left, y: bounds.top, width: 300, height: 200, chromeStatus: "disabled", title: "-summary-" }); container.viewType = CollectionViewType.Stacking; |
