From: Aleksander Ɓukasz Date: Wed, 6 Aug 2014 12:33:24 +0000 (+0200) Subject: editor: edumed exercise - allow for exercise insertion after the edited one X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/f9be0369bec7632daa68f706951bcaf8ac8284e7?hp=c654f07dd8b596abc328f1f57beef06bffa63149 editor: edumed exercise - allow for exercise insertion after the edited one --- diff --git a/src/editor/plugins/core/edumed/actions.js b/src/editor/plugins/core/edumed/actions.js index 97237ba..6d8051e 100644 --- a/src/editor/plugins/core/edumed/actions.js +++ b/src/editor/plugins/core/edumed/actions.js @@ -26,6 +26,9 @@ var createAction = function(actionConfig) { if(node.nodeType === Node.TEXT_NODE) { node = node.parent(); } + if(node.isInside('exercise')) { + node = node.getParent('exercise'); + } node.document.transaction(function() { var exerciseNode = node.after(node.document.edumedCreateExerciseNode(actionConfig.exercise)), @@ -57,7 +60,7 @@ var createAction = function(actionConfig) { }, getState: function(params) { return { - allowed: params.fragment && params.fragment.isValid() && params.fragment instanceof params.fragment.NodeFragment && !params.fragment.node.isInside('exercise'), + allowed: params.fragment && params.fragment.isValid() && params.fragment instanceof params.fragment.NodeFragment, description: gettext('Insert exercise: ' + actionConfig.exerciseTitle) }; }