wlxml: isContextRoot for the reminder of edumed exercises (fixup)
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 6 Aug 2014 12:22:18 +0000 (14:22 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 14 Aug 2014 14:26:14 +0000 (16:26 +0200)
src/wlxml/extensions/edumed/edumed.js

index 6e01d6e..ca29ad3 100644 (file)
@@ -157,6 +157,9 @@ var extension = {wlxmlClass: {'exercise.order': {
 }}};
 
 var choiceMethods = {
+    isContextRoot: function(node) {
+        return this.object.isChoiceList(node.parent()) || this.sameNode(node);
+    },
     getChoiceList: function() {
         return this.contents()
             .filter(function(n) { return this.object.isChoiceList(n); }.bind(this))[0];
@@ -209,6 +212,14 @@ extension.wlxmlClass['exercise.choice.true-or-false'] = {
     methods: choiceMethods
 };
 
+extension.wlxmlClass['exercise.gap'] = extension.wlxmlClass['exercise.replace'] = {
+    methods: {
+        isContextRoot: function(node) {
+            return this.sameNode(node);
+        }
+    }
+};
+
 extension.document = {
     methods: {
          edumedCreateExerciseNode: function(klass) {