save caret position when ending a list
[fnpeditor.git] / src / wlxml / extensions / edumed / edumed.js
index 6e01d6e..8c7472c 100644 (file)
@@ -9,7 +9,8 @@ var _ = require('libs/underscore'),
         'choice.single': require('libs/text!./choiceSingle.xml'),
         'choice.true-or-false': require('libs/text!./choiceTrueOrFalse.xml'),
         gap: require('libs/text!./gaps.xml'),
         'choice.single': require('libs/text!./choiceSingle.xml'),
         'choice.true-or-false': require('libs/text!./choiceTrueOrFalse.xml'),
         gap: require('libs/text!./gaps.xml'),
-        replace: require('libs/text!./replace.xml')
+        replace: require('libs/text!./replace.xml'),
+        match: require('libs/text!./match.xml')
     };
 
 var Item = function(node, exerciseNode) {
     };
 
 var Item = function(node, exerciseNode) {
@@ -157,6 +158,9 @@ var extension = {wlxmlClass: {'exercise.order': {
 }}};
 
 var choiceMethods = {
 }}};
 
 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];
     getChoiceList: function() {
         return this.contents()
             .filter(function(n) { return this.object.isChoiceList(n); }.bind(this))[0];
@@ -209,6 +213,14 @@ extension.wlxmlClass['exercise.choice.true-or-false'] = {
     methods: choiceMethods
 };
 
     methods: choiceMethods
 };
 
+extension.wlxmlClass['exercise.gap'] = extension.wlxmlClass['exercise.replace'] = extension.wlxmlClass['exercise.match'] = {
+    methods: {
+        isContextRoot: function(node) {
+            return this.sameNode(node);
+        }
+    }
+};
+
 extension.document = {
     methods: {
          edumedCreateExerciseNode: function(klass) {
 extension.document = {
     methods: {
          edumedCreateExerciseNode: function(klass) {