fix(properties): preserve literal text

Separate numeric fields from names and content so only numeric property values are evaluated as expressions.

Refs #809
This commit is contained in:
Hakan Seven 2026-08-20 14:58:12 +03:00
commit 5e62da464e
15 changed files with 107 additions and 31 deletions

View file

@ -417,17 +417,17 @@ impl PropertyEditable for AttributeDefinition {
Property {
label: t!("Tag").into_owned(),
field: "att_tag",
value: PropValue::EditText(self.tag.clone()),
value: PropValue::PlainText(self.tag.clone()),
},
Property {
label: t!("Prompt").into_owned(),
field: "att_prompt",
value: PropValue::EditText(self.prompt.clone()),
value: PropValue::PlainText(self.prompt.clone()),
},
Property {
label: t!("Value").into_owned(),
field: "att_default",
value: PropValue::EditText(self.default_value.clone()),
value: PropValue::PlainText(self.default_value.clone()),
},
Property {
label: t!("Style").into_owned(),
@ -698,13 +698,13 @@ impl PropertyEditable for AttributeEntity {
Property {
label: t!("Tag").into_owned(),
field: "atte_tag",
value: PropValue::EditText(self.tag.clone()),
value: PropValue::PlainText(self.tag.clone()),
},
ro(t!("Prompt").as_ref(), "atte_prompt", String::new()),
Property {
label: t!("Value").into_owned(),
field: "atte_val",
value: PropValue::EditText(self.value.clone()),
value: PropValue::PlainText(self.value.clone()),
},
Property {
label: t!("Style").into_owned(),

View file

@ -19,19 +19,19 @@ fn base_props(base: &DimensionBase) -> Vec<crate::scene::model::object::Property
crate::scene::model::object::Property {
label: t!("Text").into_owned(),
field: "text",
value: crate::scene::model::object::PropValue::EditText(base.text.clone()),
value: crate::scene::model::object::PropValue::PlainText(base.text.clone()),
},
crate::scene::model::object::Property {
label: t!("User Text").into_owned(),
field: "user_text",
value: crate::scene::model::object::PropValue::EditText(
value: crate::scene::model::object::PropValue::PlainText(
base.user_text.clone().unwrap_or_default(),
),
},
crate::scene::model::object::Property {
label: t!("Style").into_owned(),
field: "style_name",
value: crate::scene::model::object::PropValue::EditText(base.style_name.clone()),
value: crate::scene::model::object::PropValue::PlainText(base.style_name.clone()),
},
edit(t!("Text X").as_ref(), "text_x", base.text_middle_point.x),
edit(t!("Text Y").as_ref(), "text_y", base.text_middle_point.y),
@ -4129,4 +4129,3 @@ mod arch_format_tests {
}
}

View file

@ -34,7 +34,7 @@ fn text_prop(label: &str, field: &'static str, value: &str) -> Property {
Property {
label: label.into(),
field,
value: PropValue::EditText(value.to_string()),
value: PropValue::PlainText(value.to_string()),
}
}

View file

@ -291,7 +291,7 @@ fn properties(leader: &Leader) -> Vec<PropSection> {
Property {
label: t!("Dim style").into_owned(),
field: "dimension_style",
value: PropValue::EditText(leader.dimension_style.clone()),
value: PropValue::PlainText(leader.dimension_style.clone()),
},
choice_prop(
t!("Type").as_ref(),

View file

@ -337,7 +337,7 @@ impl PropertyEditable for MLine {
Property {
label: t!("Style").into_owned(),
field: "ml_style",
value: PropValue::EditText(self.style_name.clone()),
value: PropValue::PlainText(self.style_name.clone()),
},
Property {
label: t!("Style justification").into_owned(),

View file

@ -260,7 +260,7 @@ fn properties(t: &MText, text_style_names: &[String]) -> Vec<PropSection> {
Property {
label: t!("Contents").into_owned(),
field: "content",
value: PropValue::EditText(t.value.clone()),
value: PropValue::PlainText(t.value.clone()),
},
Property {
label: t!("Style").into_owned(),

View file

@ -715,7 +715,7 @@ fn properties(ml: &MultiLeader) -> Vec<PropSection> {
Property {
label: t!("Contents").into_owned(),
field: "text_string",
value: PropValue::EditText(ctx.text_string.clone()),
value: PropValue::PlainText(ctx.text_string.clone()),
},
// Text-style name resolved from text_style_handle by the panel builder.
ro(t!("Text style").as_ref(), "text_style_handle", "Standard"),

View file

@ -279,7 +279,7 @@ fn properties(t: &Text, text_style_names: &[String]) -> Vec<PropSection> {
Property {
label: t!("Contents").into_owned(),
field: "content",
value: PropValue::EditText(t.value.clone()),
value: PropValue::PlainText(t.value.clone()),
},
Property {
label: t!("Style").into_owned(),