mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-26 19:26:46 -06:00
delete_para and delete_char previously reassigned only the story text runs/paragraphs using the deleted style, leaving other styles' Based On, paragraph styles' nested/nested-line/GREP style refs, the drop cap style, and the footnote reference style pointed at a name that no longer exists. Extract redirect_style_refs() from rename_style() (everything it does except updating the registry entry's own name) and reuse it from both delete commands, so deleting a style now redirects every reference type to the replacement style before removing the registry entry. Also teach rename_char_refs() about drop_cap_style, which it missed even for renames. Add validation: name must be non-empty and refer to an existing style, and replaceWith (if given) must refer to an existing style and can't be the style being deleted. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>