Skip to content

Commit

Permalink
remove source and unobserve state
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcarlos committed Jul 2, 2021
1 parent 9833c10 commit f3bcb8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class DrawIODocumentModel implements DocumentRegistry.IModel {
const cells = source.match(patternCells);

this.transact(() => {
this.sharedModel.setSource(source);
//this.sharedModel.setSource(source);

attrs.forEach(attr => {
const patternAttr = new RegExp(/(?<key>\w+)="(?<value>[^"]*)"/g);
Expand Down Expand Up @@ -230,6 +230,7 @@ export class YDrawIO extends YDocument<IDrawIOChange> {
* Dispose of the resources.
*/
dispose(): void {
this._state.unobserve(this._stateObserver);
this._root.unobserve(this._rootObserver);
}

Expand Down
14 changes: 8 additions & 6 deletions testfiles/test.dio
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="3" value="" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fillColor=#97D077;" parent="1" vertex="1"><mxGeometry x="558" y="341" width="120" height="80" as="geometry"/></mxCell>
<mxCell id="4" value="" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fillColor=#FFD966;" parent="1" vertex="1"><mxGeometry x="149" y="341" width="120" height="80" as="geometry"/></mxCell>
<mxCell id="6" value=": )" style="shape=umlActor;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;html=1;" parent="1" vertex="1"><mxGeometry x="170" y="490" width="100" height="160" as="geometry"/></mxCell>
<mxCell id="8" value="" style="shape=image;imageAspect=0;aspect=fixed;verticalLabelPosition=bottom;verticalAlign=top;image=https://quantstack.net/img/logo.svg;" parent="1" vertex="1"><mxGeometry x="209" y="168" width="409" height="105" as="geometry"/></mxCell>
<mxCell id="9" value="" style="shape=image;imageAspect=0;aspect=fixed;verticalLabelPosition=bottom;verticalAlign=top;image=https://camo.githubusercontent.com/3a5e37dc07744e58761dc92794e7c6414e1cf3966aab3fadf088194c9f6b1a36/68747470733a2f2f796a732e6465762f696d616765732f6c6f676f2f796a732d313230783132302e706e67;" parent="1" vertex="1"><mxGeometry x="354" y="360" width="120" height="120" as="geometry"/></mxCell>
<mxCell id="10" value="" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fillColor=#7EA6E0;" parent="1" vertex="1"><mxGeometry x="354" y="545" width="120" height="80" as="geometry"/></mxCell>
<mxCell id="3" value="" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fillColor=#97D077;" parent="1" vertex="1"><mxGeometry x="530" y="538" width="120" height="80" as="geometry"/></mxCell>
<mxCell id="4" value="" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fillColor=#FFD966;" parent="1" vertex="1"><mxGeometry x="122" y="538" width="120" height="80" as="geometry"/></mxCell>
<mxCell id="9" value="" style="shape=image;imageAspect=0;aspect=fixed;verticalLabelPosition=bottom;verticalAlign=top;image=https://camo.githubusercontent.com/3a5e37dc07744e58761dc92794e7c6414e1cf3966aab3fadf088194c9f6b1a36/68747470733a2f2f796a732e6465762f696d616765732f6c6f676f2f796a732d313230783132302e706e67;" parent="1" vertex="1"><mxGeometry x="326" y="650" width="120" height="120" as="geometry"/></mxCell>
<mxCell id="10" value="" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fillColor=#7EA6E0;" parent="1" vertex="1"><mxGeometry x="326" y="833" width="120" height="80" as="geometry"/></mxCell>
<mxCell id="11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;entryX=0.02;entryY=0.516;entryPerimeter=0;jettySize=auto;orthogonalLoop=1;" parent="1" source="4" target="3" edge="1"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="12" value="" style="shape=image;imageAspect=0;aspect=fixed;verticalLabelPosition=bottom;verticalAlign=top;image=https://quantstack.net/img/logo.svg;" parent="1" vertex="1"><mxGeometry x="102" y="270" width="623" height="160" as="geometry"/></mxCell>
<mxCell id="13" value="" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="320" y="90" width="120" height="60" as="geometry"/></mxCell>
<mxCell id="14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;jettySize=auto;orthogonalLoop=1;" edge="1" parent="1" source="13" target="12"><mxGeometry relative="1" as="geometry"/></mxCell>
</root>
</mxGraphModel>

0 comments on commit f3bcb8f

Please # to comment.