Add: updateCount. Fix table caption
This commit is contained in:
parent
f42e97d71d
commit
054d94ebd2
|
@ -20,7 +20,7 @@ var linterReport = (() => { // eslint-disable-line no-var
|
||||||
}
|
}
|
||||||
table.update();
|
table.update();
|
||||||
table.updateAnnotations(annotations);
|
table.updateAnnotations(annotations);
|
||||||
$('#lint').classList.toggle('hidden', Array.from(cms.values()).every(t => t.isEmpty()));
|
updateCount();
|
||||||
});
|
});
|
||||||
|
|
||||||
linter.onUnhook(cm => {
|
linter.onUnhook(cm => {
|
||||||
|
@ -29,6 +29,7 @@ var linterReport = (() => { // eslint-disable-line no-var
|
||||||
table.element.remove();
|
table.element.remove();
|
||||||
cms.delete(cm);
|
cms.delete(cm);
|
||||||
}
|
}
|
||||||
|
updateCount();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
@ -37,6 +38,15 @@ var linterReport = (() => { // eslint-disable-line no-var
|
||||||
|
|
||||||
return {refresh};
|
return {refresh};
|
||||||
|
|
||||||
|
function updateCount() {
|
||||||
|
const issueCount = Array.from(cms.values()).reduce((sum, t) => {
|
||||||
|
sum += t.trs.length;
|
||||||
|
return sum;
|
||||||
|
}, 0);
|
||||||
|
$('#lint').classList.toggle('hidden', issueCount === 0);
|
||||||
|
$('#issue-count').textContent = issueCount;
|
||||||
|
}
|
||||||
|
|
||||||
function getIssues() {
|
function getIssues() {
|
||||||
const issues = new Set();
|
const issues = new Set();
|
||||||
for (const table of cms.values()) {
|
for (const table of cms.values()) {
|
||||||
|
@ -83,7 +93,7 @@ var linterReport = (() => { // eslint-disable-line no-var
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
caption.textContent = typeof editor === 'object' ?
|
caption.textContent = typeof editor === 'object' ?
|
||||||
'' : editors.indexOf(cm) + 1;
|
'' : `${t('sectionCode')} ${editors.indexOf(cm) + 1}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAnnotations(lines) {
|
function updateAnnotations(lines) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user