diff options
Diffstat (limited to 'src/client/views/nodes')
| -rw-r--r-- | src/client/views/nodes/DocumentContentsView.tsx | 2 | ||||
| -rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 4 | ||||
| -rw-r--r-- | src/client/views/nodes/FontIconBox/FontIconBox.tsx | 30 | ||||
| -rw-r--r-- | src/client/views/nodes/VideoBox.tsx | 7 |
4 files changed, 21 insertions, 22 deletions
diff --git a/src/client/views/nodes/DocumentContentsView.tsx b/src/client/views/nodes/DocumentContentsView.tsx index cc4b5b67f..e902d1792 100644 --- a/src/client/views/nodes/DocumentContentsView.tsx +++ b/src/client/views/nodes/DocumentContentsView.tsx @@ -19,7 +19,6 @@ import { CollectionView } from '../collections/CollectionView'; import { CollectionFreeFormView } from '../collections/collectionFreeForm/CollectionFreeFormView'; import { CollectionSchemaView } from '../collections/collectionSchema/CollectionSchemaView'; import { SchemaRowBox } from '../collections/collectionSchema/SchemaRowBox'; -import { PresElementBox } from './trails/PresElementBox'; import { SearchBox } from '../search/SearchBox'; import { AudioBox } from './AudioBox'; import { ComparisonBox } from './ComparisonBox'; @@ -47,6 +46,7 @@ import { WebBox } from './WebBox'; import { FormattedTextBox } from './formattedText/FormattedTextBox'; import { ImportElementBox } from './importBox/ImportElementBox'; import { PresBox } from './trails/PresBox'; +import { PresElementBox } from './trails/PresElementBox'; type BindingProps = Without<FieldViewProps, 'fieldKey'>; export interface JsxBindings { diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index e8d1e582e..1e7f1015a 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -16,13 +16,13 @@ import { InkTool } from '../../../fields/InkField'; import { List } from '../../../fields/List'; import { PrefetchProxy } from '../../../fields/Proxy'; import { listSpec } from '../../../fields/Schema'; -import { FollowLinkScript, ScriptField } from '../../../fields/ScriptField'; +import { ScriptField } from '../../../fields/ScriptField'; import { BoolCast, Cast, DocCast, NumCast, ScriptCast, StrCast } from '../../../fields/Types'; import { AudioField } from '../../../fields/URLField'; import { GetEffectiveAcl, TraceMobx } from '../../../fields/util'; import { DocServer } from '../../DocServer'; import { Networking } from '../../Network'; -import { DocUtils } from '../../documents/DocUtils'; +import { DocUtils, FollowLinkScript } from '../../documents/DocUtils'; import { CollectionViewType, DocumentType } from '../../documents/DocumentTypes'; import { Docs } from '../../documents/Documents'; import { DictationManager } from '../../util/DictationManager'; diff --git a/src/client/views/nodes/FontIconBox/FontIconBox.tsx b/src/client/views/nodes/FontIconBox/FontIconBox.tsx index d83690cdd..8d1617e66 100644 --- a/src/client/views/nodes/FontIconBox/FontIconBox.tsx +++ b/src/client/views/nodes/FontIconBox/FontIconBox.tsx @@ -11,8 +11,7 @@ import { BoolCast, DocCast, NumCast, ScriptCast, StrCast } from '../../../../fie import { emptyFunction } from '../../../../Utils'; import { Docs } from '../../../documents/Documents'; import { CollectionViewType, DocumentType } from '../../../documents/DocumentTypes'; -import { SelectionManager } from '../../../util/SelectionManager'; -import { SettingsManager } from '../../../util/SettingsManager'; +import { SnappingManager } from '../../../util/SnappingManager'; import { undoable, UndoManager } from '../../../util/UndoManager'; import { ContextMenu } from '../../ContextMenu'; import { ViewBoxBaseComponent } from '../../DocComponent'; @@ -125,7 +124,7 @@ export class FontIconBox extends ViewBoxBaseComponent<ButtonProps>() { return ( <NumberDropdown color={color} - background={SettingsManager.userBackgroundColor} + background={SnappingManager.userBackgroundColor} numberDropdownType={type} showPlusMinus={false} tooltip={this.label} @@ -160,9 +159,10 @@ export class FontIconBox extends ViewBoxBaseComponent<ButtonProps>() { let text: string | undefined; let getStyle: (val: string) => any = () => {}; let icon: IconProp = 'caret-down'; - const isViewDropdown = script?.script.originalScript.startsWith('setView'); + const isViewDropdown = script?.script.originalScript.startsWith('{ return setView'); if (isViewDropdown) { - const selected = SelectionManager.Docs; + const selected = Array.from(script?.script.run({ _readOnly_: true }).result) as Doc[]; + // const selected = SelectionManager.Docs; if (selected.lastElement()) { if (StrCast(selected.lastElement().type) === DocumentType.COL) { text = StrCast(selected.lastElement()._type_collection); @@ -178,15 +178,15 @@ export class FontIconBox extends ViewBoxBaseComponent<ButtonProps>() { icon={<FontAwesomeIcon size="1x" icon={icon} />} text={text} type={Type.TERT} - color={SettingsManager.userColor} - background={SettingsManager.userVariantColor} + color={SnappingManager.userColor} + background={SnappingManager.userVariantColor} popup={<SelectedDocView selectedDocs={selected} />} fillWidth /> ); } } else { - return <Button text="None Selected" type={Type.TERT} color={SettingsManager.userColor} background={SettingsManager.userVariantColor} fillWidth inactive />; + return <Button text="None Selected" type={Type.TERT} color={SnappingManager.userColor} background={SnappingManager.userVariantColor} fillWidth inactive />; } noviceList = [CollectionViewType.Freeform, CollectionViewType.Schema, CollectionViewType.Carousel3D, CollectionViewType.Stacking, CollectionViewType.NoteTaking]; } else { @@ -209,8 +209,8 @@ export class FontIconBox extends ViewBoxBaseComponent<ButtonProps>() { <Dropdown selectedVal={text} setSelectedVal={undoable(value => script.script.run({ this: this.Document, self: this.Document, value }), `dropdown select ${this.label}`)} - color={SettingsManager.userColor} - background={SettingsManager.userVariantColor} + color={SnappingManager.userColor} + background={SnappingManager.userVariantColor} type={Type.TERT} closeOnSelect={false} dropdownType={DropdownType.SELECT} @@ -250,7 +250,7 @@ export class FontIconBox extends ViewBoxBaseComponent<ButtonProps>() { selectedColor={curColor} type={Type.PRIM} color={color} - background={SettingsManager.userBackgroundColor} + background={SnappingManager.userBackgroundColor} icon={this.Icon(color)!} tooltip={tooltip} label={this.label} @@ -271,7 +271,7 @@ export class FontIconBox extends ViewBoxBaseComponent<ButtonProps>() { tooltip={`Toggle ${tooltip}`} type={Type.PRIM} color={color} - background={SettingsManager.userBackgroundColor} + background={SnappingManager.userBackgroundColor} label={this.label} items={DocListCast(this.dataDoc.data).map(item => ({ icon: <FontAwesomeIcon className={`fontIconBox-icon-${this.type}`} icon={StrCast(item.icon) as any} color={color} />, @@ -309,7 +309,7 @@ export class FontIconBox extends ViewBoxBaseComponent<ButtonProps>() { toggleStatus={toggleStatus} text={buttonText} color={color} - // background={SettingsManager.userBackgroundColor} + // background={SnappingManager.userBackgroundColor} icon={this.Icon(color)!} label={this.label} onPointerDown={e => @@ -373,9 +373,9 @@ export class FontIconBox extends ViewBoxBaseComponent<ButtonProps>() { case ButtonType.ClickButton:return <IconButton {...btnProps} size={Size.MEDIUM} color={color} />; case ButtonType.ToolButton: return <IconButton {...btnProps} size={Size.LARGE} color={color} />; case ButtonType.TextButton: return <Button {...btnProps} color={color} - background={SettingsManager.userBackgroundColor} text={StrCast(this.dataDoc.buttonText)}/>; + background={SnappingManager.userBackgroundColor} text={StrCast(this.dataDoc.buttonText)}/>; case ButtonType.MenuButton: return <IconButton {...btnProps} color={color} - background={SettingsManager.userBackgroundColor} size={Size.LARGE} tooltipPlacement='right' onPointerDown={scriptFunc} />; + background={SnappingManager.userBackgroundColor} size={Size.LARGE} tooltipPlacement='right' onPointerDown={scriptFunc} />; default: } return this.defaultButton; diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index 16767d11e..f32d00386 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -10,13 +10,12 @@ import { DocData } from '../../../fields/DocSymbols'; import { InkTool } from '../../../fields/InkField'; import { List } from '../../../fields/List'; import { ObjectField } from '../../../fields/ObjectField'; -import { FollowLinkScript } from '../../../fields/ScriptField'; import { Cast, NumCast, StrCast, toList } from '../../../fields/Types'; import { AudioField, ImageField, VideoField } from '../../../fields/URLField'; import { emptyFunction, formatTime } from '../../../Utils'; import { Docs } from '../../documents/Documents'; import { DocumentType } from '../../documents/DocumentTypes'; -import { DocUtils } from '../../documents/DocUtils'; +import { DocUtils, FollowLinkScript } from '../../documents/DocUtils'; import { DocumentManager } from '../../util/DocumentManager'; import { dropActionType } from '../../util/DropActionTypes'; import { LinkManager } from '../../util/LinkManager'; @@ -36,6 +35,7 @@ import { FieldView, FieldViewProps } from './FieldView'; import { FocusViewOptions } from './FocusViewOptions'; import { RecordingBox } from './RecordingBox'; import './VideoBox.scss'; +import { VideoThumbnails } from '../global/globalEnums'; /** * VideoBox @@ -55,7 +55,6 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps>() impl return FieldView.LayoutString(VideoBox, fieldKey); } static heightPercent = 80; // height of video relative to videoBox when timeline is open - static numThumbnails = 20; private unmounting = false; private _disposers: { [name: string]: IReactionDisposer } = {}; private _videoRef: HTMLVideoElement | null = null; // <video> ref @@ -416,7 +415,7 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps>() impl const retitled = StrCast(this.Document.title).replace(/[ -.:]/g, ''); const encodedFilename = encodeURIComponent('thumbnail' + retitled + '_' + video.currentTime.toString().replace(/\./, '_')); thumbnailPromises?.push(ClientUtils.convertDataUri(canvas.toDataURL(), basename(encodedFilename), true)); - const newTime = video.currentTime + video.duration / (VideoBox.numThumbnails - 1); + const newTime = video.currentTime + video.duration / (VideoThumbnails.DENSE - 1); if (newTime < video.duration) { video.currentTime = newTime; } else { |
