Skip to content

Commit 0731ba3

Browse files
committed
fix(ui): stop the mark list covering the editor scrollbar
- Opening the mark list laid it over the editor, hiding the vertical scrollbar and minimap under the panel; it now narrows the editor like the addon side panels do - The earlier fix for this symptom only covered the four addon panels, and its guard test only scans the addons directory, so the one built-in right-edge panel slipped through; the test now also walks the core stylesheet for fixed right-edge panels
1 parent c7c1967 commit 0731ba3

4 files changed

Lines changed: 30 additions & 5 deletions

File tree

static/css/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ body.search-mode #root-chip{min-width:0}
10901090
#memo-list-panel{position:fixed;right:0;top:0;width:320px;height:100vh;background:#1e1e1e;border-left:1px solid #333;z-index:var(--z-side-panel);flex-direction:column;display:none;min-width:200px;max-width:700px}
10911091
#memo-list-width-resizer{position:absolute;left:0;top:0;width:5px;height:100%;cursor:ew-resize;z-index:var(--z-content)}
10921092
#memo-list-width-resizer:hover,#memo-list-width-resizer:active{background:rgba(0,122,204,0.4)}
1093-
#memo-list-panel.visible{display:flex}
1093+
#memo-list-panel.open{display:flex}
10941094
#memo-list-hdr{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;border-bottom:1px solid #333;font-size:12px;color:#ccc;flex-shrink:0}
10951095
#memo-list-hdr button{background:none;border:none;color:#888;cursor:pointer;padding:2px 4px;border-radius:2px}
10961096
#memo-list-hdr button:hover{color:#ccc;background:#2a2d2e}

static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@
543543
</div>
544544
</div>
545545

546-
<div id="memo-list-panel"></div>
546+
<div id="memo-list-panel" class="side-panel"></div>
547547
<div id="memo-tooltip"></div>
548548
<div id="level-badge"><span class="lv-arrow"></span><span id="lv-from"></span><span id="lv-to" class="lv-num"></span></div>
549549
<div id="preview-popup">

static/js/memo-list.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,18 @@ function toggleMemoList() {
267267
const panel = id('memo-list-panel');
268268
if (!panel) return;
269269
_memoListOpen = !_memoListOpen;
270-
if (_memoListOpen) { renderMemoList(); panel.classList.add('visible'); }
271-
else { panel.classList.remove('visible'); }
270+
// 'open' はアドオンのサイドパネルと同じ目印。app.js の initSidePanelLayout が
271+
// .side-panel.open の幅ぶんエディタを狭めるので、これでスクロールバーが
272+
// パネルの下に隠れない(474926a でアドオン側だけ直り、本体組み込みの
273+
// このパネルが漏れていた)。
274+
if (_memoListOpen) { renderMemoList(); panel.classList.add('open'); }
275+
else { panel.classList.remove('open'); }
272276
id('btn-memo-list')?.classList.toggle('active', _memoListOpen);
273277
}
274278

275279
function closeMemoList() {
276280
_memoListOpen = false;
277-
id('memo-list-panel')?.classList.remove('visible');
281+
id('memo-list-panel')?.classList.remove('open');
278282
id('btn-memo-list')?.classList.remove('active');
279283
}
280284

test/addons.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,24 @@ test('アドオンパネル - 右端に固定するパネルは side-panel を
3131
}
3232
assert.ok(checked >= 4, `右端パネルが ${checked} 件しか見つからない(検出側が壊れている疑い)`);
3333
});
34+
35+
// 同じ症状は本体組み込みのパネルでも起きる。マーク一覧がまさにこれで、
36+
// アドオンだけ走査していた上のテストをすり抜けて1枚だけ残った。
37+
// main.css で右端固定のパネルを拾い、index.html 側の要素に目印を要求する。
38+
test('本体パネル - 右端に固定するパネルも side-panel を名乗る', () => {
39+
const css = fs.readFileSync(path.join(__dirname, '..', 'static', 'css', 'main.css'), 'utf8');
40+
const html = fs.readFileSync(path.join(__dirname, '..', 'static', 'index.html'), 'utf8');
41+
let checked = 0;
42+
for (const m of css.matchAll(/#([\w-]+)\s*\{([^}]*)\}/g)) {
43+
const body = m[2].replace(/\s+/g, '');
44+
if (!body.includes('position:fixed') || !/right:0[;}]/.test(body)) continue;
45+
const id = m[1];
46+
const tag = html.match(new RegExp(`id="${id}"[^>]*`));
47+
if (!tag) continue; // アドオン側の要素は上のテストが見る
48+
assert.ok(/class="[^"]*\bside-panel\b/.test(tag[0]),
49+
`#${id} に class="side-panel" が無い。開いてもエディタが狭まらず、` +
50+
'縦スクロールバーがパネルの下に隠れる');
51+
checked++;
52+
}
53+
assert.ok(checked >= 1, `右端固定の本体パネルが ${checked} 件しか見つからない(検出側が壊れている疑い)`);
54+
});

0 commit comments

Comments
 (0)