shorten section labels in lint report

This commit is contained in:
tophf 2022-02-04 17:55:37 +03:00
parent e11c4ef755
commit aad4828e4a
3 changed files with 25 additions and 15 deletions

View File

@ -849,26 +849,29 @@ body:not(.find-open) [data-match-highlight-count="1"] .CodeMirror-selection-high
#lint td[role="line"] {
padding-left: 0.25rem;
}
#lint table:last-child {
margin-bottom: 0;
}
#lint table.empty {
#lint .empty {
display: none;
}
#lint caption:not(:empty) {
text-align: left;
#lint .caption {
vertical-align: top;
line-height: 16px;
font-weight: bold;
padding-bottom: 6px;
}
#lint tbody {
#lint .report {
font-size: 85%;
cursor: pointer;
}
#lint tr:hover {
.lint-report-container > :not(.empty) ~ :not(.empty) {
border-top: 1px dotted rgba(128, 128, 128, .5);
margin-top: .25em;
padding-top: .25em;
}
#lint .report tr:hover {
background-color: hsla(180, 50%, 36%, .2);
}
#lint td {
padding: 0;
line-height: 16px;
}
#lint td[role="severity"] {
font-size: 0;

View File

@ -328,9 +328,13 @@ linterMan.DEFAULTS = {
}
function createTable(cm) {
const caption = $create('caption');
const tbody = $create('tbody');
const table = $create('table', [caption, tbody]);
const caption = $create('td.caption');
const tbody = $create('tbody.report');
const table = $create('table',
$create('tr', [
caption,
$create('td', tbody),
]));
const trs = [];
return {
element: table,
@ -340,7 +344,7 @@ linterMan.DEFAULTS = {
};
function updateCaption() {
caption.textContent = editor.getEditorTitle(cm);
Object.assign(caption, editor.getEditorTitle(cm));
}
function updateAnnotations(lines) {

View File

@ -46,8 +46,11 @@ function SectionsEditor() {
},
getEditorTitle(cm) {
const index = editor.getEditors().indexOf(cm);
return `${t('sectionCode')} ${index + 1}`;
const index = editor.getEditors().indexOf(cm) + 1;
return {
textContent: `#${index}`,
title: `${t('sectionCode')} ${index}`,
};
},
getValue(asObject) {