From: Aleksander Ɓukasz Date: Thu, 7 Aug 2014 14:44:44 +0000 (+0200) Subject: edtior: fix exercise.order document events handling X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/248bc3fefa3eed44a6ffed7374bea9310962fb88?hp=-c edtior: fix exercise.order document events handling --- 248bc3fefa3eed44a6ffed7374bea9310962fb88 diff --git a/src/editor/plugins/core/edumed/order/element.js b/src/editor/plugins/core/edumed/order/element.js index a81155e..724f2ec 100644 --- a/src/editor/plugins/core/edumed/order/element.js +++ b/src/editor/plugins/core/edumed/order/element.js @@ -57,7 +57,7 @@ _.extend(OrderExerciceElement, { this.createContainer(this.wlxmlNode.object.getDescription(), { resetBackground: true, manages: function(node, removedFrom) { - if(node.is('list.orderable')) { + if(node.is('list.orderable') || (removedFrom && removedFrom.is('list.orderable'))) { return false; } return exerciseNode.sameNode(node.parent() || removedFrom); //!n.hasFollowingSibing(this.params.listnode); @@ -79,6 +79,12 @@ _.extend(OrderExerciceElement, { this.reloadView(); } }, + onNodeDetached: function(event) { + var node = event.meta.node; + if(node.is('item.answer') && event.meta.parent && event.meta.parent.is('list.orderable')) { + this.reloadView(); + } + }, reloadView: function() { this.view.clearItems(); this.wlxmlNode.object.getItems().forEach(function(item) {