Browse Source

Fix bug when editing a node's value

Joeri Exelmans 4 years ago
parent
commit
8aacbc0bf7

+ 6 - 1
lib/versioning/build_client.sh

@@ -1,2 +1,7 @@
 #!/bin/sh
-python -m sccd.compiler.sccdc -l javascript -p eventloop -o client.js client.xml && browserify ../../src/main/webapp/plugins/cdf/versioning.js > ../../src/main/webapp/plugins/cdf/versioning.browser.js
+echo "Compiling statechart..."
+python -m sccd.compiler.sccdc -l javascript -p eventloop -o client.js client.xml
+echo "Browserify plugin..."
+browserify ../../src/main/webapp/plugins/cdf/versioning.js > ../../src/main/webapp/plugins/cdf/versioning.browser.js
+
+

+ 1 - 1
lib/versioning/client.js

@@ -1,5 +1,5 @@
 /*
-Date: Wed Sep 22 19:32:59 2021
+Date: Wed Oct 20 12:12:58 2021
 
 Model author: Joeri Exelmans
 Model name: client

+ 1 - 1
sccd

@@ -1 +1 @@
-Subproject commit 49f0b975629052b13bc681a06f4c0858ca93e958
+Subproject commit 322ec37a0bded4d9ea57a7662dfccc5fe2872ed6

+ 6 - 2
src/main/webapp/plugins/cdf/versioning.browser.js

@@ -1524,7 +1524,7 @@ Draw.loadPlugin(async function(ui) {
           } else {
             v = value;
           }
-          model.setValue(cell, v);
+          model.setValue(cell, v.documentElement);
         },
         source: () => {
           const sourceId = value;
@@ -1594,6 +1594,10 @@ Draw.loadPlugin(async function(ui) {
           history.autoMerge(op);
           model.endUpdate();
         }
+        catch (e) {
+          e.op = op;
+          throw e;
+        }
         finally {
           listenForEdits--;
         }
@@ -1603,7 +1607,7 @@ Draw.loadPlugin(async function(ui) {
   }
   function leaveOnError() {
     mergePromise.catch(err => {
-      console.log("Unexpected error merging", err);
+      console.error("Unexpected error merging operation", op.id, err);
       controller.addInput("leave", "in", [], controller.wallclockToSimtime());
     });
   }

+ 6 - 2
src/main/webapp/plugins/cdf/versioning.js

@@ -248,7 +248,7 @@ Draw.loadPlugin(async function(ui) {
           } else {
             v = value;
           }
-          model.setValue(cell, v);
+          model.setValue(cell, v.documentElement);
         },
         source: () => {
           const sourceId = value;
@@ -318,6 +318,10 @@ Draw.loadPlugin(async function(ui) {
           history.autoMerge(op);
           model.endUpdate();
         }
+        catch (e) {
+          e.op = op;
+          throw e;
+        }
         finally {
           listenForEdits--;
         }
@@ -327,7 +331,7 @@ Draw.loadPlugin(async function(ui) {
   }
   function leaveOnError() {
     mergePromise.catch(err => {
-      console.log("Unexpected error merging", err);
+      console.error("Unexpected error merging operation", op.id, err);
       controller.addInput("leave", "in", [], controller.wallclockToSimtime());
     });
   }