diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/documents/DocumentTypes.ts | 2 | ||||
-rw-r--r-- | src/client/documents/Documents.ts | 4 | ||||
-rw-r--r-- | src/client/util/CurrentUserUtils.ts | 4 | ||||
-rw-r--r-- | src/client/views/nodes/PresBox.tsx | 5 | ||||
-rw-r--r-- | src/fields/Doc.ts | 3 | ||||
-rw-r--r-- | src/fields/URLField.ts | 1 | ||||
-rw-r--r-- | src/fields/documentSchemas.ts | 2 | ||||
-rw-r--r-- | src/server/ApiManagers/DownloadManager.ts | 2 | ||||
-rw-r--r-- | src/server/ApiManagers/SearchManager.ts | 1 | ||||
-rw-r--r-- | src/server/GarbageCollector.ts | 2 | ||||
-rw-r--r-- | src/server/remapUrl.ts | 3 | ||||
-rw-r--r-- | src/server/updateProtos.ts | 2 | ||||
-rw-r--r-- | src/server/websocket.ts | 1 |
13 files changed, 20 insertions, 12 deletions
diff --git a/src/client/documents/DocumentTypes.ts b/src/client/documents/DocumentTypes.ts index 422d9c2e3..5bd5590b7 100644 --- a/src/client/documents/DocumentTypes.ts +++ b/src/client/documents/DocumentTypes.ts @@ -23,7 +23,7 @@ export enum DocumentType { SCRIPTING = "script", EQUATION = "equation", FUNCPLOT = "funcplot", - MAP = "MAP", + MAP = "map", // special purpose wrappers that either take no data or are compositions of lower level types diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 5ec0b0063..b17d3b3a1 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(initial: List<Doc> = new List(), options: DocumentOptions = {}) { - return InstanceFromProto(Prototypes.get(DocumentType.MAP), initial, options); + export function MapDocument(url: string, options: DocumentOptions = {}) { + return InstanceFromProto(Prototypes.get(DocumentType.MAP), new MapField(new URL(url)), options); } export function KVPDocument(document: Doc, options: DocumentOptions = {}) { diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 21c4ac110..366207334 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -448,8 +448,8 @@ 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(new List<Doc>(), { title: "google map", _width: 800, _height: 600, system: true, cloneFieldFilter: new List<string>(["system"]) }); - // ((doc.emptyMap as Doc).proto as Doc)["dragFactory-count"] = 0; + doc.emptyMap = Docs.Create.MapDocument(new List<Doc>(), { 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) { this.setupActiveMobileMenu(doc); diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 693348613..11a735645 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -80,7 +80,7 @@ const PresBoxDocument = makeInterface(documentSchema); @observer export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>(PresBoxDocument) { public static LayoutString(fieldKey: string) { return FieldView.LayoutString(PresBox, fieldKey); } - + /** * transitions & effects for documents * @param renderDoc @@ -1263,7 +1263,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema> <input className="presBox-input" type="number" value={duration} onChange={action((e) => this.setDurationTime(e.target.value))} /> s - </div> + </div> <div className="ribbon-propertyUpDown"> <div className="ribbon-propertyUpDownItem" onClick={undoBatch(() => this.setDurationTime(String(duration), 1000))}> <FontAwesomeIcon icon={"caret-up"} /> @@ -1855,6 +1855,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema> case DocumentType.VID: type = "Video"; break; case DocumentType.IMG: type = "Image"; break; case DocumentType.WEB: type = "Web page"; break; + case DocumentType.MAP: type = "Map"; break; default: type = "Other node"; break; } } diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 63d491b07..7cf29b168 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -20,7 +20,7 @@ import { RichTextField } from "./RichTextField"; import { listSpec } from "./Schema"; import { ComputedField, ScriptField } from "./ScriptField"; import { Cast, FieldValue, NumCast, StrCast, ToConstructor } from "./Types"; -import { AudioField, ImageField, PdfField, VideoField, WebField } from "./URLField"; +import { AudioField, ImageField, MapField, PdfField, VideoField, WebField } from "./URLField"; import { deleteProperty, GetEffectiveAcl, getField, getter, makeEditable, makeReadOnly, normalizeEmail, setter, SharingPermissions, updateFunction } from "./util"; import JSZip = require("jszip"); @@ -618,6 +618,7 @@ export namespace Doc { else if (value instanceof AudioField) return { url: value.url.href, __type: "audio" }; else if (value instanceof VideoField) return { url: value.url.href, __type: "video" }; else if (value instanceof WebField) return { url: value.url.href, __type: "web" }; + else if (value instanceof MapField) return { url: value.url.href, __type: "map" }; else if (value instanceof DateField) return { date: value.toString(), __type: "date" }; else if (value instanceof ProxyField) return { fieldId: value.fieldId, __type: "proxy" }; else if (value instanceof Array && key !== "fields") return { fields: value, __type: "list" }; diff --git a/src/fields/URLField.ts b/src/fields/URLField.ts index fb71160ca..48535edf0 100644 --- a/src/fields/URLField.ts +++ b/src/fields/URLField.ts @@ -48,6 +48,7 @@ export const nullAudio = "https://actions.google.com/sounds/v1/alarms/beep_short @scriptingGlobal @Deserializable("video") export class VideoField extends URLField { } @scriptingGlobal @Deserializable("pdf") export class PdfField extends URLField { } @scriptingGlobal @Deserializable("web") export class WebField extends URLField { } +@scriptingGlobal @Deserializable("map") export class MapField extends URLField { } @scriptingGlobal @Deserializable("youtube") export class YoutubeField extends URLField { } @scriptingGlobal @Deserializable("webcam") export class WebCamField extends URLField { } diff --git a/src/fields/documentSchemas.ts b/src/fields/documentSchemas.ts index f17a390a6..b114fcf2d 100644 --- a/src/fields/documentSchemas.ts +++ b/src/fields/documentSchemas.ts @@ -27,6 +27,8 @@ export const documentSchema = createSchema({ z: "number", // z "coordinate" - non-zero specifies the overlay layer of a freeformview zIndex: "number", // zIndex of a document in a freeform view _scrollTop: "number", // scroll position of a scrollable document (pdf, text, web) + lat: "number", + lng: "number", // appearance properties on the layout "_backgroundGrid-spacing": "number", // the size of the grid for collection views diff --git a/src/server/ApiManagers/DownloadManager.ts b/src/server/ApiManagers/DownloadManager.ts index 0d4472fdc..2175b6db6 100644 --- a/src/server/ApiManagers/DownloadManager.ts +++ b/src/server/ApiManagers/DownloadManager.ts @@ -112,7 +112,7 @@ async function getDocs(id: string) { const pathname = new URL(urlString).pathname; files.add(pathname); } - } else if (["audio", "image", "video", "pdf", "web"].includes(field.__type)) { + } else if (["audio", "image", "video", "pdf", "web", "map"].includes(field.__type)) { const url = new URL(field.url); const pathname = url.pathname; files.add(pathname); diff --git a/src/server/ApiManagers/SearchManager.ts b/src/server/ApiManagers/SearchManager.ts index 775e90520..a74e13a62 100644 --- a/src/server/ApiManagers/SearchManager.ts +++ b/src/server/ApiManagers/SearchManager.ts @@ -185,6 +185,7 @@ export namespace SolrManager { "pdf": ["_t", "url"], "audio": ["_t", "url"], "web": ["_t", "url"], + "map": ["_t", "url"], "date": ["_d", value => new Date(value.date).toISOString()], "proxy": ["_i", "fieldId"], "prefetch_proxy": ["_i", "fieldId"], diff --git a/src/server/GarbageCollector.ts b/src/server/GarbageCollector.ts index 7c441e3c0..c60880882 100644 --- a/src/server/GarbageCollector.ts +++ b/src/server/GarbageCollector.ts @@ -45,7 +45,7 @@ function addDoc(doc: any, ids: string[], files: { [name: string]: string[] }) { } exts.push(ext); } - } else if (["audio", "image", "video", "pdf", "web"].includes(field.__type)) { + } else if (["audio", "image", "video", "pdf", "web", "map"].includes(field.__type)) { const url = new URL(field.url); const pathname = url.pathname; const ext = path.extname(pathname); diff --git a/src/server/remapUrl.ts b/src/server/remapUrl.ts index 7178add93..e9f9da25a 100644 --- a/src/server/remapUrl.ts +++ b/src/server/remapUrl.ts @@ -8,7 +8,8 @@ const suffixMap: { [type: string]: true } = { "pdf": true, "audio": true, "web": true, - "image": true + "image": true, + "map": true, }; async function update() { diff --git a/src/server/updateProtos.ts b/src/server/updateProtos.ts index e9860bd61..c5552f6bf 100644 --- a/src/server/updateProtos.ts +++ b/src/server/updateProtos.ts @@ -1,7 +1,7 @@ import { Database } from "./database"; const protos = - ["text", "image", "web", "collection", "kvp", "video", "audio", "pdf", "icon", "import", "linkdoc"]; + ["text", "image", "web", "collection", "kvp", "video", "audio", "pdf", "icon", "import", "linkdoc", "map"]; (async function () { await Promise.all( diff --git a/src/server/websocket.ts b/src/server/websocket.ts index 4ae97913f..115baa0be 100644 --- a/src/server/websocket.ts +++ b/src/server/websocket.ts @@ -229,6 +229,7 @@ export namespace WebSocket { "pdf": ["_t", "url"], "audio": ["_t", "url"], "web": ["_t", "url"], + "map": ["_t", "url"], "script": ["_t", value => value.script.originalScript], "RichTextField": ["_t", value => value.Text], "date": ["_d", value => new Date(value.date).toISOString()], |