diff options
| author | srichman333 <sarah_n_richman@brown.edu> | 2023-06-15 12:47:31 -0400 |
|---|---|---|
| committer | srichman333 <sarah_n_richman@brown.edu> | 2023-06-15 12:47:31 -0400 |
| commit | 40579c8b3cf0504ac10e966e640af58e8876acd3 (patch) | |
| tree | cc280d53b66d244eae6bd1e5c5d00a0d6b1dc3ea /src/client/views/DocumentDecorations.tsx | |
| parent | e31f6403bc62faea72767f68d3bf34ac8bd28183 (diff) | |
| parent | d92775bffab6470dc6142e02092b7cae2c30b5ff (diff) | |
Merge branch 'collaboration-sarah' of https://github.com/brown-dash/Dash-Web into collaboration-sarah
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
| -rw-r--r-- | src/client/views/DocumentDecorations.tsx | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 25d70b932..80e2f1e65 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -13,7 +13,7 @@ import { InkField } from '../../fields/InkField'; import { RichTextField } from '../../fields/RichTextField'; import { ScriptField } from '../../fields/ScriptField'; import { Cast, DocCast, NumCast, StrCast } from '../../fields/Types'; -import { GetEffectiveAcl, normalizeEmail } from '../../fields/util'; +import { GetEffectiveAcl, normalizeEmail, SharingPermissions } from '../../fields/util'; import { DocumentType } from '../documents/DocumentTypes'; import { Docs } from '../documents/Documents'; import { DocumentManager } from '../util/DocumentManager'; @@ -661,7 +661,7 @@ const dragDocView = SelectionManager.Views()[0]; const rotCtr = [docwidth / 2, docheight / 2]; const tlRotated = Utils.rotPt(-rotCtr[0], -rotCtr[1], (NumCast(doc._rotation) / 180) * Math.PI); - const maxHeight = doc.nativeHeightUnfrozen || !nheight ? 0 : Math.max(nheight, NumCast(doc.scrollHeight, NumCast(doc[docView.LayoutFieldKey + '-scrollHeight']))) * docView.NativeDimScaling(); + const maxHeight = doc.nativeHeightUnfrozen || !nheight ? 0 : Math.max(nheight, NumCast(doc.scrollHeight, NumCast(doc[docView.LayoutFieldKey + '_scrollHeight']))) * docView.NativeDimScaling(); dH && (doc._height = actualdH > maxHeight && maxHeight ? maxHeight : actualdH); dW && (doc._width = actualdW); dH && (doc._layout_autoHeight = false); @@ -766,23 +766,23 @@ const dragDocView = SelectionManager.Views()[0]; // sharing // const docShareMode = Doc.GetProto(seldocview.rootDoc)['acl-Public']; - const docShareMode = Doc.GetProto(seldocview.rootDoc)['acl-'+normalizeEmail(Doc.CurrentUserEmail)]; + const docShareMode = Doc.GetProto(seldocview.rootDoc)['acl-' + normalizeEmail(Doc.CurrentUserEmail)]; const shareMode = StrCast(docShareMode); var shareSymbolIcon = null; switch (shareMode) { - case 'Admin': + case SharingPermissions.Admin: shareSymbolIcon = '⬢ '; break; - case 'Edit': + case SharingPermissions.Edit: shareSymbolIcon = '⬢ '; break; - case 'Augment': + case SharingPermissions.Augment: shareSymbolIcon = '⬟ '; break; - case 'View': + case SharingPermissions.View: shareSymbolIcon = '♦ '; break; - case 'Not-Shared': + case SharingPermissions.None: shareSymbolIcon = '▲ '; break; default: @@ -811,7 +811,7 @@ const dragDocView = SelectionManager.Views()[0]; seldocview.rootDoc.hideDeleteButton || SelectionManager.Views().some(docView => { const collectionAcl = docView.props.docViewPath()?.lastElement() ? GetEffectiveAcl(docView.props.docViewPath().lastElement().rootDoc[DocData]) : AclEdit; - return docView.rootDoc.stayInCollection || (collectionAcl !== AclAdmin && collectionAcl !== AclEdit && GetEffectiveAcl(docView.rootDoc) !== AclAdmin); + return (docView.rootDoc.stayInCollection && !docView.rootDoc._isTimelineLabel) || (collectionAcl !== AclAdmin && collectionAcl !== AclEdit && GetEffectiveAcl(docView.rootDoc) !== AclAdmin); }); const topBtn = (key: string, icon: string, pointerDown: undefined | ((e: React.PointerEvent) => void), click: undefined | ((e: any) => void), title: string) => ( <Tooltip key={key} title={<div className="dash-tooltip">{title}</div>} placement="top"> @@ -839,7 +839,7 @@ const dragDocView = SelectionManager.Views()[0]; // Radius constants const useRounding = seldocview.ComponentView instanceof ImageBox || seldocview.ComponentView instanceof FormattedTextBox || seldocview.ComponentView instanceof CollectionFreeFormView; - const borderRadius = numberValue(StrCast(seldocview.rootDoc.borderRounding)); + const borderRadius = numberValue(StrCast(seldocview.rootDoc.layout_borderRounding)); const docMax = Math.min(NumCast(seldocview.rootDoc.width) / 2, NumCast(seldocview.rootDoc.height) / 2); const maxDist = Math.min((this.Bounds.r - this.Bounds.x) / 2, (this.Bounds.b - this.Bounds.y) / 2); const radiusHandle = (borderRadius / docMax) * maxDist; @@ -865,7 +865,16 @@ const dragDocView = SelectionManager.Views()[0]; ); const sharingMenu = docShareMode ? ( - <div className='documentDecorations-share' onPointerDown={e => setupMoveUpEvents(this, e, e => this.onBackgroundMove(true, e), e => {}, action(e => {}))} > + <div className='documentDecorations-share' + onPointerDown={e => + setupMoveUpEvents( + this, + e, + e => this.onBackgroundMove(true, e), + returnFalse, + action(() => SettingsManager.propertiesWidth =250) + ) + }> <div className={`documentDecorations-share${shareMode}`}> <span>{shareSymbolIcon + ' ' + shareMode}</span> </div> @@ -906,7 +915,6 @@ const dragDocView = SelectionManager.Views()[0]; {hideDeleteButton ? null : topBtn('close', 'times', undefined, e => this.onCloseClick(true), 'Close')} {hideResizers || hideDeleteButton ? null : topBtn('minimize', 'window-maximize', undefined, e => this.onCloseClick(undefined), 'Minimize')} {hideTitle ? null : titleArea} - {sharingMenu} {hideOpenButton ? <div /> : topBtn('open', 'external-link-alt', this.onMaximizeDown, undefined, 'Open in Lightbox (ctrl: as alias, shift: in new collection)')} </div> {hideResizers ? null : ( |
