From be7aa9812cfc2f486f295fa198951a6383987d6c Mon Sep 17 00:00:00 2001 From: madelinegr Date: Mon, 11 Mar 2019 20:07:15 -0400 Subject: remove doc from presentation --- src/client/views/PresentationView.tsx | 58 ++++++++++++++++------------------- 1 file changed, 27 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/client/views/PresentationView.tsx b/src/client/views/PresentationView.tsx index 4e68ebfc9..3d833c286 100644 --- a/src/client/views/PresentationView.tsx +++ b/src/client/views/PresentationView.tsx @@ -34,6 +34,30 @@ class PresentationViewItem extends React.Component { } } + /** + * Removes a document from the presentation view + **/ + @action + public RemoveDoc(doc: Document) { + const value = this.props.Document.GetData(KeyStore.Data, ListField, new Array()) + let index = -1; + for (let i = 0; i < value.length; i++) { + if (value[i].Id == doc.Id) { + index = i; + break; + } + } + if (index !== -1) { + value.splice(index, 1) + + //TODO: do i need below lines?? + // SelectionManager.DeselectAll() + // ContextMenu.Instance.clearItems() + // return true; + } + // return false + } + /** * Renders a single child document. It will just append a list element. * @param document The document to render. @@ -48,9 +72,9 @@ class PresentationViewItem extends React.Component { // finally, if it's a normal document, then render it as such. else { //TODO: there is a zoom event that will be merged for on click - return
  • this.openDoc(document)} > -
    {title.Data}
    -
    X
  • ; + return
  • +
    this.openDoc(document)}>{title.Data}
    +
    this.RemoveDoc(document)}>X
  • ; } } @@ -103,34 +127,6 @@ export class PresentationView extends React.Component { this.props.Document.SetData(KeyStore.Width, 300, NumberField); } - /** - * Removes a document from the presentation view - **/ - @action - public RemoveDoc(doc: Document) { - const value = this.props.Document.GetData(KeyStore.Data, ListField, new Array()) - let index = -1; - for (let i = 0; i < value.length; i++) { - if (value[i].Id == doc.Id) { - index = i; - break; - } - } - if (index !== -1) { - value.splice(index, 1) - - //TODO: do i need below lines?? - // SelectionManager.DeselectAll() - // ContextMenu.Instance.clearItems() - // return true; - } - // return false - - this.collapsed = true; - } - - - render() { let titleStr = "Title"; let title = this.props.Document.GetT(KeyStore.Title, TextField); -- cgit v1.2.3-70-g09d2