feat: 글자크기를 계정별·메뉴별로 저장(재로그인 유지)
기존 전역 localStorage 방식(모든 메뉴 일괄 적용)을 화면 경로(메뉴키) 기준 계정별 DB 저장으로 변경. A−/A+ 조정 시 해당 화면만 조정·저장되고, 다음 방문·재로그인 시 각 화면의 저장값이 서버 주입으로 복원된다. - member_menu_font_scale 테이블 + 저장 엔드포인트(bag/pref/font-scale) - member_font_scale_for() 헬퍼로 렌더 시 현재 화면 저장값 주입 - admin/portal/embed 레이아웃 + 워크스페이스(탭 iframe)에 적용 · 워크스페이스는 포커스된 탭(메뉴)만 조정, 디바운스 저장으로 CSRF 경합 방지 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -229,6 +229,37 @@ if (! function_exists('current_nav_request_path')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('member_font_scale_for')) {
|
||||
/**
|
||||
* 로그인 계정의 특정 메뉴(화면 경로)에 저장된 글자크기(zoom %)를 반환.
|
||||
* 저장값이 없거나 범위(70~150) 밖이면 100.
|
||||
*/
|
||||
function member_font_scale_for(string $menuKey): int
|
||||
{
|
||||
$mbIdx = (int) (session()->get('mb_idx') ?? 0);
|
||||
$menuKey = trim($menuKey);
|
||||
if ($mbIdx <= 0 || $menuKey === '') {
|
||||
return 100;
|
||||
}
|
||||
try {
|
||||
$db = \Config\Database::connect();
|
||||
if (! $db->tableExists('member_menu_font_scale')) {
|
||||
return 100;
|
||||
}
|
||||
$row = $db->table('member_menu_font_scale')
|
||||
->select('mmf_scale')
|
||||
->where('mmf_mb_idx', $mbIdx)
|
||||
->where('mmf_menu_key', $menuKey)
|
||||
->get()->getRow();
|
||||
} catch (\Throwable $e) {
|
||||
return 100;
|
||||
}
|
||||
$s = $row ? (int) $row->mmf_scale : 100;
|
||||
|
||||
return ($s >= 70 && $s <= 150) ? $s : 100;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('normalize_menu_link_for_url')) {
|
||||
/**
|
||||
* menu.mm_link 를 base_url() 인자로 쓸 수 있는 상대 경로로 정규화합니다.
|
||||
|
||||
Reference in New Issue
Block a user