aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index aee129c36..1fd07d61d 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -7,7 +7,6 @@ import { Id } from '../../fields/FieldSymbols';
import { HtmlField } from '../../fields/HtmlField';
import { InkField, PointData } from '../../fields/InkField';
import { List } from '../../fields/List';
-import { ProxyField } from '../../fields/Proxy';
import { RichTextField } from '../../fields/RichTextField';
import { SchemaHeaderField } from '../../fields/SchemaHeaderField';
import { ComputedField, ScriptField } from '../../fields/ScriptField';
@@ -38,7 +37,7 @@ import { FontIconBox } from '../views/nodes/button/FontIconBox';
import { ColorBox } from '../views/nodes/ColorBox';
import { ComparisonBox } from '../views/nodes/ComparisonBox';
import { DataVizBox } from '../views/nodes/DataVizBox/DataVizBox';
-import { DocFocusOptions } from '../views/nodes/DocumentView';
+import { DocFocusOptions, OpenWhere, OpenWhereMod } from '../views/nodes/DocumentView';
import { EquationBox } from '../views/nodes/EquationBox';
import { FieldViewProps } from '../views/nodes/FieldView';
import { FilterBox } from '../views/nodes/FilterBox';
@@ -158,7 +157,7 @@ export class DocumentOptions {
_contentBounds?: List<number>; // the (forced) bounds of the document to display. format is: [left, top, right, bottom]
_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
- _isPushpin?: boolean; // whether document, when clicked, toggles display of its link target
+ _followLinkToggle?: boolean; // whether document, when clicked, toggles display of its link target
_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
@@ -238,6 +237,7 @@ export class DocumentOptions {
childContextMenuScripts?: List<ScriptField>;
childContextMenuLabels?: List<string>;
childContextMenuIcons?: List<string>;
+ followLinkZoom?: boolean; // whether to zoom to the target of a link
hideLinkButton?: boolean; // whether the blue link counter button should be hidden
hideDecorationTitle?: boolean;
hideOpenButton?: boolean;
@@ -258,9 +258,9 @@ export class DocumentOptions {
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
+ viewTransitionTime?: number; // transition duration for view parameters
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; // box-shadow css string OR "standard" to use dash standard box shadow
data?: any;
@@ -272,7 +272,7 @@ export class DocumentOptions {
clipWidth?: number; // percent transition from before to after in comparisonBox
dockingConfig?: string;
annotationOn?: Doc;
- isPushpin?: boolean;
+ followLinkToggle?: boolean;
isGroup?: boolean; // whether a collection should use a grouping UI behavior
_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
noteType?: string;
@@ -679,8 +679,6 @@ export namespace Docs {
* haven't been initialized, the newly initialized prototype document.
*/
export async function initialize(): Promise<void> {
- ProxyField.initPlugin();
- ComputedField.initPlugin();
// non-guid string ids for each document prototype
const prototypeIds = Object.values(DocumentType)
.filter(type => type !== DocumentType.NONE)
@@ -805,7 +803,7 @@ export namespace Docs {
const viewKeys = ['x', 'y', 'system']; // keys that should be addded to the view document even though they don't begin with an "_"
const { omit: dataProps, extract: viewProps } = OmitKeys(options, viewKeys, '^_');
- dataProps['acl-Override'] = 'None';
+ // dataProps['acl-Override'] = SharingPermissions.Unset;
dataProps['acl-Public'] = options['acl-Public'] ? options['acl-Public'] : Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.Augment;
dataProps.system = viewProps.system;
@@ -831,7 +829,7 @@ export namespace Docs {
const viewFirstProps: { [id: string]: any } = {};
viewFirstProps['acl-Public'] = options['_acl-Public'] ? options['_acl-Public'] : Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.Augment;
- viewFirstProps['acl-Override'] = 'None';
+ // viewFirstProps['acl-Override'] = SharingPermissions.Unset;
viewFirstProps.author = Doc.CurrentUserEmail;
let viewDoc: Doc;
// determines whether viewDoc should be created using placeholder Doc or default
@@ -1001,7 +999,7 @@ export namespace Docs {
I.data = new InkField(points);
I.creationDate = new DateField();
I['acl-Public'] = Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.Augment;
- I['acl-Override'] = 'None';
+ //I['acl-Override'] = SharingPermissions.Unset;
I.links = ComputedField.MakeFunction('links(self)');
I[Initializing] = false;
return I;
@@ -1055,6 +1053,10 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.MARKER), options?.data, options, id);
}
+ export function ImageanchorDocument(options: DocumentOptions = {}, id?: string) {
+ return InstanceFromProto(Prototypes.get(DocumentType.MARKER), options?.data, options, id);
+ }
+
export function HTMLAnchorDocument(documents: Array<Doc>, options: DocumentOptions, id?: string) {
return InstanceFromProto(Prototypes.get(DocumentType.MARKER), new List(documents), options, id);
}
@@ -1324,7 +1326,7 @@ export namespace DocUtils {
return DocUtils.ActiveRecordings.map(audio => {
const sourceDoc = getSourceDoc();
const link = sourceDoc && DocUtils.MakeLink({ doc: sourceDoc }, { doc: audio.getAnchor() || audio.props.Document }, 'recording annotation:linked recording', 'recording timeline');
- link && (link.followLinkLocation = 'add:right');
+ link && (link.followLinkLocation = OpenWhere.addRight);
return link;
});
}
@@ -1377,7 +1379,6 @@ export namespace DocUtils {
'acl-Public': SharingPermissions.Augment,
'_acl-Public': SharingPermissions.Augment,
linkDisplay: true,
- _hidden: true,
_linkAutoMove: true,
linkRelationship,
_showCaption: 'description',
@@ -1614,7 +1615,7 @@ export namespace DocUtils {
const iconViews = DocListCast(Cast(Doc.UserDoc()['template-icons'], Doc, null)?.data);
const templBtns = DocListCast(Cast(Doc.UserDoc()['template-buttons'], Doc, null)?.data);
const noteTypes = DocListCast(Cast(Doc.UserDoc()['template-notes'], Doc, null)?.data);
- const clickFuncs = DocListCast(Cast(Doc.UserDoc().clickFuncs, Doc, null)?.data);
+ const clickFuncs = DocListCast(Cast(Doc.UserDoc()['template-clickFuncs'], Doc, null)?.data);
const allTemplates = iconViews
.concat(templBtns)
.concat(noteTypes)
@@ -1706,7 +1707,7 @@ export namespace DocUtils {
}
export function LeavePushpin(doc: Doc, annotationField: string) {
- if (doc.isPushpin) return undefined;
+ if (doc.followLinkToggle) return undefined;
const context = Cast(doc.context, Doc, null) ?? Cast(doc.annotationOn, Doc, null);
const hasContextAnchor = DocListCast(doc.links).some(l => (l.anchor2 === doc && Cast(l.anchor1, Doc, null)?.annotationOn === context) || (l.anchor1 === doc && Cast(l.anchor2, Doc, null)?.annotationOn === context));
if (context && !hasContextAnchor && (context.type === DocumentType.VID || context.type === DocumentType.WEB || context.type === DocumentType.PDF || context.type === DocumentType.IMG)) {
@@ -1714,7 +1715,7 @@ export namespace DocUtils {
title: 'pushpin',
label: '',
annotationOn: Cast(doc.annotationOn, Doc, null),
- isPushpin: true,
+ followLinkToggle: true,
icon: 'map-pin',
x: Cast(doc.x, 'number', null),
y: Cast(doc.y, 'number', null),
@@ -1760,14 +1761,14 @@ export namespace DocUtils {
return dd;
}
- async function processFileupload(generatedDocuments: Doc[], name: string, type: string, result: Error | Upload.FileInformation, options: DocumentOptions, rootDoc?: Doc) {
+ async function processFileupload(generatedDocuments: Doc[], name: string, type: string, result: Error | Upload.FileInformation, options: DocumentOptions, overwriteDoc?: Doc) {
if (result instanceof Error) {
alert(`Upload failed: ${result.message}`);
return;
}
const full = { ...options, _width: 400, title: name };
const pathname = Utils.prepend(result.accessPaths.agnostic.client);
- const doc = await DocUtils.DocumentFromType(type, pathname, full, rootDoc);
+ const doc = await DocUtils.DocumentFromType(type, pathname, full, overwriteDoc);
if (doc) {
const proto = Doc.GetProto(doc);
proto.text = result.rawText;
@@ -1799,8 +1800,10 @@ export namespace DocUtils {
if (Upload.isVideoInformation(result)) {
proto['data-duration'] = result.duration;
}
- if (rootDoc) {
- Doc.removeCurrentlyLoading(rootDoc);
+ if (overwriteDoc) {
+ Doc.removeCurrentlyLoading(overwriteDoc);
+ // loading doc icons are just labels. so any icon views of loading docs need to be replaced with the proper icon view.
+ DocumentManager.Instance.getAllDocumentViews(overwriteDoc).forEach(dv => StrCast(dv.rootDoc.layoutKey) === 'layout_icon' && dv.iconify(() => dv.iconify()));
}
generatedDocuments.push(doc);
}
@@ -1917,5 +1920,5 @@ ScriptingGlobals.add(function generateLinkTitle(self: Doc) {
return `${anchor1title} (${relation}) ${anchor2title}`;
});
ScriptingGlobals.add(function openTabAlias(tab: Doc) {
- CollectionDockingView.AddSplit(Doc.MakeAlias(tab), 'right');
+ CollectionDockingView.AddSplit(Doc.MakeAlias(tab), OpenWhereMod.right);
});