|
@@ -144,22 +144,24 @@ class ScreenShare {
|
|
|
},
|
|
|
"init_screenshare": (from, graphSerialized, reply) => {
|
|
|
const yes = () => {
|
|
|
- const cells = decodeCells(graphSerialized);
|
|
|
- this.graph.model.clear();
|
|
|
- this.graph.importCells(cells);
|
|
|
+ const doc = mxUtils.parseXml(graphSerialized);
|
|
|
+ const codec = new mxCodec(doc);
|
|
|
+ codec.decode(doc.documentElement, graph.model);
|
|
|
this.sharingWith[from] = true;
|
|
|
reply(); // acknowledge
|
|
|
+ this.alert("You are now <b>screen sharing</b> with " + shortUUID(from));
|
|
|
};
|
|
|
const no = () => {
|
|
|
reply("denied")
|
|
|
};
|
|
|
- this.confirm(`Peer ${shortUUID(from)} wants to <b>screen share</b>.<br /><br />Accept?`, yes, no);
|
|
|
+ this.confirm(`Peer ${shortUUID(from)} wants to <b>screen share</b>.<br />Your diagram will be erased and replaced by his/hers.<br /><br />Accept?`, yes, no);
|
|
|
},
|
|
|
});
|
|
|
}
|
|
|
|
|
|
initshare(peer) {
|
|
|
- const graphSerialized = encodeCells(Object.values(this.graph.model.cells));
|
|
|
+ const codec = new mxCodec();
|
|
|
+ const graphSerialized = mxUtils.getXml(codec.encode(this.graph.model));
|
|
|
this.p2p.send(peer, "init_screenshare", graphSerialized, (err, data) => {
|
|
|
if (err) {
|
|
|
this.alert(err)
|