aboutsummaryrefslogtreecommitdiff
path: root/src/fields
diff options
context:
space:
mode:
Diffstat (limited to 'src/fields')
-rw-r--r--src/fields/Doc.ts119
-rw-r--r--src/fields/RichTextUtils.ts6
-rw-r--r--src/fields/Types.ts5
-rw-r--r--src/fields/documentSchemas.ts52
-rw-r--r--src/fields/util.ts4
5 files changed, 95 insertions, 91 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index b8ac8fb5d..deda4c876 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -41,7 +41,7 @@ export namespace Field {
switch (typeof field) {
case 'string':
if (field.startsWith('{"')) return `'${field}'`; // bcz: hack ... want to quote the string the right way. if there are nested "'s, then use ' instead of ". In this case, test for the start of a JSON string of the format {"property": ... } and use outer 's instead of "s
- return `"${field}"`;
+ return !field.includes('`') ? `\`${field}\`` : `"${field}"`;
case 'number':
case 'boolean':
return String(field);
@@ -236,7 +236,7 @@ export class Doc extends RefField {
if (
doc &&
Doc.MyFileOrphans instanceof Doc &&
- Doc.IsPrototype(doc) &&
+ Doc.IsDocDataProto(doc) &&
!Doc.IsSystem(doc) &&
![DocumentType.MARKER, DocumentType.KVP, DocumentType.LINK, DocumentType.LINKANCHOR].includes(doc.type as any) &&
!doc.isFolder &&
@@ -381,7 +381,7 @@ export class Doc extends RefField {
const templateLayoutDoc = Cast(Doc.LayoutField(this[SelfProxy]), Doc, null);
if (templateLayoutDoc) {
let renderFieldKey: any;
- const layoutField = templateLayoutDoc[StrCast(templateLayoutDoc.layoutKey, 'layout')];
+ const layoutField = templateLayoutDoc[StrCast(templateLayoutDoc.layout_fieldKey, 'layout')];
if (typeof layoutField === 'string') {
renderFieldKey = layoutField.split("fieldKey={'")[1].split("'")[0]; //layoutField.split("'")[1];
} else {
@@ -510,14 +510,14 @@ export namespace Doc {
export function GetT<T extends Field>(doc: Doc, key: string, ctor: ToConstructor<T>, ignoreProto: boolean = false): FieldResult<T> {
return Cast(Get(doc, key, ignoreProto), ctor) as FieldResult<T>;
}
- export function IsPrototype(doc: Doc) {
- return GetT(doc, 'isPrototype', 'boolean', true);
+ export function IsDocDataProto(doc: Doc) {
+ return GetT(doc, 'isDataDoc', 'boolean', true);
}
export function IsBaseProto(doc: Doc) {
- return GetT(doc, 'baseProto', 'boolean', true);
+ return GetT(doc, 'isBaseProto', 'boolean', true);
}
export function IsSystem(doc: Doc) {
- return GetT(doc, 'system', 'boolean', true);
+ return GetT(doc, 'isSystem', 'boolean', true);
}
export function IsDelegateField(doc: Doc, fieldKey: string) {
return doc && Get(doc, fieldKey, true) !== undefined;
@@ -574,9 +574,9 @@ export namespace Doc {
// Gets the data document for the document. Note: this is mis-named -- it does not specifically
// return the doc's proto, but rather recursively searches through the proto inheritance chain
- // and returns the document who's proto is undefined or whose proto is marked as a base prototype ('isPrototype').
+ // and returns the document who's proto is undefined or whose proto is marked as a data doc ('isDataDoc').
export function GetProto(doc: Doc): Doc {
- const proto = doc && (Doc.GetT(doc, 'isPrototype', 'boolean', true) ? doc : doc.proto || doc);
+ const proto = doc && (Doc.GetT(doc, 'isDataDoc', 'boolean', true) ? doc : doc.proto || doc);
return proto === doc ? proto : Doc.GetProto(proto);
}
export function GetDataDoc(doc: Doc): Doc {
@@ -680,25 +680,25 @@ export namespace Doc {
return bounds;
}
- export function MakeAlias(doc: Doc, id?: string) {
- const alias = !GetT(doc, 'isPrototype', 'boolean', true) && doc.proto ? Doc.MakeCopy(doc, undefined, id) : Doc.MakeDelegate(doc, id);
- const layout = Doc.LayoutField(alias);
- if (layout instanceof Doc && layout !== alias && layout === Doc.Layout(alias)) {
- Doc.SetLayout(alias, Doc.MakeAlias(layout));
+ export function MakeEmbedding(doc: Doc, id?: string) {
+ const embedding = !GetT(doc, 'isDataDoc', 'boolean', true) && doc.proto ? Doc.MakeCopy(doc, undefined, id) : Doc.MakeDelegate(doc, id);
+ const layout = Doc.LayoutField(embedding);
+ if (layout instanceof Doc && layout !== embedding && layout === Doc.Layout(embedding)) {
+ Doc.SetLayout(embedding, Doc.MakeEmbedding(layout));
}
- alias.aliasOf = doc;
- alias.aliasNumber = Doc.GetProto(doc).aliasNumber = NumCast(Doc.GetProto(doc).aliasNumber) + 1;
- alias.title = ComputedField.MakeFunction(`renameAlias(this)`);
- alias.author = Doc.CurrentUserEmail;
+ embedding.createdFrom = doc;
+ embedding.proto_embeddingId = Doc.GetProto(doc).proto_embeddingId = NumCast(Doc.GetProto(doc).proto_embeddingId) + 1;
+ embedding.title = ComputedField.MakeFunction(`renameEmbedding(this)`);
+ embedding.author = Doc.CurrentUserEmail;
- Doc.AddDocToList(Doc.GetProto(doc)[DataSym], 'aliases', alias);
+ Doc.AddDocToList(Doc.GetProto(doc)[DataSym], 'proto_embeddings', embedding);
- return alias;
+ return embedding;
}
- export function BestAlias(doc: Doc) {
- const bestAlias = Doc.GetProto(doc) ? DocListCast(doc.aliases).find(doc => !doc.context && doc.author === Doc.CurrentUserEmail) : doc;
- return bestAlias ?? Doc.MakeAlias(doc);
+ export function BestEmbedding(doc: Doc) {
+ const bestEmbedding = Doc.GetProto(doc) ? DocListCast(doc.proto_embeddings).find(doc => !doc.embedContainer && doc.author === Doc.CurrentUserEmail) : doc;
+ return bestEmbedding ?? Doc.MakeEmbedding(doc);
}
// this lists out all the tag ids that can be in a RichTextField that might contain document ids.
@@ -745,7 +745,7 @@ export namespace Doc {
if (docAtKey instanceof Doc) {
if (pruneDocs.includes(docAtKey)) {
// prune doc and do nothing
- } else if (!Doc.IsSystem(docAtKey) && (key.startsWith('layout') || ['context', 'annotationOn', 'proto'].includes(key) || ((key === 'anchor1' || key === 'anchor2') && doc.author === Doc.CurrentUserEmail))) {
+ } else if (!Doc.IsSystem(docAtKey) && (key.startsWith('layout') || ['embedContainer', 'annotationOn', 'proto'].includes(key) || ((key === 'link_anchor_1' || key === 'link_anchor_2') && doc.author === Doc.CurrentUserEmail))) {
assignKey(await Doc.makeClone(docAtKey, cloneMap, linkMap, rtfs, exclusions, pruneDocs, cloneLinks));
} else {
assignKey(docAtKey);
@@ -766,7 +766,8 @@ export namespace Doc {
Array.from(doc[DirectLinksSym]).forEach(async link => {
if (
cloneLinks ||
- ((cloneMap.has(DocCast(link.anchor1)?.[Id]) || cloneMap.has(DocCast(DocCast(link.anchor1)?.annotationOn)?.[Id])) && (cloneMap.has(DocCast(link.anchor2)?.[Id]) || cloneMap.has(DocCast(DocCast(link.anchor2)?.annotationOn)?.[Id])))
+ ((cloneMap.has(DocCast(link.link_anchor_1)?.[Id]) || cloneMap.has(DocCast(DocCast(link.link_anchor_1)?.annotationOn)?.[Id])) &&
+ (cloneMap.has(DocCast(link.link_anchor_2)?.[Id]) || cloneMap.has(DocCast(DocCast(link.link_anchor_2)?.annotationOn)?.[Id])))
) {
linkMap.set(link[Id], await Doc.makeClone(link, cloneMap, linkMap, rtfs, exclusions, pruneDocs, cloneLinks));
}
@@ -804,7 +805,7 @@ export namespace Doc {
export async function MakeClone(doc: Doc, cloneLinks = true, cloneMap: Map<string, Doc> = new Map()) {
const linkMap = new Map<string, Doc>();
const rtfMap: { copy: Doc; key: string; field: RichTextField }[] = [];
- const copy = await Doc.makeClone(doc, cloneMap, linkMap, rtfMap, ['cloneOf'], doc.context ? [DocCast(doc.context)] : [], cloneLinks);
+ const copy = await Doc.makeClone(doc, cloneMap, linkMap, rtfMap, ['cloneOf'], doc.embedContainer ? [DocCast(doc.embedContainer)] : [], cloneLinks);
const repaired = new Set<Doc>();
const linkedDocs = Array.from(linkMap.values());
linkedDocs.map((link: Doc) => LinkManager.Instance.addLink(link, true));
@@ -980,7 +981,7 @@ export namespace Doc {
export function MakeCopy(doc: Doc, copyProto: boolean = false, copyProtoId?: string, retitle = false): Doc {
const copy = new Doc(copyProtoId, true);
updateCachedAcls(copy);
- const exclude = Cast(doc.cloneFieldFilter, listSpec('string'), []);
+ const exclude = [...Cast(doc.cloneFieldFilter, listSpec('string'), []), 'dragFactory_count', 'cloneFieldFilter'];
Object.keys(doc).forEach(key => {
if (exclude.includes(key)) return;
const cfield = ComputedField.WithoutComputed(() => FieldValue(doc[key]));
@@ -1009,12 +1010,12 @@ export namespace Doc {
}
});
if (copyProto) {
- Doc.GetProto(copy).context = undefined;
- Doc.GetProto(copy).aliases = new List<Doc>([copy]);
+ Doc.GetProto(copy).embedContainer = undefined;
+ Doc.GetProto(copy).proto_embeddings = new List<Doc>([copy]);
} else {
- Doc.AddDocToList(Doc.GetProto(copy)[DataSym], 'aliases', copy);
+ Doc.AddDocToList(Doc.GetProto(copy)[DataSym], 'proto_embeddings', copy);
}
- copy.context = undefined;
+ copy.embedContainer = undefined;
Doc.defaultAclPrivate && (copy['acl-Public'] = 'Not Shared');
if (retitle) {
copy.title = incrementTitleCopy(StrCast(copy.title));
@@ -1035,7 +1036,7 @@ export namespace Doc {
Object.keys(doc)
.filter(key => key.startsWith('acl'))
.forEach(key => (delegate[key] = doc[key]));
- if (!Doc.IsSystem(doc)) Doc.AddDocToList(doc[DataSym], 'aliases', delegate);
+ if (!Doc.IsSystem(doc)) Doc.AddDocToList(doc[DataSym], 'proto_embeddings', delegate);
title && (delegate.title = title);
delegate[Initializing] = false;
Doc.AddFileOrphan(delegate);
@@ -1053,13 +1054,13 @@ export namespace Doc {
delegateProto[Initializing] = true;
delegateProto.proto = doc;
delegateProto.author = Doc.CurrentUserEmail;
- delegateProto.isPrototype = true;
+ delegateProto.isDataDoc = true;
title && (delegateProto.title = title);
const delegate = new Doc(id, true);
delegate[Initializing] = true;
delegate.proto = delegateProto;
delegate.author = Doc.CurrentUserEmail;
- Doc.AddDocToList(delegateProto[DataSym], 'aliases', delegate);
+ Doc.AddDocToList(delegateProto[DataSym], 'proto_embeddings', delegate);
delegate[Initializing] = false;
delegateProto[Initializing] = false;
return delegate;
@@ -1071,9 +1072,9 @@ export namespace Doc {
const proto = new Doc();
proto.author = Doc.CurrentUserEmail;
const target = Doc.MakeDelegate(proto);
- const targetKey = StrCast(templateDoc.layoutKey, 'layout');
+ const targetKey = StrCast(templateDoc.layout_fieldKey, 'layout');
const applied = ApplyTemplateTo(templateDoc, target, targetKey, templateDoc.title + '(...' + _applyCount++ + ')');
- target.layoutKey = targetKey;
+ target.layout_fieldKey = targetKey;
applied && (Doc.GetProto(applied).type = templateDoc.type);
Doc.defaultAclPrivate && (applied['acl-Public'] = 'Not Shared');
return applied;
@@ -1176,31 +1177,31 @@ export namespace Doc {
return overrideLayout || doc[LayoutSym] || doc;
}
export function SetLayout(doc: Doc, layout: Doc | string) {
- doc[StrCast(doc.layoutKey, 'layout')] = layout;
+ doc[StrCast(doc.layout_fieldKey, 'layout')] = layout;
}
export function LayoutField(doc: Doc) {
- return doc[StrCast(doc.layoutKey, 'layout')];
+ return doc[StrCast(doc.layout_fieldKey, 'layout')];
}
export function LayoutFieldKey(doc: Doc): string {
- return StrCast(Doc.Layout(doc).layout).split("'")[1]; // bcz: TODO check on this . used to always reference 'layout', now it uses the layout speicfied by the current layoutKey
+ return StrCast(Doc.Layout(doc).layout).split("'")[1]; // bcz: TODO check on this . used to always reference 'layout', now it uses the layout speicfied by the current layout_fieldKey
}
export function NativeAspect(doc: Doc, dataDoc?: Doc, useDim?: boolean) {
return Doc.NativeWidth(doc, dataDoc, useDim) / (Doc.NativeHeight(doc, dataDoc, useDim) || 1);
}
export function NativeWidth(doc?: Doc, dataDoc?: Doc, useWidth?: boolean) {
- return !doc ? 0 : NumCast(doc._nativeWidth, NumCast((dataDoc || doc)[Doc.LayoutFieldKey(doc) + '-nativeWidth'], useWidth ? doc[WidthSym]() : 0));
+ return !doc ? 0 : NumCast(doc._nativeWidth, NumCast((dataDoc || doc)[Doc.LayoutFieldKey(doc) + '_nativeWidth'], useWidth ? doc[WidthSym]() : 0));
}
export function NativeHeight(doc?: Doc, dataDoc?: Doc, useHeight?: boolean) {
if (!doc) return 0;
const nheight = (Doc.NativeWidth(doc, dataDoc, useHeight) * doc[HeightSym]()) / doc[WidthSym]();
- const dheight = NumCast((dataDoc || doc)[Doc.LayoutFieldKey(doc) + '-nativeHeight'], useHeight ? doc[HeightSym]() : 0);
+ const dheight = NumCast((dataDoc || doc)[Doc.LayoutFieldKey(doc) + '_nativeHeight'], useHeight ? doc[HeightSym]() : 0);
return NumCast(doc._nativeHeight, nheight || dheight);
}
export function SetNativeWidth(doc: Doc, width: number | undefined, fieldKey?: string) {
- doc[(fieldKey ?? Doc.LayoutFieldKey(doc)) + '-nativeWidth'] = width;
+ doc[(fieldKey ?? Doc.LayoutFieldKey(doc)) + '_nativeWidth'] = width;
}
export function SetNativeHeight(doc: Doc, height: number | undefined, fieldKey?: string) {
- doc[(fieldKey ?? Doc.LayoutFieldKey(doc)) + '-nativeHeight'] = height;
+ doc[(fieldKey ?? Doc.LayoutFieldKey(doc)) + '_nativeHeight'] = height;
}
const manager = new DocData();
@@ -1271,8 +1272,8 @@ export namespace Doc {
const lastBrushed = Array.from(brushManager.BrushedDoc.keys()).lastElement();
if (lastBrushed) {
for (const link of LinkManager.Instance.getAllDirectLinks(lastBrushed)) {
- const a1 = Cast(link.anchor1, Doc, null);
- const a2 = Cast(link.anchor2, Doc, null);
+ const a1 = Cast(link.link_anchor_1, Doc, null);
+ const a2 = Cast(link.link_anchor_2, Doc, null);
if (Doc.AreProtosEqual(a1, doc) || Doc.AreProtosEqual(a2, doc) || Doc.AreProtosEqual(Cast(a1.annotationOn, Doc, null), doc) || Doc.AreProtosEqual(Cast(a2.annotationOn, Doc, null), doc)) {
return DocBrushStatus.linkHighlighted;
}
@@ -1304,8 +1305,8 @@ export namespace Doc {
}
export function LinkEndpoint(linkDoc: Doc, anchorDoc: Doc) {
- if (linkDoc.anchor2 === anchorDoc || (linkDoc.anchor2 as Doc).annotationOn) return '2';
- return Doc.AreProtosEqual(anchorDoc, (linkDoc.anchor1 as Doc).annotationOn as Doc) || Doc.AreProtosEqual(anchorDoc, linkDoc.anchor1 as Doc) ? '1' : '2';
+ if (linkDoc.link_anchor_2 === anchorDoc || (linkDoc.link_anchor_2 as Doc).annotationOn) return '2';
+ return Doc.AreProtosEqual(anchorDoc, (linkDoc.link_anchor_1 as Doc).annotationOn as Doc) || Doc.AreProtosEqual(anchorDoc, linkDoc.link_anchor_1 as Doc) ? '1' : '2';
}
export function linkFollowUnhighlight() {
@@ -1400,14 +1401,14 @@ export namespace Doc {
}
export function deiconifyView(doc: Doc) {
- StrCast(doc.layoutKey).split('_')[1] === 'icon' && setNativeView(doc);
+ StrCast(doc.layout_fieldKey).split('_')[1] === 'icon' && setNativeView(doc);
}
export function setNativeView(doc: any) {
- const prevLayout = StrCast(doc.layoutKey).split('_')[1];
+ const prevLayout = StrCast(doc.layout_fieldKey).split('_')[1];
const deiconify = prevLayout === 'icon' && StrCast(doc.deiconifyLayout) ? 'layout_' + StrCast(doc.deiconifyLayout) : '';
prevLayout === 'icon' && (doc.deiconifyLayout = undefined);
- doc.layoutKey = deiconify || 'layout';
+ doc.layout_fieldKey = deiconify || 'layout';
}
export function setDocRangeFilter(container: Opt<Doc>, key: string, range?: number[]) {
if (!container) return;
@@ -1431,7 +1432,7 @@ export namespace Doc {
// based on the modifiers :"check", "x", undefined
export function setDocFilter(container: Opt<Doc>, key: string, value: any, modifiers: 'remove' | 'match' | 'check' | 'x' | 'exists' | 'unset', toggle?: boolean, fieldPrefix?: string, append: boolean = true) {
if (!container) return;
- const filterField = '_' + (fieldPrefix ? fieldPrefix + '-' : '') + 'docFilters';
+ const filterField = '_' + (fieldPrefix ? fieldPrefix + '_' : '') + 'docFilters';
const docFilters = Cast(container[filterField], listSpec('string'), []);
runInAction(() => {
for (let i = 0; i < docFilters.length; i++) {
@@ -1471,18 +1472,18 @@ export namespace Doc {
export function toggleNativeDimensions(layoutDoc: Doc, contentScale: number, panelWidth: number, panelHeight: number) {
runInAction(() => {
if (Doc.NativeWidth(layoutDoc) || Doc.NativeHeight(layoutDoc)) {
- layoutDoc._viewScale = NumCast(layoutDoc._viewScale, 1) * contentScale;
+ layoutDoc._freeform_scale = NumCast(layoutDoc._freeform_scale, 1) * contentScale;
layoutDoc._nativeWidth = undefined;
layoutDoc._nativeHeight = undefined;
- layoutDoc._forceReflow = undefined;
+ layoutDoc._layout_forceReflow = undefined;
layoutDoc._nativeHeightUnfrozen = undefined;
layoutDoc._nativeDimModifiable = undefined;
} else {
- layoutDoc._autoHeight = false;
+ layoutDoc._layout_autoHeight = false;
if (!Doc.NativeWidth(layoutDoc)) {
layoutDoc._nativeWidth = NumCast(layoutDoc._width, panelWidth);
layoutDoc._nativeHeight = NumCast(layoutDoc._height, panelHeight);
- layoutDoc._forceReflow = true;
+ layoutDoc._layout_forceReflow = true;
layoutDoc._nativeHeightUnfrozen = true;
layoutDoc._nativeDimModifiable = true;
}
@@ -1710,8 +1711,8 @@ export function IdToDoc(id: string) {
ScriptingGlobals.add(function idToDoc(id: string): any {
return IdToDoc(id);
});
-ScriptingGlobals.add(function renameAlias(doc: any) {
- return StrCast(Doc.GetProto(doc).title).replace(/\([0-9]*\)/, '') + `(${doc.aliasNumber})`;
+ScriptingGlobals.add(function renameEmbedding(doc: any) {
+ return StrCast(Doc.GetProto(doc).title).replace(/\([0-9]*\)/, '') + `(${doc.proto_embeddingId})`;
});
ScriptingGlobals.add(function getProto(doc: any) {
return Doc.GetProto(doc);
@@ -1719,8 +1720,8 @@ ScriptingGlobals.add(function getProto(doc: any) {
ScriptingGlobals.add(function getDocTemplate(doc?: any) {
return Doc.getDocTemplate(doc);
});
-ScriptingGlobals.add(function getAlias(doc: any) {
- return Doc.MakeAlias(doc);
+ScriptingGlobals.add(function getEmbedding(doc: any) {
+ return Doc.MakeEmbedding(doc);
});
ScriptingGlobals.add(function getCopy(doc: any, copyProto: any) {
return doc.isTemplateDoc ? Doc.ApplyTemplate(doc) : Doc.MakeCopy(doc, copyProto);
diff --git a/src/fields/RichTextUtils.ts b/src/fields/RichTextUtils.ts
index 239b59e83..24cd078f2 100644
--- a/src/fields/RichTextUtils.ts
+++ b/src/fields/RichTextUtils.ts
@@ -395,11 +395,11 @@ export namespace RichTextUtils {
if (new RegExp(window.location.origin + delimiter).test(url) && !url.endsWith(alreadyShared)) {
const linkDoc = await DocServer.GetRefField(url.split(delimiter)[1]);
if (linkDoc instanceof Doc) {
- let exported = (await Cast(linkDoc.anchor2, Doc))!;
+ let exported = (await Cast(linkDoc.link_anchor_2, Doc))!;
if (!exported.customLayout) {
- exported = Doc.MakeAlias(exported);
+ exported = Doc.MakeEmbedding(exported);
DocUtils.makeCustomViewClicked(exported, Docs.Create.FreeformDocument);
- linkDoc.anchor2 = exported;
+ linkDoc.link_anchor_2 = exported;
}
url = Utils.shareUrl(exported[Id]);
}
diff --git a/src/fields/Types.ts b/src/fields/Types.ts
index 4cf286a32..251b1149d 100644
--- a/src/fields/Types.ts
+++ b/src/fields/Types.ts
@@ -3,7 +3,7 @@ import { List } from './List';
import { RefField } from './RefField';
import { DateField } from './DateField';
import { ScriptField } from './ScriptField';
-import { URLField, WebField, ImageField } from './URLField';
+import { URLField, WebField, ImageField, CsvField } from './URLField';
import { TextField } from '@material-ui/core';
import { RichTextField } from './RichTextField';
@@ -104,6 +104,9 @@ export function RTFCast(field: FieldResult) {
export function ScriptCast(field: FieldResult, defaultVal: ScriptField | null = null) {
return Cast(field, ScriptField, defaultVal);
}
+export function CsvCast(field: FieldResult, defaultVal: CsvField | null = null) {
+ return Cast(field, CsvField, defaultVal);
+}
export function WebCast(field: FieldResult, defaultVal: WebField | null = null) {
return Cast(field, WebField, defaultVal);
}
diff --git a/src/fields/documentSchemas.ts b/src/fields/documentSchemas.ts
index b7fd06973..7b2fd74d0 100644
--- a/src/fields/documentSchemas.ts
+++ b/src/fields/documentSchemas.ts
@@ -13,11 +13,11 @@ export const documentSchema = createSchema({
links: listSpec(Doc), // computed (readonly) list of links associated with this document
// "Location" properties in a very general sense
- _curPage: 'number', // current page of a page based document
+ _layout_curPage: 'number', // current page of a page based document
_currentFrame: 'number', // current frame of a frame based collection (e.g., a progressive slide)
lastFrame: 'number', // last frame of a frame based collection (e.g., a progressive slide)
activeFrame: 'number', // the active frame of a frame based animated document
- _currentTimecode: 'number', // current play back time of a temporal document (video / audio)
+ _layout_currentTimecode: 'number', // current play back time of a temporal document (video / audio)
_timecodeToShow: 'number', // the time that a document should be displayed (e.g., time an annotation should be displayed on a video)
_timecodeToHIde: 'number', // the time that a document should be hidden
markers: listSpec(Doc), // list of markers for audio / video
@@ -25,52 +25,52 @@ export const documentSchema = createSchema({
y: 'number', // y coordinate when in a freeform view
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)
+ _layout_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
- _autoHeight: 'boolean', // whether the height of the document should be computed automatically based on its contents
+ _layout_autoHeight: 'boolean', // whether the height of the document should be computed automatically based on its contents
_nativeWidth: 'number', // native width of document which determines how much document contents are scaled when the document's width is set
_nativeHeight: 'number', // "
_width: 'number', // width of document in its container's coordinate system
_height: 'number', // "
- _xPadding: 'number', // pixels of padding on left/right of collectionfreeformview contents when fitContentsToBox is set
- _yPadding: 'number', // pixels of padding on top/bottom of collectionfreeformview contents when fitContentsToBox is set
+ _xPadding: 'number', // pixels of padding on left/right of collectionfreeformview contents when freeform_fitContentsToBox is set
+ _yPadding: 'number', // pixels of padding on top/bottom of collectionfreeformview contents when freeform_fitContentsToBox is set
_xMargin: 'number', // margin added on left/right of most documents to add separation from their container
_yMargin: 'number', // margin added on top/bottom of most documents to add separation from their container
_overflow: 'string', // sets overflow behvavior for CollectionFreeForm views
- _showCaption: 'string', // whether editable caption text is overlayed at the bottom of the document
- _showTitle: 'string', // the fieldkey(s) whose contents should be displayed at the top of the document. separate multiple keys with ";". Use :hover suffix to indicate title should be shown on hover
+ _layout_showCaption: 'string', // whether editable caption text is overlayed at the bottom of the document
+ _layout_showTitle: 'string', // the fieldkey(s) whose contents should be displayed at the top of the document. separate multiple keys with ";". Use :hover suffix to indicate title should be shown on hover
_pivotField: 'string', // specifies which field key should be used as the timeline/pivot axis
_columnsFill: 'boolean', // whether documents in a stacking view column should be sized to fill the column
_columnsSort: 'string', // how a document should be sorted "ascending", "descending", undefined (none)
_columnsHideIfEmpty: 'boolean', // whether empty stacking view column headings should be hidden
- _columnHeaders: listSpec(SchemaHeaderField), // header descriptions for stacking/masonry
- _schemaHeaders: listSpec(SchemaHeaderField), // header descriptions for schema views
+ // _columnHeaders: listSpec(SchemaHeaderField), // header descriptions for stacking/masonry
+ // _schemaHeaders: listSpec(SchemaHeaderField), // header descriptions for schema views
_fontSize: 'string',
_fontFamily: 'string',
- _sidebarWidthPercent: 'string', // percent of text window width taken up by sidebar
+ _layout_sidebarWidthPercent: 'string', // percent of text window width taken up by sidebar
// appearance properties on the data document
backgroundColor: 'string', // background color of document
borderRounding: 'string', // border radius rounding of document
boxShadow: 'string', // the amount of shadow around the perimeter of a document
color: 'string', // foreground color of document
- fitContentsToBox: 'boolean', // whether freeform view contents should be zoomed/panned to fill the area of the document view box
+ freeform_fitContentsToBox: 'boolean', // whether freeform view contents should be zoomed/panned to fill the area of the document view box
fontSize: 'string',
hidden: 'boolean', // whether a document should not be displayed
- isInkMask: 'boolean', // is the document a mask (ie, sits on top of other documents, has an unbounded width/height that is dark, and content uses 'hard-light' mix-blend-mode to let other documents pop through)
- layout: 'string', // this is the native layout string for the document. templates can be added using other fields and setting layoutKey below
- layoutKey: 'string', // holds the field key for the field that actually holds the current lyoat
+ stroke_isInkMask: 'boolean', // is the document a mask (ie, sits on top of other documents, has an unbounded width/height that is dark, and content uses 'hard-light' mix-blend-mode to let other documents pop through)
+ layout: 'string', // this is the native layout string for the document. templates can be added using other fields and setting layout_fieldKey below
+ layout_fieldKey: 'string', // holds the field key for the field that actually holds the current lyoat
letterSpacing: 'string',
opacity: 'number', // opacity of document
- strokeWidth: 'number',
- strokeBezier: 'number',
- strokeStartMarker: 'string',
- strokeEndMarker: 'string',
- strokeDash: 'string',
+ stroke_width: 'number',
+ stroke_bezier: 'number',
+ stroke_startMarker: 'string',
+ stroke_endMarker: 'string',
+ stroke_dash: 'string',
textTransform: 'string',
treeViewOpen: 'boolean', // flag denoting whether the documents sub-tree (contents) is visible or hidden
treeViewExpandedView: 'string', // name of field whose contents are being displayed as the document's subtree
@@ -87,20 +87,20 @@ export const documentSchema = createSchema({
followLinkLocation: 'string', // flag for where to place content when following a click interaction (e.g., add:right, lightbox, default, )
hideLinkButton: 'boolean', // whether the blue link counter button should be hidden
hideAllLinks: 'boolean', // whether all individual blue anchor dots should be hidden
- linkDisplay: 'boolean', // whether a link connection should be shown between link anchor endpoints.
+ layout_linkDisplay: 'boolean', // whether a link connection should be shown between link anchor endpoints.
isLightbox: 'boolean', // whether the marked object will display addDocTab() calls that target "lightbox" destinations
layers: listSpec('string'), // which layers the document is part of
_lockedPosition: 'boolean', // whether the document can be moved (dragged)
_lockedTransform: 'boolean', // whether a freeformview can pan/zoom
- linkDisplayArrow: 'boolean', // toggles directed arrows
+ layout_linkDisplayArrow: 'boolean', // toggles directed arrows
// drag drop properties
_stayInCollection: 'boolean', // whether document can be dropped into a different collection
dragFactory: Doc, // the document that serves as the "template" for the onDragStart script. ie, to drag out copies of the dragFactory document.
- dropAction: 'string', // override specifying what should happen when this document is dropped (can be "alias", "copy", "move")
- targetDropAction: 'string', // allows the target of a drop event to specify the dropAction ("alias", "copy", "move") NOTE: if the document is dropped within the same collection, the dropAction is coerced to 'move'
- childDropAction: 'string', // specify the override for what should happen when the child of a collection is dragged from it and dropped (can be "alias" or "copy")
- removeDropProperties: listSpec('string'), // properties that should be removed from the alias/copy/etc of this document when it is dropped
+ dropAction: 'string', // override specifying what should happen when this document is dropped (can be "embed", "copy", "move")
+ targetDropAction: 'string', // allows the target of a drop event to specify the dropAction ("embed", "copy", "move") NOTE: if the document is dropped within the same collection, the dropAction is coerced to 'move'
+ childDropAction: 'string', // specify the override for what should happen when the child of a collection is dragged from it and dropped (can be "embed" or "copy")
+ removeDropProperties: listSpec('string'), // properties that should be removed from the embed/copy/etc of this document when it is dropped
});
export const collectionSchema = createSchema({
diff --git a/src/fields/util.ts b/src/fields/util.ts
index d5b55867e..2a6caaaa3 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -289,7 +289,7 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc
});
// maps over the annotations of the document
- DocListCast(dataDoc[Doc.LayoutFieldKey(dataDoc) + '-annotations']).forEach(d => {
+ DocListCast(dataDoc[Doc.LayoutFieldKey(dataDoc) + '_annotations']).forEach(d => {
distributeAcls(key, acl, d, inheritingFromCollection, visited);
distributeAcls(key, acl, d[DataSym], inheritingFromCollection, visited);
});
@@ -377,7 +377,7 @@ export function updateFunction(target: any, prop: any, value: any, receiver: any
diff?.op === '$addToSet'
? { $addToSet: { ['fields.' + prop]: SerializationHelper.Serialize(new List<Doc>(diff.items)) } }
: diff?.op === '$remFromSet'
- ? { $remFromSet: { ['fields.' + prop]: SerializationHelper.Serialize(new List<Doc>(diff.items)), hint : diff.hint } }
+ ? { $remFromSet: { ['fields.' + prop]: SerializationHelper.Serialize(new List<Doc>(diff.items)), hint: diff.hint } }
: { $set: { ['fields.' + prop]: SerializationHelper.Serialize(value) } };
!op.$set && ((op as any).length = diff.length);
const prevValue = ObjectField.MakeCopy(lastValue as List<any>);