Artboards: a Cut or Copy with the Artboard tool replays on its artboards

edit.copy and edit.cut chose the artboard route by the tool chosen, which
the journal does not record. A replay in a new session acted on the objects
selected there, or stopped with "nothing selected" when there were none.

With the Artboard tool chosen, both now record selectedArtboards and art in
the journal entry. A given selectedArtboards runs the artboard route with
any tool and needs only a document. A recorded action leaves both values
out, so it follows the tool chosen when it plays. Cut and Copy of objects
record nothing new.
This commit is contained in:
dotCooCoo
2026-11-06 21:35:41 -08:00
parent ff9deee46d
commit 72af76d418
7 changed files with 165 additions and 20 deletions
+6 -2
View File
@@ -54,9 +54,13 @@ impl Session {
self.check_given_ids(id, params)?;
}
// Clear's menu needs a selection; an agent supplying explicit targets only needs a
// document. The command validates those targets before making any edit.
// document. The command validates those targets before making any edit. Cut and Copy given
// the artboards the journal recorded need only a document too, whatever is selected and
// whichever tool is chosen.
let given = given_ids(spec.params, params);
let enabled = if id == "edit.clear" && params.get("ids").is_some() {
let enabled = if (id == "edit.clear" && params.get("ids").is_some())
|| (matches!(id, "edit.copy" | "edit.cut") && params.get("selectedArtboards").is_some())
{
cmd::has_doc(self)
} else if let Some(ids) = given.clone() {
// Objects given as `ids` (or `id`) stand in for the selection: the command is enabled