aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/documents/Documents.ts234
-rw-r--r--src/client/util/CurrentUserUtils.ts1
-rw-r--r--src/client/views/Main.tsx10
-rw-r--r--src/client/views/nodes/LabelBox.tsx2
4 files changed, 225 insertions, 22 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 1acba01a9..905ca324c 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -59,21 +59,26 @@ import { DocumentType } from "./DocumentTypes";
const path = require('path');
const defaultNativeImageDim = Number(DFLT_IMAGE_NATIVE_DIM.replace("px", ""));
+interface dinfo {
+ description: string;
+ type: string;
+ dflt?: any;
+}
export interface DocumentOptions {
- system?: boolean;
- _autoHeight?: boolean;
- _headerHeight?: number; // height of header of custom notes
- _headerFontSize?: number; // font size of header of custom notes
- _headerPointerEvents?: string; // types of events the header of a custom text document can consume
- _panX?: number;
- _panY?: number;
- _width?: number;
- _height?: number;
- _nativeWidth?: number;
- _nativeHeight?: number;
- _dimMagnitude?: number; // magnitude of collectionMulti{row,col} view element
- _dimUnit?: string; // "px" or "*" (default = "*")
- _fitWidth?: boolean;
+ system?: boolean | dinfo;
+ _autoHeight?: boolean | dinfo;
+ _headerHeight?: number | dinfo; // height of header of custom notes
+ _headerFontSize?: number | dinfo; // font size of header of custom notes
+ _headerPointerEvents?: string | dinfo; // types of events the header of a custom text document can consume
+ _panX?: number | dinfo;
+ _panY?: number | dinfo;
+ _width?: number | dinfo;
+ _height?: number | dinfo;
+ _nativeWidth?: number | dinfo;
+ _nativeHeight?: number | dinfo;
+ _dimMagnitude?: number | dinfo; // magnitude of collectionMulti{row,col} view element
+ _dimUnit?: string | dinfo; // "px" or "*" (default = "*")
+ _fitWidth?: boolean | dinfo;
_fitToBox?: boolean; // whether a freeformview should zoom/scale to create a shrinkwrapped view of its contents
_freeformLOD?: boolean; // whether to use LOD to render a freeform document
_showTitle?: string; // field name to display in header (:hover is an optional suffix)
@@ -232,8 +237,184 @@ export interface DocumentOptions {
isLabel?: boolean; // whether the document is a label or not (video / audio)
useLinkSmallAnchor?: boolean; // whether links to this document should use a miniature linkAnchorBox
border?: string; //for searchbox
- hovercolor?: string;
+ _hovercolor?: string;
}
+/*
+let _docOptions: DocumentOptions = {
+ system: { type: "string", description: "is document created/owned by the system", dflt: false },
+ _autoHeight: { type: "boolean", description: "whether document automatically resizes vertically to display contents", dflt: false },
+ _headerHeight: { type: "number", description: "height of document header used for displaying title", dflt: 20 },
+ _headerFontSize: { type: "number", description: "font size of header of custom notes", dflt: 12 },
+ _headerPointerEvents: { type: "string", description: "types of events the header of a custom text document can consume" },
+ _panX: { type: "number", description: "horizontal pan location of a freeform view" },
+ _panY: { type: "number", description: "vertical pan location of a freeform view" },
+ _width: { type: "number", description: "displayed width of a document" },
+ _height: { type: "number", description: "displayed height of document" },
+ _nativeWidth: { type: "number", description: "native width of document contents (e.g., the pixel width of an image)" },
+ _nativeHeight: { type: "number", description: "native height of document contents (e.g., the pixel height of an image)" },
+ _dimMagnitude: { type: "number", description: "magnitude of collectionMulti{row,col} element's width or height" },
+ _dimUnit: { type: "string", description: "units of collectionMulti{row,col} element's width or height - 'px' or '*' for pixels or relative units" },
+ _fitWidth: { type: "boolean", description: "whether document should scale its contents to fit its rendered width or not (e.g., for PDFviews)" }
+ /*_fitToBox?: boolean; // whether a freeformview should zoom/scale to create a shrinkwrapped view of its contents
+ _freeformLOD?: boolean; // whether to use LOD to render a freeform document
+ _showTitle?: string; // field name to display in header (:hover is an optional suffix)
+ _showCaption?: string; // which field to display in the caption area. leave empty to have no caption
+ _scrollTop?: number; // scroll location for pdfs
+ _noAutoscroll?: boolean;// whether collections autoscroll when this item is dragged
+ _chromeStatus?: string;
+ _searchDoc?: boolean; // is this a search document (used to change UI for search results in schema view)
+ _viewType?: string; // sub type of a collection
+ _gridGap?: number; // gap between items in masonry view
+ _xMargin?: number; // gap between left edge of document and start of masonry/stacking layouts
+ _yMargin?: number; // gap between top edge of dcoument and start of masonry/stacking layouts
+ _xPadding?: number;
+ _yPadding?: number;
+ _itemIndex?: number; // which item index the carousel viewer is showing
+ _showSidebar?: boolean; //whether an annotationsidebar should be displayed for text docuemnts
+ _singleLine?: boolean; // whether text document is restricted to a single line (carriage returns make new document)
+ "_carousel-caption-xMargin"?: number;
+ "_carousel-caption-yMargin"?: number;
+ x?: number;
+ y?: number;
+ z?: number;
+ author?: string;
+ _hideContextMenu?: boolean; // whether the context menu can be shown
+ dropAction?: dropActionType;
+ childDropAction?: dropActionType;
+ targetDropAction?: dropActionType;
+ layoutKey?: string;
+ type?: string;
+ title?: string;
+ version?: string; // version identifier for a document
+ label?: string;
+ hidden?: boolean;
+ userDoc?: Doc; // the userDocument
+ toolTip?: string; // tooltip to display on hover
+ style?: string;
+ page?: number;
+ dontUndo?: boolean; // whether button clicks should be undoable (this is set to true for Undo/Redo/and sidebar buttons that open the siebar panel)
+ description?: string; // added for links
+ _viewScale?: number;
+ _overflow?: string;
+ forceActive?: boolean;
+ layout?: string | Doc; // default layout string for a document
+ contentPointerEvents?: string; // pointer events allowed for content of a document view. eg. set to "none" in menuSidebar for sharedDocs so that you can select a document, but not interact with its contents
+ childLimitHeight?: number; // whether to limit the height of colleciton children. 0 - means height can be no bigger than width
+ childLayoutTemplate?: Doc; // template for collection to use to render its children (see PresBox or Buxton layout in tree view)
+ childLayoutString?: string; // template string for collection to use to render its children
+ hideLinkButton?: boolean; // whether the blue link counter button should be hidden
+ hideAllLinks?: boolean; // whether all individual blue anchor dots should be hidden
+ _columnsHideIfEmpty?: boolean; // whether stacking view column headings should be hidden
+ isTemplateForField?: string; // the field key for which the containing document is a rendering template
+ isTemplateDoc?: boolean;
+ watchedDocuments?: Doc; // list of documents to "watch" in an icon doc to display a badge
+ targetScriptKey?: string; // where to write a template script (used by collections with click templates which need to target onClick, onDoubleClick, etc)
+ templates?: List<string>;
+ hero?: ImageField; // primary image that best represents a compound document (e.g., for a buxton device document that has multiple images)
+ backgroundColor?: string | ScriptField; // background color for data doc
+ _backgroundColor?: string | ScriptField; // background color for each template layout doc ( overrides backgroundColor )
+ color?: string; // foreground color data doc
+ _color?: string; // foreground color for each template layout doc (overrides color)
+ _clipWidth?: number; // percent transition from before to after in comparisonBox
+ caption?: RichTextField;
+ ignoreClick?: boolean;
+ lockedPosition?: boolean; // lock the x,y coordinates of the document so that it can't be dragged
+ _lockedTransform?: boolean; // lock the panx,pany and scale parameters of the document so that it be panned/zoomed
+ isAnnotating?: boolean; // whether we web document is annotation mode where links can't be clicked to allow annotations to be created
+ opacity?: number;
+ defaultBackgroundColor?: string;
+ _layers?: List<string>;
+ _raiseWhenDragged?: boolean; // whether a document is brought to front when dragged.
+ isLinkButton?: boolean;
+ isFolder?: boolean;
+ _columnWidth?: number;
+ _fontSize?: string;
+ _fontWeight?: number;
+ _fontFamily?: string;
+ _curPage?: number;
+ _currentTimecode?: number; // the current timecode of a time-based document (e.g., current time of a video) value is in seconds
+ _currentFrame?: number; // the current frame of a frame-based collection (e.g., progressive slide)
+ _timecodeToShow?: number; // the time that a document should be displayed (e.g., when an annotation shows up as a video plays)
+ _timecodeToHide?: number; // the time that a document should be hidden
+ _timelineLabel?: boolean; // whether the document exists on a timeline
+ lastFrame?: number; // the last frame of a frame-based collection (e.g., progressive slide)
+ activeFrame?: number; // the active frame of a document in a frame base collection
+ appearFrame?: number; // the frame in which the document appears
+ presTransition?: number; //the time taken for the transition TO a document
+ presDuration?: number; //the duration of the slide in presentation view
+ presProgressivize?: boolean;
+ borderRounding?: string;
+ boxShadow?: string;
+ dontRegisterChildViews?: boolean;
+ dontRegisterView?: boolean;
+ lookupField?: ScriptField; // script that returns the value of a field. This script is passed the rootDoc, layoutDoc, field, and container of the document. see PresBox.
+ "onDoubleClick-rawScript"?: string; // onDoubleClick script in raw text form
+ "onChildDoubleClick-rawScript"?: string; // onChildDoubleClick script in raw text form
+ "onChildClick-rawScript"?: string; // on ChildClick script in raw text form
+ "onClick-rawScript"?: string; // onClick script in raw text form
+ "onCheckedClick-rawScript"?: string; // onChecked script in raw text form
+ "onCheckedClick-params"?: List<string>; // parameter list for onChecked treeview functions
+ _pivotField?: string; // field key used to determine headings for sections in stacking, masonry, pivot views
+ _columnHeaders?: List<SchemaHeaderField>; // headers for stacking views
+ _schemaHeaders?: List<SchemaHeaderField>; // headers for schema view
+ dockingConfig?: string;
+ annotationOn?: Doc;
+ isPushpin?: boolean;
+ removeDropProperties?: List<string>; // list of properties that should be removed from a document when it is dropped. e.g., a creator button may be forceActive to allow it be dragged, but the forceActive property can be removed from the dropped document
+ dbDoc?: Doc;
+ iconShape?: string; // shapes of the fonticon border
+ linkRelationship?: string; // type of relatinoship a link represents
+ ischecked?: ScriptField; // returns whether a font icon box is checked
+ activeInkPen?: Doc; // which pen document is currently active (used as the radio button state for the 'unhecked' pen tool scripts)
+ onClick?: ScriptField;
+ onDoubleClick?: ScriptField;
+ onChildClick?: ScriptField; // script given to children of a collection to execute when they are clicked
+ onChildDoubleClick?: ScriptField; // script given to children of a collection to execute when they are double clicked
+ onPointerDown?: ScriptField;
+ onPointerUp?: ScriptField;
+ dropConverter?: ScriptField; // script to run when documents are dropped on this Document.
+ dragFactory?: Doc; // document to create when dragging with a suitable onDragStart script
+ clickFactory?: Doc; // document to create when clicking on a button with a suitable onClick script
+ onDragStart?: ScriptField; //script to execute at start of drag operation -- e.g., when a "creator" button is dragged this script generates a different document to drop
+ clipboard?: Doc;
+ useCors?: boolean;
+ icon?: string;
+ target?: Doc; // available for use in scripts as the primary target document
+ sourcePanel?: Doc; // panel to display in 'targetContainer' as the result of a button onClick script
+ targetContainer?: Doc; // document whose proto will be set to 'panel' as the result of a onClick click script
+ searchFileTypes?: List<string>; // file types allowed in a search query
+ strokeWidth?: number;
+ cloneFieldFilter?: List<string>; // fields not to copy when the document is cloned
+ _stayInCollection?: boolean;// whether the document should remain in its collection when someone tries to drag and drop it elsewhere
+ freezeChildren?: string; // whether children are now allowed to be added and or removed from a collection
+ treeViewPreventOpen?: boolean; // ignores the treeViewOpen Doc flag which allows a treeViewItem's expand/collapse state to be independent of other views of the same document in the tree view
+ treeViewHideTitle?: boolean; // whether to hide the top document title of a tree view
+ treeViewHideHeader?: boolean; // whether to hide the header for a document in a tree view
+ treeViewHideHeaderFields?: boolean; // whether to hide the drop down options for tree view items.
+ treeViewOpen?: boolean; // whether this document is expanded in a tree view
+ treeViewExpandedView?: string; // which field/thing is displayed when this item is opened in tree view
+ treeViewChecked?: ScriptField; // script to call when a tree view checkbox is checked
+ treeViewTruncateTitleWidth?: number;
+ treeViewType?: string; // whether treeview is a Slide, file system, or (default) collection hierarchy
+ treeViewLockExpandedView?: boolean; // whether the expanded view can be changed
+ treeViewDefaultExpandedView?: string; // default expanded view
+ sidebarColor?: string; // background color of text sidebar
+ sidebarViewType?: string; // collection type of text sidebar
+ limitHeight?: number; // maximum height for newly created (eg, from pasting) text documents
+ // [key: string]: Opt<Field>;
+ pointerHack?: boolean; // for buttons, allows onClick handler to fire onPointerDown
+ textTransform?: string; // is linear view expanded
+ letterSpacing?: string; // is linear view expanded
+ flexDirection?: "unset" | "row" | "column" | "row-reverse" | "column-reverse";
+ selectedIndex?: number;
+ syntaxColor?: string; // can be applied to text for syntax highlighting all matches in the text
+ searchQuery?: string; // for quersyBox
+ linearViewIsExpanded?: boolean; // is linear view expanded
+ isLabel?: boolean; // whether the document is a label or not (video / audio)
+ useLinkSmallAnchor?: boolean; // whether links to this document should use a miniature linkAnchorBox
+ border?: string; //for searchbox
+ _hovercolor?: string;
+}*/
class EmptyBox {
public static LayoutString() {
@@ -243,6 +424,29 @@ class EmptyBox {
export namespace Docs {
+ export let FieldInfos: Doc | undefined;
+ export async function setupFieldInfos() {
+ const fieldDocs = await DocServer.GetRefField("FIELDS");
+ if (fieldDocs instanceof Doc) {
+ Docs.FieldInfos = fieldDocs;
+ } else {
+ runInAction(() => {
+ const infos = Docs.FieldInfos = new Doc("FIELDS", true);
+ const keys = Object.keys(_docOptions);
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ const options = (_docOptions as any)[key] as dinfo;
+ const finfo = new Doc();
+ finfo.name = key;
+ finfo.default = options.dflt;
+ finfo.description = options.description;
+ finfo.type = options.type;
+ infos[key] = finfo;
+ }
+ });
+ }
+ }
+
export let newAccount: boolean = false;
export namespace Prototypes {
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 8ef52e02a..3413f7b05 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -1069,6 +1069,7 @@ export class CurrentUserUtils {
}
public static async loadUserDocument(id: string) {
+ //await Docs.setupFieldInfos();
this.curr_id = id;
await rp.get(Utils.prepend("/getUserDocumentIds")).then(ids => {
const { userDocumentId, sharingDocumentId, linkDatabaseId } = JSON.parse(ids);
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 92f6ae028..5063c6f6b 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -1,12 +1,10 @@
-import { MainView } from "./MainView";
-import { Docs } from "../documents/Documents";
-import { CurrentUserUtils } from "../util/CurrentUserUtils";
-import * as ReactDOM from 'react-dom';
import * as React from 'react';
-import { DocServer } from "../DocServer";
+import * as ReactDOM from 'react-dom';
import { AssignAllExtensions } from "../../extensions/General/Extensions";
-import { Networking } from "../Network";
+import { Docs } from "../documents/Documents";
+import { CurrentUserUtils } from "../util/CurrentUserUtils";
import { CollectionView } from "./collections/CollectionView";
+import { MainView } from "./MainView";
AssignAllExtensions();
diff --git a/src/client/views/nodes/LabelBox.tsx b/src/client/views/nodes/LabelBox.tsx
index 87d5b07a2..3d4429a55 100644
--- a/src/client/views/nodes/LabelBox.tsx
+++ b/src/client/views/nodes/LabelBox.tsx
@@ -59,7 +59,7 @@ export class LabelBox extends ViewBoxBaseComponent<FieldViewProps, LabelDocument
}
@observable _mouseOver = false;
- @computed get backColor() { return this.clicked || this._mouseOver ? StrCast(this.layoutDoc.hovercolor) : "unset"; }
+ @computed get backColor() { return this.clicked || this._mouseOver ? StrCast(this.layoutDoc._hovercolor) : "unset"; }
@observable clicked = false;
// (!missingParams || !missingParams.length ? "" : "(" + missingParams.map(m => m + ":").join(" ") + ")")