mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-26 12:21:08 +01:00
Scripts: setters refuse art in a hidden or locked layer, and empty objects read zero bounds
- Assigning hidden, locked, position, left, top, width or height to an object in a hidden or locked layer throws Cannot edit, as opacity does, and changes nothing. Its name and note still change. - An object with nothing in it, such as an empty group or a compound path whose paths moved out, reads its bounds, position, width and height as zeros, and assigning them does nothing, so reading every property for-in lists does not throw on it. - Assigning selection without app. sets the active document's selection, and app.selection can be assigned the same way. Assigning activeDocument without app. activates a document, and assigning documents keeps its value. - JSON.stringify writes a collection, or data that holds one, without reading toJSON through the collection's name lookup, which threw Not found. - The docs state that Object.keys, Object.getOwnPropertyNames and Object.getOwnPropertyDescriptor do not report the members, that a value assigned to a member the class lacks is not kept, and that the selection order is VectorCraft's own rule. Docs: docs/mcp.md, docs/target-app-parity.md.
This commit is contained in:
1 parent
9872e6b679
commit
6b778a4c70
9 files changed
+200
-117
No files matched your search
@@ -15,15 +15,18 @@
|
||||
//!
|
||||
//! Collections are counted from 0, and `pageItems` lists art topmost first, as
|
||||
//! <https://ai-scripting.docsforadobe.dev/jsobjref/CMYKColor/> reads the frontmost path as
|
||||
//! `pathItems[0]`. A document's selection lists the selected objects in the same order, not in the
|
||||
//! order they were selected (<https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/>).
|
||||
//! A collection read with a name, `pageItems["name"]`, gives the object `getByName` gives, as that
|
||||
//! page describes, and throws `Not found` when none has the name; `"name" in pageItems` is false then,
|
||||
//! and assigning to such a name throws the same error. As that page also describes, a script may name
|
||||
//! `activeDocument`, `documents` and `selection` without `app.`; assigning one of those names makes it
|
||||
//! a variable of the script's own.
|
||||
//! `pathItems[0]`. A collection read with a name, `pageItems["name"]`, gives the object `getByName`
|
||||
//! gives, and a script may name the application's members without `app.`, as
|
||||
//! <https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/> describes; here
|
||||
//! that holds for `activeDocument`, `documents` and `selection`.
|
||||
//!
|
||||
//! VectorCraft's own rules, which the help pages do not state:
|
||||
//! - A document's selection lists the selected objects topmost first, as `pageItems` does, whatever
|
||||
//! order they were selected or made in.
|
||||
//! - A collection read with a name that nothing has throws `Not found`, and `"name" in pageItems` is
|
||||
//! false then. Assigning to such a name throws the same error.
|
||||
//! - Assigning `activeDocument` or `selection` without `app.` assigns `app.activeDocument` or the
|
||||
//! active document's selection. Assigning `documents` keeps its value.
|
||||
//! - Collections list documents in tab order. `pageItems` lists every object, with the objects
|
||||
//! inside groups and compound paths after the group or compound path, and leaves out layers and
|
||||
//! ruler guides. An index out of range gives `undefined`; `index` and `getByName` throw
|
||||
@@ -36,8 +39,12 @@
|
||||
//! - Assigning `Document.selection` takes one object, a list of them, `null` or `[]`; every object
|
||||
//! must be one of that document's that can be selected, or nothing changes.
|
||||
//! - Members the help pages list that are not here yet throw an error that says so.
|
||||
//! - Assigning `opacity` to an object in a hidden or locked layer throws `Cannot edit` and changes
|
||||
//! nothing. An object that is hidden or locked itself, or is in a hidden or locked group, takes it.
|
||||
//! - Assigning `hidden`, `locked`, `opacity`, `position`, `left`, `top`, `width` or `height` to an
|
||||
//! object in a hidden or locked layer throws `Cannot edit` and changes nothing; its `name` and
|
||||
//! `note` still change. An object that is hidden or locked itself, or is in a hidden or locked
|
||||
//! group, takes them.
|
||||
//! - An object with nothing in it, such as an empty group or a compound path whose paths moved out,
|
||||
//! reads its bounds, `position`, `width` and `height` as zeros, and assigning them does nothing.
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
@@ -709,6 +716,18 @@ fn app_selection(h: &Host, _: &[Data]) -> Answer {
|
||||
}
|
||||
}
|
||||
|
||||
/// `app.selection = objects`: the active document's selection, as `selection` of that document is
|
||||
/// assigned.
|
||||
fn app_set_selection(h: &Host, a: &[Data]) -> Answer {
|
||||
let doc = {
|
||||
let s = h.session.borrow();
|
||||
let active = s.active_index().and_then(|index| s.documents().get(index).map(|st| Doc { index, uid: st.uid }));
|
||||
active.ok_or_else(|| HostError::Error(NO_ACTIVE_DOCUMENT.into()))?
|
||||
};
|
||||
let ids = selection_ids(h, doc, arg(a, 1))?;
|
||||
set_selection(h, doc, ids)
|
||||
}
|
||||
|
||||
fn app_coords(h: &Host, _: &[Data]) -> Answer {
|
||||
Ok(text(if h.dom.coords.get() == Coords::Document { DOCUMENT_COORDS } else { ARTBOARD_COORDS }))
|
||||
}
|
||||
@@ -1490,12 +1509,27 @@ fn item_set_note(h: &Host, a: &[Data]) -> Answer {
|
||||
Ok(Data::Undefined)
|
||||
}
|
||||
|
||||
/// Refuses a change to the item's appearance, place or size while a layer it is in is hidden or
|
||||
/// locked. Its name and note may still change.
|
||||
fn refuse_in_closed_layer(h: &Host, item: Item) -> std::result::Result<(), HostError> {
|
||||
let refused = with_doc(h, item.doc, |_, st| {
|
||||
let d = &st.doc;
|
||||
let closed = |i: &NodeId| d.node(*i).is_some_and(|n| matches!(n.kind, NodeKind::Layer { .. }) && (!n.visible || n.locked));
|
||||
d.ancestry(item.id).is_some_and(|a| a.iter().any(closed)).then(|| d.node(item.id).and_then(typename).unwrap_or("page item"))
|
||||
});
|
||||
match refused {
|
||||
Some(name) => Err(HostError::Error(format!("Cannot edit {name} {}: a layer it is in is hidden or locked", item.id.0))),
|
||||
None => Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
fn item_hidden(h: &Host, a: &[Data]) -> Answer {
|
||||
read_item(h, a, |_, n| Ok(Data::Bool(!n.visible)))
|
||||
}
|
||||
|
||||
fn item_set_hidden(h: &Host, a: &[Data]) -> Answer {
|
||||
let hidden = boolean(arg(a, 1), "hidden")?;
|
||||
refuse_in_closed_layer(h, this_item(h, a)?)?;
|
||||
set_props(h, a, |n| n.visible != hidden, json!({"visible": !hidden}))
|
||||
}
|
||||
|
||||
@@ -1505,6 +1539,7 @@ fn item_locked(h: &Host, a: &[Data]) -> Answer {
|
||||
|
||||
fn item_set_locked(h: &Host, a: &[Data]) -> Answer {
|
||||
let locked = boolean(arg(a, 1), "locked")?;
|
||||
refuse_in_closed_layer(h, this_item(h, a)?)?;
|
||||
set_props(h, a, |n| n.locked == locked, json!({"locked": locked}))
|
||||
}
|
||||
|
||||
@@ -1521,14 +1556,7 @@ fn item_set_opacity(h: &Host, a: &[Data]) -> Answer {
|
||||
// `object.setProps` finds the no-op itself: an opacity a graph mark or label already has still
|
||||
// replaces the one the graph keeps for its series or kind.
|
||||
let item = this_item(h, a)?;
|
||||
let refused = with_doc(h, item.doc, |_, st| {
|
||||
let d = &st.doc;
|
||||
let closed = |i: &NodeId| d.node(*i).is_some_and(|n| matches!(n.kind, NodeKind::Layer { .. }) && (!n.visible || n.locked));
|
||||
d.ancestry(item.id).is_some_and(|a| a.iter().any(closed)).then(|| d.node(item.id).and_then(typename).unwrap_or("page item"))
|
||||
});
|
||||
if let Some(name) = refused {
|
||||
return Err(HostError::Error(format!("Cannot edit {name} {}: a layer it is in is hidden or locked", item.id.0)));
|
||||
}
|
||||
refuse_in_closed_layer(h, item)?;
|
||||
let now = with_doc(h, item.doc, |_, st| st.doc.node(item.id).map(|n| f64::from(n.opacity) * 100.0));
|
||||
let v = now.filter(|now| (now - v).abs() < 1e-4).unwrap_or(v);
|
||||
set_props(h, a, |_| false, json!({"opacity": v}))
|
||||
@@ -1554,18 +1582,19 @@ fn item_set_selected(h: &Host, a: &[Data]) -> Answer {
|
||||
}
|
||||
|
||||
/// The item's geometric bounds (`visual`: its visible bounds) in document coordinates and the
|
||||
/// document's [`Frame`].
|
||||
fn item_rect(h: &Host, item: Item, visual: bool) -> std::result::Result<(Rect, Frame), HostError> {
|
||||
with_doc(h, item.doc, |_, st| {
|
||||
let r = st.doc.bounds_of(&[item.id], visual).ok_or_else(|| HostError::Error("the object has no bounds".into()))?;
|
||||
Ok((r, frame(st)?))
|
||||
})
|
||||
/// document's [`Frame`]. An object with nothing in it, such as an empty group or a compound path
|
||||
/// whose paths moved out, has no bounds: its bounds read as zeros, and moving or resizing it does
|
||||
/// nothing.
|
||||
fn item_rect(h: &Host, item: Item, visual: bool) -> std::result::Result<(Option<Rect>, Frame), HostError> {
|
||||
with_doc(h, item.doc, |_, st| Ok((st.doc.bounds_of(&[item.id], visual), frame(st)?)))
|
||||
}
|
||||
|
||||
fn bounds(h: &Host, a: &[Data], visual: bool) -> Answer {
|
||||
let item = this_item(h, a)?;
|
||||
let (r, f) = item_rect(h, item, visual)?;
|
||||
Ok(f.bounds(h.dom.coords.get(), r))
|
||||
match item_rect(h, item, visual)? {
|
||||
(Some(r), f) => Ok(f.bounds(h.dom.coords.get(), r)),
|
||||
(None, _) => Ok(Data::Array(vec![num(0.0), num(0.0), num(0.0), num(0.0)])),
|
||||
}
|
||||
}
|
||||
|
||||
fn item_geometric(h: &Host, a: &[Data]) -> Answer {
|
||||
@@ -1578,8 +1607,10 @@ fn item_visible(h: &Host, a: &[Data]) -> Answer {
|
||||
|
||||
fn item_position(h: &Host, a: &[Data]) -> Answer {
|
||||
let item = this_item(h, a)?;
|
||||
let (r, f) = item_rect(h, item, false)?;
|
||||
Ok(pair(f.to_script(h.dom.coords.get(), Point::new(r.x0, r.y0))))
|
||||
match item_rect(h, item, false)? {
|
||||
(Some(r), f) => Ok(pair(f.to_script(h.dom.coords.get(), Point::new(r.x0, r.y0)))),
|
||||
(None, _) => Ok(pair([0.0, 0.0])),
|
||||
}
|
||||
}
|
||||
|
||||
fn item_left(h: &Host, a: &[Data]) -> Answer {
|
||||
@@ -1598,19 +1629,20 @@ fn item_top(h: &Host, a: &[Data]) -> Answer {
|
||||
|
||||
fn item_width(h: &Host, a: &[Data]) -> Answer {
|
||||
let item = this_item(h, a)?;
|
||||
Ok(num(item_rect(h, item, false)?.0.width()))
|
||||
Ok(num(item_rect(h, item, false)?.0.map_or(0.0, |r| r.width())))
|
||||
}
|
||||
|
||||
fn item_height(h: &Host, a: &[Data]) -> Answer {
|
||||
let item = this_item(h, a)?;
|
||||
Ok(num(item_rect(h, item, false)?.0.height()))
|
||||
Ok(num(item_rect(h, item, false)?.0.map_or(0.0, |r| r.height())))
|
||||
}
|
||||
|
||||
/// Moves the item so its top-left corner is at `x` and `y` in script coordinates (`None`: that one
|
||||
/// stays).
|
||||
fn move_to(h: &Host, a: &[Data], x: Option<f64>, y: Option<f64>) -> Answer {
|
||||
let item = this_item(h, a)?;
|
||||
let (r, f) = item_rect(h, item, false)?;
|
||||
refuse_in_closed_layer(h, item)?;
|
||||
let (Some(r), f) = item_rect(h, item, false)? else { return Ok(Data::Undefined) };
|
||||
let c = h.dom.coords.get();
|
||||
let now = f.to_script(c, Point::new(r.x0, r.y0));
|
||||
let to = f.to_document(c, [x.unwrap_or(now[0]), y.unwrap_or(now[1])]);
|
||||
@@ -1646,7 +1678,8 @@ fn resize(h: &Host, a: &[Data], width: bool) -> Answer {
|
||||
return Err(HostError::Range(format!("{what} must be more than 0 and at most 3999856 points")));
|
||||
}
|
||||
let item = this_item(h, a)?;
|
||||
let (r, _) = item_rect(h, item, false)?;
|
||||
refuse_in_closed_layer(h, item)?;
|
||||
let (Some(r), _) = item_rect(h, item, false)? else { return Ok(Data::Undefined) };
|
||||
let now = if width { r.width() } else { r.height() };
|
||||
if now <= 0.0 {
|
||||
return Err(HostError::Error(format!("the object has no {what} to scale")));
|
||||
@@ -2009,7 +2042,7 @@ pub(super) fn install(realm: &mut Realm, link: &Link) -> std::result::Result<(),
|
||||
("typename", typename_of("Application")),
|
||||
("documents", get(l, app_documents)),
|
||||
("activeDocument", property(l, app_active, app_set_active)),
|
||||
("selection", get(l, app_selection)),
|
||||
("selection", property(l, app_selection, app_set_selection)),
|
||||
("coordinateSystem", property(l, app_coords, app_set_coords)),
|
||||
("getIsFileOpen", method(l, app_is_open)),
|
||||
("toString", class_text("Application")),
|
||||
@@ -2137,11 +2170,11 @@ pub(super) fn install(realm: &mut Realm, link: &Link) -> std::result::Result<(),
|
||||
None,
|
||||
));
|
||||
realm.define_host_classes(classes, vec![("app".into(), host_ref("Application", &[]))])?;
|
||||
// The application's members a script may name without `app.`.
|
||||
// The application's members a script may name without `app.`, assigned as `app.<member>` is.
|
||||
realm.define_host_globals(vec![
|
||||
("activeDocument".into(), function(l, app_active)),
|
||||
("documents".into(), function(l, app_documents)),
|
||||
("selection".into(), function(l, app_selection)),
|
||||
("activeDocument".into(), function(l, app_active), Some(function(l, app_set_active))),
|
||||
("documents".into(), function(l, app_documents), None),
|
||||
("selection".into(), function(l, app_selection), Some(function(l, app_set_selection))),
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
@@ -506,9 +506,16 @@ fn moving_the_last_path_out_of_a_compound_path_keeps_the_compound_path() {
|
||||
"var d = app.activeDocument, c = d.pageItems[0], m = [d.pageItems[2], d.pageItems[1]];\
|
||||
m[0].move(c, ElementPlacement.PLACEBEFORE); vc.log(d.pageItems.length);\
|
||||
m[1].move(c, ElementPlacement.PLACEBEFORE); vc.log(d.pageItems.length);\
|
||||
vc.log([c.typename, c === d.pageItems[2]]);",
|
||||
vc.log([c.typename, c === d.pageItems[2]]);\
|
||||
var bad = []; for (var k in c) { try { c[k]; } catch (e) { bad.push(k + ': ' + e.message); } } vc.log(bad);\
|
||||
vc.log([c.geometricBounds, c.visibleBounds, c.position, c.width, c.height]);\
|
||||
c.left = 5; c.top = 5; c.position = [1, 2]; c.width = 10; c.height = 10; vc.log(c.geometricBounds);",
|
||||
);
|
||||
assert_eq!(out, vec![json!(3), json!(3), json!(["CompoundPathItem", true])]);
|
||||
let zeros = json!([0, 0, 0, 0]);
|
||||
assert_eq!(out[..3], [json!(3), json!(3), json!(["CompoundPathItem", true])]);
|
||||
// Every property `for`-`in` lists reads, and the emptied compound path has zero bounds that
|
||||
// moving or resizing leaves as they are.
|
||||
assert_eq!(out[3..], [json!([]), json!([zeros, zeros, [0, 0], 0, 0]), zeros]);
|
||||
let doc = &s.active().unwrap().doc;
|
||||
assert!(doc.node(compound).is_some_and(|n| n.children().is_some_and(|c| c.is_empty())), "the compound path stays, empty");
|
||||
// Each path went directly above the compound path, the second above the first.
|
||||
@@ -1409,17 +1416,18 @@ fn page_items_report_their_available_members_as_their_own() {
|
||||
assert_eq!(out[2], json!([true, true, -1, -1]));
|
||||
}
|
||||
|
||||
/// A name a page item class's prototype has, such as `constructor`, or that a script tries to put on
|
||||
/// the prototype, is not an object's own.
|
||||
/// A name a page item class's prototype has, such as `constructor`, is not an object's own, and a
|
||||
/// script cannot put a name on the prototype.
|
||||
#[test]
|
||||
fn a_property_added_to_a_class_prototype_is_not_an_objects_own() {
|
||||
let (mut s, _, _) = doc();
|
||||
let out = log(
|
||||
&mut s,
|
||||
"var p = app.activeDocument.pageItems[0]; PathItem.prototype.foo = 1; PageItem.prototype.bar = 2;\
|
||||
vc.log([PathItem.prototype.foo === undefined, PageItem.prototype.bar === undefined, 'foo' in p]);\
|
||||
vc.log([p.hasOwnProperty('foo'), p.hasOwnProperty('bar'), p.propertyIsEnumerable('foo'), p.hasOwnProperty('constructor')]);",
|
||||
);
|
||||
assert_eq!(out, vec![json!([false, false, false, false])]);
|
||||
assert_eq!(out, vec![json!([true, true, false]), json!([false, false, false, false])]);
|
||||
}
|
||||
|
||||
/// Reading every property `for`-`in` lists calls each getter, and each call counts against the run:
|
||||
@@ -1449,7 +1457,7 @@ fn reading_every_listed_property_is_charged_and_can_be_stopped() {
|
||||
}
|
||||
|
||||
/// `pageItems` lists art topmost first, and the selection lists the selected objects in that
|
||||
/// order whatever order they were selected in.
|
||||
/// order whatever order they were selected or made in.
|
||||
#[test]
|
||||
fn page_items_and_the_selection_list_the_topmost_object_first() {
|
||||
let (mut s, a, b) = doc();
|
||||
@@ -1464,6 +1472,16 @@ fn page_items_and_the_selection_list_the_topmost_object_first() {
|
||||
d.selection = [d.pageItems[1], d.pageItems[0]]; vc.log(d.selection[0].name);",
|
||||
);
|
||||
assert_eq!(out, vec![json!(["top", "bottom", "top", "bottom"]), json!("top")]);
|
||||
// An object made last and sent to the back comes after the others it is selected with.
|
||||
let c = rect(&mut s, 200.0, 200.0, 20.0, 20.0);
|
||||
s.execute("object.setProps", &json!({"ids": [c.0], "name": "last"})).unwrap();
|
||||
let out = log(
|
||||
&mut s,
|
||||
"var d = app.activeDocument, c = d.pageItems.getByName('last'); c.zOrder(ZOrderMethod.SENDTOBACK);\
|
||||
d.selection = null; c.selected = true; d.pageItems.getByName('top').selected = true;\
|
||||
vc.log([d.selection[0].name, d.selection[1].name, d.pageItems[2].name]);",
|
||||
);
|
||||
assert_eq!(out, vec![json!(["top", "last", "last"])]);
|
||||
}
|
||||
|
||||
/// A collection read with a name gives what `getByName` gives, and throws as it does for no match.
|
||||
@@ -1483,10 +1501,11 @@ fn a_collection_read_with_a_name_gives_the_named_object() {
|
||||
assert_eq!(out, vec![json!([true, "n", true, false, true]), json!([true, true, false]), json!(["Not found", "Not found"])]);
|
||||
}
|
||||
|
||||
/// `opacity` on an object in a hidden or locked layer throws and the run changes nothing; an object
|
||||
/// that is hidden or locked itself takes it.
|
||||
/// `opacity`, `hidden`, `locked` and the position and size setters on an object in a hidden or
|
||||
/// locked layer throw and the run changes nothing, while its name and note still change; an object
|
||||
/// that is hidden or locked itself takes them.
|
||||
#[test]
|
||||
fn opacity_refuses_art_in_a_hidden_or_locked_layer() {
|
||||
fn setters_refuse_art_in_a_hidden_or_locked_layer() {
|
||||
let (mut s, a, b) = doc();
|
||||
let layer = NodeId(s.execute("layer.new", &json!({})).unwrap()["id"].as_u64().unwrap());
|
||||
let c = rect(&mut s, 200.0, 200.0, 20.0, 20.0);
|
||||
@@ -1498,12 +1517,20 @@ fn opacity_refuses_art_in_a_hidden_or_locked_layer() {
|
||||
(json!({"ids": [layer.0], "locked": true}), json!({"ids": [layer.0], "locked": false})),
|
||||
] {
|
||||
s.execute("object.setProps", &on).unwrap();
|
||||
let (before, steps) = (format!("{:?}", s.active().unwrap().doc.layers), undo_steps(&s));
|
||||
// The change made before the refusal is put back with the rest of the run.
|
||||
let e = failure(&mut s, "var p = app.activeDocument.pageItems; p.getByName('free').opacity = 20; p.getByName('closed').opacity = 50;");
|
||||
assert!(e.contains(&format!("Cannot edit PathItem {}", c.0)), "{on}: {e}");
|
||||
assert_eq!(format!("{:?}", s.active().unwrap().doc.layers), before, "{on}");
|
||||
assert_eq!(undo_steps(&s), steps, "{on}");
|
||||
for set in ["opacity = 50", "hidden = true", "locked = true", "left = 5", "top = 5", "position = [5, 5]", "width = 10", "height = 10"] {
|
||||
let (before, steps) = (format!("{:?}", s.active().unwrap().doc.layers), undo_steps(&s));
|
||||
// The change made before the refusal is put back with the rest of the run.
|
||||
let e = failure(&mut s, &format!("var p = app.activeDocument.pageItems; p.getByName('free').opacity = 20; p.getByName('closed').{set};"));
|
||||
assert!(e.contains(&format!("Cannot edit PathItem {}", c.0)), "{on} {set}: {e}");
|
||||
assert_eq!(format!("{:?}", s.active().unwrap().doc.layers), before, "{on} {set}");
|
||||
assert_eq!(undo_steps(&s), steps, "{on} {set}");
|
||||
}
|
||||
let out = log(
|
||||
&mut s,
|
||||
"var c = app.activeDocument.pageItems.getByName('closed'); c.note = 'n'; c.name = 'renamed'; vc.log([c.name, c.note]);\
|
||||
c.name = 'closed'; c.note = '';",
|
||||
);
|
||||
assert_eq!(out, vec![json!(["renamed", "n"])], "{on}");
|
||||
s.execute("object.setProps", &off).unwrap();
|
||||
}
|
||||
s.execute("object.setProps", &json!({"ids": [a.0], "locked": true})).unwrap();
|
||||
@@ -1548,10 +1575,10 @@ fn objects_of_the_object_model_print_their_class_and_name() {
|
||||
}
|
||||
|
||||
/// `activeDocument`, `documents` and `selection` without `app.` read the application's members, and
|
||||
/// assigning one makes it the script's own variable.
|
||||
/// assigning one assigns the member: `selection` selects, `documents` keeps its value.
|
||||
#[test]
|
||||
fn the_application_members_can_be_named_without_app() {
|
||||
let (mut s, a, _) = doc();
|
||||
let (mut s, a, b) = doc();
|
||||
s.execute("select.set", &json!({"ids": [a.0]})).unwrap();
|
||||
let out = log(
|
||||
&mut s,
|
||||
@@ -1559,17 +1586,24 @@ fn the_application_members_can_be_named_without_app() {
|
||||
selection.length, selection[0] === app.activeDocument.pageItems[1], typeof activeDocument]);",
|
||||
);
|
||||
assert_eq!(out, vec![json!([true, true, 1, 1, true, "object"])]);
|
||||
// A script's own variable of the same name holds what the script puts in it.
|
||||
let out = log(&mut s, "var selection = 5, documents; vc.log([selection, typeof documents, app.selection.length]);");
|
||||
assert_eq!(out, vec![json!([5, "object", 1])]);
|
||||
assert_eq!(s.active().unwrap().selection.objects, vec![a]);
|
||||
let out = log(
|
||||
&mut s,
|
||||
"var d = app.activeDocument; selection = null; vc.log(d.selection.length);\
|
||||
selection = [d.pageItems[0], d.pageItems[1]]; vc.log(d.selection.length);\
|
||||
app.selection = d.pageItems[0]; vc.log([d.selection.length, selection[0] === d.pageItems[0]]);\
|
||||
var selection = d.selection; documents = 5; activeDocument = d; vc.log([selection.length, typeof documents]);",
|
||||
);
|
||||
assert_eq!(out, vec![json!(0), json!(2), json!([1, true]), json!([1, "object"])]);
|
||||
assert_eq!(s.active().unwrap().selection.objects, vec![b]);
|
||||
assert!(failure(&mut s, "activeDocument = 5;").contains("not a Document"));
|
||||
failure(&mut s, "'use strict'; documents = 5;");
|
||||
// With no document open, reading `activeDocument` throws as `app.activeDocument` does.
|
||||
let mut s = Session::new();
|
||||
assert!(failure(&mut s, "activeDocument;").contains("No active document"));
|
||||
}
|
||||
|
||||
/// Assigning to a name a collection does not have throws as reading it does; a page item keeps
|
||||
/// no member it lacks and does not throw.
|
||||
/// Assigning to a name a collection does not have throws as reading it does, and assigning an
|
||||
/// index does not replace the object there.
|
||||
#[test]
|
||||
fn assigning_a_name_a_collection_lacks_throws() {
|
||||
let (mut s, _, _) = doc();
|
||||
@@ -1577,7 +1611,20 @@ fn assigning_a_name_a_collection_lacks_throws() {
|
||||
for source in ["app.activeDocument.pageItems.qux = 4;", "app.documents.qux = 4;"] {
|
||||
assert!(failure(&mut s, source).contains("Not found"), "{source}");
|
||||
}
|
||||
let out = log(&mut s, "var i = app.activeDocument.pageItems[0]; i.foo = 1; app.activeDocument.pageItems[0] = 3; vc.log([i.foo === undefined]);");
|
||||
assert_eq!(out, vec![json!([true])]);
|
||||
let out = log(&mut s, "var p = app.activeDocument.pageItems; p[0] = 3; vc.log(typeof p[0]);");
|
||||
assert_eq!(out, vec![json!("object")]);
|
||||
assert_eq!(undo_steps(&s), steps);
|
||||
}
|
||||
|
||||
/// `JSON.stringify` writes a collection, or data that holds one, without reading a `toJSON` the
|
||||
/// collection lacks, while a script that reads `toJSON` itself gets `Not found`.
|
||||
#[test]
|
||||
fn json_stringify_writes_a_collection() {
|
||||
let (mut s, _, _) = doc();
|
||||
let out = log(
|
||||
&mut s,
|
||||
"var p = app.activeDocument.pageItems, m = ''; vc.log([JSON.stringify(p), JSON.stringify({list: [p, app.documents]})]);\
|
||||
try { p.toJSON; } catch (e) { m = e.message; } vc.log(m);",
|
||||
);
|
||||
assert_eq!(out, vec![json!(["{}", "{\"list\":[{},{}]}"]), json!("Not found")]);
|
||||
}
|
||||
@@ -75,13 +75,13 @@ const INSIDE: &[(&str, &str)] = &[
|
||||
"",
|
||||
"activeDocument activeDocument= app Application CoordinateSystem Document DocumentArtboardLayout DocumentColorSpace \
|
||||
DocumentPreset DocumentPresetType DocumentPreviewMode DocumentRasterResolution DocumentTransparencyGrid documents \
|
||||
documents= Documents ElementPlacement Layer PageItem PageItems RulerUnits selection selection= ZOrderMethod",
|
||||
Documents ElementPlacement Layer PageItem PageItems RulerUnits selection selection= ZOrderMethod",
|
||||
),
|
||||
("Application.", "prototype"),
|
||||
(
|
||||
"Application.prototype.",
|
||||
"activeDocument activeDocument= beep beep= constructor coordinateSystem coordinateSystem= documents getIsFileOpen \
|
||||
selection toString typename",
|
||||
selection selection= toString typename",
|
||||
),
|
||||
("DocumentPreset.", "prototype"),
|
||||
(
|
||||
|
||||
@@ -538,7 +538,7 @@ fn resolve_rooted(interp: &mut Interp, settings: &Settings, holder: ObjId, k: &K
|
||||
keep(interp, &v);
|
||||
let name = Value::String(Str::from_rc(k.clone()));
|
||||
if let Value::Object(o) = v {
|
||||
let to_json = interp.get_from(o, &key("toJSON"), &v)?;
|
||||
let to_json = interp.get_property_only(o, &key("toJSON"), &v)?;
|
||||
if interp.is_callable(&to_json) {
|
||||
v = interp.call(&to_json, &v, std::slice::from_ref(&name))?;
|
||||
keep(interp, &v);
|
||||
|
||||
@@ -17,20 +17,22 @@
|
||||
//! setter gets `this` and the value assigned. A class with an indexer answers `object[i]` for each
|
||||
//! array index `i` with it, called with `this` and the index as a number. Other names are looked up
|
||||
//! as usual, and a name that the object and its prototypes lack goes to the indexer as a string (as
|
||||
//! a number when it is the text of one, such as `-1`), so the indexer may throw for a name nothing has. Assigning to such a name reads it with the indexer
|
||||
//! first, so the assignment throws what the read throws; otherwise the value is not kept. `k in
|
||||
//! object` calls the indexer with `true` as a third argument, and is true when it gives a value other
|
||||
//! than `undefined`.
|
||||
//! a number when it is the text of one, such as `-1`), so the indexer may throw for a name nothing
|
||||
//! has. Names the engine looks up itself, such as `toJSON` in `JSON.stringify`, do not go to the
|
||||
//! indexer. Assigning to such a name reads it with the indexer first, so the assignment throws what
|
||||
//! the read throws; otherwise the value is not kept. `k in object` calls the indexer with `true` as
|
||||
//! a third argument, and is true when it gives a value other than `undefined`.
|
||||
//!
|
||||
//! `hasOwnProperty` and `propertyIsEnumerable` are true on an object of a host class for each
|
||||
//! member of its class and of the classes it descends from, apart from the members that are not
|
||||
//! available yet ([`HostMember::Unavailable`]). `for`-`in` lists the properties among those members,
|
||||
//! and not the methods.
|
||||
//! and not the methods. `Object.keys`, `Object.getOwnPropertyNames` and
|
||||
//! `Object.getOwnPropertyDescriptor` do not report the members.
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::heap::{CONFIGURABLE, Class, ENUMERABLE, Func, Key, NativeKind, ObjId, Object, Prop, WRITABLE, key};
|
||||
use crate::heap::{CONFIGURABLE, Class, ENUMERABLE, Func, Key, ObjId, Object, Prop, key};
|
||||
use crate::host::ArgRead;
|
||||
use crate::interp::{Abrupt, ErrorType, Interp, JsResult};
|
||||
use crate::value::Value;
|
||||
@@ -271,39 +273,22 @@ pub(crate) fn install(i: &mut Interp, classes: Vec<HostClass>, instances: Vec<(S
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Adds the global properties `getters`, each read with its function as a member of a host class is.
|
||||
/// Assigning one, as `var name = value` at the top level does, replaces it with a plain global
|
||||
/// variable that holds the value.
|
||||
pub(crate) fn install_globals(i: &mut Interp, getters: Vec<(String, HostFunction)>) -> JsResult<()> {
|
||||
/// Adds the global properties `globals`, each read with its getter and assigned with its setter as
|
||||
/// a member of a host class is. Assigning one without a setter keeps its value, and throws in strict
|
||||
/// mode code.
|
||||
pub(crate) fn install_globals(i: &mut Interp, globals: Vec<(String, HostFunction, Option<HostFunction>)>) -> JsResult<()> {
|
||||
let global = i.global;
|
||||
let proto = i.intrinsics.function_proto;
|
||||
for (name, f) in getters {
|
||||
for (name, get, set) in globals {
|
||||
let mark = i.temp_roots.len();
|
||||
let get = hosted_function(i, f, &name);
|
||||
let get = hosted_function(i, get, &name);
|
||||
i.temp_roots.push(Value::Object(get));
|
||||
let replace = i.heap.alloc_object(Object::new(
|
||||
Class::Function(Func::Native { f: replace_global, kind: NativeKind::Plain, constructor: false, name: "" }),
|
||||
Some(proto),
|
||||
));
|
||||
i.temp_roots.push(Value::Object(replace));
|
||||
let args: Rc<[Value]> = Rc::from([Value::str(&name)]);
|
||||
let set = i.heap.alloc_object(Object::new(Class::Function(Func::Bound { target: replace, this: Value::Undefined, args }), Some(proto)));
|
||||
let set = set.map(|f| hosted_function(i, f, &name));
|
||||
i.temp_roots.truncate(mark);
|
||||
i.define(global, key(&name), Prop::Accessor { get: Some(get), set: Some(set), flags: CONFIGURABLE })?;
|
||||
i.define(global, key(&name), Prop::Accessor { get: Some(get), set, flags: CONFIGURABLE })?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The setter of a global [`install_globals`] adds: makes the global `args[0]` a plain variable
|
||||
/// holding `args[1]`.
|
||||
fn replace_global(interp: &mut Interp, _: Value, args: &[Value], _: bool) -> JsResult<Value> {
|
||||
let name = interp.to_key(args.first().unwrap_or(&Value::Undefined))?;
|
||||
let value = args.get(1).cloned().unwrap_or(Value::Undefined);
|
||||
let global = interp.global;
|
||||
interp.define(global, name, Prop::Data { value, flags: WRITABLE | ENUMERABLE | CONFIGURABLE })?;
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
||||
fn install_class(i: &mut Interp, class: HostClass) -> JsResult<()> {
|
||||
if i.host_classes.iter().any(|e| *e.name == *class.name) {
|
||||
return Err(i.throw(ErrorType::Type, &format!("the host class {} is defined twice", class.name)));
|
||||
|
||||
@@ -1446,6 +1446,17 @@ impl Interp {
|
||||
}
|
||||
}
|
||||
|
||||
/// [[Get]] of a name that is not an array index, without the indexer of an object of a host
|
||||
/// class: a name the object and its prototypes lack is `undefined`. For names the engine looks
|
||||
/// up itself, such as `toJSON`, which a collection's indexer would answer with an error.
|
||||
pub(crate) fn get_property_only(&mut self, start: ObjId, k: &[u16], receiver: &Value) -> JsResult<Value> {
|
||||
match self.find_property(start, k)? {
|
||||
None | Some(Prop::Accessor { get: None, .. }) => Ok(Value::Undefined),
|
||||
Some(Prop::Data { value, .. }) => Ok(value),
|
||||
Some(Prop::Accessor { get: Some(g), .. }) => self.call(&Value::Object(g), receiver, &[]),
|
||||
}
|
||||
}
|
||||
|
||||
/// The prototype a primitive's properties are looked up on.
|
||||
fn primitive_proto(&mut self, v: &Value, k: &[u16]) -> JsResult<ObjId> {
|
||||
match v {
|
||||
|
||||
@@ -522,11 +522,11 @@ impl Realm {
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds the global properties `getters`, each read with its function, which gets `undefined` as
|
||||
/// `this`. Assigning one, as `var name = value` at the top level does, makes it a plain global
|
||||
/// variable that holds the value.
|
||||
pub fn define_host_globals(&mut self, getters: Vec<(String, crate::HostFunction)>) -> Result<(), RunError> {
|
||||
match crate::host_classes::install_globals(&mut self.interp, getters) {
|
||||
/// Adds the global properties `globals`: a name, the function that answers a read, and the
|
||||
/// function that answers an assignment, each called with `undefined` as `this` (and the value
|
||||
/// assigned). Assigning one without a setter keeps its value, and throws in strict mode code.
|
||||
pub fn define_host_globals(&mut self, globals: Vec<(String, crate::HostFunction, Option<crate::HostFunction>)>) -> Result<(), RunError> {
|
||||
match crate::host_classes::install_globals(&mut self.interp, globals) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(e) => self.outcome(Err(e)).map(drop),
|
||||
}
|
||||
|
||||
+23
-16
@@ -2622,11 +2622,12 @@ app through the global object `vc`, and writes to the Script Console and runs ot
|
||||
- `vc.log(value)` adds a value to the report and a line to the Script Console.
|
||||
- `app` is the application object the help page https://ai-scripting.docsforadobe.dev/jsobjref/Application/
|
||||
describes: `app.documents`, `app.activeDocument` (assigning an open document makes it the active one),
|
||||
`app.selection`, `app.coordinateSystem` and `app.getIsFileOpen(path)`. A script may name `activeDocument`,
|
||||
`documents` and `selection` without `app.`, as
|
||||
`app.selection` (assigning it sets the active document's selection), `app.coordinateSystem` and
|
||||
`app.getIsFileOpen(path)`. A script may name the application's members without `app.`, as
|
||||
[Accessing and referencing objects](https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/)
|
||||
describes; assigning one of those names, as `var selection = ...` does, makes it a variable of the script's own
|
||||
(VectorCraft's own rule). `app.documents`
|
||||
describes; in VectorCraft that holds for `activeDocument`, `documents` and `selection`. Assigning `activeDocument` or `selection` without `app.`, as `var selection = ...` at the top level also
|
||||
does, assigns the application's member, and assigning `documents` keeps its value (VectorCraft's own rule).
|
||||
`app.documents`
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/Documents/) has `length`, `[i]`, `index(key)`, `getByName(name)`
|
||||
and `add(colorSpace?, width?, height?, numArtBoards?, artboardLayout?, artboardSpacing?, artboardRowsOrCols?)`,
|
||||
which runs `file.new` (`artboardRowsOrCols` is the number of rows for `GridByCol` and `RLGridByCol`, and of
|
||||
@@ -2667,11 +2668,14 @@ app through the global object `vc`, and writes to the Script Console and runs ot
|
||||
`node.move` refuses the place of a copy, `duplicate` throws that error and leaves the documents, the selection and
|
||||
the undo history as they were before the call. `move` on an object that is hidden or locked, inside a hidden or
|
||||
locked layer or group, or on a locked artboard throws `Cannot move` and moves nothing. `duplicate` on such an
|
||||
object, with or without a relative object, throws `Cannot duplicate` and makes no copy. Assigning `opacity` to an
|
||||
object in a hidden or locked layer throws `Cannot edit` and changes nothing; an object that is hidden or locked
|
||||
itself takes it (VectorCraft's own rule). `move` with the object itself as the relative object and `PLACEBEFORE`
|
||||
or `PLACEAFTER` leaves it where it is and adds no undo step. When `move` takes the last path out of a compound
|
||||
path, the compound path stays, empty, so a script that holds it can still read it. `duplicate` on a path inside a compound path throws
|
||||
object, with or without a relative object, throws `Cannot duplicate` and makes no copy. Assigning `hidden`,
|
||||
`locked`, `opacity`, `position`, `left`, `top`, `width` or `height` to an object in a hidden or locked layer
|
||||
throws `Cannot edit` and changes nothing, while its `name` and `note` still change; an object that is hidden or
|
||||
locked itself takes them (VectorCraft's own rule). `move` with the object itself as the relative object and
|
||||
`PLACEBEFORE` or `PLACEAFTER` leaves it where it is and adds no undo step. When `move` takes the last path out of
|
||||
a compound path, the compound path stays, empty, so a script that holds it can still read it. An object with
|
||||
nothing in it, such as an empty group or that compound path, reads its bounds, `position`, `width` and `height`
|
||||
as zeros, and assigning them does nothing (VectorCraft's own rule). `duplicate` on a path inside a compound path throws
|
||||
`Duplicating a path inside a compound path is not available yet`, and `zOrder` on one throws
|
||||
`Reordering a path inside a compound path is not available yet` and leaves the document unchanged. A script that holds a placed image keeps the
|
||||
same object when the image is embedded: the next read gives that object, now a `RasterItem`. The
|
||||
@@ -2680,12 +2684,13 @@ app through the global object `vc`, and writes to the Script Console and runs ot
|
||||
`DocumentTransparencyGrid` hold strings such as `"ZOrderMethod.BRINGTOFRONT"`.
|
||||
`pageItems` lists the art topmost first, as the example on
|
||||
[CMYKColor](https://ai-scripting.docsforadobe.dev/jsobjref/CMYKColor/) reads the frontmost path as `pathItems[0]`,
|
||||
and a document's `selection` lists the selected objects in the same order, not in the order they were selected
|
||||
([Accessing and referencing objects](https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/)).
|
||||
A collection read with a name, such as `pageItems["Logo"]` or `documents["Untitled-1"]`, gives the object
|
||||
`getByName` gives, as that page describes, and throws `Not found` when none has the name, a name the collection
|
||||
class lacks as a member included; `"name" in pageItems` is false then, and assigning to such a name throws
|
||||
`Not found` too. `name` takes a number or a Boolean as the text `String(value)` gives. `String(object)` gives
|
||||
and a document's `selection` lists the selected objects in the same order, whatever order they were selected or
|
||||
made in (VectorCraft's own rule). A collection read with a name, such as `pageItems["Logo"]` or
|
||||
`documents["Untitled-1"]`, gives the object `getByName` gives, as
|
||||
[Accessing and referencing objects](https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/)
|
||||
shows. A read with a name that nothing has, a name the collection class lacks as a member included, throws
|
||||
`Not found`; `"name" in pageItems` is false then, and assigning to such a name throws `Not found` too
|
||||
(VectorCraft's own rule). `JSON.stringify` does not read `toJSON` from a collection this way. `name` takes a number or a Boolean as the text `String(value)` gives. `String(object)` gives
|
||||
`[PathItem Logo]` for a page item named `Logo` (`[PathItem ]` with no name), `[Document <name>]`,
|
||||
`[Layer <name>]`, `[Application]` and `[PageItems]` (VectorCraft's own rule).
|
||||
VectorCraft's own rules: documents are listed in tab order, and page items with the
|
||||
@@ -2715,7 +2720,9 @@ app through the global object `vc`, and writes to the Script Console and runs ot
|
||||
`app.beep`, throw an error that says they are not available yet when they are read or assigned.
|
||||
`hasOwnProperty` and `propertyIsEnumerable` are false for those members and true for every other member of an
|
||||
object's class, so `item.hasOwnProperty("opacity")` is true on a page item, and `for (k in item)` lists the
|
||||
other properties but not the methods. Other members
|
||||
other properties but not the methods. `Object.keys`, `Object.getOwnPropertyNames` and
|
||||
`Object.getOwnPropertyDescriptor` do not report those members. Assigning a member that an object's class does not
|
||||
have does not keep the value and does not throw. Other members
|
||||
those pages list, such as `app.version` and `Document.save()`, and the members of the pages of the page-item kinds
|
||||
themselves, such as a path's fill, are not defined yet and read as `undefined`.
|
||||
- `$.write(...values)` writes the values to the Script Console with no separator, each as `String(value)` gives it, and
|
||||
|
||||
@@ -1024,7 +1024,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- Synthetic input validates complete gestures before queue mutation: at most 256 drag steps, 16 clicks and 1,024 pending events; up to 64 control requests per frame, with later requests retained for the next frame (#1709).
|
||||
- The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s.
|
||||
- Scripts: File › Scripts › Other Script… and `script.run` run a JavaScript file against the open documents as one transaction with one undo step for each changed document. A failed or stopped run puts every document back. `crates/engine/src/tests/script_run.rs`.
|
||||
- Scripts: the global `app` gives the open documents, new documents from a startup preset and a `DocumentPreset`, the active document, each document's selection and its page items with their names, notes, visibility, lock, opacity, position, size, bounds and stacking order, and moves and copies them into or beside other objects, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Application/, https://ai-scripting.docsforadobe.dev/jsobjref/Documents/, https://ai-scripting.docsforadobe.dev/jsobjref/DocumentPreset/, https://ai-scripting.docsforadobe.dev/jsobjref/Document/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItems/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItem/ and https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/ describe them; each change runs a command inside the run's transaction (`docs/mcp.md`). A script can check a member with `hasOwnProperty`, read a collection by name, and name `activeDocument`, `documents` and `selection` without `app.` (https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/). Layers, paths, type and the other classes are not there yet. `crates/engine/src/tests/script_dom.rs`.
|
||||
- Scripts: the global `app` gives the open documents, new documents from a startup preset and a `DocumentPreset`, the active document, each document's selection and its page items with their names, notes, visibility, lock, opacity, position, size, bounds and stacking order, and moves and copies them into or beside other objects, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Application/, https://ai-scripting.docsforadobe.dev/jsobjref/Documents/, https://ai-scripting.docsforadobe.dev/jsobjref/DocumentPreset/, https://ai-scripting.docsforadobe.dev/jsobjref/Document/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItems/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItem/ and https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/ describe them; each change runs a command inside the run's transaction (`docs/mcp.md`). A script can check a member with `hasOwnProperty`, and can read a collection by name and name `activeDocument`, `documents` and `selection` without `app.` (https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/). Layers, paths, type and the other classes are not there yet. `crates/engine/src/tests/script_dom.rs`.
|
||||
- Scripts: Window › Script Console shows each run's `$.write` and `$.writeln` output, `vc.log` entries, uncaught error with the script's name, line and column, and a report of its time, host calls and slowest commands, keeping at most 2,048 lines and counting the lines it dropped. `script.run`'s report carries the same data, and `script.console`, `script.console.clear` and `ui.copyScriptConsole` read, clear and copy it. `crates/engine/src/tests/script_console.rs`.
|
||||
- Scripts: the status bar translates its own words around a failed run's error and the app's own error messages, and shows text the script threw itself (a value, an error it made, or an error whose name or message it changed) as it is, even when that text reads like one of the app's messages. `script.run`'s report gives `messageOrigin` (`script` or `built-in`), and the advice about objects other applications give their scripts follows only the app's own reference errors. VectorCraft's own rule. `crates/js/src/interp_tests.rs`, `crates/engine/src/tests/script_run.rs`, `crates/ui-egui/src/chrome/tests.rs`.
|
||||
- Scripts: the `$` object has the other members the Dollar object page lists (https://extendscript.docsforadobe.dev/extendscript-tools-features/dollar-object/), from `$.about()` to `$.version`, and scripts have the global `localize(object, ...values)` (https://extendscript.docsforadobe.dev/extendscript-tools-features/localizing-extendscript-strings/), `toSource(value)` and `Object.prototype.toSource()`. Each run starts with the interface's locale, and what a script changes in `$` lasts only for that run. `crates/engine/src/tests/script_dollar.rs`, `crates/js/src/extension_tests.rs`.
|
||||
|
||||
Reference in new issue
Block a user