Commit ·
f3e25f2
1
Parent(s): 92584b4
Fix error filtering logic (add data-type to suggestion-card, fix querySelectors)
Browse files- src/js/format.js +3 -3
- src/js/ui.js +1 -0
src/js/format.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
// Rich text formatting commands for the editor
|
| 3 |
|
| 4 |
/**
|
|
@@ -845,7 +845,7 @@ function filterErrors(type) {
|
|
| 845 |
tab.classList.toggle('active', tab.dataset.filter === type);
|
| 846 |
});
|
| 847 |
// Filter suggestion items
|
| 848 |
-
document.querySelectorAll('#suggestions-list .suggestion-item, #suggestions-list .sugg-card').forEach(item => {
|
| 849 |
if (type === 'all') {
|
| 850 |
item.style.display = '';
|
| 851 |
} else {
|
|
@@ -861,7 +861,7 @@ function filterErrors(type) {
|
|
| 861 |
function dismissAllFiltered() {
|
| 862 |
const type = _currentErrorFilter;
|
| 863 |
if (type === 'all') return;
|
| 864 |
-
document.querySelectorAll('#suggestions-list .suggestion-item, #suggestions-list .sugg-card').forEach(item => {
|
| 865 |
const itemType = item.dataset.type || item.getAttribute('data-error-type') || '';
|
| 866 |
if (itemType.includes(type)) {
|
| 867 |
item.remove();
|
|
|
|
| 1 |
+
// src/js/format.js
|
| 2 |
// Rich text formatting commands for the editor
|
| 3 |
|
| 4 |
/**
|
|
|
|
| 845 |
tab.classList.toggle('active', tab.dataset.filter === type);
|
| 846 |
});
|
| 847 |
// Filter suggestion items
|
| 848 |
+
document.querySelectorAll('#suggestions-list .suggestion-item, #suggestions-list .sugg-card, #suggestions-list .suggestion-card').forEach(item => {
|
| 849 |
if (type === 'all') {
|
| 850 |
item.style.display = '';
|
| 851 |
} else {
|
|
|
|
| 861 |
function dismissAllFiltered() {
|
| 862 |
const type = _currentErrorFilter;
|
| 863 |
if (type === 'all') return;
|
| 864 |
+
document.querySelectorAll('#suggestions-list .suggestion-item, #suggestions-list .sugg-card, #suggestions-list .suggestion-card').forEach(item => {
|
| 865 |
const itemType = item.dataset.type || item.getAttribute('data-error-type') || '';
|
| 866 |
if (itemType.includes(type)) {
|
| 867 |
item.remove();
|
src/js/ui.js
CHANGED
|
@@ -96,6 +96,7 @@ function buildSuggestionCardHTML(suggestion, index) {
|
|
| 96 |
return `
|
| 97 |
<div class="suggestion-card" role="listitem" tabindex="0"
|
| 98 |
data-suggestion-id="${suggestionId}"
|
|
|
|
| 99 |
aria-label="${label}: ${suggestion.original} إلى ${suggestion.correction}">
|
| 100 |
<span class="suggestion-card-badge ${badgeClass}">${label}</span>
|
| 101 |
<div class="suggestion-card-change">
|
|
|
|
| 96 |
return `
|
| 97 |
<div class="suggestion-card" role="listitem" tabindex="0"
|
| 98 |
data-suggestion-id="${suggestionId}"
|
| 99 |
+
data-type="${suggestion.type}"
|
| 100 |
aria-label="${label}: ${suggestion.original} إلى ${suggestion.correction}">
|
| 101 |
<span class="suggestion-card-badge ${badgeClass}">${label}</span>
|
| 102 |
<div class="suggestion-card-change">
|