mdv-live 0.4.0 → 0.4.1
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 +17 -4
package/package.json
CHANGED
package/src/static/app.js
CHANGED
|
@@ -493,9 +493,8 @@
|
|
|
493
493
|
},
|
|
494
494
|
|
|
495
495
|
async expandToPath(filePath) {
|
|
496
|
-
//
|
|
496
|
+
// パスを分割して順番に展開
|
|
497
497
|
const parts = filePath.split('/');
|
|
498
|
-
parts.pop(); // ファイル名を除外
|
|
499
498
|
|
|
500
499
|
let currentPath = '';
|
|
501
500
|
for (const part of parts) {
|
|
@@ -507,6 +506,7 @@
|
|
|
507
506
|
const children = item.querySelector('.tree-children');
|
|
508
507
|
const chevron = item.querySelector('.chevron');
|
|
509
508
|
|
|
509
|
+
// ディレクトリの場合のみ展開
|
|
510
510
|
if (children && children.classList.contains('collapsed')) {
|
|
511
511
|
// 未読み込みの場合は子要素を取得
|
|
512
512
|
if (item.dataset.loaded !== 'true') {
|
|
@@ -1941,6 +1941,11 @@
|
|
|
1941
1941
|
|
|
1942
1942
|
chevron.classList.toggle('expanded');
|
|
1943
1943
|
children.classList.toggle('collapsed');
|
|
1944
|
+
|
|
1945
|
+
// 展開時にURLを更新(ディレクトリは末尾に/)
|
|
1946
|
+
if (isExpanding) {
|
|
1947
|
+
updateUrlPath(path + '/');
|
|
1948
|
+
}
|
|
1944
1949
|
}
|
|
1945
1950
|
};
|
|
1946
1951
|
|
|
@@ -2008,8 +2013,16 @@
|
|
|
2008
2013
|
|
|
2009
2014
|
const initialPath = new URLSearchParams(window.location.search).get('path');
|
|
2010
2015
|
if (initialPath) {
|
|
2011
|
-
|
|
2012
|
-
|
|
2016
|
+
// 末尾の/でディレクトリ判定
|
|
2017
|
+
const isDirectoryPath = initialPath.endsWith('/');
|
|
2018
|
+
const cleanPath = isDirectoryPath ? initialPath.slice(0, -1) : initialPath;
|
|
2019
|
+
|
|
2020
|
+
await FileTreeManager.expandToPath(cleanPath);
|
|
2021
|
+
|
|
2022
|
+
// ファイルの場合のみ開く
|
|
2023
|
+
if (!isDirectoryPath) {
|
|
2024
|
+
await TabManager.open(cleanPath);
|
|
2025
|
+
}
|
|
2013
2026
|
}
|
|
2014
2027
|
}
|
|
2015
2028
|
|