浏览代码

[notebook] Move focus to the ace editor after switching snippet type

Johan Ahlen 10 年之前
父节点
当前提交
60fe180
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

+ 5 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -199,6 +199,11 @@
         self.properties(ko.mapping.fromJS(getDefaultSnippetProperties(newValue)));
       }
       self.result.clear();
+      window.setTimeout(function () {
+        if (self.ace() !== null) {
+          self.ace().focus();
+        }
+      }, 100);
     });
 
     self.variables = ko.observableArray([]);