editor: canvas fix
[fnpeditor.git] / src / editor / plugins / core / switch.js
index 9b34721..645f7ad 100644 (file)
@@ -14,7 +14,7 @@ var createSwitchAction = function(createParams) {
         },
         getState: function(params) {
             var state = {
-                    label: this.config.label
+                    label: createParams.to.name
                 },
                 f = params.fragment,
                 description;
@@ -39,9 +39,9 @@ var createSwitchAction = function(createParams) {
                 toSwitch = toSwitch.getParent(createParams.from);
             }
 
-            description = 'Switch to ' + createParams.to.name;
+            description = gettext('Switch to') + ' ' + createParams.to.name;
             return _.extend(state, {
-                allowed: !!toSwitch,
+                allowed: !!toSwitch || alreadyInTarget,
                 toggled: alreadyInTarget,
                 description: description,
                 execute: alreadyInTarget ? function() {} : function(callback) {
@@ -55,7 +55,8 @@ var createSwitchAction = function(createParams) {
                         return f.document.createFragment(f.CaretFragment, {node: f.document.getNodeByPath(textNodePath), offset: f.offset});
                     }, {
                         metadata: {
-                            description: description
+                            description: description,
+                            fragment: params.fragment
                         },
                         success: callback
                     });