diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/documents/Documents.ts | 19 | ||||
-rw-r--r-- | src/client/util/CurrentUserUtils.ts | 13 | ||||
-rw-r--r-- | src/client/views/nodes/MapBox/MapBox.tsx | 16 |
3 files changed, 23 insertions, 25 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index b17d3b3a1..a48bba24c 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -802,8 +802,8 @@ export namespace Docs { return InstanceFromProto(Prototypes.get(DocumentType.WEB), new HtmlField(html), options); } - export function MapDocument(url: string, options: DocumentOptions = {}) { - return InstanceFromProto(Prototypes.get(DocumentType.MAP), new MapField(new URL(url)), options); + export function MapDocument(documents: Array<Doc>, options: DocumentOptions = {}) { + return InstanceFromProto(Prototypes.get(DocumentType.MAP), new List(documents), options); } export function KVPDocument(document: Doc, options: DocumentOptions = {}) { @@ -1158,7 +1158,7 @@ export namespace DocUtils { created = Docs.Create.StackingDocument(DocListCast(field), resolved); layout = CollectionView.LayoutString; } else if (field instanceof MapField) { - created = Docs.Create.MapDocument((field).url.href, resolved); + created = Docs.Create.MapDocument(DocListCast(field), resolved); layout = MapBox.LayoutString; } else { @@ -1192,11 +1192,12 @@ export namespace DocUtils { if (!options._width) options._width = 400; if (!options._height) options._height = (options._width as number) * 1200 / 927; } - if (type.indexOf("map") !== -1) { - ctor = Docs.Create.MapDocument; - if (!options._width) options._width = 800; - if (!options._height) options._height = (options._width as number) * 3 / 4; - } + //TODO:al+glr + // if (type.indexOf("map") !== -1) { + // ctor = Docs.Create.MapDocument; + // if (!options._width) options._width = 800; + // if (!options._height) options._height = (options._width as number) * 3 / 4; + // } if (type.indexOf("html") !== -1) { if (path.includes(window.location.hostname)) { const s = path.split('/'); @@ -1314,8 +1315,6 @@ export namespace DocUtils { fieldTemplate = Docs.Create.AudioDocument("http://www.cs.brown.edu", options); } else if (doc.data instanceof ImageField) { fieldTemplate = Docs.Create.ImageDocument("http://www.cs.brown.edu", options); - } else if (doc.data instanceof MapField) { - fieldTemplate = Docs.Create.MapDocument("http://www.cs.brown.edu", options); } const docTemplate = docLayoutTemplate || creator?.(fieldTemplate ? [fieldTemplate] : [], { title: customName + "(" + doc.title + ")", isTemplateDoc: true, _width: _width + 20, _height: Math.max(100, _height + 45) }); diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 4989cac7c..a3d837258 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -1,14 +1,15 @@ -import { computed, observable, reaction, action } from "mobx"; +import { computed, observable, reaction } from "mobx"; import * as rp from 'request-promise'; -import { DataSym, Doc, DocListCast, DocListCastAsync, AclReadonly } from "../../fields/Doc"; +import { DataSym, Doc, DocListCast, DocListCastAsync } from "../../fields/Doc"; import { Id } from "../../fields/FieldSymbols"; +import { InkTool } from "../../fields/InkField"; import { List } from "../../fields/List"; import { PrefetchProxy } from "../../fields/Proxy"; import { RichTextField } from "../../fields/RichTextField"; import { listSpec } from "../../fields/Schema"; import { SchemaHeaderField } from "../../fields/SchemaHeaderField"; import { ComputedField, ScriptField } from "../../fields/ScriptField"; -import { BoolCast, Cast, NumCast, PromiseValue, StrCast, DateCast } from "../../fields/Types"; +import { BoolCast, Cast, DateCast, NumCast, PromiseValue, StrCast } from "../../fields/Types"; import { nullAudio } from "../../fields/URLField"; import { SharingPermissions } from "../../fields/util"; import { Utils } from "../../Utils"; @@ -31,10 +32,8 @@ import { LinkManager } from "./LinkManager"; import { Scripting } from "./Scripting"; import { SearchUtil } from "./SearchUtil"; import { SelectionManager } from "./SelectionManager"; -import { UndoManager } from "./UndoManager"; import { SnappingManager } from "./SnappingManager"; -import { InkTool } from "../../fields/InkField"; -import { computedFn } from "mobx-utils"; +import { UndoManager } from "./UndoManager"; export let resolvedPorts: { server: number, socket: number }; @@ -448,7 +447,7 @@ export class CurrentUserUtils { doc.emptyWebpage = Docs.Create.WebDocument("", { title: "webpage", _nativeWidth: 850, isTemplateDoc: true, _height: 512, _width: 400, useCors: true, system: true, cloneFieldFilter: new List<string>(["system"]) }); } if (doc.emptyMap === undefined) { - doc.emptyMap = Docs.Create.MapDocument("", { title: "map", _width: 800, _height: 600, system: true, cloneFieldFilter: new List<string>(["system"]) }); + doc.emptyMap = Docs.Create.MapDocument([], { title: "map", _width: 800, _height: 600, system: true, cloneFieldFilter: new List<string>(["system"]) }); ((doc.emptyMap as Doc).proto as Doc)["dragFactory-count"] = 0; } if (doc.activeMobileMenu === undefined) { diff --git a/src/client/views/nodes/MapBox/MapBox.tsx b/src/client/views/nodes/MapBox/MapBox.tsx index aa220c4da..cc7bf6d84 100644 --- a/src/client/views/nodes/MapBox/MapBox.tsx +++ b/src/client/views/nodes/MapBox/MapBox.tsx @@ -287,15 +287,15 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps const { Document, fieldKey, isContentActive: active } = this.props; return <div className="MapBox"> - - <div className={"MapBox-contents"} + HELLO WORLD! + {/*<div className={"MapBox-contents"} style={{ pointerEvents: active() ? undefined : "none", overflow: 'hidden' }} onWheel={e => e.stopPropagation()} onPointerDown={e => (e.button === 0 && !e.ctrlKey) && e.stopPropagation()} > - {/* <LoadScript - googleMapsApiKey={process.env.GOOGLE_MAPS!} - libraries={['places', 'drawing']} - > */} + // {/* <LoadScript + // googleMapsApiKey={process.env.GOOGLE_MAPS!} + // libraries={['places', 'drawing']} + // > <div className="map-wrapper"> <GoogleMap mapContainerStyle={mapContainerStyle} @@ -355,7 +355,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps )} </GoogleMap> </div> - {/* </LoadScript > */} + {/* </LoadScript > <SidebarAnnos ref={this._sidebarRef} {...this.props} fieldKey={this.annotationKey} @@ -367,7 +367,7 @@ export class MapBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps removeDocument={this.removeDocument} isContentActive={this.isContentActive} /> - </div > + </div >*/} </div >; } |