Use capi.json as the default project extension
This commit is contained in:
parent
eef67d9fb7
commit
9ae5271569
|
|
@ -67,7 +67,7 @@ pub fn parse_values(text: &str) -> Result<ImportDocument, String> {
|
|||
return crate::geometry_formats::parse_json(text);
|
||||
}
|
||||
return Err(
|
||||
"This JSON is not a geometry exchange. Use Open project for .midra.json files.".into(),
|
||||
"This JSON is not a geometry exchange. Use Open project for .capi.json files (or legacy .midra.json projects).".into(),
|
||||
);
|
||||
}
|
||||
if crate::geometry_formats::looks_like_csv(text) {
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ impl Editor {
|
|||
Ok(contents) => {
|
||||
if let Some(path) = rfd::FileDialog::new()
|
||||
.add_filter("Canvas Pilot project", &["json"])
|
||||
.set_file_name("layout.midra.json")
|
||||
.set_file_name("layout.capi.json")
|
||||
.save_file()
|
||||
{
|
||||
self.queue_write(path, contents);
|
||||
|
|
|
|||
|
|
@ -142,16 +142,18 @@ fn exported_svg_roundtrips_rounded_geometry_including_full_screen_layers() {
|
|||
}
|
||||
#[test]
|
||||
fn publication_requires_overwrite_and_read_matches_written_document() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let path = dir.path().join("layout.midra.json");
|
||||
let p = Project::from_layout(&Layout::default());
|
||||
write_file(&path, p.to_json().unwrap().as_bytes(), false).unwrap();
|
||||
assert_eq!(Project::read(&path).unwrap(), p);
|
||||
assert!(write_file(&path, b"replacement", false).is_err());
|
||||
assert_eq!(Project::read(&path).unwrap(), p);
|
||||
write_file(&path, b"replacement", true).unwrap();
|
||||
assert_eq!(std::fs::read(&path).unwrap(), b"replacement");
|
||||
assert_eq!(std::fs::read_dir(dir.path()).unwrap().count(), 1);
|
||||
for filename in ["layout.capi.json", "layout.midra.json"] {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let path = dir.path().join(filename);
|
||||
let p = Project::from_layout(&Layout::default());
|
||||
write_file(&path, p.to_json().unwrap().as_bytes(), false).unwrap();
|
||||
assert_eq!(Project::read(&path).unwrap(), p);
|
||||
assert!(write_file(&path, b"replacement", false).is_err());
|
||||
assert_eq!(Project::read(&path).unwrap(), p);
|
||||
write_file(&path, b"replacement", true).unwrap();
|
||||
assert_eq!(std::fs::read(&path).unwrap(), b"replacement");
|
||||
assert_eq!(std::fs::read_dir(dir.path()).unwrap().count(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
- New project saves suggest `.capi.json` (Canvas Pilot). Existing `.midra.json`
|
||||
projects remain readable and are not renamed automatically. Updated the manual
|
||||
and checked read/write and overwrite protection with both filenames; JSON
|
||||
contents and schema version are unchanged.
|
||||
|
||||
- Added user-guide feature matrices for all eleven exchange formats, project saves
|
||||
and separate clipboard workflows. Distinguished geometry, names, visual crop/mask
|
||||
pictures and editable snapshot restoration, checked against the codec behavior.
|
||||
|
|
|
|||
|
|
@ -139,7 +139,10 @@ user confirmed actual draw.io copy/paste working on 2026-11-15.
|
|||
## Save, open and export
|
||||
|
||||
Use the **Project** toolbar menu to **Save project…** or **Open project…**.
|
||||
Projects use readable, versioned `.midra.json` files and preserve applied output,
|
||||
Existing `.midra.json` projects still open normally and are not renamed
|
||||
automatically. **Save project…** suggests a `.capi.json` name.
|
||||
|
||||
Projects use readable, versioned `.capi.json` files and preserve applied output,
|
||||
inputs, layer bounds/crops, source assignments, locks, visibility, selection,
|
||||
viewport preferences, and all embedded reference images. Apply pending edits
|
||||
before saving. Opening asks before replacing current work and starts a fresh
|
||||
|
|
@ -168,7 +171,7 @@ are supported. SVG rendered by draw.io Desktop is recognized through its retaine
|
|||
cell IDs; generated HTML labels and raster text fallbacks are ignored. Draw.io
|
||||
may crop and rebase that SVG unless the exported diagram includes the background
|
||||
layer. These exports round-trip whole-pixel visible-box geometry, not
|
||||
source/crop settings; the separate `.midra.json` project format preserves the full project. See the
|
||||
source/crop settings; the separate `.capi.json` project format preserves the full project. See the
|
||||
[geometry exchange contract and native draw.io checks](../../interfaces/canvas-pilot-exchange.md)
|
||||
and [project save contract](../../interfaces/canvas-pilot.md).
|
||||
|
||||
|
|
@ -380,5 +383,5 @@ service. A missing converter produces an error without changing the project.
|
|||
Use SVG if you do not want to install or configure the converter.
|
||||
|
||||
AI exchanges layer geometry and optional artwork, not the complete editor project.
|
||||
Use a `.midra.json` project to preserve all settings. See the
|
||||
Use a `.capi.json` project to preserve all settings. See the
|
||||
[AI format contract and round-trip checks](../../interfaces/canvas-pilot-exchange.md#illustrator-ai).
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ and layer labels can help identify the boxes; they do not rename destinations.
|
|||
|
||||
| File | Import | Export | Layer names in export | Background picture | Crop/mask preview pictures | Extra settings snapshot |
|
||||
| --- | :---: | :---: | :---: | :---: | :---: | :---: |
|
||||
| Canvas Pilot project (`.midra.json`) | ☑* | ☑* | ☑ | ☑* | ☑* | ☑* |
|
||||
| Canvas Pilot project (`.capi.json`) | ☑* | ☑* | ☑ | ☑* | ☑* | ☑* |
|
||||
| SVG (`.svg`) | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ |
|
||||
| draw.io (`.drawio`, XML) | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ |
|
||||
| Geometry JSON (`.json`) | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ |
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ You can skip this step if you only need rectangle positions.
|
|||
## 4. Save the editable project
|
||||
|
||||
Apply any pending property edits, then choose **Project → Save project…** and
|
||||
save as `first-layout.midra.json`. This is the file to reopen when you want to continue
|
||||
save as `first-layout.capi.json`. This is the file to reopen when you want to continue
|
||||
editing: it retains the project, including source/crop settings and reference images.
|
||||
|
||||
Use **Project → Open project…** to load it later.
|
||||
|
|
@ -62,7 +62,7 @@ Choose **Project → Export → Export layers…**, select **SVG** and **All lay
|
|||
and save the export. For plain layer boxes, leave the background and placeholder
|
||||
pictures disabled. The SVG can be opened in a vector editor.
|
||||
|
||||
Keep the `.midra.json` project as well: a geometry export does not retain all editor
|
||||
Keep the `.capi.json` project as well: a geometry export does not retain all editor
|
||||
settings. The [starter-file catalog](../../templates/canvas-pilot/catalog.md) has
|
||||
matching layouts in every supported format if you prefer to start in another app.
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ See [formats and crop](guide/formats-and-crop.md) and
|
|||
|
||||
## Save, exchange or send a layout
|
||||
|
||||
- **Save your work:** use **Project → Save project…** for a `.midra.json` file
|
||||
- **Save your work:** use **Project → Save project…** for a `.capi.json` file
|
||||
that retains the full editor project.
|
||||
- **Work with another application:** drop a supported geometry file into the window,
|
||||
use **Import → Geometry file…**, or **Project → Export → Export layers…**. The [starter-file catalog](../templates/canvas-pilot/catalog.md)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,13 @@ examples and tests in the same change as any save/export schema change.
|
|||
|
||||
## Project JSON, version 15
|
||||
|
||||
Suggested filename: `layout.midra.json`. Encoding: UTF-8, pretty-printed JSON,
|
||||
Suggested filename: `layout.capi.json`. Legacy `.midra.json` projects remain
|
||||
readable through **Open project**; both names contain the same JSON representation.
|
||||
The file dialog accepts `.json`, and validation uses file contents rather than the
|
||||
filename. **Save project…** suggests the new name and lets the user choose the path;
|
||||
existing files are not renamed automatically. This filename change requires no schema migration.
|
||||
|
||||
Encoding: UTF-8, pretty-printed JSON,
|
||||
with a trailing newline. A project preserves applied document values at their
|
||||
stored floating-point precision. No display rounding is applied. The loader
|
||||
requires every field below, rejects unknown fields, and rejects unsupported
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ CLI to import or export them. See [AI setup](../../canvas-pilot/guide/files.md#i
|
|||
These files exchange visible layer boxes. They do not store the complete editor
|
||||
state, source assignments, crop settings or device links. In particular, the
|
||||
`.json` starter is **geometry JSON**, not a saved Midra project. Use **Project →
|
||||
Save project…** for a full `.midra.json` project; see the
|
||||
Save project…** for a full `.capi.json` project; see the
|
||||
[project format](../../interfaces/canvas-pilot.md). Versioned schema and migration
|
||||
examples stay beside their [interface contracts](../../interfaces/README.md).
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue