diff options
author | Lionel Han <47760119+IGoByJoe@users.noreply.github.com> | 2020-08-08 21:32:51 -0700 |
---|---|---|
committer | Lionel Han <47760119+IGoByJoe@users.noreply.github.com> | 2020-08-08 21:32:51 -0700 |
commit | 98d753d5dd66a646f00bcdf15656f845cd27fb81 (patch) | |
tree | 402eda69cf59fb9a85814f02f57a1ff3862abbb8 /src/client/views/PropertiesButtons.tsx | |
parent | 25fa93e7060c8f8561c294c7309c763e3b8f9313 (diff) | |
parent | 9f4a7ec5f79d9dec3a0ffb0b633197216cbefec8 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into new_audio
Diffstat (limited to 'src/client/views/PropertiesButtons.tsx')
-rw-r--r-- | src/client/views/PropertiesButtons.tsx | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/src/client/views/PropertiesButtons.tsx b/src/client/views/PropertiesButtons.tsx index 5c584d270..5e25ead87 100644 --- a/src/client/views/PropertiesButtons.tsx +++ b/src/client/views/PropertiesButtons.tsx @@ -3,7 +3,7 @@ import { faArrowAltCircleDown, faArrowAltCircleRight, faArrowAltCircleUp, faChec import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { action, computed, observable, runInAction } from "mobx"; import { observer } from "mobx-react"; -import { Doc, DocListCast } from "../../fields/Doc"; +import { Doc, DocListCast, AclEdit, AclAdmin } from "../../fields/Doc"; import { RichTextField } from '../../fields/RichTextField'; import { Cast, NumCast, BoolCast } from "../../fields/Types"; import { emptyFunction, setupMoveUpEvents, Utils } from "../../Utils"; @@ -30,6 +30,7 @@ import { undoBatch, UndoManager } from '../util/UndoManager'; import { DocumentType } from '../documents/DocumentTypes'; import { InkField } from '../../fields/InkField'; import { PresBox } from './nodes/PresBox'; +import { GetEffectiveAcl } from "../../fields/util"; const higflyout = require("@hig/flyout"); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @@ -224,10 +225,11 @@ export class PropertiesButtons extends React.Component<{}, {}> { <FontAwesomeIcon className="documentdecorations-icon" size="lg" icon="map-pin" /> </div> - <div className="propertiesButtons-title" style={{ - backgroundColor: Doc.isDocPinned(targetDoc) ? "white" : "black", - color: Doc.isDocPinned(targetDoc) ? "black" : "white" - }} + <div className="propertiesButtons-title" + // style={{ + // backgroundColor: Doc.isDocPinned(targetDoc) ? "white" : "black", + // color: Doc.isDocPinned(targetDoc) ? "black" : "white" + // }} >{Doc.isDocPinned(targetDoc) ? "Unpin" : "Pin"}</div> </div> </Tooltip>; @@ -258,7 +260,7 @@ export class PropertiesButtons extends React.Component<{}, {}> { } }}> <FontAwesomeIcon className="documentdecorations-icon" size="lg" icon="map-pin" /> - <div style={{ position: 'relative', fontSize: 25, fontWeight: 700, transform: 'translate(0, -20px)', color: 'rgba(250,250,250,0.5)' }}>V</div> + <div style={{ position: 'relative', fontSize: 25, fontWeight: 700, transform: 'translate(0, -28px)', color: 'rgba(250,250,250,0.55)' }}>V</div> </div> <div className="propertiesButtons-title">{"View"}</div> @@ -381,10 +383,12 @@ export class PropertiesButtons extends React.Component<{}, {}> { color={BoolCast(this.selectedDoc?.lockedPosition) ? "black" : "white"} icon={BoolCast(this.selectedDoc?.lockedPosition) ? "unlock" : "lock"} size="lg" />} </div> - <div className="propertiesButtons-title" style={{ - backgroundColor: BoolCast(this.selectedDoc?.lockedPosition) ? "white" : "black", - color: BoolCast(this.selectedDoc?.lockedPosition) ? "black" : "white" - }}>Position </div> + <div className="propertiesButtons-title" + // style={{ + // backgroundColor: BoolCast(this.selectedDoc?.lockedPosition) ? "white" : "black", + // color: BoolCast(this.selectedDoc?.lockedPosition) ? "black" : "white" + // }} + >Position </div> </div> </Tooltip>; } @@ -428,7 +432,19 @@ export class PropertiesButtons extends React.Component<{}, {}> { @undoBatch @action deleteDocument = () => { + const recent = Cast(Doc.UserDoc().myRecentlyClosed, Doc) as Doc; + const selected = SelectionManager.SelectedDocuments().slice(); + + selected.map(dv => { + const effectiveAcl = GetEffectiveAcl(dv.props.Document); + if (effectiveAcl === AclEdit || effectiveAcl === AclAdmin) { // deletes whatever you have the right to delete + recent && Doc.AddDocToList(recent, "data", dv.props.Document, undefined, true, true); + dv.props.removeDocument?.(dv.props.Document); + } + }); + this.selectedDoc && (this.selectedDoc.deleted = true); this.selectedDocumentView?.props.ContainingCollectionView?.removeDocument(this.selectedDocumentView?.props.Document); + SelectionManager.DeselectAll(); } @computed @@ -582,10 +598,12 @@ export class PropertiesButtons extends React.Component<{}, {}> { color={this.selectedDoc?.useClusters ? "black" : "white"} icon="braille" size="lg" />} </div> - <div className="propertiesButtons-title" style={{ - backgroundColor: this.selectedDoc?.useClusters ? "white" : "black", - color: this.selectedDoc?.useClusters ? "black" : "white" - }}> clusters </div> + <div className="propertiesButtons-title" + // style={{ + // backgroundColor: this.selectedDoc?.useClusters ? "white" : "black", + // color: this.selectedDoc?.useClusters ? "black" : "white" + // }} + > clusters </div> </div> </Tooltip>; } @@ -613,10 +631,12 @@ export class PropertiesButtons extends React.Component<{}, {}> { color={this.selectedDoc?._fitToBox ? "black" : "white"} icon="expand" size="lg" />} </div> - <div className="propertiesButtons-title" style={{ - backgroundColor: this.selectedDoc?._fitToBox ? "white" : "black", - color: this.selectedDoc?._fitToBox ? "black" : "white" - }}> {this.selectedDoc?._fitToBox ? "unfit" : "fit"} </div> + <div className="propertiesButtons-title" + // style={{ + // backgroundColor: this.selectedDoc?._fitToBox ? "white" : "black", + // color: this.selectedDoc?._fitToBox ? "black" : "white" + // }} + > {this.selectedDoc?._fitToBox ? "unfit" : "fit"} </div> </div> </Tooltip>; } |