mirror of
https://github.com/kbenestad/mdcms.git
synced 2026-06-18 07:24:31 +00:00
Merge remote-tracking branch 'origin/main' into development
This commit is contained in:
commit
24f428d8d3
2 changed files with 8 additions and 5 deletions
|
|
@ -166,6 +166,7 @@ For nested navigation, set `parent: <parent-section-code>` and `parent-sort` on
|
||||||
- Variant files: `<base>.<code>.md` — the suffix is only treated as a category if the code is declared in config
|
- Variant files: `<base>.<code>.md` — the suffix is only treated as a category if the code is declared in config
|
||||||
- `categories-sectionnames: per-category` requires each section in `nav.yml` to have a `categorynames` block with an entry per category code
|
- `categories-sectionnames: per-category` requires each section in `nav.yml` to have a `categorynames` block with an entry per category code
|
||||||
- RTL is set per category via `direction: rtl`
|
- RTL is set per category via `direction: rtl`
|
||||||
|
- Line height is set per category via `line-height: 2.8` (useful for scripts like Nastaliq that need extra vertical space). Restores to theme default when switching to a category without this key.
|
||||||
|
|
||||||
## Dynamic post tags (mdcms code blocks)
|
## Dynamic post tags (mdcms code blocks)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,8 @@ body {
|
||||||
.sidebar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; }
|
.sidebar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; }
|
||||||
.sidebar::-webkit-scrollbar-track { background: var(--scrollbar-track); }
|
.sidebar::-webkit-scrollbar-track { background: var(--scrollbar-track); }
|
||||||
|
|
||||||
|
.layout-sidebar .mobile-header { display: none; }
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════
|
/* ═══════════════════════════════════════════
|
||||||
SIDEBAR CONTENT
|
SIDEBAR CONTENT
|
||||||
═══════════════════════════════════════════ */
|
═══════════════════════════════════════════ */
|
||||||
|
|
@ -957,6 +959,7 @@ body {
|
||||||
let activeCategory = null; // current code
|
let activeCategory = null; // current code
|
||||||
let sectionnamesMode = 'same'; // 'same' | 'per-category'
|
let sectionnamesMode = 'same'; // 'same' | 'per-category'
|
||||||
let loadedFonts = new Set(); // track which font files have been loaded
|
let loadedFonts = new Set(); // track which font files have been loaded
|
||||||
|
let defaultLineHeight = null; // theme/CSS default, captured after theme is applied
|
||||||
|
|
||||||
// ─── Icons ────────────────────────────────────────────────
|
// ─── Icons ────────────────────────────────────────────────
|
||||||
const STANDARD_ICONS = ['dark_mode','light_mode','menu','search','arrow_right','arrow_drop_down','mobile_arrow_down','language','info','warning','error','success','exclamation','dangerous','report','history','text_compare','keyboard_arrow_right','keyboard_arrow_down','keyboard_double_arrow_right','keyboard_double_arrow_down','expand_content','collapse_content','add','minimize'];
|
const STANDARD_ICONS = ['dark_mode','light_mode','menu','search','arrow_right','arrow_drop_down','mobile_arrow_down','language','info','warning','error','success','exclamation','dangerous','report','history','text_compare','keyboard_arrow_right','keyboard_arrow_down','keyboard_double_arrow_right','keyboard_double_arrow_down','expand_content','collapse_content','add','minimize'];
|
||||||
|
|
@ -2018,7 +2021,6 @@ function fmtDatetime(dtStr) {
|
||||||
const layout = el('div', { className: `layout-sidebar nav-${navPos}` });
|
const layout = el('div', { className: `layout-sidebar nav-${navPos}` });
|
||||||
|
|
||||||
const mobileHeader = el('div', { className: 'mobile-header' });
|
const mobileHeader = el('div', { className: 'mobile-header' });
|
||||||
mobileHeader.style.display = 'none';
|
|
||||||
const hamburger = el('button', { className: 'hamburger', 'aria-label': 'Open menu' });
|
const hamburger = el('button', { className: 'hamburger', 'aria-label': 'Open menu' });
|
||||||
hamburger.appendChild(iconEl('menu'));
|
hamburger.appendChild(iconEl('menu'));
|
||||||
const mobileName = el('span', { className: 'sidebar-sitename', textContent: config.sitename || 'MD-CMS' });
|
const mobileName = el('span', { className: 'sidebar-sitename', textContent: config.sitename || 'MD-CMS' });
|
||||||
|
|
@ -2028,10 +2030,6 @@ function fmtDatetime(dtStr) {
|
||||||
}
|
}
|
||||||
mobileHeader.appendChild(mobileName);
|
mobileHeader.appendChild(mobileName);
|
||||||
|
|
||||||
const mobileStyle = document.createElement('style');
|
|
||||||
mobileStyle.textContent = `@media (max-width: 768px) { .layout-sidebar .mobile-header { display: flex !important; } }`;
|
|
||||||
document.head.appendChild(mobileStyle);
|
|
||||||
|
|
||||||
const overlay = el('div', { className: 'mobile-overlay' });
|
const overlay = el('div', { className: 'mobile-overlay' });
|
||||||
overlay.addEventListener('click', () => closeMobileMenu());
|
overlay.addEventListener('click', () => closeMobileMenu());
|
||||||
|
|
||||||
|
|
@ -2298,6 +2296,9 @@ function fmtDatetime(dtStr) {
|
||||||
document.querySelectorAll('.category-bar').forEach(b => b.setAttribute('dir', direction));
|
document.querySelectorAll('.category-bar').forEach(b => b.setAttribute('dir', direction));
|
||||||
document.querySelectorAll('.md-content, .title-bar').forEach(el => el.setAttribute('dir', direction));
|
document.querySelectorAll('.md-content, .title-bar').forEach(el => el.setAttribute('dir', direction));
|
||||||
document.querySelectorAll('.sidebar').forEach(el => el.setAttribute('dir', direction));
|
document.querySelectorAll('.sidebar').forEach(el => el.setAttribute('dir', direction));
|
||||||
|
// Apply per-category line-height override, or restore theme default
|
||||||
|
const lh = cat && cat['line-height'];
|
||||||
|
document.documentElement.style.setProperty('--line-height-body', lh ? String(lh) : (defaultLineHeight || '1.7'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSearch(query, resultsEl) {
|
function doSearch(query, resultsEl) {
|
||||||
|
|
@ -2770,6 +2771,7 @@ function fmtDatetime(dtStr) {
|
||||||
|
|
||||||
if (config.theme) applyThemeYml(themeConfig);
|
if (config.theme) applyThemeYml(themeConfig);
|
||||||
else applyConfigTheme();
|
else applyConfigTheme();
|
||||||
|
defaultLineHeight = getComputedStyle(document.documentElement).getPropertyValue('--line-height-body').trim() || '1.7';
|
||||||
applyTheme(getInitialTheme());
|
applyTheme(getInitialTheme());
|
||||||
|
|
||||||
// nav.yml — phase 2 expects `sections:` + `pages:` blocks; phase 1 flat
|
// nav.yml — phase 2 expects `sections:` + `pages:` blocks; phase 1 flat
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue