mirror of
https://github.com/narrrl/narl-workspace.git
synced 2026-11-03 16:41:27 +01:00
export, import: an export that pours back into a workspace whole
An export used to lose what plain files cannot carry: dates, names as typed, the boards. It now writes .workspace.json beside the tree (format 1), and an import that finds one restores them. The markdown stays plain, so the archive still reads without the application. POST /api/import (:import! / in the UI) imports at the root: each top-level directory becomes a space, or merges into the space already there by that name, with its board and cards and the diary role. With a manifest, media/ comes back as embedded files rather than a folder, a file whose name ends in .md stays a file, and empty folders come back. Export claims every path in one set, folders, then documents, then files, so a file named notes.md beside a document notes no longer makes a duplicate entry that failed the whole zip. Links to folders are rewritten like links to documents, in one regex pass per kind instead of a replace per file and document. A sealed file that will not open now fails the export instead of being left out silently. The temporary zip is made in the data directory, not in /tmp.
This commit is contained in:
1 parent
b1ba63dc61
commit
aa34be8663
10 files changed
+799
-199
No files matched your search
@@ -10,7 +10,8 @@ export const hooks = {
|
||||
/** Files for the folder being browsed, rather than for the document. */
|
||||
pickTreeFiles: (_encrypt: boolean) => {},
|
||||
pickFolder: () => {},
|
||||
pickArchive: () => {},
|
||||
/** `root`: into the workspace itself, where each directory is a space. */
|
||||
pickArchive: (_root: boolean) => {},
|
||||
focusEditor: () => {},
|
||||
focusList: () => {},
|
||||
insertText: (_text: string) => {},
|
||||
@@ -239,8 +240,8 @@ export const commands: CommandSpec[] = [
|
||||
help: 'upload a folder into this one — markdown becomes documents, links follow',
|
||||
run: () => hooks.pickFolder(),
|
||||
bang: {
|
||||
help: 'import loose files, or a .zip of a folder, instead of a folder',
|
||||
run: () => hooks.pickArchive(),
|
||||
help: 'import loose files, or a .zip of a folder; :import! / pours an :export! back in, spaces and boards and all',
|
||||
run: (arg) => hooks.pickArchive(arg.trim() === '/'),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user