@maxbill/dsh-file-explorer 1.1.2 → 1.2.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/README.en.md +22 -4
- package/README.md +22 -4
- package/docs/awesome-list.md +41 -0
- package/docs/ego-browser-debug.md +79 -0
- package/docs/terminal-panel.png +0 -0
- package/lib/client.js +566 -13
- package/lib/index.js +303 -2
- package/package.json +7 -1
- package/screenshots.json +1 -0
package/lib/client.js
CHANGED
|
@@ -14,6 +14,327 @@ window.__ModuleLoader__.load({
|
|
|
14
14
|
var useRef = React.useRef;
|
|
15
15
|
var useState = React.useState;
|
|
16
16
|
|
|
17
|
+
/** xterm is loaded from the host once, on first use. */
|
|
18
|
+
var xtermPromise = null;
|
|
19
|
+
function loadXterm() {
|
|
20
|
+
if (xtermPromise) return xtermPromise;
|
|
21
|
+
xtermPromise = new Promise(function (resolve, reject) {
|
|
22
|
+
if (window.Terminal) { resolve(window.Terminal); return; }
|
|
23
|
+
var css = document.createElement("link");
|
|
24
|
+
css.rel = "stylesheet";
|
|
25
|
+
css.href = API + "/vendor?name=xterm.css";
|
|
26
|
+
document.head.appendChild(css);
|
|
27
|
+
var script = document.createElement("script");
|
|
28
|
+
script.src = API + "/vendor?name=xterm.js";
|
|
29
|
+
script.onload = function () {
|
|
30
|
+
if (window.Terminal) resolve(window.Terminal);
|
|
31
|
+
else reject(new Error("xterm did not register"));
|
|
32
|
+
};
|
|
33
|
+
script.onerror = function () { reject(new Error("xterm failed to load")); };
|
|
34
|
+
document.head.appendChild(script);
|
|
35
|
+
});
|
|
36
|
+
return xtermPromise;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/** Terminal metrics: one fixed size, the theme follows the app. */
|
|
41
|
+
var TERM_FONT_SIZE = 13;
|
|
42
|
+
var TERM_LINE_HEIGHT = 1.5;
|
|
43
|
+
var TERM_THEMES = {
|
|
44
|
+
light: { background: "#ffffff", foreground: "#1b1b1b", cursor: "#3b6cf6", selectionBackground: "rgba(59, 108, 246, .22)" },
|
|
45
|
+
dark: { background: "#1f1f1f", foreground: "#e6edf3", cursor: "#7aa2ff", selectionBackground: "rgba(122, 162, 255, .3)" },
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** True when the page is in a dark theme. */
|
|
49
|
+
function termIsDark() {
|
|
50
|
+
return (document.documentElement.getAttribute("data-ds-theme-source") || "") === "dark"
|
|
51
|
+
|| !!(window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** The xterm theme for the page theme. */
|
|
55
|
+
function termTheme() {
|
|
56
|
+
return termIsDark() ? TERM_THEMES.dark : TERM_THEMES.light;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Character width for the terminal font, measured with a canvas. */
|
|
60
|
+
function termCharWidth() {
|
|
61
|
+
var canvas = document.createElement("canvas");
|
|
62
|
+
var context = canvas.getContext("2d");
|
|
63
|
+
context.font = TERM_FONT_SIZE + "px ui-monospace, SFMono-Regular, Menlo, monospace";
|
|
64
|
+
return context.measureText("MMMMMMMMMM").width / 10;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The cell size xterm actually renders with. Its internal cell height is
|
|
69
|
+
* taller than fontSize * lineHeight, so it is read from the renderer and
|
|
70
|
+
* only estimated when that is unavailable.
|
|
71
|
+
* @param {object} terminal - xterm instance
|
|
72
|
+
* @returns {object} width and height in css pixels
|
|
73
|
+
*/
|
|
74
|
+
function termCell(terminal) {
|
|
75
|
+
try {
|
|
76
|
+
var dims = terminal && terminal._core && terminal._core._renderService && terminal._core._renderService.dimensions;
|
|
77
|
+
var cell = dims && dims.css && dims.css.cell;
|
|
78
|
+
if (cell && cell.width > 0 && cell.height > 0) return { width: cell.width, height: cell.height };
|
|
79
|
+
} catch (error) {}
|
|
80
|
+
return { width: termCharWidth(), height: TERM_FONT_SIZE * TERM_LINE_HEIGHT * 1.15 };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** How many cells fit in the dock; the vertical padding is derived after. */
|
|
84
|
+
function termGrid(host, terminal) {
|
|
85
|
+
var cell = termCell(terminal);
|
|
86
|
+
var style = window.getComputedStyle(host);
|
|
87
|
+
var padX = (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0);
|
|
88
|
+
return {
|
|
89
|
+
cols: Math.max(20, Math.floor((host.clientWidth - padX - 2) / cell.width)),
|
|
90
|
+
rows: Math.max(4, Math.floor((host.clientHeight - 2) / cell.height)),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Split the leftover height evenly above and below the grid. */
|
|
95
|
+
function termCenter(host, terminal) {
|
|
96
|
+
var cell = termCell(terminal);
|
|
97
|
+
var used = terminal.rows * cell.height;
|
|
98
|
+
var pad = Math.max(0, (host.clientHeight - used) / 2);
|
|
99
|
+
host.style.paddingTop = pad + "px";
|
|
100
|
+
host.style.paddingBottom = pad + "px";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The docked terminal: a tab per shell, one xterm instance for the active
|
|
105
|
+
* tab, polled output.
|
|
106
|
+
* @param {object} props - cwd, height, handlers
|
|
107
|
+
* @returns {object} element
|
|
108
|
+
*/
|
|
109
|
+
function TerminalDock(props) {
|
|
110
|
+
var hostRef = useRef(null);
|
|
111
|
+
var termRef = useRef(null);
|
|
112
|
+
var [revision, setRevision] = useState(function () {
|
|
113
|
+
if (termTabs.length === 0) termEnsureTab(props.cwd);
|
|
114
|
+
else if (!termActiveKey) termActiveKey = termTabs[0].key;
|
|
115
|
+
return 0;
|
|
116
|
+
});
|
|
117
|
+
var [editingKey, setEditingKey] = useState(null);
|
|
118
|
+
var [draftName, setDraftName] = useState("");
|
|
119
|
+
var height = props.height;
|
|
120
|
+
var active = null;
|
|
121
|
+
for (var i = 0; i < termTabs.length; i += 1) {
|
|
122
|
+
if (termTabs[i].key === termActiveKey) active = termTabs[i];
|
|
123
|
+
}
|
|
124
|
+
var bump = function () { setRevision(function (count) { return count + 1; }); };
|
|
125
|
+
|
|
126
|
+
/** Rename a tab; an empty name falls back to the folder. */
|
|
127
|
+
var commitTabName = function (tab) {
|
|
128
|
+
var next = draftName.trim();
|
|
129
|
+
tab.name = next.length > 0 ? next : null;
|
|
130
|
+
setEditingKey(null);
|
|
131
|
+
bump();
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// the xterm instance is created once and reused for every tab, so
|
|
135
|
+
// switching tabs never tears the terminal down and flashes the panel
|
|
136
|
+
useEffect(function () {
|
|
137
|
+
var disposed = false;
|
|
138
|
+
var terminal = null;
|
|
139
|
+
loadXterm().then(function (Terminal) {
|
|
140
|
+
if (disposed) return;
|
|
141
|
+
var host = hostRef.current;
|
|
142
|
+
if (!host) return;
|
|
143
|
+
terminal = new Terminal({
|
|
144
|
+
fontSize: TERM_FONT_SIZE,
|
|
145
|
+
lineHeight: TERM_LINE_HEIGHT,
|
|
146
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
147
|
+
cursorBlink: true,
|
|
148
|
+
scrollback: 4000,
|
|
149
|
+
allowProposedApi: true,
|
|
150
|
+
theme: termTheme(),
|
|
151
|
+
});
|
|
152
|
+
terminal.open(host);
|
|
153
|
+
termRef.current = terminal;
|
|
154
|
+
var grid = termGrid(host, terminal);
|
|
155
|
+
terminal.resize(grid.cols, grid.rows);
|
|
156
|
+
termCenter(host, terminal);
|
|
157
|
+
setRevision(function (count) { return count + 1; });
|
|
158
|
+
});
|
|
159
|
+
return function () {
|
|
160
|
+
disposed = true;
|
|
161
|
+
if (terminal) terminal.dispose();
|
|
162
|
+
termRef.current = null;
|
|
163
|
+
};
|
|
164
|
+
}, []);
|
|
165
|
+
|
|
166
|
+
// bind the reused terminal to the active tab: replay its screen, then
|
|
167
|
+
// forward keys and poll its output
|
|
168
|
+
useEffect(function () {
|
|
169
|
+
var terminal = termRef.current;
|
|
170
|
+
var host = hostRef.current;
|
|
171
|
+
if (!terminal || !host || !active) return undefined;
|
|
172
|
+
var stopped = false;
|
|
173
|
+
var timer = null;
|
|
174
|
+
var inputTimer = null;
|
|
175
|
+
var pending = "";
|
|
176
|
+
var dataSub = null;
|
|
177
|
+
|
|
178
|
+
terminal.reset();
|
|
179
|
+
if (active.log) terminal.write(active.log);
|
|
180
|
+
|
|
181
|
+
var flush = function () {
|
|
182
|
+
if (!pending || !active.id) return;
|
|
183
|
+
var data = pending;
|
|
184
|
+
pending = "";
|
|
185
|
+
fetch(API + "/term", {
|
|
186
|
+
method: "POST",
|
|
187
|
+
headers: { "content-type": "application/json" },
|
|
188
|
+
body: JSON.stringify({ action: "input", id: active.id, data: data }),
|
|
189
|
+
}).catch(function () {});
|
|
190
|
+
};
|
|
191
|
+
dataSub = terminal.onData(function (data) {
|
|
192
|
+
if (!active.id) return;
|
|
193
|
+
pending += data;
|
|
194
|
+
if (inputTimer) return;
|
|
195
|
+
inputTimer = setTimeout(function () { inputTimer = null; flush(); }, 12);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
var tick = function () {
|
|
199
|
+
if (stopped) return;
|
|
200
|
+
fetch(API + "/term-poll?id=" + encodeURIComponent(active.id) + "&since=" + active.since)
|
|
201
|
+
.then(function (response) { return response.json(); })
|
|
202
|
+
.then(function (payload) {
|
|
203
|
+
if (stopped) return;
|
|
204
|
+
if (payload.gone) { active.id = null; return; }
|
|
205
|
+
if (payload.data) {
|
|
206
|
+
terminal.write(payload.data);
|
|
207
|
+
active.since = payload.since;
|
|
208
|
+
active.log = (active.log + payload.data).slice(-TERM_LOG_LIMIT);
|
|
209
|
+
}
|
|
210
|
+
if (payload.exited) { active.exited = true; return; }
|
|
211
|
+
timer = setTimeout(tick, 120);
|
|
212
|
+
})
|
|
213
|
+
.catch(function () { if (!stopped) timer = setTimeout(tick, 800); });
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
if (active.id) {
|
|
217
|
+
tick();
|
|
218
|
+
} else {
|
|
219
|
+
var grid = termGrid(host, terminal);
|
|
220
|
+
fetch(API + "/term", {
|
|
221
|
+
method: "POST",
|
|
222
|
+
headers: { "content-type": "application/json" },
|
|
223
|
+
body: JSON.stringify({ action: "open", cwd: active.cwd, cols: grid.cols, rows: grid.rows }),
|
|
224
|
+
}).then(function (response) { return response.json(); }).then(function (payload) {
|
|
225
|
+
if (stopped) {
|
|
226
|
+
if (payload && payload.id) fetch(API + "/term", { method: "POST", body: JSON.stringify({ action: "close", id: payload.id }) }).catch(function () {});
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (!payload || !payload.id) return;
|
|
230
|
+
active.id = payload.id;
|
|
231
|
+
active.pty = !!payload.pty;
|
|
232
|
+
active.since = 0;
|
|
233
|
+
active.log = "";
|
|
234
|
+
active.exited = false;
|
|
235
|
+
tick();
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return function () {
|
|
240
|
+
stopped = true;
|
|
241
|
+
if (timer) { clearTimeout(timer); timer = null; }
|
|
242
|
+
if (inputTimer) { clearTimeout(inputTimer); inputTimer = null; }
|
|
243
|
+
if (dataSub) dataSub.dispose();
|
|
244
|
+
};
|
|
245
|
+
}, [revision]);
|
|
246
|
+
|
|
247
|
+
// a folder opened from the panel gets its own tab
|
|
248
|
+
useEffect(function () {
|
|
249
|
+
if (!props.cwd) return;
|
|
250
|
+
var before = termActiveKey;
|
|
251
|
+
termEnsureTab(props.cwd);
|
|
252
|
+
if (before !== termActiveKey) bump();
|
|
253
|
+
}, [props.cwd]);
|
|
254
|
+
|
|
255
|
+
// refit the active tab when the dock is dragged, and tell the shell
|
|
256
|
+
useEffect(function () {
|
|
257
|
+
var terminal = termRef.current;
|
|
258
|
+
var host = hostRef.current;
|
|
259
|
+
if (!terminal || !host || !active) return;
|
|
260
|
+
var grid = termGrid(host, terminal);
|
|
261
|
+
terminal.resize(grid.cols, grid.rows);
|
|
262
|
+
termCenter(host, terminal);
|
|
263
|
+
if (active.id) {
|
|
264
|
+
fetch(API + "/term", {
|
|
265
|
+
method: "POST",
|
|
266
|
+
headers: { "content-type": "application/json" },
|
|
267
|
+
body: JSON.stringify({ action: "resize", id: active.id, cols: grid.cols, rows: grid.rows }),
|
|
268
|
+
}).catch(function () {});
|
|
269
|
+
}
|
|
270
|
+
}, [height]);
|
|
271
|
+
|
|
272
|
+
var palette = termTheme();
|
|
273
|
+
return h("div", { className: "dfx-term", style: { height: height + "px", background: palette.background, color: palette.foreground } },
|
|
274
|
+
h("div", { className: "dfx-term-grip", onPointerDown: props.onGrip, title: t("拖动调整高度") }),
|
|
275
|
+
h("div", { className: "dfx-term-tabs" },
|
|
276
|
+
termTabs.map(function (tab) {
|
|
277
|
+
return h("div", {
|
|
278
|
+
key: tab.key,
|
|
279
|
+
className: "dfx-term-tab" + (tab.key === termActiveKey ? " dfx-term-tab--active" : ""),
|
|
280
|
+
title: tab.cwd,
|
|
281
|
+
onClick: function () { if (termActiveKey !== tab.key) { termActiveKey = tab.key; bump(); } },
|
|
282
|
+
},
|
|
283
|
+
glyph("terminal", 13),
|
|
284
|
+
tab.key === editingKey
|
|
285
|
+
? h("input", {
|
|
286
|
+
className: "dfx-term-tabinput",
|
|
287
|
+
value: draftName,
|
|
288
|
+
autoFocus: true,
|
|
289
|
+
spellCheck: false,
|
|
290
|
+
onClick: function (event) { event.stopPropagation(); },
|
|
291
|
+
onChange: function (event) { setDraftName(event.target.value); },
|
|
292
|
+
onBlur: function () { commitTabName(tab); },
|
|
293
|
+
onKeyDown: function (event) {
|
|
294
|
+
if (event.key === "Enter") { event.preventDefault(); commitTabName(tab); }
|
|
295
|
+
else if (event.key === "Escape") { event.preventDefault(); setEditingKey(null); }
|
|
296
|
+
},
|
|
297
|
+
})
|
|
298
|
+
: h("span", {
|
|
299
|
+
className: "dfx-term-tabname",
|
|
300
|
+
title: t("双击重命名"),
|
|
301
|
+
onDoubleClick: function (event) {
|
|
302
|
+
event.stopPropagation();
|
|
303
|
+
setDraftName(tab.name || termTabName(tab.cwd));
|
|
304
|
+
setEditingKey(tab.key);
|
|
305
|
+
},
|
|
306
|
+
}, tab.name || termTabName(tab.cwd)),
|
|
307
|
+
h("button", {
|
|
308
|
+
type: "button",
|
|
309
|
+
className: "dfx-term-tabclose",
|
|
310
|
+
title: t("关闭终端"),
|
|
311
|
+
"aria-label": t("关闭终端"),
|
|
312
|
+
onClick: function (event) {
|
|
313
|
+
event.stopPropagation();
|
|
314
|
+
termCloseTab(tab);
|
|
315
|
+
if (termTabs.length === 0) { props.onClose(); return; }
|
|
316
|
+
bump();
|
|
317
|
+
},
|
|
318
|
+
}, glyph("close", 12)));
|
|
319
|
+
}),
|
|
320
|
+
h("button", {
|
|
321
|
+
type: "button",
|
|
322
|
+
className: "dfx-term-new",
|
|
323
|
+
title: t("新建终端"),
|
|
324
|
+
"aria-label": t("新建终端"),
|
|
325
|
+
onClick: function () { termNewTab(active ? active.cwd : props.cwd); bump(); },
|
|
326
|
+
}, glyph("plus", 14)),
|
|
327
|
+
h("span", { className: "dfx-term-spacer" }),
|
|
328
|
+
h("button", {
|
|
329
|
+
type: "button",
|
|
330
|
+
className: "dfx-term-hide",
|
|
331
|
+
title: t("隐藏终端"),
|
|
332
|
+
"aria-label": t("隐藏终端"),
|
|
333
|
+
onClick: props.onClose,
|
|
334
|
+
}, glyph("chevronDown", 15))),
|
|
335
|
+
h("div", { className: "dfx-term-body", ref: hostRef }));
|
|
336
|
+
}
|
|
337
|
+
|
|
17
338
|
/** Identity shared by the sidebar entry and the main panel it opens. */
|
|
18
339
|
var PANEL_ID = "dsh-file-explorer";
|
|
19
340
|
/** Host route prefix served by lib/index.js. */
|
|
@@ -21,7 +342,59 @@ window.__ModuleLoader__.load({
|
|
|
21
342
|
var STYLE_ID = "dsh-file-explorer-style";
|
|
22
343
|
|
|
23
344
|
/** Remembered navigation, clipboard and view so switching panels does not lose them. */
|
|
24
|
-
var remembered = { path: null, clipboard: null, view: null };
|
|
345
|
+
var remembered = { path: null, clipboard: null, view: null, termOpen: false, termCwd: null };
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Terminal tabs, kept outside the panel so switching to a conversation and
|
|
349
|
+
* back reattaches the same shells instead of starting new ones.
|
|
350
|
+
*/
|
|
351
|
+
var termTabs = [];
|
|
352
|
+
var termActiveKey = null;
|
|
353
|
+
var termTabSeq = 0;
|
|
354
|
+
var TERM_LOG_LIMIT = 200 * 1024;
|
|
355
|
+
|
|
356
|
+
/** The folder name a tab shows. */
|
|
357
|
+
function termTabName(path) {
|
|
358
|
+
var clean = String(path || "").replace(/[\\/]+$/, "");
|
|
359
|
+
var parts = clean.split(/[\\/]/);
|
|
360
|
+
return parts[parts.length - 1] || clean || "终端";
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** The tab for a folder, appended (and activated) when it is missing. */
|
|
364
|
+
function termEnsureTab(cwd) {
|
|
365
|
+
for (var i = 0; i < termTabs.length; i += 1) {
|
|
366
|
+
if (termTabs[i].cwd === cwd) { termActiveKey = termTabs[i].key; return termTabs[i]; }
|
|
367
|
+
}
|
|
368
|
+
var tab = { key: "tt" + (termTabSeq += 1), id: null, cwd: cwd, name: null, since: 0, log: "", pty: false, exited: false };
|
|
369
|
+
termTabs.push(tab);
|
|
370
|
+
termActiveKey = tab.key;
|
|
371
|
+
return tab;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** Append a fresh tab in a folder, even when one is already open there. */
|
|
375
|
+
function termNewTab(cwd) {
|
|
376
|
+
var tab = { key: "tt" + (termTabSeq += 1), id: null, cwd: cwd, name: null, since: 0, log: "", pty: false, exited: false };
|
|
377
|
+
termTabs.push(tab);
|
|
378
|
+
termActiveKey = tab.key;
|
|
379
|
+
return tab;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** Close one tab and its shell. */
|
|
383
|
+
function termCloseTab(tab) {
|
|
384
|
+
if (tab.id) {
|
|
385
|
+
fetch(API + "/term", {
|
|
386
|
+
method: "POST",
|
|
387
|
+
headers: { "content-type": "application/json" },
|
|
388
|
+
body: JSON.stringify({ action: "close", id: tab.id }),
|
|
389
|
+
}).catch(function () {});
|
|
390
|
+
}
|
|
391
|
+
var index = termTabs.indexOf(tab);
|
|
392
|
+
if (index >= 0) termTabs.splice(index, 1);
|
|
393
|
+
if (termActiveKey === tab.key) {
|
|
394
|
+
var next = termTabs[Math.min(index, termTabs.length - 1)];
|
|
395
|
+
termActiveKey = next ? next.key : null;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
25
398
|
|
|
26
399
|
/** DSH workspace service (from ctx.workspaces), filled in by apply(). */
|
|
27
400
|
var workspacesRef = { current: null };
|
|
@@ -180,6 +553,13 @@ window.__ModuleLoader__.load({
|
|
|
180
553
|
"引用到输入框": "Mention in the composer",
|
|
181
554
|
"[dsh-file-explorer] 引用到输入框失败:": "Could not reference the file in the composer:",
|
|
182
555
|
"添加为工作区": "Add as workspace",
|
|
556
|
+
"终端": "Terminal",
|
|
557
|
+
"新建终端": "New terminal",
|
|
558
|
+
"隐藏终端": "Hide terminal",
|
|
559
|
+
"双击重命名": "Double-click to rename",
|
|
560
|
+
"在终端打开": "Open in terminal",
|
|
561
|
+
"关闭终端": "Close terminal",
|
|
562
|
+
"在终端中打开当前目录": "Open this folder in a terminal",
|
|
183
563
|
"粘贴": "Paste",
|
|
184
564
|
"在访达中显示当前文件夹": "Reveal this folder in Finder",
|
|
185
565
|
"刷新": "Refresh",
|
|
@@ -645,6 +1025,64 @@ window.__ModuleLoader__.load({
|
|
|
645
1025
|
.dfx-tool:disabled { opacity: .38; cursor: default; }
|
|
646
1026
|
.dfx-tool--open { background: rgba(127, 127, 127, .16); color: var(--dsw-alias-label-primary, #1b1b1b); }
|
|
647
1027
|
.dfx-tool-label { line-height: 1; }
|
|
1028
|
+
/* ── terminal dock ─────────────────────────────────────────────────── */
|
|
1029
|
+
.dfx-term {
|
|
1030
|
+
position: relative; display: flex; flex-direction: column; flex: 0 0 auto;
|
|
1031
|
+
border-top: 1px solid var(--dfx-rule, rgba(127, 127, 127, .13));
|
|
1032
|
+
background: var(--dsw-alias-bg-layer-1, #fff);
|
|
1033
|
+
}
|
|
1034
|
+
.dfx-term-grip {
|
|
1035
|
+
position: absolute; top: -4px; left: 0; right: 0; height: 8px; cursor: row-resize;
|
|
1036
|
+
}
|
|
1037
|
+
.dfx-term-grip::after {
|
|
1038
|
+
content: ""; position: absolute; left: 50%; top: 2px; width: 34px; height: 3px; margin-left: -17px;
|
|
1039
|
+
border-radius: 999px; background: var(--dsw-alias-border-l2, rgba(0, 0, 0, .16));
|
|
1040
|
+
}
|
|
1041
|
+
.dfx-term-tabs {
|
|
1042
|
+
display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; flex: 0 0 auto;
|
|
1043
|
+
border-bottom: 1px solid var(--dfx-rule, rgba(127, 127, 127, .13));
|
|
1044
|
+
background: rgba(127, 127, 127, .04);
|
|
1045
|
+
}
|
|
1046
|
+
.dfx-term-tab {
|
|
1047
|
+
display: flex; align-items: center; gap: 8px; height: 30px; min-width: 150px; max-width: 320px; padding: 0 5px 0 12px;
|
|
1048
|
+
border-radius: 8px; border: 1px solid transparent;
|
|
1049
|
+
font-size: 12px; color: inherit; opacity: .55; cursor: pointer; user-select: none;
|
|
1050
|
+
}
|
|
1051
|
+
.dfx-term-tab:hover { opacity: .8; background: rgba(127, 127, 127, .08); }
|
|
1052
|
+
.dfx-term-tab--active { opacity: .95; background: var(--dsw-alias-bg-layer-1, #fff); border-color: var(--dfx-rule, rgba(127, 127, 127, .18)); }
|
|
1053
|
+
.dfx-term-tabname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1054
|
+
.dfx-term-tabinput {
|
|
1055
|
+
width: 132px; height: 21px; padding: 0 5px; border-radius: 5px; outline: none;
|
|
1056
|
+
border: 1px solid var(--dfx-brand, #3b6cf6); background: transparent; color: inherit;
|
|
1057
|
+
font: inherit; font-size: 12px;
|
|
1058
|
+
}
|
|
1059
|
+
.dfx-term-tabclose {
|
|
1060
|
+
width: 18px; height: 18px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
|
|
1061
|
+
border: 0; border-radius: 4px; background: transparent; color: inherit; opacity: .45; cursor: pointer;
|
|
1062
|
+
}
|
|
1063
|
+
.dfx-term-tabclose:hover { opacity: .9; background: rgba(127, 127, 127, .2); }
|
|
1064
|
+
.dfx-term-tab--active .dfx-term-tabclose { opacity: .6; }
|
|
1065
|
+
.dfx-term-hide {
|
|
1066
|
+
width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
|
|
1067
|
+
border: 0; border-radius: 6px; background: transparent; color: inherit; opacity: .55; cursor: pointer;
|
|
1068
|
+
}
|
|
1069
|
+
.dfx-term-hide:hover { opacity: .9; background: rgba(127, 127, 127, .14); }
|
|
1070
|
+
.dfx-term-new {
|
|
1071
|
+
width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
|
|
1072
|
+
border: 0; border-radius: 6px; background: transparent; color: inherit; opacity: .55; cursor: pointer;
|
|
1073
|
+
}
|
|
1074
|
+
.dfx-term-new:hover { opacity: .9; background: rgba(127, 127, 127, .14); }
|
|
1075
|
+
.dfx-term-spacer { flex: 1 1 auto; }
|
|
1076
|
+
.dfx-term-body { flex: 1 1 auto; min-height: 0; padding: 11px 10px 12px; overflow: hidden; }
|
|
1077
|
+
.dfx-term-body .xterm { height: 100%; }
|
|
1078
|
+
.dfx-term .dfx-navbtn { color: inherit; opacity: .7; }
|
|
1079
|
+
.dfx-term .dfx-navbtn:hover { opacity: 1; }
|
|
1080
|
+
.dfx-term .dfx-navbtn--active { opacity: 1; }
|
|
1081
|
+
.dfx-term .xterm-viewport {
|
|
1082
|
+
background: transparent !important;
|
|
1083
|
+
overflow-y: auto !important;
|
|
1084
|
+
}
|
|
1085
|
+
.dfx-term .xterm-scrollbar { display: none !important; }
|
|
648
1086
|
.dfx-root svg { display: block; flex: 0 0 auto; }
|
|
649
1087
|
.dfx-rows--in, .dfx-head--in, .dfx-opt-sample--in { animation: dfx-nav-in 340ms cubic-bezier(.25, .8, .25, 1) both; }
|
|
650
1088
|
.dfx-rows--out, .dfx-head--out, .dfx-opt-sample--out { animation: dfx-nav-out 340ms cubic-bezier(.25, .8, .25, 1) both; }
|
|
@@ -1592,6 +2030,8 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
1592
2030
|
infoBorn: ["M6.2 5.8h11.6a1.8 1.8 0 0 1 1.8 1.8v10.6a1.8 1.8 0 0 1-1.8 1.8H6.2a1.8 1.8 0 0 1-1.8-1.8V7.6a1.8 1.8 0 0 1 1.8-1.8z", "M4.4 10.2h15.2", "M8.2 3.8v3.6", "M15.8 3.8v3.6"],
|
|
1593
2031
|
infoTime: ["M12 19.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15z", "M12 8.2V12l2.9 1.8"],
|
|
1594
2032
|
infoAcl: ["M5.2 10.6h13.6v9.2H5.2z", "M8.4 10.6V8.2a3.6 3.6 0 0 1 7.2 0v2.4"],
|
|
2033
|
+
// A prompt chevron beside a cursor: the terminal.
|
|
2034
|
+
terminal: ["M4.6 6.4l5.2 5.6-5.2 5.6", "M12.4 17.6h7"],
|
|
1595
2035
|
viewInvert: ["M6.4 9.4h10.2l-2.9-2.9", "M17.6 14.6H7.4l2.9 2.9"],
|
|
1596
2036
|
viewGrid: ["M4 4.5h6v6H4z", "M14 4.5h6v6h-6z", "M4 13.5h6v6H4z", "M14 13.5h6v6h-6z"],
|
|
1597
2037
|
info: ["M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z", "M12 11v5.5", "M12 7.6h.01"],
|
|
@@ -2713,6 +3153,20 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
2713
3153
|
});
|
|
2714
3154
|
}
|
|
2715
3155
|
|
|
3156
|
+
/** Whether two listings show the same entries (name, kind, size, mtime). */
|
|
3157
|
+
function sameEntries(left, right) {
|
|
3158
|
+
var a = left || [];
|
|
3159
|
+
var b = right || [];
|
|
3160
|
+
if (a.length !== b.length) return false;
|
|
3161
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
3162
|
+
if (a[i].name !== b[i].name) return false;
|
|
3163
|
+
if (!!a[i].dir !== !!b[i].dir) return false;
|
|
3164
|
+
if (a[i].size !== b[i].size) return false;
|
|
3165
|
+
if (a[i].mtime !== b[i].mtime) return false;
|
|
3166
|
+
}
|
|
3167
|
+
return true;
|
|
3168
|
+
}
|
|
3169
|
+
|
|
2716
3170
|
function FileExplorerPanel() {
|
|
2717
3171
|
// Resolve the language before anything renders, so every t() call in this
|
|
2718
3172
|
// pass uses it.
|
|
@@ -2770,6 +3224,8 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
2770
3224
|
var [dropHot, setDropHot] = useState(false);
|
|
2771
3225
|
// The right pane starts hidden; the toolbar toggle or 选项 brings it back.
|
|
2772
3226
|
var [paneState, setPaneState] = useState(readStoredPane);
|
|
3227
|
+
/** The entry the right pane is showing; right-click does not replace it. */
|
|
3228
|
+
var [paneEntry, setPaneEntry] = useState(null);
|
|
2773
3229
|
var paneVisible = paneState.visible;
|
|
2774
3230
|
var paneMode = paneState.mode;
|
|
2775
3231
|
/**
|
|
@@ -2783,7 +3239,18 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
2783
3239
|
storePane(next.visible, next.mode);
|
|
2784
3240
|
setPaneState(next);
|
|
2785
3241
|
}
|
|
2786
|
-
function setPaneVisible(next) {
|
|
3242
|
+
function setPaneVisible(next) {
|
|
3243
|
+
setPaneBoth(next, paneMode);
|
|
3244
|
+
if (!next) return;
|
|
3245
|
+
var entry = selected || (rows && rows[0]) || null;
|
|
3246
|
+
if (!entry) return;
|
|
3247
|
+
if (!selected) {
|
|
3248
|
+
setSelected(entry);
|
|
3249
|
+
setSelectedPaths([entry.path]);
|
|
3250
|
+
setAnchorPath(entry.path);
|
|
3251
|
+
}
|
|
3252
|
+
fillPane(entry);
|
|
3253
|
+
}
|
|
2787
3254
|
function setPaneMode(next) { setPaneBoth(paneVisible, next); }
|
|
2788
3255
|
var [addressDraft, setAddressDraft] = useState(null);
|
|
2789
3256
|
var addressRef = useRef(null);
|
|
@@ -2807,6 +3274,50 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
2807
3274
|
var [gitMap, setGitMap] = useState(null);
|
|
2808
3275
|
/** True when the browser runs on another machine than the host. */
|
|
2809
3276
|
var [remoteMode, setRemoteMode] = useState(false);
|
|
3277
|
+
var [termOpen, setTermOpen] = useState(function () { return remembered.termOpen === true; });
|
|
3278
|
+
var [termCwd, setTermCwd] = useState(function () { return remembered.termCwd || ""; });
|
|
3279
|
+
var [termHeight, setTermHeight] = useState(function () {
|
|
3280
|
+
var saved = null;
|
|
3281
|
+
try { saved = Number(window.localStorage.getItem("dfx.termHeight")); } catch (error) { saved = null; }
|
|
3282
|
+
var maxHeight = Math.max(220, Math.floor((window.innerHeight || 800) / 2));
|
|
3283
|
+
return saved >= 180 ? Math.min(saved, maxHeight) : 260;
|
|
3284
|
+
});
|
|
3285
|
+
|
|
3286
|
+
/** Open the docked terminal at a folder. */
|
|
3287
|
+
function openTerminalAt(target) {
|
|
3288
|
+
var folder = target || (listing ? listing.path : remembered.path);
|
|
3289
|
+
if (!folder) return;
|
|
3290
|
+
remembered.termCwd = folder;
|
|
3291
|
+
remembered.termOpen = true;
|
|
3292
|
+
setTermCwd(folder);
|
|
3293
|
+
setTermOpen(true);
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
/** Hide the dock (its shell is closed by the dock itself). */
|
|
3297
|
+
function hideTerminal() {
|
|
3298
|
+
remembered.termOpen = false;
|
|
3299
|
+
setTermOpen(false);
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
/** Drag the top edge to grow or shrink the dock, capped at half the window. */
|
|
3303
|
+
function startTermDrag(event) {
|
|
3304
|
+
if (!event || event.button !== 0) return;
|
|
3305
|
+
event.preventDefault();
|
|
3306
|
+
var startY = event.clientY;
|
|
3307
|
+
var startHeight = termHeight;
|
|
3308
|
+
var maxHeight = Math.max(220, Math.floor((window.innerHeight || 800) / 2));
|
|
3309
|
+
var move = function (moveEvent) {
|
|
3310
|
+
var next = Math.max(180, Math.min(maxHeight, startHeight - (moveEvent.clientY - startY)));
|
|
3311
|
+
setTermHeight(next);
|
|
3312
|
+
try { window.localStorage.setItem("dfx.termHeight", String(next)); } catch (error) {}
|
|
3313
|
+
};
|
|
3314
|
+
var up = function () {
|
|
3315
|
+
window.removeEventListener("pointermove", move);
|
|
3316
|
+
window.removeEventListener("pointerup", up);
|
|
3317
|
+
};
|
|
3318
|
+
window.addEventListener("pointermove", move);
|
|
3319
|
+
window.addEventListener("pointerup", up);
|
|
3320
|
+
}
|
|
2810
3321
|
/** Editor state when a text file is being edited in the pane. */
|
|
2811
3322
|
var [editor, setEditor] = useState(null);
|
|
2812
3323
|
var [busy, setBusy] = useState(false);
|
|
@@ -2844,17 +3355,24 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
2844
3355
|
setView(next);
|
|
2845
3356
|
}, []);
|
|
2846
3357
|
|
|
2847
|
-
var load = useCallback(function (target, focusPath, direction) {
|
|
3358
|
+
var load = useCallback(function (target, focusPath, direction, silent) {
|
|
2848
3359
|
var seq = requestSeq.current + 1;
|
|
2849
3360
|
requestSeq.current = seq;
|
|
2850
|
-
if (direction) setNavMotion({ dir: direction, seq: navSeqRef.current + 1 });
|
|
3361
|
+
if (direction && !silent) setNavMotion({ dir: direction, seq: navSeqRef.current + 1 });
|
|
2851
3362
|
navSeqRef.current += 1;
|
|
2852
|
-
setStatus("loading");
|
|
3363
|
+
if (!silent) setStatus("loading");
|
|
2853
3364
|
setError(null);
|
|
2854
3365
|
setMenu(null);
|
|
2855
3366
|
apiGet("/list", target ? { path: target } : {}).then(function (result) {
|
|
2856
3367
|
if (requestSeq.current !== seq) return;
|
|
2857
3368
|
if (!result.ok) throw new Error(t((result.body && result.body.message) || "无法读取目录"));
|
|
3369
|
+
if (silent) {
|
|
3370
|
+
var previous = listingRef.current;
|
|
3371
|
+
if (previous && previous.path === result.body.path && sameEntries(previous.entries, result.body.entries)) {
|
|
3372
|
+
setStatus("ready");
|
|
3373
|
+
return;
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
2858
3376
|
setListing(result.body);
|
|
2859
3377
|
remembered.path = result.body.path;
|
|
2860
3378
|
setStatus("ready");
|
|
@@ -2871,6 +3389,7 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
2871
3389
|
setSelected(focus);
|
|
2872
3390
|
setSelectedPaths(focus ? [focus.path] : []);
|
|
2873
3391
|
setAnchorPath(focus ? focus.path : null);
|
|
3392
|
+
setPaneEntry(focus || null);
|
|
2874
3393
|
if (focus && focus.dir) detailsRef.current(focus);
|
|
2875
3394
|
else if (focus) previewRef.current(focus);
|
|
2876
3395
|
else { setPreview(null); setPreviewStatus("idle"); }
|
|
@@ -3005,12 +3524,14 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
3005
3524
|
/** Open the details pane for one entry and remember the choice. */
|
|
3006
3525
|
var openInfo = useCallback(function (entry) {
|
|
3007
3526
|
if (!entry) return;
|
|
3527
|
+
setPaneEntry(entry);
|
|
3008
3528
|
setPaneBoth(true, "info");
|
|
3009
3529
|
openDetails(entry);
|
|
3010
3530
|
}, [openDetails]);
|
|
3011
3531
|
|
|
3012
3532
|
/** Fill the right pane for an entry according to the current mode. */
|
|
3013
3533
|
var fillPane = useCallback(function (entry) {
|
|
3534
|
+
setPaneEntry(entry || null);
|
|
3014
3535
|
if (!entry) {
|
|
3015
3536
|
setPreview(null);
|
|
3016
3537
|
setPreviewStatus("idle");
|
|
@@ -3067,6 +3588,7 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
3067
3588
|
|
|
3068
3589
|
/** Drop the whole selection. */
|
|
3069
3590
|
function clearSelection() {
|
|
3591
|
+
setPaneEntry(null);
|
|
3070
3592
|
setSelectedPaths([]);
|
|
3071
3593
|
setAnchorPath(null);
|
|
3072
3594
|
setSelected(null);
|
|
@@ -3226,7 +3748,7 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
3226
3748
|
var live = listingRef.current;
|
|
3227
3749
|
if (listingChanged && loadRef.current && live && live.path === current.path) {
|
|
3228
3750
|
var keep = selectionRef.current ? selectionRef.current.path : null;
|
|
3229
|
-
loadRef.current(current.path, keep, "neutral");
|
|
3751
|
+
loadRef.current(current.path, keep, "neutral", true);
|
|
3230
3752
|
}
|
|
3231
3753
|
}, function () { watchRef.current.busy = false; });
|
|
3232
3754
|
}, 1600);
|
|
@@ -3682,6 +4204,7 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
3682
4204
|
if (id === "attach") { attachToSession(entry); return; }
|
|
3683
4205
|
if (id === "quote") { quoteToSession(entry); return; }
|
|
3684
4206
|
if (id === "addWorkspace") { askAddWorkspace(entry); return; }
|
|
4207
|
+
if (id === "openTerm") { openTerminalAt(entry.dir ? entry.path : parentOf(entry.path)); return; }
|
|
3685
4208
|
if (id === "trash") { askDeleteSelection(); return; }
|
|
3686
4209
|
}
|
|
3687
4210
|
|
|
@@ -3934,6 +4457,7 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
3934
4457
|
entry.dir ? null : { id: "quote", label: t("引用到输入框"), icon: "at" },
|
|
3935
4458
|
entry.dir && workspacesRef.current ? { separator: true } : null,
|
|
3936
4459
|
entry.dir && workspacesRef.current ? { id: "addWorkspace", label: t("添加为工作区"), icon: "briefcase" } : null,
|
|
4460
|
+
remoteMode ? null : { id: "openTerm", label: t("在终端打开"), icon: "terminal" },
|
|
3937
4461
|
remoteMode ? null : { separator: true },
|
|
3938
4462
|
remoteMode ? null : { id: "trash", label: t("移到废纸篓"), icon: "trash", danger: true },
|
|
3939
4463
|
];
|
|
@@ -4072,11 +4596,12 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
4072
4596
|
function openRowMenu(event, entry) {
|
|
4073
4597
|
event.preventDefault();
|
|
4074
4598
|
event.stopPropagation();
|
|
4599
|
+
// Right-click only selects and opens the menu: it must not pull the
|
|
4600
|
+
// entry into the preview pane, which stays on whatever it showed.
|
|
4075
4601
|
if (selectedPaths.indexOf(entry.path) === -1) {
|
|
4076
4602
|
setSelected(entry);
|
|
4077
4603
|
setSelectedPaths([entry.path]);
|
|
4078
4604
|
setAnchorPath(entry.path);
|
|
4079
|
-
fillPane(entry);
|
|
4080
4605
|
}
|
|
4081
4606
|
setMenu({ x: event.clientX, y: event.clientY, entry: entry });
|
|
4082
4607
|
if (rowsRef.current && rowsRef.current.focus) rowsRef.current.focus({ preventScroll: true });
|
|
@@ -4820,7 +5345,15 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
4820
5345
|
};
|
|
4821
5346
|
|
|
4822
5347
|
previewPathRef.current = preview && preview.entry && !preview.entry.dir ? preview.entry.path : null;
|
|
4823
|
-
|
|
5348
|
+
// With the pane switched on, show the first entry until the user picks
|
|
5349
|
+
// one: the pane then follows clicks, never a right-click.
|
|
5350
|
+
useEffect(function () {
|
|
5351
|
+
if (!paneVisible || paneEntry) return;
|
|
5352
|
+
if (rows && rows.length > 0) fillPane(rows[0]);
|
|
5353
|
+
}, [paneVisible, paneEntry, rows && rows.length]);
|
|
5354
|
+
|
|
5355
|
+
var paneShown = paneEntry;
|
|
5356
|
+
var showInfoPane = paneVisible && !!paneShown && (paneShown.dir || paneMode === "info");
|
|
4824
5357
|
var previewPane = null;
|
|
4825
5358
|
if (!paneVisible) {
|
|
4826
5359
|
previewPane = null;
|
|
@@ -4834,9 +5367,9 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
4834
5367
|
infoInner = infoRows(details.body);
|
|
4835
5368
|
}
|
|
4836
5369
|
previewPane = h("div", { className: "dfx-preview" },
|
|
4837
|
-
paneHeader(
|
|
5370
|
+
paneHeader(paneShown),
|
|
4838
5371
|
h("div", { className: "dfx-preview-body" }, infoInner),
|
|
4839
|
-
paneFooter(
|
|
5372
|
+
paneFooter(paneShown));
|
|
4840
5373
|
} else if (preview || previewStatus === "loading") {
|
|
4841
5374
|
var meta = null;
|
|
4842
5375
|
var inner = null;
|
|
@@ -4987,12 +5520,12 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
4987
5520
|
inner = h("div", { className: "dfx-empty" }, t("此格式不支持内嵌预览"));
|
|
4988
5521
|
}
|
|
4989
5522
|
}
|
|
4990
|
-
|
|
5523
|
+
|
|
4991
5524
|
previewPane = h("div", { className: "dfx-preview" },
|
|
4992
|
-
paneHeader(
|
|
5525
|
+
paneHeader(paneShown),
|
|
4993
5526
|
meta,
|
|
4994
5527
|
h("div", { className: "dfx-preview-body" }, inner),
|
|
4995
|
-
paneFooter(
|
|
5528
|
+
paneFooter(paneShown));
|
|
4996
5529
|
}
|
|
4997
5530
|
|
|
4998
5531
|
var menuNode = null;
|
|
@@ -5175,6 +5708,7 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
5175
5708
|
h("span", { className: "dfx-dropzone-hint" }, t("文件作为附件,文件夹作为引用")))
|
|
5176
5709
|
: null;
|
|
5177
5710
|
|
|
5711
|
+
|
|
5178
5712
|
return h("div", {
|
|
5179
5713
|
className: "dfx-root",
|
|
5180
5714
|
ref: rootRef,
|
|
@@ -5353,6 +5887,18 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
5353
5887
|
title: t("排序方式"),
|
|
5354
5888
|
onClick: function (event) { openPopup("sort", event); },
|
|
5355
5889
|
}, glyph("sortIcon", 14), h("span", { className: "dfx-tool-label" }, t("排序")), glyph("chevronDown", 12)),
|
|
5890
|
+
remoteMode ? null : h("span", { className: "dfx-toolbar-sep" }),
|
|
5891
|
+
remoteMode ? null : h("button", {
|
|
5892
|
+
type: "button",
|
|
5893
|
+
className: "dfx-tool" + (termOpen ? " dfx-tool--open" : ""),
|
|
5894
|
+
title: t("在终端中打开当前目录"),
|
|
5895
|
+
"aria-pressed": termOpen ? "true" : "false",
|
|
5896
|
+
onClick: function () {
|
|
5897
|
+
if (termOpen) { hideTerminal(); return; }
|
|
5898
|
+
openTerminalAt();
|
|
5899
|
+
},
|
|
5900
|
+
}, glyph("terminal", 14), h("span", { className: "dfx-tool-label" }, t("终端"))),
|
|
5901
|
+
remoteMode ? null : h("span", { className: "dfx-toolbar-sep" }),
|
|
5356
5902
|
h("button", {
|
|
5357
5903
|
type: "button",
|
|
5358
5904
|
className: "dfx-tool" + (popup && popup.kind === "more" ? " dfx-tool--open" : ""),
|
|
@@ -5446,6 +5992,13 @@ html[data-ds-theme-source="dark"] .dfx-json-code { --dsw-json-guide: rgba(255, 2
|
|
|
5446
5992
|
previewPane),
|
|
5447
5993
|
dropStrip,
|
|
5448
5994
|
quickLookNode,
|
|
5995
|
+
termOpen ? h(TerminalDock, {
|
|
5996
|
+
key: "term",
|
|
5997
|
+
cwd: termCwd || (listing ? listing.path : ""),
|
|
5998
|
+
height: termHeight,
|
|
5999
|
+
onClose: hideTerminal,
|
|
6000
|
+
onGrip: startTermDrag,
|
|
6001
|
+
}) : null,
|
|
5449
6002
|
h("div", { className: "dfx-foot" },
|
|
5450
6003
|
h("span", null, tf("{n} 项", { n: rows.length })),
|
|
5451
6004
|
listing && listing.truncated ? h(Fragment, null,
|