diff --git a/edit.html b/edit.html index f905f882..33fc617e 100644 --- a/edit.html +++ b/edit.html @@ -447,6 +447,18 @@ position: relative; top: 0.2rem; } + #lint h2 { + display: block; + cursor: default; + margin-bottom: 0; + } + #lint > div { + max-height: 0; + } + #lint:hover > div { + margin-top: 1em; + max-height: 30vh; + } #sections { padding-left: 0; } @@ -594,7 +606,7 @@ -

+

:

diff --git a/edit.js b/edit.js index d587cd09..a3bd5032 100644 --- a/edit.js +++ b/edit.js @@ -937,12 +937,14 @@ function renderLintReport(someBlockChanged) { var content = container.children[1]; var label = t("sectionCode"); var newContent = content.cloneNode(false); + var issueCount = 0; editors.forEach(function(cm, index) { if (cm.state.lint.html) { var newBlock = newContent.appendChild(document.createElement("table")); var html = "" + label + " " + (index+1) + "" + cm.state.lint.html; newBlock.innerHTML = html; newBlock.cm = cm; + issueCount += newBlock.rows.length; var block = content.children[newContent.children.length - 1]; var blockChanged = !block || cm != block.cm || html != block.innerHTML; @@ -951,6 +953,7 @@ function renderLintReport(someBlockChanged) { } }); if (someBlockChanged || newContent.children.length != content.children.length) { + document.getElementById('issue-count').textContent = issueCount; container.replaceChild(newContent, content); container.style.display = newContent.children.length ? "block" : "none"; resizeLintReport(null, newContent); @@ -960,10 +963,8 @@ function renderLintReport(someBlockChanged) { function resizeLintReport(event, content) { content = content || document.getElementById("lint").children[1]; if (content.children.length) { - var header = document.getElementById("header"); - var headerHeight = parseFloat(getComputedStyle(header).height); - var contentTop = content.getBoundingClientRect().top - header.getBoundingClientRect().top; - var newMaxHeight = Math.max(100, headerHeight - contentTop) + "px"; + var bounds = content.getBoundingClientRect(); + var newMaxHeight = bounds.bottom <= innerHeight ? '' : (innerHeight - bounds.top) + "px"; if (newMaxHeight != content.style.maxHeight) { content.style.maxHeight = newMaxHeight; }