diff options
| author | Agando <roduccomm@gmail.com> | 2026-10-26 15:25:58 +0100 |
|---|---|---|
| committer | Agando <roduccomm@gmail.com> | 2026-10-26 15:25:58 +0100 |
| commit | 132185e96034fca3bd2fc95998dd778e9e22258b (patch) | |
| tree | cbfeb4c8a291f3c5f2c32c4709c112099b9f5d49 /modules/ext/filemgr.js | |
| parent | 7904f3e9300a4ee02243728c185e8bfce0953bb1 (diff) | |
feat(newos4): cut/copy in Files, paste into WebDAV (Issue D2)
The two panes kept separate clipboards (filemgr._clipboard vs webdav._selected), so "cut here, paste
there" did not exist — the operator's last phone-test item.
filemgr.js _openOverlay() publishes a read-only view of its clipboard on the terminal object:
webx11.fileClipboard() / fileClipboardClear() / fileClipboardSet(paths, mode).
webdav.js the bulk bar gains "📥 Paste N" (hidden when the clipboard is empty). Handler: for each
path readFile -> _webdavRequest('PUT', dest + '/' + name, {body}); only 200/201/204 counts.
For mode "cut" the local file is deleted AFTER the server accepted the bytes, never
before. A failed PUT keeps the local copy, prints "📥 Paste failed: <name> — HTTP n",
and leaves that path in the clipboard so "📥 Paste 1" is a retry. Successes leave it.
Summary "📥 Pasted N item(s) to <path>" (+ "— M failed"), then the pane reopens there.
Semantics: cut moves (upload then delete local), copy leaves the local file and keeps the clipboard so
the same files can go into several folders.
Verified with the transport stubbed in the live page (this browser has no WebDAV credential):
button "📥 Paste 2" for a 2-path cut
PUT ok (201) -> local file null (moved)
PUT fail(500) -> local file "BBB" (kept)
clipboard after -> {mode:"cut", paths:["/fail-d.txt"]}, button "📥 Paste 1"
node --check both modules, no-undef clean (55 files), v4.6.101 x3 in main.html, syntax OK, help 362/362.
Diffstat (limited to 'modules/ext/filemgr.js')
| -rw-r--r-- | modules/ext/filemgr.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/ext/filemgr.js b/modules/ext/filemgr.js index 7412578..b813815 100644 --- a/modules/ext/filemgr.js +++ b/modules/ext/filemgr.js @@ -587,6 +587,15 @@ class FileManagerModule { } const overlay = this._createOverlay(); document.body.appendChild(overlay); + // 2026-10-26 (Issue D2): the WebDAV pane lives in another module and needs a read-only view of + // this clipboard to implement "cut/copy here, paste there". + try { + if (typeof window !== 'undefined' && window.webx11) { + window.webx11.fileClipboard = () => ({ mode: this._clipboard.mode, paths: [...this._clipboard.paths] }); + window.webx11.fileClipboardClear = () => { this._clipboard = { mode: null, paths: [] }; }; + window.webx11.fileClipboardSet = (paths, mode) => { this._clipboard = { mode: mode || 'copy', paths: [...(paths || [])] }; }; + } + } catch (_e) {} this._navigateTo(this.currentPath); } |