mdv-live 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/static/app.js +18 -4
package/package.json
CHANGED
package/src/static/app.js
CHANGED
|
@@ -204,6 +204,7 @@
|
|
|
204
204
|
const ThemeManager = {
|
|
205
205
|
set(theme) {
|
|
206
206
|
state.theme = theme;
|
|
207
|
+
document.documentElement.dataset.theme = theme;
|
|
207
208
|
document.body.dataset.theme = theme;
|
|
208
209
|
localStorage.setItem(STORAGE_KEYS.THEME, theme);
|
|
209
210
|
|
|
@@ -493,9 +494,8 @@
|
|
|
493
494
|
},
|
|
494
495
|
|
|
495
496
|
async expandToPath(filePath) {
|
|
496
|
-
//
|
|
497
|
+
// パスを分割して順番に展開
|
|
497
498
|
const parts = filePath.split('/');
|
|
498
|
-
parts.pop(); // ファイル名を除外
|
|
499
499
|
|
|
500
500
|
let currentPath = '';
|
|
501
501
|
for (const part of parts) {
|
|
@@ -507,6 +507,7 @@
|
|
|
507
507
|
const children = item.querySelector('.tree-children');
|
|
508
508
|
const chevron = item.querySelector('.chevron');
|
|
509
509
|
|
|
510
|
+
// ディレクトリの場合のみ展開
|
|
510
511
|
if (children && children.classList.contains('collapsed')) {
|
|
511
512
|
// 未読み込みの場合は子要素を取得
|
|
512
513
|
if (item.dataset.loaded !== 'true') {
|
|
@@ -1941,6 +1942,11 @@
|
|
|
1941
1942
|
|
|
1942
1943
|
chevron.classList.toggle('expanded');
|
|
1943
1944
|
children.classList.toggle('collapsed');
|
|
1945
|
+
|
|
1946
|
+
// 展開時にURLを更新(ディレクトリは末尾に/)
|
|
1947
|
+
if (isExpanding) {
|
|
1948
|
+
updateUrlPath(path + '/');
|
|
1949
|
+
}
|
|
1944
1950
|
}
|
|
1945
1951
|
};
|
|
1946
1952
|
|
|
@@ -2008,8 +2014,16 @@
|
|
|
2008
2014
|
|
|
2009
2015
|
const initialPath = new URLSearchParams(window.location.search).get('path');
|
|
2010
2016
|
if (initialPath) {
|
|
2011
|
-
|
|
2012
|
-
|
|
2017
|
+
// 末尾の/でディレクトリ判定
|
|
2018
|
+
const isDirectoryPath = initialPath.endsWith('/');
|
|
2019
|
+
const cleanPath = isDirectoryPath ? initialPath.slice(0, -1) : initialPath;
|
|
2020
|
+
|
|
2021
|
+
await FileTreeManager.expandToPath(cleanPath);
|
|
2022
|
+
|
|
2023
|
+
// ファイルの場合のみ開く
|
|
2024
|
+
if (!isDirectoryPath) {
|
|
2025
|
+
await TabManager.open(cleanPath);
|
|
2026
|
+
}
|
|
2013
2027
|
}
|
|
2014
2028
|
}
|
|
2015
2029
|
|