Fix: toggle hidden state
This commit is contained in:
parent
f79b92c7b0
commit
d57c327955
|
@ -10,6 +10,8 @@ var linterReport = (() => { // eslint-disable-line no-var
|
||||||
const table = cms.get(cm);
|
const table = cms.get(cm);
|
||||||
table.update();
|
table.update();
|
||||||
table.updateAnnotations(annotations);
|
table.updateAnnotations(annotations);
|
||||||
|
|
||||||
|
$('#lint').classList.toggle('hidden', Array.from(cms.values()).every(t => t.isEmpty()));
|
||||||
});
|
});
|
||||||
// document.addEventListener('DOMContentLoaded', () => {
|
// document.addEventListener('DOMContentLoaded', () => {
|
||||||
// $('#lint-help').addEventListener('click', showLintHelp);
|
// $('#lint-help').addEventListener('click', showLintHelp);
|
||||||
|
@ -26,8 +28,13 @@ var linterReport = (() => { // eslint-disable-line no-var
|
||||||
const tbody = $create('tbody');
|
const tbody = $create('tbody');
|
||||||
const table = $create('table', [caption, tbody]);
|
const table = $create('table', [caption, tbody]);
|
||||||
const trs = [];
|
const trs = [];
|
||||||
|
let empty = true;
|
||||||
container.append(table);
|
container.append(table);
|
||||||
return {updateAnnotations, update};
|
return {updateAnnotations, update, isEmpty};
|
||||||
|
|
||||||
|
function isEmpty() {
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
caption.textContent = typeof editor === 'object' ?
|
caption.textContent = typeof editor === 'object' ?
|
||||||
|
@ -51,7 +58,8 @@ var linterReport = (() => { // eslint-disable-line no-var
|
||||||
while (trs.length > i) {
|
while (trs.length > i) {
|
||||||
trs.pop().element.remove();
|
trs.pop().element.remove();
|
||||||
}
|
}
|
||||||
table.classList.toggle('empty', i > 0);
|
empty = i === 0;
|
||||||
|
table.classList.toggle('empty', empty);
|
||||||
|
|
||||||
function *getAnnotations() {
|
function *getAnnotations() {
|
||||||
for (const line of lines.filter(Boolean)) {
|
for (const line of lines.filter(Boolean)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user