Date: Thu, 8 Apr 2021 15:42:09 -0400
Subject: fixed pushpins to be created only when removed from a collection.
fixed webbox links which weren't showing up in link menu.
---
src/client/documents/Documents.ts | 4 ++--
src/client/views/DocComponent.tsx | 4 ++--
src/client/views/collections/CollectionSubView.tsx | 2 +-
src/client/views/nodes/WebBox.tsx | 9 +++++++--
4 files changed, 12 insertions(+), 7 deletions(-)
(limited to 'src')
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 90db8644d..38a9bd0e1 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -1317,7 +1317,7 @@ export namespace DocUtils {
}
}
- export function LeavePushpin(doc: Doc) {
+ export function LeavePushpin(doc: Doc, annotationField: string) {
if (doc.isPushpin) return undefined;
const context = Cast(doc.context, Doc, null) ?? Cast(doc.annotationOn, Doc, null);
const hasContextAnchor = DocListCast(doc.links).
@@ -1330,7 +1330,7 @@ export namespace DocUtils {
icon: "map-pin", x: Cast(doc.x, "number", null), y: Cast(doc.y, "number", null), backgroundColor: "#ACCEF7",
_width: 15, _height: 15, _xPadding: 0, _isLinkButton: true, _timecodeToShow: Cast(doc._timecodeToShow, "number", null)
});
- Doc.AddDocToList(context, Doc.LayoutFieldKey(context) + "-annotations", pushpin);
+ Doc.AddDocToList(context, annotationField, pushpin);
const pushpinLink = DocUtils.MakeLink({ doc: pushpin }, { doc: doc }, "pushpin", "");
doc._timecodeToShow = undefined;
return pushpin;
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index 5ff96ac8d..c017b7015 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -151,7 +151,7 @@ export function ViewBoxAnnotatableComponent {
- leavePushpin && DocUtils.LeavePushpin(doc);
+ leavePushpin && DocUtils.LeavePushpin(doc, annotationKey ?? this.annotationKey);
Doc.RemoveDocFromList(targetDataDoc, annotationKey ?? this.annotationKey, doc);
doc.context = undefined;
recent && Doc.AddDocToList(recent, "data", doc, undefined, true, true);
@@ -216,7 +216,7 @@ export function ViewBoxAnnotatableComponent
[AclAdmin, AclEdit].includes(GetEffectiveAcl(doc))).map(doc => { // only make a pushpin if we have acl's to edit the document
this.props.layerProvider?.(doc, true);
- DocUtils.LeavePushpin(doc);
+ //DocUtils.LeavePushpin(doc);
doc._stayInCollection = undefined;
doc.context = this.props.Document;
if (annotationKey ?? this._annotationKey) Doc.GetProto(doc).annotationOn = this.props.Document;
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index a5d679df0..071422131 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -74,7 +74,7 @@ export function CollectionSubView(schemaCtor: (doc: Doc) => T, moreProps?:
const { Document, DataDoc } = this.props;
const validPairs = this.childDocs.map(doc => Doc.GetLayoutDataDocPair(Document, !this.props.isAnnotationOverlay ? DataDoc : undefined, doc)).
filter(pair => { // filter out any documents that have a proto that we don't have permissions to (which we determine by not having any keys
- return pair.layout && !pair.layout.hidden && (!pair.layout.proto || (pair.layout.proto instanceof Doc && GetEffectiveAcl(pair.layout.proto) !== AclPrivate));// Object.keys(pair.layout.proto).length));
+ return pair.layout && /*!pair.layout.hidden &&*/ (!pair.layout.proto || (pair.layout.proto instanceof Doc && GetEffectiveAcl(pair.layout.proto) !== AclPrivate));// Object.keys(pair.layout.proto).length));
});
return validPairs.map(({ data, layout }) => ({ data: data as Doc, layout: layout! })); // this mapping is a bit of a hack to coerce types
}
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index ab178c60b..cea3833bb 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -12,7 +12,7 @@ import { makeInterface, listSpec } from "../../../fields/Schema";
import { Cast, NumCast, StrCast } from "../../../fields/Types";
import { WebField } from "../../../fields/URLField";
import { TraceMobx } from "../../../fields/util";
-import { emptyFunction, getWordAtPoint, OmitKeys, returnOne, smoothScroll, Utils, setupMoveUpEvents } from "../../../Utils";
+import { emptyFunction, getWordAtPoint, OmitKeys, returnOne, smoothScroll, Utils, setupMoveUpEvents, returnFalse } from "../../../Utils";
import { Docs } from "../../documents/Documents";
import { DocumentType } from '../../documents/DocumentTypes';
import { CurrentUserUtils } from "../../util/CurrentUserUtils";
@@ -32,6 +32,7 @@ import { FieldView, FieldViewProps } from './FieldView';
import { LinkDocPreview } from "./LinkDocPreview";
import "./WebBox.scss";
import React = require("react");
+import { ComputedField } from "../../../fields/ScriptField";
const _global = (window /* browser */ || global /* node */) as any;
const htmlToText = require("html-to-text");
@@ -80,6 +81,7 @@ export class WebBox extends ViewBoxAnnotatableComponent {
this._url = this.webField?.toString() || "";
this._annotationKey = "annotations-" + this.urlHash(this._url);
+ this.dataDoc[this.fieldKey + "-annotations"] = ComputedField.MakeFunction(`copyField(this["${this.annotationKey}"])`);
});
this._disposers.selection = reaction(() => this.props.isSelected(),
@@ -290,6 +292,7 @@ export class WebBox extends ViewBoxAnnotatableComponent
Date: Fri, 9 Apr 2021 11:18:59 -0400
Subject: fix for removing documents from pdfs/web boxes. fixes for making
objects draggable again in PDFs. fixes for lightboxview to allow stepping
into collecitons. fix for stacking view to skip hidden documents
---
src/client/views/LightboxView.tsx | 6 +-----
src/client/views/collections/CollectionStackedTimeline.tsx | 3 ++-
src/client/views/collections/CollectionStackingView.tsx | 2 +-
src/client/views/nodes/DocumentView.tsx | 2 +-
src/client/views/nodes/PDFBox.tsx | 2 ++
src/client/views/nodes/VideoBox.tsx | 2 +-
src/client/views/nodes/WebBox.tsx | 5 -----
src/client/views/pdf/PDFViewer.tsx | 3 ++-
8 files changed, 10 insertions(+), 15 deletions(-)
(limited to 'src')
diff --git a/src/client/views/LightboxView.tsx b/src/client/views/LightboxView.tsx
index 098c40df4..9444446b1 100644
--- a/src/client/views/LightboxView.tsx
+++ b/src/client/views/LightboxView.tsx
@@ -190,12 +190,8 @@ export class LightboxView extends React.Component {
const coll = LightboxView._docTarget;
const doc = LightboxView.LightboxDoc;
if (coll && doc) {
- console.log('test');
- console.log('target: ' + coll.title);
- console.log('doc: ' + doc.title);
const fieldKey = Doc.LayoutFieldKey(coll);
- LightboxView.SetLightboxDoc(doc);
- // LightboxView.SetLightboxDoc(coll, undefined, [...DocListCast(coll[fieldKey]), ...DocListCast(coll[fieldKey + "-annotations"])]);
+ LightboxView.SetLightboxDoc(coll, undefined, [...DocListCast(coll[fieldKey]), ...DocListCast(coll[fieldKey + "-annotations"])]);
TabDocView.PinDoc(coll, { hidePresBox: true });
}
}
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx
index 4f9f297a2..5b5d05681 100644
--- a/src/client/views/collections/CollectionStackedTimeline.tsx
+++ b/src/client/views/collections/CollectionStackedTimeline.tsx
@@ -235,6 +235,7 @@ export class CollectionStackedTimeline extends CollectionSubView "50%";
+ documentHeight = () => "100%";
timelineContentHeight = () => this.props.PanelHeight() / 2;
dictationScreenToLocalTransform = () => this.props.ScreenToLocalTransform().translate(0, -this.timelineContentHeight());
@computed get renderDictation() {
@@ -242,7 +243,7 @@ export class CollectionStackedTimeline extends CollectionSubView
"100%"}
+ PanelHeight={this.documentHeight}
isAnnotationOverlay={true}
isDocumentActive={returnFalse}
select={emptyFunction}
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index 8d8c69fd5..1aed40bc3 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -55,7 +55,7 @@ export class CollectionStackingView extends CollectionSubView pair.layout instanceof Doc).map(pair => pair.layout); }
+ @computed get filteredChildren() { return this.childLayoutPairs.filter(pair => (pair.layout instanceof Doc) && !pair.layout.hidden).map(pair => pair.layout); }
@computed get headerMargin() { return this.props.styleProvider?.(this.layoutDoc, this.props, StyleProp.HeaderMargin); }
@computed get xMargin() { return NumCast(this.layoutDoc._xMargin, 2 * Math.min(this.gridGap, .05 * this.props.PanelWidth())); }
@computed get yMargin() { return this.props.yMargin || NumCast(this.layoutDoc._yMargin, 5); } // 2 * this.gridGap)); }
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 859aff2e8..22543cc8a 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -1106,7 +1106,7 @@ export class DocumentView extends React.Component {
position: this.props.Document.isInkMask ? "absolute" : undefined,
transform: `translate(${this.centeringX}px, ${this.centeringY}px)`,
width: xshift() ?? `${100 * (this.props.PanelWidth() - this.Xshift * 2) / this.props.PanelWidth()}%`,
- height: this.props.Document.type === DocumentType.VID ? "100%" : yshift() ?? (this.fitWidth ? `${this.panelHeight}px` :
+ height: yshift() ?? (this.fitWidth ? `${this.panelHeight}px` :
`${100 * this.effectiveNativeHeight / this.effectiveNativeWidth * this.props.PanelWidth() / this.props.PanelHeight()}%`),
}}>
{
this._url = this.webField?.toString() || "";
this._annotationKey = "annotations-" + this.urlHash(this._url);
- this.dataDoc[this.fieldKey + "-annotations"] = ComputedField.MakeFunction(`copyField(this["${this.annotationKey}"])`);
});
this._disposers.selection = reaction(() => this.props.isSelected(),
@@ -292,7 +290,6 @@ export class WebBox extends ViewBoxAnnotatableComponent {
}}>
Date: Fri, 9 Apr 2021 11:53:48 -0400
Subject: pres box audio changes
---
src/client/views/nodes/PresBox.tsx | 25 +++++++++++-----------
.../views/nodes/formattedText/FormattedTextBox.tsx | 4 +++-
2 files changed, 16 insertions(+), 13 deletions(-)
(limited to 'src')
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index 8c5f77550..446db3549 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -29,6 +29,7 @@ import { CollectionFreeFormDocumentView } from "./CollectionFreeFormDocumentView
import { FieldView, FieldViewProps } from './FieldView';
import "./PresBox.scss";
import Color = require("color");
+import { LightboxView } from "../LightboxView";
export enum PresMovement {
Zoom = "zoom",
@@ -433,10 +434,12 @@ export class PresBox extends ViewBoxBaseComponent
};
// If openDocument is selected then it should open the document for the user
if (activeItem.openDocument) {
- openInTab(targetDoc);
+ LightboxView.SetLightboxDoc(targetDoc);
} else if (curDoc.presMovement === PresMovement.Pan && targetDoc) {
+ LightboxView.SetLightboxDoc(undefined);
await DocumentManager.Instance.jumpToDocument(targetDoc, false, openInTab, srcContext, undefined, undefined, undefined, includesDoc || tab ? undefined : resetSelection); // documents open in new tab instead of on right
} else if ((curDoc.presMovement === PresMovement.Zoom || curDoc.presMovement === PresMovement.Jump) && targetDoc) {
+ LightboxView.SetLightboxDoc(undefined);
//awaiting jump so that new scale can be found, since jumping is async
await DocumentManager.Instance.jumpToDocument(targetDoc, true, openInTab, srcContext, undefined, undefined, undefined, includesDoc || tab ? undefined : resetSelection); // documents open in new tab instead of on right
}
@@ -574,6 +577,9 @@ export class PresBox extends ViewBoxBaseComponent
if (this._presTimer) clearTimeout(this._presTimer);
this.layoutDoc.presStatus = PresStatus.Manual;
this.layoutDoc.presLoop = false;
+ this.childDocs.forEach((doc) => {
+ this.stopTempMedia(Cast(doc.presentationTargetDoc, Doc, null));
+ });
}
}
@@ -633,10 +639,12 @@ export class PresBox extends ViewBoxBaseComponent
updateMinimize = () => {
const docView = DocumentManager.Instance.getDocumentView(this.layoutDoc);
if (CurrentUserUtils.OverlayDocs.includes(this.layoutDoc)) {
+ console.log("case 1");
this.layoutDoc.presStatus = PresStatus.Edit;
Doc.RemoveDocFromList((Doc.UserDoc().myOverlayDocs as Doc), undefined, this.rootDoc);
CollectionDockingView.AddSplit(this.rootDoc, "right");
} else if (this.layoutDoc.context && docView) {
+ console.log("case 2");
this.layoutDoc.presStatus = PresStatus.Edit;
clearTimeout(this._presTimer);
const pt = this.props.ScreenToLocalTransform().inverse().transformPoint(0, 0);
@@ -647,15 +655,8 @@ export class PresBox extends ViewBoxBaseComponent
docView.props.removeDocument?.(this.layoutDoc);
Doc.AddDocToList((Doc.UserDoc().myOverlayDocs as Doc), undefined, this.rootDoc);
} else {
- this.layoutDoc.presStatus = PresStatus.Edit;
- clearTimeout(this._presTimer);
- const pt = this.props.ScreenToLocalTransform().inverse().transformPoint(0, 0);
- this.rootDoc.x = pt[0] + (this.props.PanelWidth() - 250);
- this.rootDoc.y = pt[1] + 10;
- this.rootDoc._height = 35;
- this.rootDoc._width = 250;
- this.props.addDocTab?.(this.rootDoc, "close");
- Doc.AddDocToList((Doc.UserDoc().myOverlayDocs as Doc), undefined, this.rootDoc);
+ console.log("case 3");
+ // TODO glr: fix this case
}
}
@@ -1193,7 +1194,7 @@ export class PresBox extends ViewBoxBaseComponent
const effect = targetDoc.presEffect ? targetDoc.presEffect : 'None';
activeItem.presMovement = activeItem.presMovement ? activeItem.presMovement : 'Zoom';
return (
- e.stopPropagation()} onPointerUp={e => e.stopPropagation()} onClick={action(e => { e.stopPropagation(); this.openMovementDropdown = false; this.openEffectDropdown = false; })}>
+
e.stopPropagation()} onPointerUp={e => e.stopPropagation()} onClick={action(e => { e.stopPropagation(); this.openMovementDropdown = false; this.openEffectDropdown = false; })}>
Movement
{isPresCollection || (isPresCollection && isPinWithView) ?
@@ -1248,7 +1249,7 @@ export class PresBox extends ViewBoxBaseComponent
{isPresCollection ? (null) :
{"Hide before presented"}
>}> this.updateHideBefore(activeItem)}>Hide before
}
{isPresCollection ? (null) :
{"Hide after presented"}
>}> this.updateHideAfter(activeItem)}>Hide after
}
-
{"Open document in a new tab"}
>}> this.updateOpenDoc(activeItem)}>Open
+
{"Open in lightbox view"}
>}> this.updateOpenDoc(activeItem)}>Lightbox
{(type === DocumentType.AUDIO || type === DocumentType.VID) ? (null) : <>
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 9482b632a..1e901c0aa 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -297,7 +297,9 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp
this._editorView.updateState(EditorState.fromJSON(this.config, json));
}
}
- if (window.getSelection()?.isCollapsed) AnchorMenu.Instance.fadeOut(true);
+ if (window.getSelection()?.isCollapsed && this.props.isSelected) {
+ AnchorMenu.Instance.fadeOut(true);
+ }
}
}
--
cgit v1.2.3-70-g09d2
From 813dcbeaf3359dc184067f597e731b44a0446e1b Mon Sep 17 00:00:00 2001
From: bobzel
Date: Fri, 9 Apr 2021 12:22:37 -0400
Subject: fixed not following links on video in lightbox
---
src/client/views/collections/CollectionStackedTimeline.tsx | 3 ++-
.../views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 2 +-
src/client/views/nodes/FieldView.tsx | 1 +
3 files changed, 4 insertions(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx
index 5b5d05681..782726456 100644
--- a/src/client/views/collections/CollectionStackedTimeline.tsx
+++ b/src/client/views/collections/CollectionStackedTimeline.tsx
@@ -349,7 +349,8 @@ class StackedTimelineAnchor extends React.Component
(time) => {
const dictationDoc = Cast(this.props.layoutDoc["data-dictation"], Doc, null);
const isDictation = dictationDoc && DocListCast(this.props.mark.links).some(link => Cast(link.anchor1, Doc, null)?.annotationOn === dictationDoc);
- if ((isDictation || !Doc.AreProtosEqual(LightboxView.LightboxDoc, this.props.layoutDoc)) && DocListCast(this.props.mark.links).length &&
+ if ((!LightboxView.LightboxDoc
+ /*isDictation || !Doc.AreProtosEqual(LightboxView.LightboxDoc, this.props.layoutDoc)*/) && DocListCast(this.props.mark.links).length &&
time > NumCast(this.props.mark[this.props.startTag]) &&
time < NumCast(this.props.mark[this.props.endTag]) &&
this._lastTimecode < NumCast(this.props.mark[this.props.startTag])) {
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index c623ce653..004d29127 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1032,7 +1032,7 @@ export class CollectionFreeFormView extends CollectionSubView void;
isContentActive: (outsideReaction?: boolean) => boolean;
+ isDocumentActive?: () => boolean;
isSelected: (outsideReaction?: boolean) => boolean;
scaling?: () => number;
setHeight: (height: number) => void;
--
cgit v1.2.3-70-g09d2
From ebf301a8382e01fa3463f7295bfba175b905e59e Mon Sep 17 00:00:00 2001
From: bobzel
Date: Fri, 9 Apr 2021 13:27:15 -0400
Subject: fixed webBox to display link icon w/ all related links properly.
---
src/client/views/MainView.tsx | 10 +++++++---
src/client/views/nodes/WebBox.tsx | 6 ++++++
2 files changed, 13 insertions(+), 3 deletions(-)
(limited to 'src')
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 7d78d74e3..c31e82ba0 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -178,8 +178,8 @@ export class MainView extends React.Component {
const targClass = targets[0].className.toString();
if (SearchBox.Instance._searchbarOpen || SearchBox.Instance.open) {
const check = targets.some((thing) =>
- (thing.className === "collectionSchemaView-searchContainer" || (thing as any)?.dataset.icon === "filter" ||
- thing.className === "collectionSchema-header-menuOptions"));
+ (thing.className === "collectionSchemaView-searchContainer" || (thing as any)?.dataset.icon === "filter" ||
+ thing.className === "collectionSchema-header-menuOptions"));
!check && SearchBox.Instance.resetSearch(true);
}
!targClass.includes("contextMenu") && ContextMenu.Instance.closeMenu();
@@ -273,7 +273,11 @@ export class MainView extends React.Component {
@computed get dockingContent() {
return { e.stopPropagation(); e.preventDefault(); }}
- style={{ minWidth: `calc(100% - ${this._flyoutWidth + this.menuPanelWidth() + this.propertiesWidth()}px)`, width: `calc(100% - ${this._flyoutWidth + this.menuPanelWidth() + this.propertiesWidth()}px)` }}>
+ style={{
+ minWidth: `calc(100% - ${this._flyoutWidth + this.menuPanelWidth() + this.propertiesWidth()}px)`,
+ transform: LightboxView.LightboxDoc ? "scale(0.0001)" : undefined,
+ width: `calc(100% - ${this._flyoutWidth + this.menuPanelWidth() + this.propertiesWidth()}px)`
+ }}>
{!this.mainContainer ? (null) : this.mainDocView}
;
}
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index 2a575ca9b..2f2b242f5 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -32,6 +32,7 @@ import { FieldView, FieldViewProps } from './FieldView';
import { LinkDocPreview } from "./LinkDocPreview";
import "./WebBox.scss";
import React = require("react");
+import { ComputedField } from "../../../fields/ScriptField";
const _global = (window /* browser */ || global /* node */) as any;
const htmlToText = require("html-to-text");
@@ -80,6 +81,8 @@ export class WebBox extends ViewBoxAnnotatableComponent {
this._url = this.webField?.toString() || "";
this._annotationKey = "annotations-" + this.urlHash(this._url);
+ this.dataDoc["annotation-active"] = this._annotationKey;
+ this.dataDoc[this.fieldKey + "-annotations"] = ComputedField.MakeFunction(`copyField(this["${this.fieldKey}-"+this["annotation-active"]])`);
});
this._disposers.selection = reaction(() => this.props.isSelected(),
@@ -290,6 +293,7 @@ export class WebBox extends ViewBoxAnnotatableComponent
Date: Fri, 9 Apr 2021 14:28:36 -0400
Subject: fixed : in lightbox view from creating a document
---
src/client/views/collections/CollectionStackingViewFieldColumn.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src')
diff --git a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
index bee7aeb87..47733994b 100644
--- a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
+++ b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
@@ -235,7 +235,7 @@ export class CollectionStackingViewFieldColumn extends React.Component
Date: Fri, 9 Apr 2021 14:54:16 -0400
Subject: fix for disappearing anchor menu when dictating and highlighting a
pdf/web .
---
src/client/views/nodes/formattedText/FormattedTextBox.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src')
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 1e901c0aa..c2860af76 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -297,7 +297,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp
this._editorView.updateState(EditorState.fromJSON(this.config, json));
}
}
- if (window.getSelection()?.isCollapsed && this.props.isSelected) {
+ if (window.getSelection()?.isCollapsed && this.props.isSelected()) {
AnchorMenu.Instance.fadeOut(true);
}
}
--
cgit v1.2.3-70-g09d2
From 9669ebd0c0e76bbfbbc898e8b379cff41b1031ed Mon Sep 17 00:00:00 2001
From: bobzel
Date: Sun, 11 Apr 2021 12:07:10 -0400
Subject: some cleanup of demo_changes
---
src/client/views/collections/CollectionMenu.tsx | 2 +-
.../collections/CollectionStackedTimeline.tsx | 17 ++++++++-------
src/client/views/nodes/PresBox.tsx | 24 +++++++++-------------
src/client/views/nodes/ScreenshotBox.tsx | 12 +----------
src/client/views/nodes/VideoBox.tsx | 1 -
src/client/views/nodes/WebBox.tsx | 5 +++++
6 files changed, 27 insertions(+), 34 deletions(-)
(limited to 'src')
diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index f56f12c67..337595f1c 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -15,7 +15,7 @@ import { RichTextField } from "../../../fields/RichTextField";
import { listSpec } from "../../../fields/Schema";
import { ScriptField } from "../../../fields/ScriptField";
import { BoolCast, Cast, NumCast, StrCast } from "../../../fields/Types";
-import { DeepCopy, emptyFunction, setupMoveUpEvents, Utils } from "../../../Utils";
+import { emptyFunction, setupMoveUpEvents, Utils } from "../../../Utils";
import { DocumentType } from "../../documents/DocumentTypes";
import { CurrentUserUtils } from "../../util/CurrentUserUtils";
import { DragManager } from "../../util/DragManager";
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx
index 782726456..ab9c4aa2c 100644
--- a/src/client/views/collections/CollectionStackedTimeline.tsx
+++ b/src/client/views/collections/CollectionStackedTimeline.tsx
@@ -234,16 +234,16 @@ export class CollectionStackedTimeline extends CollectionSubView "50%";
- documentHeight = () => "100%";
- timelineContentHeight = () => this.props.PanelHeight() / 2;
+ dictationHeightPercent = 50;
+ dictationHeight = () => `${this.dictationHeightPercent}%`;
+ timelineContentHeight = () => this.props.PanelHeight() * this.dictationHeightPercent / 100;
dictationScreenToLocalTransform = () => this.props.ScreenToLocalTransform().translate(0, -this.timelineContentHeight());
@computed get renderDictation() {
const dictation = Cast(this.dataDoc[this.props.dictationKey], Doc, null);
- return !dictation ? (null) :
+ return !dictation ? (null) :
(time) => {
const dictationDoc = Cast(this.props.layoutDoc["data-dictation"], Doc, null);
const isDictation = dictationDoc && DocListCast(this.props.mark.links).some(link => Cast(link.anchor1, Doc, null)?.annotationOn === dictationDoc);
- if ((!LightboxView.LightboxDoc
- /*isDictation || !Doc.AreProtosEqual(LightboxView.LightboxDoc, this.props.layoutDoc)*/) && DocListCast(this.props.mark.links).length &&
+ if (!LightboxView.LightboxDoc
+ // bcz: when should links be followed? we don't want to move away from the video to follow a link but we can open it in a sidebar/etc. But we don't know that upfront.
+ // for now, we won't follow any links when the lightbox is oepn to avoid "losing" the video.
+ /*(isDictation || !Doc.AreProtosEqual(LightboxView.LightboxDoc, this.props.layoutDoc))*/
+ && DocListCast(this.props.mark.links).length &&
time > NumCast(this.props.mark[this.props.startTag]) &&
time < NumCast(this.props.mark[this.props.endTag]) &&
this._lastTimecode < NumCast(this.props.mark[this.props.startTag])) {
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index 446db3549..f3fb6ff17 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -5,7 +5,7 @@ import { action, computed, IReactionDisposer, observable, ObservableMap, reactio
import { observer } from "mobx-react";
import { ColorState, SketchPicker } from "react-color";
import { Bounce, Fade, Flip, LightSpeed, Roll, Rotate, Zoom } from 'react-reveal';
-import { Doc, DocListCast, DocListCastAsync } from "../../../fields/Doc";
+import { Doc, DocListCast, DocListCastAsync, FieldResult } from "../../../fields/Doc";
import { documentSchema } from "../../../fields/documentSchemas";
import { InkTool } from "../../../fields/InkField";
import { List } from "../../../fields/List";
@@ -247,11 +247,12 @@ export class PresBox extends ViewBoxBaseComponent
// }
}
- stopTempMedia = (targetDoc: Doc) => {
- if (targetDoc.type === DocumentType.AUDIO) {
+ stopTempMedia = (targetDocField: FieldResult) => {
+ const targetDoc = Cast(targetDocField, Doc, null);
+ if (targetDoc?.type === DocumentType.AUDIO) {
if (this._mediaTimer && this._mediaTimer[1] === targetDoc) clearTimeout(this._mediaTimer[0]);
targetDoc._audioStop = true;
- } else if (targetDoc.type === DocumentType.VID) {
+ } else if (targetDoc?.type === DocumentType.VID) {
if (this._mediaTimer && this._mediaTimer[1] === targetDoc) clearTimeout(this._mediaTimer[0]);
targetDoc._triggerVideoStop = true;
}
@@ -331,14 +332,11 @@ export class PresBox extends ViewBoxBaseComponent
this.rootDoc._itemIndex = index;
const activeItem: Doc = this.activeItem;
const targetDoc: Doc = this.targetDoc;
- if (from && from.mediaStopTriggerList && this.layoutDoc.presStatus !== PresStatus.Edit) {
- const mediaDocList = DocListCast(from.mediaStopTriggerList);
- mediaDocList.forEach((doc) => {
- this.stopTempMedia(Cast(doc.presentationTargetDoc, Doc, null));
- });
+ if (from?.mediaStopTriggerList && this.layoutDoc.presStatus !== PresStatus.Edit) {
+ DocListCast(from.mediaStopTriggerList).forEach(this.stopTempMedia);
}
- if (from && from.mediaStop === "auto" && this.layoutDoc.presStatus !== PresStatus.Edit) {
- this.stopTempMedia(Cast(from.presentationTargetDoc, Doc, null));
+ if (from?.mediaStop === "auto" && this.layoutDoc.presStatus !== PresStatus.Edit) {
+ this.stopTempMedia(from.presentationTargetDoc);
}
// If next slide is audio / video 'Play automatically' then the next slide should be played
if (this.layoutDoc.presStatus !== PresStatus.Edit && (targetDoc.type === DocumentType.AUDIO || targetDoc.type === DocumentType.VID) && (activeItem.mediaStart === "auto")) {
@@ -577,9 +575,7 @@ export class PresBox extends ViewBoxBaseComponent
if (this._presTimer) clearTimeout(this._presTimer);
this.layoutDoc.presStatus = PresStatus.Manual;
this.layoutDoc.presLoop = false;
- this.childDocs.forEach((doc) => {
- this.stopTempMedia(Cast(doc.presentationTargetDoc, Doc, null));
- });
+ this.childDocs.forEach(this.stopTempMedia);
}
}
diff --git a/src/client/views/nodes/ScreenshotBox.tsx b/src/client/views/nodes/ScreenshotBox.tsx
index cecc593f0..6449c99a1 100644
--- a/src/client/views/nodes/ScreenshotBox.tsx
+++ b/src/client/views/nodes/ScreenshotBox.tsx
@@ -36,7 +36,7 @@ const ScreenshotDocument = makeInterface(documentSchema);
@observer
export class ScreenshotBox extends ViewBoxAnnotatableComponent(ScreenshotDocument) {
public static LayoutString(fieldKey: string) { return FieldView.LayoutString(ScreenshotBox, fieldKey); }
- private _videoRef: HTMLVideoElement | undefined | null;
+ private _videoRef: HTMLVideoElement | null = null;
private _audioRec: any;
private _videoRec: any;
@observable _screenCapture = false;
@@ -82,12 +82,9 @@ export class ScreenshotBox extends ViewBoxAnnotatableComponent {
- console.log('ref: ', r);
this._videoRef = r;
setTimeout(() => {
if (this.rootDoc.startRec && this._videoRef) { // TODO glr: use mediaState
@@ -107,12 +104,8 @@ export class ScreenshotBox extends ViewBoxAnnotatableComponent {
- console.log("toggleRecording");
- console.log("2:" + this._videoRef!.srcObject);
-
this._screenCapture = !this._screenCapture;
if (this._screenCapture) {
- console.log("opening");
this._audioRec = new MediaRecorder(await navigator.mediaDevices.getUserMedia({ audio: true }));
const aud_chunks: any = [];
this._audioRec.ondataavailable = (e: any) => aud_chunks.push(e.data);
@@ -128,7 +121,6 @@ export class ScreenshotBox extends ViewBoxAnnotatableComponent this.dataDoc[this.props.fieldKey + "-recordingStart"] = new DateField(new Date());
this._videoRec.ondataavailable = (e: any) => vid_chunks.push(e.data);
this._videoRec.onstop = async (e: any) => {
- console.log("onStop: video end");
const file = new File(vid_chunks, `${this.rootDoc[Id]}.mkv`, { type: vid_chunks[0].type, lastModified: Date.now() });
const [{ result }] = await Networking.UploadFilesToServer(file);
this.dataDoc[this.fieldKey + "-duration"] = (new Date().getTime() - this.recordingStart!) / 1000;
@@ -152,7 +144,6 @@ export class ScreenshotBox extends ViewBoxAnnotatableComponent Math.max(0, this.props.PanelHeight() - this.videoPanelHeight());
render() {
TraceMobx();
- console.log('rendering');
return
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx
index 3b0fb4091..fb58ddefc 100644
--- a/src/client/views/nodes/VideoBox.tsx
+++ b/src/client/views/nodes/VideoBox.tsx
@@ -417,7 +417,6 @@ export class VideoBox extends ViewBoxAnnotatableComponent
{
this._clicking = true;
- console.log('timeline click');
setupMoveUpEvents(this, e,
action((e: PointerEvent) => {
this._clicking = false;
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index 2f2b242f5..a632d1fcc 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -81,7 +81,12 @@ export class WebBox extends ViewBoxAnnotatableComponent {
this._url = this.webField?.toString() || "";
this._annotationKey = "annotations-" + this.urlHash(this._url);
+ // bcz: this is messy. logically, setting the url alone should direct where annotations should go. But
+ // right now we need to set doc.annotation-active to be the field suffix for the annotations
+ // and we need to set a computed field to copy the annotations to where everyone else expects them in doc.field-annotations
+ // TODO: always write annotations to doc.field-anotations and then copy them to doc.field-annotaitons-hash only when the page is changed.
this.dataDoc["annotation-active"] = this._annotationKey;
+ // bcz: need to make sure that doc.data-annotations points to the currently active web page's annotations (this could/should be in the constructor)
this.dataDoc[this.fieldKey + "-annotations"] = ComputedField.MakeFunction(`copyField(this["${this.fieldKey}-"+this["annotation-active"]])`);
});
--
cgit v1.2.3-70-g09d2
From 79171e0275b45393cc56f54955c0056920ab2c40 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Sun, 11 Apr 2021 12:09:43 -0400
Subject: from last
---
src/client/views/LightboxView.tsx | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/client/views/LightboxView.tsx b/src/client/views/LightboxView.tsx
index 9444446b1..b26765fa7 100644
--- a/src/client/views/LightboxView.tsx
+++ b/src/client/views/LightboxView.tsx
@@ -188,8 +188,7 @@ export class LightboxView extends React.Component {
LightboxView._future?.push(...DocListCast(tours[0][fieldKey]).reverse());
} else {
const coll = LightboxView._docTarget;
- const doc = LightboxView.LightboxDoc;
- if (coll && doc) {
+ if (coll) {
const fieldKey = Doc.LayoutFieldKey(coll);
LightboxView.SetLightboxDoc(coll, undefined, [...DocListCast(coll[fieldKey]), ...DocListCast(coll[fieldKey + "-annotations"])]);
TabDocView.PinDoc(coll, { hidePresBox: true });
--
cgit v1.2.3-70-g09d2
From 6accc320ae70c6607e67a1befe37f5712b092c02 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Sun, 11 Apr 2021 12:18:18 -0400
Subject: added childDocumentsActive prop to avoid hardwiring reference to
"starburst" in freeformview.
---
src/client/views/collections/CollectionPileView.tsx | 13 ++++++++++---
src/client/views/collections/CollectionView.tsx | 1 +
.../collectionFreeForm/CollectionFreeFormView.tsx | 2 +-
3 files changed, 12 insertions(+), 4 deletions(-)
(limited to 'src')
diff --git a/src/client/views/collections/CollectionPileView.tsx b/src/client/views/collections/CollectionPileView.tsx
index 6f6cdd5d2..6baf633dd 100644
--- a/src/client/views/collections/CollectionPileView.tsx
+++ b/src/client/views/collections/CollectionPileView.tsx
@@ -2,7 +2,7 @@ import { action, computed } from "mobx";
import { observer } from "mobx-react";
import { Doc, HeightSym, WidthSym } from "../../../fields/Doc";
import { NumCast, StrCast } from "../../../fields/Types";
-import { emptyFunction, setupMoveUpEvents } from "../../../Utils";
+import { emptyFunction, setupMoveUpEvents, returnTrue } from "../../../Utils";
import { DocUtils } from "../../documents/Documents";
import { SelectionManager } from "../../util/SelectionManager";
import { SnappingManager } from "../../util/SnappingManager";
@@ -31,9 +31,16 @@ export class CollectionPileView extends CollectionSubView(doc => doc) {
// returns the contents of the pileup in a CollectionFreeFormView
@computed get contents() {
+ const isStarburst = this.layoutEngine() === "starburst";
const draggingSelf = this.props.isSelected();
- return
-
+ {
(doc instanceof Doc ? [doc] : doc).map((d) => DocUtils.iconify(d));
return this.props.addDocument?.(doc) || false;
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 4dc0ee3e6..85ae66fdc 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -66,6 +66,7 @@ export interface CollectionViewProps extends FieldViewProps {
// property overrides for child documents
children?: never | (() => JSX.Element[]) | React.ReactNode;
childDocuments?: Doc[]; // used to override the documents shown by the sub collection to an explicit list (see LinkBox)
+ childDocumentsActive?: () => boolean;// whether child documents can be dragged if collection can be dragged (eg., in a when a Pile document is in startburst mode)
childFitWidth?: () => boolean;
childOpacity?: () => number;
childHideTitle?: () => boolean; // whether to hide the documentdecorations title for children
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 004d29127..7a879ecde 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1032,7 +1032,7 @@ export class CollectionFreeFormView extends CollectionSubView
Date: Sun, 11 Apr 2021 12:21:54 -0400
Subject: from last
---
src/client/views/nodes/ScreenshotBox.tsx | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
(limited to 'src')
diff --git a/src/client/views/nodes/ScreenshotBox.tsx b/src/client/views/nodes/ScreenshotBox.tsx
index 6449c99a1..73fe8d68a 100644
--- a/src/client/views/nodes/ScreenshotBox.tsx
+++ b/src/client/views/nodes/ScreenshotBox.tsx
@@ -1,6 +1,6 @@
import React = require("react");
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { action, computed, IReactionDisposer, observable, ObservableMap, reaction, runInAction, trace } from "mobx";
+import { action, computed, observable } from "mobx";
import { observer } from "mobx-react";
import { DateField } from "../../../fields/DateField";
import { Doc, WidthSym } from "../../../fields/Doc";
@@ -11,21 +11,21 @@ import { makeInterface } from "../../../fields/Schema";
import { ComputedField } from "../../../fields/ScriptField";
import { Cast, NumCast } from "../../../fields/Types";
import { AudioField, VideoField } from "../../../fields/URLField";
+import { TraceMobx } from "../../../fields/util";
import { emptyFunction, OmitKeys, returnFalse, returnOne, Utils } from "../../../Utils";
import { DocUtils } from "../../documents/Documents";
import { DocumentType } from "../../documents/DocumentTypes";
import { Networking } from "../../Network";
+import { CaptureManager } from "../../util/CaptureManager";
import { CurrentUserUtils } from "../../util/CurrentUserUtils";
import { CollectionFreeFormView } from "../collections/collectionFreeForm/CollectionFreeFormView";
import { CollectionStackedTimeline } from "../collections/CollectionStackedTimeline";
import { ContextMenu } from "../ContextMenu";
import { ViewBoxAnnotatableComponent, ViewBoxAnnotatableProps } from "../DocComponent";
import { FieldView, FieldViewProps } from './FieldView';
+import { FormattedTextBox } from "./formattedText/FormattedTextBox";
import "./ScreenshotBox.scss";
import { VideoBox } from "./VideoBox";
-import { TraceMobx } from "../../../fields/util";
-import { FormattedTextBox } from "./formattedText/FormattedTextBox";
-import { CaptureManager } from "../../util/CaptureManager";
declare class MediaRecorder {
constructor(e: any, options?: any); // whatever MediaRecorder has
}
@@ -41,8 +41,6 @@ export class ScreenshotBox extends ViewBoxAnnotatableComponent disposer?.());
}
specificContextMenu = (e: React.MouseEvent): void => {
--
cgit v1.2.3-70-g09d2
From 470240a50c3af2ff29a6d61ee256374e70933eb9 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Sun, 11 Apr 2021 12:34:51 -0400
Subject: updated startRect to use mediaState and added pendingRecording as an
option.
---
src/client/documents/Documents.ts | 5 +++--
src/client/util/CurrentUserUtils.ts | 2 +-
src/client/views/collections/CollectionMenu.tsx | 5 +----
src/client/views/nodes/AudioBox.tsx | 2 +-
src/client/views/nodes/ScreenshotBox.tsx | 3 +--
5 files changed, 7 insertions(+), 10 deletions(-)
(limited to 'src')
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 96aa43c79..219890945 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -164,6 +164,7 @@ export class DocumentOptions {
version?: string; // version identifier for a document
label?: string;
hidden?: boolean;
+ mediaState?: string; // status of media document: "pendingRecording", "recording", "paused", "playing"
autoPlayAnchors?: boolean; // whether to play audio/video when an anchor is clicked in a stackedTimeline.
dontPlayLinkOnSelect?: boolean; // whether an audio/video should start playing when a link is followed to it.
toolTip?: string; // tooltip to display on hover
@@ -703,8 +704,8 @@ export namespace Docs {
return InstanceFromProto(Prototypes.get(DocumentType.WEBCAM), "", options);
}
- export function ScreenshotDocument(url: string, options: DocumentOptions = {}) {
- return InstanceFromProto(Prototypes.get(DocumentType.SCREENSHOT), "", options);
+ export function ScreenshotDocument(title: string, options: DocumentOptions = {}) {
+ return InstanceFromProto(Prototypes.get(DocumentType.SCREENSHOT), "", { ...options, title });
}
export function ComparisonDocument(options: DocumentOptions = { title: "Comparison Box" }) {
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 0875d9be7..cb8bf5a7f 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -423,7 +423,7 @@ export class CurrentUserUtils {
((doc.emptyScript as Doc).proto as Doc)["dragFactory-count"] = 0;
}
if (doc.emptyScreenshot === undefined) {
- doc.emptyScreenshot = Docs.Create.ScreenshotDocument("", { _fitWidth: true, _width: 400, _height: 200, title: "screen snapshot", system: true, cloneFieldFilter: new List(["system"]) });
+ doc.emptyScreenshot = Docs.Create.ScreenshotDocument("empty screenshot", { _fitWidth: true, _width: 400, _height: 200, system: true, cloneFieldFilter: new List(["system"]) });
}
if (doc.emptyAudio === undefined) {
doc.emptyAudio = Docs.Create.AudioDocument(nullAudio, { _width: 200, title: "audio recording", system: true, cloneFieldFilter: new List(["system"]) });
diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index 337595f1c..a26953ff6 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -399,10 +399,7 @@ export class CollectionViewBaseChrome extends React.Component {
- const doc = Docs.Create.ScreenshotDocument("", { _fitWidth: true, _width: 400, _height: 200, title: "screen snapshot", system: true, cloneFieldFilter: new List(["system"]) });
- doc.x = 0;
- doc.y = 0;
- doc.startRec = true;
+ const doc = Docs.Create.ScreenshotDocument("screen recording", { _fitWidth: true, _width: 400, _height: 200, mediaState: "pendingRecording" });
//Doc.AddDocToList((Doc.UserDoc().myOverlayDocs as Doc), undefined, doc);
CollectionDockingView.AddSplit(doc, "right");
}
diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx
index 85899578c..a2e36f12e 100644
--- a/src/client/views/nodes/AudioBox.tsx
+++ b/src/client/views/nodes/AudioBox.tsx
@@ -53,7 +53,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent = this.layoutDoc._height;
@observable _paused: boolean = false;
- @computed get mediaState(): undefined | "recording" | "paused" | "playing" { return this.dataDoc.mediaState as (undefined | "recording" | "paused" | "playing"); }
+ @computed get mediaState(): undefined | "pendingRecording" | "recording" | "paused" | "playing" { return this.dataDoc.mediaState as (undefined | "pendingRecording" | "recording" | "paused" | "playing"); }
set mediaState(value) { this.dataDoc.mediaState = value; }
public static SetScrubTime = action((timeInMillisFrom1970: number) => { AudioBox._scrubTime = 0; AudioBox._scrubTime = timeInMillisFrom1970; });
@computed get recordingStart() { return Cast(this.dataDoc[this.props.fieldKey + "-recordingStart"], DateField)?.date.getTime(); }
diff --git a/src/client/views/nodes/ScreenshotBox.tsx b/src/client/views/nodes/ScreenshotBox.tsx
index 73fe8d68a..c4f8d1143 100644
--- a/src/client/views/nodes/ScreenshotBox.tsx
+++ b/src/client/views/nodes/ScreenshotBox.tsx
@@ -84,9 +84,8 @@ export class ScreenshotBox extends ViewBoxAnnotatableComponent {
this._videoRef = r;
setTimeout(() => {
- if (this.rootDoc.startRec && this._videoRef) { // TODO glr: use mediaState
+ if (this.rootDoc.mediaState === "pendingRecording" && this._videoRef) { // TODO glr: use mediaState
this.toggleRecording();
- this.rootDoc.startRec = undefined;
}
}, 1000);
}}
--
cgit v1.2.3-70-g09d2
From b215d4860454fca9050bb96a5f7c222c1eb9a3c7 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Sun, 11 Apr 2021 13:16:31 -0400
Subject: clean up of webBox annotation field updating when navigating between
pages.
---
src/client/views/nodes/KeyValueBox.tsx | 2 +-
src/client/views/nodes/WebBox.tsx | 34 ++++++++++++++--------------------
src/fields/Doc.ts | 2 +-
3 files changed, 16 insertions(+), 22 deletions(-)
(limited to 'src')
diff --git a/src/client/views/nodes/KeyValueBox.tsx b/src/client/views/nodes/KeyValueBox.tsx
index bf9ca1de0..111509fdb 100644
--- a/src/client/views/nodes/KeyValueBox.tsx
+++ b/src/client/views/nodes/KeyValueBox.tsx
@@ -58,7 +58,7 @@ export class KeyValueBox extends React.Component {
value = eq ? value.substr(1) : value;
const dubEq = value.startsWith(":=") ? "computed" : value.startsWith(";=") ? "script" : false;
value = dubEq ? value.substr(2) : value;
- const options: ScriptOptions = { addReturn: true, params: { this: "Doc", _last_: "any" }, globals: true, editable: false };
+ const options: ScriptOptions = { addReturn: true, params: { this: "Doc", _last_: "any" }, editable: false };
if (dubEq) options.typecheck = false;
const script = CompileScript(value, options);
return !script.compiled ? undefined : { script, type: dubEq, onDelegate: eq };
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index a632d1fcc..fc6f9ceab 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -2,20 +2,22 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { action, computed, IReactionDisposer, observable, ObservableMap, reaction, runInAction } from "mobx";
import { observer } from "mobx-react";
import * as WebRequest from 'web-request';
-import { Doc, DocListCast, HeightSym, Opt, StrListCast, WidthSym } from "../../../fields/Doc";
+import { Doc, DocListCast, HeightSym, Opt, WidthSym } from "../../../fields/Doc";
import { documentSchema } from "../../../fields/documentSchemas";
import { Id } from "../../../fields/FieldSymbols";
import { HtmlField } from "../../../fields/HtmlField";
import { InkTool } from "../../../fields/InkField";
import { List } from "../../../fields/List";
-import { makeInterface, listSpec } from "../../../fields/Schema";
+import { listSpec, makeInterface } from "../../../fields/Schema";
+import { ComputedField } from "../../../fields/ScriptField";
import { Cast, NumCast, StrCast } from "../../../fields/Types";
import { WebField } from "../../../fields/URLField";
import { TraceMobx } from "../../../fields/util";
-import { emptyFunction, getWordAtPoint, OmitKeys, returnOne, smoothScroll, Utils, setupMoveUpEvents, returnFalse } from "../../../Utils";
+import { emptyFunction, getWordAtPoint, OmitKeys, returnFalse, returnOne, setupMoveUpEvents, smoothScroll, Utils } from "../../../Utils";
import { Docs } from "../../documents/Documents";
import { DocumentType } from '../../documents/DocumentTypes';
import { CurrentUserUtils } from "../../util/CurrentUserUtils";
+import { Scripting } from "../../util/Scripting";
import { SnappingManager } from "../../util/SnappingManager";
import { undoBatch } from "../../util/UndoManager";
import { CollectionFreeFormView } from "../collections/collectionFreeForm/CollectionFreeFormView";
@@ -32,7 +34,6 @@ import { FieldView, FieldViewProps } from './FieldView';
import { LinkDocPreview } from "./LinkDocPreview";
import "./WebBox.scss";
import React = require("react");
-import { ComputedField } from "../../../fields/ScriptField";
const _global = (window /* browser */ || global /* node */) as any;
const htmlToText = require("html-to-text");
@@ -80,14 +81,9 @@ export class WebBox extends ViewBoxAnnotatableComponent {
this._url = this.webField?.toString() || "";
- this._annotationKey = "annotations-" + this.urlHash(this._url);
- // bcz: this is messy. logically, setting the url alone should direct where annotations should go. But
- // right now we need to set doc.annotation-active to be the field suffix for the annotations
- // and we need to set a computed field to copy the annotations to where everyone else expects them in doc.field-annotations
- // TODO: always write annotations to doc.field-anotations and then copy them to doc.field-annotaitons-hash only when the page is changed.
- this.dataDoc["annotation-active"] = this._annotationKey;
- // bcz: need to make sure that doc.data-annotations points to the currently active web page's annotations (this could/should be in the constructor)
- this.dataDoc[this.fieldKey + "-annotations"] = ComputedField.MakeFunction(`copyField(this["${this.fieldKey}-"+this["annotation-active"]])`);
+ this._annotationKey = "annotations-" + WebBox.urlHash(this._url);
+ // bcz: need to make sure that doc.data-annotations points to the currently active web page's annotations (this could/should be when the doc is created)
+ this.dataDoc[this.fieldKey + "-annotations"] = ComputedField.MakeFunction(`copyField(this["${this.fieldKey}-annotations-"+urlHash(this["${this.fieldKey}"]?.url?.toString()))`);
});
this._disposers.selection = reaction(() => this.props.isSelected(),
@@ -297,8 +293,7 @@ export class WebBox extends ViewBoxAnnotatableComponent([this._url]);
else future.push(this._url);
this.dataDoc[this.fieldKey] = new WebField(new URL(this._url = history.pop()!));
- this._annotationKey = "annotations-" + this.urlHash(this._url);
- this.dataDoc["annotation-active"] = this._annotationKey;
+ this._annotationKey = "annotations-" + WebBox.urlHash(this._url);
return true;
}
return false;
}
- urlHash = (s: string) => {
+ static urlHash = (s: string) => {
return s.split('').reduce((a: any, b: any) => { a = ((a << 5) - a) + b.charCodeAt(0); return a & a; }, 0);
}
@@ -341,8 +335,7 @@ export class WebBox extends ViewBoxAnnotatableComponent
);
}
-}
\ No newline at end of file
+}
+Scripting.addGlobal(function urlHash(url: string) { return WebBox.urlHash(url); });
\ No newline at end of file
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index 300dae0aa..9faba9486 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -1324,7 +1324,7 @@ export namespace Doc {
}
-Scripting.addGlobal(function idToDoc(id: string) { return DocServer.GetCachedRefField(id); });
+Scripting.addGlobal(function idToDoc(id: string): any { return DocServer.GetCachedRefField(id); });
Scripting.addGlobal(function renameAlias(doc: any, n: any) { return StrCast(Doc.GetProto(doc).title).replace(/\([0-9]*\)/, "") + `(${n})`; });
Scripting.addGlobal(function getProto(doc: any) { return Doc.GetProto(doc); });
Scripting.addGlobal(function getDocTemplate(doc?: any) { return Doc.getDocTemplate(doc); });
--
cgit v1.2.3-70-g09d2