diff --git a/public/app/core/components/code_editor/code_editor.ts b/public/app/core/components/code_editor/code_editor.ts index ec10b7a477b..0ceb21d0335 100644 --- a/public/app/core/components/code_editor/code_editor.ts +++ b/public/app/core/components/code_editor/code_editor.ts @@ -110,7 +110,7 @@ function link(scope, elem, attrs) { elem.addClass("gf-code-editor"); let textarea = elem.find("textarea"); textarea.addClass('gf-form-input'); - if (attrs.giveFocus) { + if (scope.focus) { setTimeout(function () { textarea.focus(); var domEl = textarea[0]; @@ -209,6 +209,7 @@ export function codeEditorDirective() { template: editorTemplate, scope: { content: "=", + focus: "=", onChange: "&", getCompleter: "&" }, diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index 9b2aa533743..d35f9f9c14c 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -2,7 +2,7 @@