aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-02-27 15:08:45 -0500
committerbobzel <zzzman@gmail.com>2023-02-27 15:08:45 -0500
commitaf2a2c83868c87812e9ae54c8e3cced81374619a (patch)
treedaa3f79b93c22f9c0f90b00c2e6f843de6eedc36 /src/client/documents/Documents.ts
parent536e1ed3f847b0e7343c1cf9eb7fc0c97818e171 (diff)
restructured getAnchor()/scrollFocus to be more consistent. added setterscript for computedFields. restructed getFieldsImpl to avoid making multiple requests for the same document due to timing issues by 'locking' a document cache with a promise before sending the server request. added rotation and fill color as animatable fields. fixed image cropping for
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index debb11066..d2ab67849 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -263,6 +263,7 @@ export class DocumentOptions {
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
+ presZoomText?: boolean; // whether text anchors should shown in a larger box when following links to make them stand out
borderRounding?: string;
boxShadow?: string; // box-shadow css string OR "standard" to use dash standard box shadow
data?: any;
@@ -1043,6 +1044,9 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.MARKER), url, options, id);
}
+ export function CollectionAnchorDocument(options: DocumentOptions = {}, id?: string) {
+ return InstanceFromProto(Prototypes.get(DocumentType.MARKER), options?.data, options, id);
+ }
export function TextanchorDocument(options: DocumentOptions = {}, id?: string) {
return InstanceFromProto(Prototypes.get(DocumentType.MARKER), options?.data, options, id);
}
@@ -1051,6 +1055,10 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.MARKER), options?.data, options, id);
}
+ export function InkAnchorDocument(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);
}
@@ -1407,12 +1415,15 @@ export namespace DocUtils {
}
});
funcs &&
- Object.keys(funcs).map(key => {
- const cfield = ComputedField.WithoutComputed(() => FieldValue(doc[key]));
- if (ScriptCast(cfield)?.script.originalScript !== funcs[key]) {
- doc[key] = funcs[key] ? ComputedField.MakeFunction(funcs[key], { dragData: DragManager.DocumentDragData.name }, { _readOnly_: true }) : undefined;
- }
- });
+ Object.keys(funcs)
+ .filter(key => key.endsWith('-setter'))
+ .map(key => {
+ const cfield = ComputedField.WithoutComputed(() => FieldValue(doc[key]));
+ if (ScriptCast(cfield)?.script.originalScript !== funcs[key]) {
+ const setFunc = Cast(funcs[key + '-setter'], 'string', null);
+ doc[key] = funcs[key] ? ComputedField.MakeFunction(funcs[key], { dragData: DragManager.DocumentDragData.name }, { _readOnly_: true }, setFunc) : undefined;
+ }
+ });
return doc;
}
export function AssignOpts(doc: Doc | undefined, reqdOpts: DocumentOptions, items?: Doc[]) {