Make the Text tool control bar font family, style, and size sync with the selected layer (#4118)

* Fix contenteditable preview alignment

* Make the Text tool control bar font family, style, and size sync with the selected layer

* Tidying up
This commit is contained in:
Keavon Chambers
2026-05-06 20:50:41 -07:00
committed by GitHub
parent 2ae35a67e7
commit 24c857ddc7
6 changed files with 118 additions and 62 deletions

View File

@@ -71,6 +71,19 @@ impl TextAlign {
_ => None,
}
}
/// CSS `(text-align, text-align-last)` values approximating this alignment for the `contenteditable` text overlay.
pub fn css(self) -> (&'static str, &'static str) {
match self {
Self::AlignLeft => ("left", "auto"),
Self::AlignCenter => ("center", "auto"),
Self::AlignRight => ("right", "auto"),
Self::JustifyLeft => ("justify", "auto"),
Self::JustifyCenter => ("justify", "center"),
Self::JustifyRight => ("justify", "right"),
Self::JustifyAll => ("justify", "justify"),
}
}
}
#[derive(PartialEq, Clone, Copy, Debug)]