feat: 매뉴얼 검색·소메뉴 아이콘 개선·워크스페이스 탭 세션 유지

- 매뉴얼: 전체 검색 박스(slug별 hit 카운트·스니펫)와 본문 하이라이트 추가
  - ManualRenderer::plainText()/search(), Bag::manualSearch(), bag/manual/search 라우트
- 사이드바 소메뉴 선택 아이콘 변경: 닫기처럼 보이던 × → ▸, + → · (정적/동적 일관)
- 워크스페이스: 탭 목록을 sessionStorage에 저장·복원
  - 관리자 페이지 이동 후 복귀·새로고침해도 열어둔 탭 유지(세션 범위)
  - 복원으로 무의미해진 beforeunload 새로고침 경고 제거
- e2e: 관리자 이동 후 탭 복원 케이스 추가

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
taekyoungc
2026-06-08 19:52:53 +09:00
parent e8d58b5837
commit 1a443de02e
8 changed files with 205 additions and 14 deletions

View File

@@ -105,6 +105,17 @@ if ($effectiveLgIdx) {
catch (e) { return u + (u.indexOf('?') >= 0 ? '&' : '?') + 'embed=1'; }
}
var STORE_KEY = 'jrj_ws_tabs';
function persist() {
try {
var data = {
tabs: order.map(function (id) { return { url: tabs[id].url, title: tabs[id].title }; }),
active: activeId
};
sessionStorage.setItem(STORE_KEY, JSON.stringify(data));
} catch (e) {}
}
function activate(id) {
if (!tabs[id]) return;
activeId = id;
@@ -113,6 +124,7 @@ if ($effectiveLgIdx) {
tabs[k].btn.classList.toggle('active', k === id);
});
if (empty) empty.style.display = 'none';
persist();
}
function reloadTab(id) {
@@ -132,6 +144,7 @@ if ($effectiveLgIdx) {
var next = order[order.length - 1];
if (next) activate(next); else { activeId = null; if (empty) empty.style.display = 'flex'; }
}
persist();
}
function openTab(url, title) {
@@ -194,17 +207,18 @@ if ($effectiveLgIdx) {
});
});
// 브라우저 전체 새로고침/이탈 시 경고 (기본 대시보드 외 탭이 열려 있을 때)
window.addEventListener('beforeunload', function (e) {
if (order.length > 1) {
e.preventDefault();
e.returnValue = '열어 둔 탭이 모두 닫힙니다. 계속할까요?';
return e.returnValue;
// 첫 화면: 세션에 저장된 탭이 있으면 복원(관리자 페이지 등 전체 이동 후 복귀·새로고침 대응),
// 없으면 대시보드 탭 자동 열기
(function restore() {
var saved = null;
try { saved = JSON.parse(sessionStorage.getItem(STORE_KEY) || 'null'); } catch (e) {}
if (saved && saved.tabs && saved.tabs.length) {
saved.tabs.forEach(function (t) { if (t && t.url) openTab(t.url, t.title); });
if (saved.active && tabs[saved.active]) activate(saved.active);
return;
}
});
// 첫 화면: 대시보드 탭 자동 열기
openTab('<?= base_url('/') ?>', '업무 현황');
openTab('<?= base_url('/') ?>', '업무 현황');
})();
})();
</script>
</body>