Commit ·
7fad09c
1
Parent(s): 2702d02
fix: dismissAllFiltered bug, and make editor layout exactly 100vh with isolated internal scrolling
Browse files- src/css/components.css +40 -1
- src/js/format.js +40 -8
src/css/components.css
CHANGED
|
@@ -4083,4 +4083,43 @@ body.focus-mode .editor-surface {
|
|
| 4083 |
.sparkline {
|
| 4084 |
display: block;
|
| 4085 |
margin: 6px auto;
|
| 4086 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4083 |
.sparkline {
|
| 4084 |
display: block;
|
| 4085 |
margin: 6px auto;
|
| 4086 |
+
}
|
| 4087 |
+
/* ── Fix Layout: Editor Full Height Fit ── */
|
| 4088 |
+
#page-editor > section {
|
| 4089 |
+
height: 100vh;
|
| 4090 |
+
display: flex;
|
| 4091 |
+
flex-direction: column;
|
| 4092 |
+
overflow: hidden;
|
| 4093 |
+
padding-bottom: 0;
|
| 4094 |
+
}
|
| 4095 |
+
|
| 4096 |
+
#page-editor .max-w-\[1600px\] {
|
| 4097 |
+
flex: 1;
|
| 4098 |
+
display: flex;
|
| 4099 |
+
flex-direction: column;
|
| 4100 |
+
min-height: 0;
|
| 4101 |
+
width: 100%;
|
| 4102 |
+
}
|
| 4103 |
+
|
| 4104 |
+
#page-editor .editor-layout {
|
| 4105 |
+
flex: 1;
|
| 4106 |
+
min-height: 0;
|
| 4107 |
+
height: 100%;
|
| 4108 |
+
}
|
| 4109 |
+
|
| 4110 |
+
#page-editor .editor-shell {
|
| 4111 |
+
display: flex;
|
| 4112 |
+
flex-direction: column;
|
| 4113 |
+
height: 100%;
|
| 4114 |
+
overflow: hidden;
|
| 4115 |
+
}
|
| 4116 |
+
|
| 4117 |
+
#page-editor #write-area,
|
| 4118 |
+
#page-editor #summarize-area,
|
| 4119 |
+
#page-editor #dialect-area,
|
| 4120 |
+
#page-editor #quran-area {
|
| 4121 |
+
flex: 1;
|
| 4122 |
+
overflow-y: auto;
|
| 4123 |
+
min-height: 0;
|
| 4124 |
+
}
|
| 4125 |
+
|
src/js/format.js
CHANGED
|
@@ -853,20 +853,52 @@ function filterErrors(type) {
|
|
| 853 |
item.style.display = itemType.includes(type) ? '' : 'none';
|
| 854 |
}
|
| 855 |
});
|
| 856 |
-
|
| 857 |
const dismissBtn = document.getElementById('dismiss-filtered-btn');
|
| 858 |
-
if (dismissBtn)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 859 |
}
|
| 860 |
|
| 861 |
function dismissAllFiltered() {
|
| 862 |
-
const type = _currentErrorFilter;
|
| 863 |
-
if (
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 868 |
}
|
| 869 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 870 |
}
|
| 871 |
|
| 872 |
/* ── Error Breakdown Chart (SVG Donut) ── */
|
|
|
|
| 853 |
item.style.display = itemType.includes(type) ? '' : 'none';
|
| 854 |
}
|
| 855 |
});
|
| 856 |
+
// Show/hide dismiss button
|
| 857 |
const dismissBtn = document.getElementById('dismiss-filtered-btn');
|
| 858 |
+
if (dismissBtn) {
|
| 859 |
+
dismissBtn.classList.remove('is-hidden');
|
| 860 |
+
// For 'all', show total count, else show filtered count
|
| 861 |
+
const count = type === 'all' ? window.currentSuggestions?.length || 0
|
| 862 |
+
: (window.currentSuggestions?.filter(s => s.type === type).length || 0);
|
| 863 |
+
dismissBtn.style.display = count > 0 ? '' : 'none';
|
| 864 |
+
}
|
| 865 |
}
|
| 866 |
|
| 867 |
function dismissAllFiltered() {
|
| 868 |
+
const type = window._currentErrorFilter || 'all';
|
| 869 |
+
if (!window.currentSuggestions || window.currentSuggestions.length === 0) return;
|
| 870 |
+
|
| 871 |
+
if (typeof window.pushUndoState === 'function') {
|
| 872 |
+
window.pushUndoState();
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
// Get suggestions to dismiss
|
| 876 |
+
const toDismiss = type === 'all' ? window.currentSuggestions : window.currentSuggestions.filter(s => s.type === type);
|
| 877 |
+
|
| 878 |
+
// Add originals to whitelist
|
| 879 |
+
let dismissed = [];
|
| 880 |
+
try {
|
| 881 |
+
dismissed = JSON.parse(localStorage.getItem('bayan_dismissed_words') || '[]');
|
| 882 |
+
} catch(e) {}
|
| 883 |
+
|
| 884 |
+
toDismiss.forEach(s => {
|
| 885 |
+
const cleanWord = s.original.trim().replace(/[.,!?،؛؟"]/g, '');
|
| 886 |
+
if (cleanWord.length > 0 && !dismissed.includes(cleanWord)) {
|
| 887 |
+
dismissed.push(cleanWord);
|
| 888 |
}
|
| 889 |
});
|
| 890 |
+
localStorage.setItem('bayan_dismissed_words', JSON.stringify(dismissed));
|
| 891 |
+
|
| 892 |
+
// Update suggestions array
|
| 893 |
+
if (type === 'all') {
|
| 894 |
+
window.currentSuggestions = [];
|
| 895 |
+
} else {
|
| 896 |
+
window.currentSuggestions = window.currentSuggestions.filter(s => s.type !== type);
|
| 897 |
+
}
|
| 898 |
+
|
| 899 |
+
// Re-render UI
|
| 900 |
+
if (typeof window.renderEditorHighlights === 'function') window.renderEditorHighlights();
|
| 901 |
+
if (typeof window.renderSuggestionsSidebar === 'function') window.renderSuggestionsSidebar(window.currentSuggestions);
|
| 902 |
}
|
| 903 |
|
| 904 |
/* ── Error Breakdown Chart (SVG Donut) ── */
|