mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-15 15:02:23 +00:00
Resolve and test style changes through Arc::make_mut after the shared-stylesheet change on main
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7814450d0a
commit
097cddbd03
4 files changed
+9
-7
No files matched your search
@@ -309,7 +309,7 @@ fn styles_and_lists_round_trip() {
|
||||
fn tracked_style_definition_change_round_trips() {
|
||||
let mut d = Document::new();
|
||||
d.revisions.push(Revision { kind: RevisionKind::Format, author: "Ana".into(), date: "2026-10-17T10:00:00Z".into(), move_name: None });
|
||||
d.styles.upsert(Style {
|
||||
std::sync::Arc::make_mut(&mut d.styles).upsert(Style {
|
||||
id: "Mine".into(),
|
||||
name: "Mine".into(),
|
||||
kind: StyleKind::Paragraph,
|
||||
|
||||
@@ -242,7 +242,7 @@ pub(crate) fn record(s: &mut Session, id: &str, before: &Document) {
|
||||
r.blocks(&pb.blocks, &mut pa.blocks, 0);
|
||||
}
|
||||
}
|
||||
r.styles(&before.styles.styles, &mut doc.styles.styles);
|
||||
r.styles(&before.styles.styles, &mut std::sync::Arc::make_mut(&mut doc.styles).styles);
|
||||
}
|
||||
|
||||
/// Record the paragraph formatting a command changed on the paragraph at `path` whose text it also
|
||||
|
||||
@@ -101,7 +101,7 @@ fn resolve_styles_sel(s: &mut Session, selected: bool, accept: bool) -> Result<b
|
||||
if !s.doc.styles.styles.iter().any(|st| st.para_change.is_some() || st.chr_change.is_some()) {
|
||||
return Ok(false);
|
||||
}
|
||||
for st in &mut s.doc.styles.styles {
|
||||
for st in &mut std::sync::Arc::make_mut(&mut s.doc.styles).styles {
|
||||
fmt_revisions::resolve_style(st, accept);
|
||||
}
|
||||
Ok(true)
|
||||
@@ -209,8 +209,10 @@ fn resolve_all(s: &mut Session, accept: bool) -> CmdResult {
|
||||
fmt_revisions::resolve_containers(&mut part.blocks, accept, 0);
|
||||
}
|
||||
fmt_revisions::resolve_section(&mut s.doc.last_section, accept);
|
||||
for st in &mut s.doc.styles.styles {
|
||||
fmt_revisions::resolve_style(st, accept);
|
||||
if s.doc.styles.styles.iter().any(|st| st.para_change.is_some() || st.chr_change.is_some()) {
|
||||
for st in &mut std::sync::Arc::make_mut(&mut s.doc.styles).styles {
|
||||
fmt_revisions::resolve_style(st, accept);
|
||||
}
|
||||
}
|
||||
// The note separators are block lists of their own, not stories; they must not keep ids of
|
||||
// revisions that are about to be dropped.
|
||||
|
||||
@@ -3319,7 +3319,7 @@ fn non_property_style_changes_are_not_recorded_as_formatting() {
|
||||
let mut s = s();
|
||||
run(&mut s, "review.trackChanges", json!({"value": true}));
|
||||
let before = s.doc.clone();
|
||||
let st = s.doc.styles.get_mut("Heading1").unwrap();
|
||||
let st = std::sync::Arc::make_mut(&mut s.doc.styles).get_mut("Heading1").unwrap();
|
||||
st.based_on = Some("Title".into());
|
||||
st.next = Some("Heading2".into());
|
||||
st.linked = Some("Emphasis".into());
|
||||
@@ -3363,7 +3363,7 @@ fn tracked_style_change_round_trips_through_docx() {
|
||||
fn rejecting_a_reopened_style_change_keeps_style_metadata() {
|
||||
use wordcraft_doc::styles::{Style, StyleKind, TableStyleParts};
|
||||
let mut s = s();
|
||||
s.doc.styles.upsert(Style {
|
||||
std::sync::Arc::make_mut(&mut s.doc.styles).upsert(Style {
|
||||
id: "GridX".into(),
|
||||
name: "Grid X".into(),
|
||||
kind: StyleKind::Table,
|
||||
|
||||
Reference in new issue
Block a user