diff options
author | Mohammad Amoush <mohammad_amoush@brown.edu> | 2019-07-05 19:26:32 -0400 |
---|---|---|
committer | Mohammad Amoush <mohammad_amoush@brown.edu> | 2019-07-05 19:26:32 -0400 |
commit | 288198ab8aa8127bb69928ab9a827af146287cb2 (patch) | |
tree | b3cc0ddafa4b0d9ae6a7c4b20d5040ecd5bd49e6 | |
parent | edf530d1524cc1896ceeb0289f946ee31b16a938 (diff) |
error with presElem disappearing
-rw-r--r-- | src/client/views/presentationview/PresentationElement.tsx | 6 | ||||
-rw-r--r-- | src/client/views/presentationview/PresentationList.tsx | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/client/views/presentationview/PresentationElement.tsx b/src/client/views/presentationview/PresentationElement.tsx index fcddb2ad4..95e949b87 100644 --- a/src/client/views/presentationview/PresentationElement.tsx +++ b/src/client/views/presentationview/PresentationElement.tsx @@ -35,6 +35,8 @@ interface PresentationElementProps { presButtonBackUp: Doc; presGroupBackUp: Doc; removeDocByRef(doc: Doc): boolean; + setPresElementsMappings: (keyDoc: Doc, elem: PresentationElement) => void; + } @@ -90,7 +92,7 @@ export default class PresentationElement extends React.Component<PresentationEle //Lifecycle function that makes sure that button BackUp is received when mounted. async componentDidMount() { this.receiveButtonBackUp(); - + //this.props.setPresElementsMappings(this.props.document, this); if (this.presElRef.current) { this.header = this.presElRef.current; this.createListDropTarget(this.presElRef.current); @@ -100,6 +102,8 @@ export default class PresentationElement extends React.Component<PresentationEle //Lifecycle function that makes sure button BackUp is received when not re-mounted bu re-rendered. async componentDidUpdate() { //this.receiveButtonBackUp(); + //this.props.setPresElementsMappings(this.props.document, this); + if (this.presElRef.current) { this.header = this.presElRef.current; this.createListDropTarget(this.presElRef.current); diff --git a/src/client/views/presentationview/PresentationList.tsx b/src/client/views/presentationview/PresentationList.tsx index 35af451dd..90a163f20 100644 --- a/src/client/views/presentationview/PresentationList.tsx +++ b/src/client/views/presentationview/PresentationList.tsx @@ -88,7 +88,11 @@ export default class PresentationViewList extends React.Component<PresListProps> <div className="presentationView-listCont" > {children.map((doc: Doc, index: number) => <PresentationElement - ref={(e) => { if (e) { this.props.setPresElementsMappings(doc, e); } }} + ref={(e) => { + if (e) { + this.props.setPresElementsMappings(doc, e); + } + }} key={doc[Id]} mainDocument={this.props.mainDocument} document={doc} @@ -101,6 +105,7 @@ export default class PresentationViewList extends React.Component<PresListProps> presButtonBackUp={this.props.presButtonBackUp} presGroupBackUp={this.props.presGroupBackUp} removeDocByRef={this.props.removeDocByRef} + setPresElementsMappings={this.props.setPresElementsMappings} /> )} </div> |