Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Paragraph styles: create_para whole again, with the style name parameter helper before it

moppeeer741fbe9fac2f
diff --git a/crates/engine/src/cmd/style/paragraph.rs b/crates/engine/src/cmd/style/paragraph.rs
index b7842daef..1f501cf7a 100644
--- a/crates/engine/src/cmd/style/paragraph.rs
+++ b/crates/engine/src/cmd/style/paragraph.rs
@@ -403,8 +403,6 @@ fn continue_numbering(p: Option<&Value>, para: &mut ParaAttrs) {
}
}
-pub(super) fn create_para(s: &mut Session, p: &Value) -> Result<Value> {
- let base = str_param(p, "name").unwrap_or("Paragraph Style 1").to_string();
/// The style `p[key]` names: none when absent or null; anything but a name is refused.
fn style_name_param(cmd: &str, p: &Value, key: &str) -> Result<Option<String>> {
match p.get(key) {
@@ -414,7 +412,7 @@ fn style_name_param(cmd: &str, p: &Value, key: &str) -> Result<Option<String>> {
}
}
-fn create_para(s: &mut Session, p: &Value) -> Result<Value> {
+pub(super) fn create_para(s: &mut Session, p: &Value) -> Result<Value> {
let base = str_param(p, "name").unwrap_or("Paragraph Style 1").to_string();
let based_on = style_name_param("style.paragraph.create", p, "basedOn")?;
let next = style_name_param("style.paragraph.create", p, "nextStyle")?;