aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/documents')
-rw-r--r--src/client/documents/DocumentTypes.ts43
-rw-r--r--src/client/documents/Documents.ts29
2 files changed, 48 insertions, 24 deletions
diff --git a/src/client/documents/DocumentTypes.ts b/src/client/documents/DocumentTypes.ts
index dba7ff907..161dff6e0 100644
--- a/src/client/documents/DocumentTypes.ts
+++ b/src/client/documents/DocumentTypes.ts
@@ -2,17 +2,17 @@ export enum DocumentType {
NONE = "none",
// core data types
- RTF = "rtf", // rich text
- IMG = "image", // image box
- WEB = "web", // web page or html clipping
- COL = "collection", // collection
- KVP = "kvp", // key value pane
- VID = "video", // video
- AUDIO = "audio", // audio
- PDF = "pdf", // pdf
- INK = "inks", // ink stroke
- SCREENSHOT = "screenshot", // view of a desktop application
- FONTICON = "fonticonbox", // font icon
+ RTF = "rtf",
+ IMG = "image",
+ WEB = "web",
+ COL = "collection",
+ KVP = "kvp",
+ VID = "video",
+ AUDIO = "audio",
+ PDF = "pdf",
+ INK = "inks",
+ SCREENSHOT = "screenshot",
+ FONTICON = "fonticonbox",
FILTER = "filter",
SEARCH = "search", // search query
LABEL = "label", // simple text label
@@ -23,19 +23,20 @@ export enum DocumentType {
SCRIPTING = "script", // script editor
EQUATION = "equation", // equation editor
FUNCPLOT = "funcplot", // function plotter
+ MAP = "map",
// special purpose wrappers that either take no data or are compositions of lower level types
- LINK = "link", // link (view of a document that acts as a link)
- LINKANCHOR = "linkanchor", // blue dot link anchor (view of a link document's anchor)
- IMPORT = "import", // directory import box (file system directory)
- SLIDER = "slider", // number slider (view of a number)
- PRES = "presentation", // presentation (view of a collection) --- shouldn't this be a view type? technically requires a special view in which documents must have their aliasOf fields filled in
- PRESELEMENT = "preselement",// presentation item (view of a document in a collection)
- COLOR = "color", // color picker (view of a color picker for a color string)
- YOUTUBE = "youtube", // youtube directory (view of you tube search results)
+ LINK = "link",
+ LINKANCHOR = "linkanchor",
+ IMPORT = "import",
+ SLIDER = "slider",
+ PRES = "presentation",
+ PRESELEMENT = "preselement",
+ COLOR = "color",
+ YOUTUBE = "youtube",
SEARCHITEM = "searchitem",
- COMPARISON = "comparison", // before/after view with slider (view of 2 images)
- GROUP = "group", // group of users
+ COMPARISON = "comparison",
+ GROUP = "group",
LINKDB = "linkdb", // database of links ??? why do we have this
SCRIPTDB = "scriptdb", // database of scripts
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 142c37ea4..9740f81ef 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -11,7 +11,7 @@ import { RichTextField } from "../../fields/RichTextField";
import { SchemaHeaderField } from "../../fields/SchemaHeaderField";
import { ComputedField, ScriptField } from "../../fields/ScriptField";
import { Cast, NumCast, StrCast } from "../../fields/Types";
-import { AudioField, ImageField, PdfField, VideoField, WebField, YoutubeField } from "../../fields/URLField";
+import { AudioField, ImageField, MapField, PdfField, VideoField, WebField, YoutubeField } from "../../fields/URLField";
import { SharingPermissions } from "../../fields/util";
import { MessageStore } from "../../server/Message";
import { Upload } from "../../server/SharedMediaTypes";
@@ -60,6 +60,7 @@ import { EquationBox } from "../views/nodes/EquationBox";
import { FunctionPlotBox } from "../views/nodes/FunctionPlotBox";
import { CurrentUserUtils } from "../util/CurrentUserUtils";
import { FieldViewProps } from "../views/nodes/FieldView";
+import { MapBox } from "../views/nodes/MapBox/MapBox";
const path = require('path');
const defaultNativeImageDim = Number(DFLT_IMAGE_NATIVE_DIM.replace("px", ""));
@@ -362,6 +363,10 @@ export namespace Docs {
layout: { view: PDFBox, dataField: defaultDataKey },
options: { _curPage: 1, _fitWidth: true, links: ComputedField.MakeFunction("links(self)") as any }
}],
+ [DocumentType.MAP, {
+ layout: { view: MapBox, dataField: defaultDataKey },
+ options: { _height: 600, _width: 800, links: ComputedField.MakeFunction("links(self)") as any }
+ }],
[DocumentType.IMPORT, {
layout: { view: DirectoryImportBox, dataField: defaultDataKey },
options: { _height: 150 }
@@ -717,6 +722,14 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.WEB), new HtmlField(html), options);
}
+ export function MapDocument(documents: Array<Doc>, options: DocumentOptions = {}) {
+ return InstanceFromProto(Prototypes.get(DocumentType.MAP), new List(documents), options);
+ }
+
+ export function MapMarkerDocument(documents: Array<Doc>, options: DocumentOptions, id?: string) {
+ return InstanceFromProto(Prototypes.get(DocumentType.MARKER), new List(documents), options, id);
+ }
+
export function KVPDocument(document: Doc, options: DocumentOptions = {}) {
return InstanceFromProto(Prototypes.get(DocumentType.KVP), document, { title: document.title + ".kvp", ...options });
}
@@ -742,7 +755,7 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { ...options, _viewType: CollectionViewType.Linear }, id);
}
- export function MapDocument(documents: Array<Doc>, options: DocumentOptions = {}) {
+ export function MapCollectionDocument(documents: Array<Doc>, options: DocumentOptions = {}) {
return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { ...options, _viewType: CollectionViewType.Map });
}
@@ -1068,7 +1081,11 @@ export namespace DocUtils {
} else if (field instanceof List && field[0] instanceof Doc) {
created = Docs.Create.StackingDocument(DocListCast(field), resolved);
layout = CollectionView.LayoutString;
- } else {
+ } else if (field instanceof MapField) {
+ created = Docs.Create.MapDocument(DocListCast(field), resolved);
+ layout = MapBox.LayoutString;
+ }
+ else {
created = Docs.Create.TextDocument("", { ...{ _width: 200, _height: 25, _autoHeight: true }, ...resolved });
layout = FormattedTextBox.LayoutString;
}
@@ -1099,6 +1116,12 @@ export namespace DocUtils {
if (!options._width) options._width = 400;
if (!options._height) options._height = (options._width as number) * 1200 / 927;
}
+ //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('/');