diff --git a/addon/lint/lint.js b/addon/lint/lint.js index 0eac8d12a1..f36a232978 100644 --- a/addon/lint/lint.js +++ b/addon/lint/lint.js @@ -16,7 +16,10 @@ var tt = document.createElement("div"); tt.className = "CodeMirror-lint-tooltip cm-s-" + cm.options.theme; tt.appendChild(content.cloneNode(true)); - document.body.appendChild(tt); + if(cm.options.lint.selfContain) + cm.getWrapperElement().appendChild(tt); + else + document.body.appendChild(tt); function position(e) { if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position); diff --git a/demo/lint.html b/demo/lint.html index 1184232d43..4b245dc54c 100644 --- a/demo/lint.html +++ b/demo/lint.html @@ -150,7 +150,9 @@

Linter Demo

lineNumbers: true, mode: "javascript", gutters: ["CodeMirror-lint-markers"], - lint: true + lint: { + selfContain: true + } }); var editor_json = CodeMirror.fromTextArea(document.getElementById("code-json"), { diff --git a/doc/manual.html b/doc/manual.html index e943ce63b2..7030b7914d 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -2911,6 +2911,7 @@

Addons

will only be executed when the promise resolves. By default, the linter will run (debounced) whenever the document is changed. You can pass a lintOnChange: false option to disable that. + You can pass a selfContain: true option to render the tooltip inside the editor instance. Depends on addon/lint/lint.css. A demo can be found here.