mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-28 09:21:55 +01:00
Merge pull request #9780 from dotCooCoo/fix/para-style-options-opening-document
Keep Paragraph Style Options in its opening document
This commit is contained in:
6 files changed
+255
-48
No files matched your search
@@ -11,7 +11,7 @@ use craft::behavior::Mixed;
|
||||
use craft::text::ui::character::{AKI_PRESETS, DIACRITIC_PRESETS, TSUME_PRESETS};
|
||||
use craft::ui::choice::Checkbox;
|
||||
use craft::ui::contract::{Bind, Entry, Outcome as _, Props as _, Show as _, ShowContainer as _};
|
||||
use craft::ui::dialog::{DialogResult, FieldRefusal};
|
||||
use craft::ui::dialog::{DialogResult, FieldRefusal, StackDialog};
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::patterns::form_dialogs::{
|
||||
DialogFields, FieldValue, HostedPropertiesDialog, Param, ParamKind, PropertiesDialog, PropertiesTab, PropertyRow, TabLayout,
|
||||
@@ -1219,52 +1219,82 @@ pub fn reset_panel(app: &mut VectorcraftApp) -> Result<Value, String> {
|
||||
|
||||
/// The dialog's frame work: previews the values, commits at OK, and rolls the preview back at Cancel.
|
||||
pub(crate) fn pump(app: &mut VectorcraftApp, _ctx: &egui::Context) {
|
||||
let refusals = Refusals {
|
||||
busy: "finish the active edit before applying Character Style Options",
|
||||
elsewhere: "switch back to the document where Character Style Options was opened",
|
||||
closed: "the document where Character Style Options was opened has closed",
|
||||
};
|
||||
pump_in_opening_document::<CharStyleOptions>(
|
||||
app,
|
||||
|app| &mut app.char_style_preview,
|
||||
|d| (d.document, d.frame()),
|
||||
CharStyleOptions::hosted_mut,
|
||||
(tl!("Character Style Options"), "charStyle.edit"),
|
||||
&refusals,
|
||||
);
|
||||
}
|
||||
|
||||
/// Why a style options dialog's OK is refused outside its own preview.
|
||||
pub(crate) struct Refusals {
|
||||
/// Another edit is active in the opening document.
|
||||
pub(crate) busy: &'static str,
|
||||
/// Another document is active.
|
||||
pub(crate) elsewhere: &'static str,
|
||||
/// The opening document has closed.
|
||||
pub(crate) closed: &'static str,
|
||||
}
|
||||
|
||||
/// Runs one frame of the style options dialog `D` that opened on one document: previews and commits `command`
|
||||
/// (its undo label and id) only while that document is active and no other edit is active in it, refuses OK
|
||||
/// elsewhere with `refusals`, and at Cancel rolls back only the preview the dialog still owns. `preview` is the
|
||||
/// app's slot for the dialog's preview, `state` gives the opening document's uid and this frame's state, and
|
||||
/// `hosted` gives the hosted dialog that takes OK's answer.
|
||||
pub(crate) fn pump_in_opening_document<D: StackDialog>(
|
||||
app: &mut VectorcraftApp,
|
||||
preview: fn(&mut VectorcraftApp) -> &mut Preview,
|
||||
state: fn(&mut D) -> (u64, Frame),
|
||||
hosted: fn(&mut D) -> &mut HostedPropertiesDialog,
|
||||
(label, command): (&str, &str),
|
||||
refusals: &Refusals,
|
||||
) {
|
||||
let Some(dialogs) = app.dialogs() else { return };
|
||||
let active = app.session.active().map(|doc| (doc.uid, app.session.tool_resets()));
|
||||
let interaction_selection = app.session.active().and_then(|doc| doc.interaction.as_ref().map(|interaction| interaction.selection.clone()));
|
||||
let owns_interaction = app.char_style_preview.activation == active
|
||||
&& app
|
||||
.char_style_preview
|
||||
.interaction_selection
|
||||
.as_ref()
|
||||
.zip(interaction_selection.as_ref())
|
||||
.is_some_and(|(owned, current)| Arc::ptr_eq(owned, current));
|
||||
let Some((document, frame)) = dialogs.with(|host| host.get_mut::<CharStyleOptions>().map(|d| (d.document, d.frame()))) else {
|
||||
if matches!(dialogs.with(|host| host.take::<CharStyleOptions>()), Some(DialogResult::Cancel)) {
|
||||
let preview = std::mem::take(&mut app.char_style_preview);
|
||||
let owned = preview(app);
|
||||
let owns_interaction = owned.activation == active
|
||||
&& owned.interaction_selection.as_ref().zip(interaction_selection.as_ref()).is_some_and(|(owned, current)| Arc::ptr_eq(owned, current));
|
||||
let Some((document, frame)) = dialogs.with(|host| host.get_mut::<D>().map(state)) else {
|
||||
if matches!(dialogs.with(|host| host.take::<D>()), Some(DialogResult::Cancel)) {
|
||||
let owned = std::mem::take(preview(app));
|
||||
if owns_interaction {
|
||||
preview.live.cancel(app);
|
||||
owned.live.cancel(app);
|
||||
}
|
||||
}
|
||||
return;
|
||||
};
|
||||
let done = if let Some(activation) = active.filter(|(uid, _)| *uid == document) {
|
||||
if interaction_selection.is_some() && !owns_interaction {
|
||||
frame.ok.then(|| Err("finish the active edit before applying Character Style Options".into()))
|
||||
frame.ok.then(|| Err(refusals.busy.into()))
|
||||
} else {
|
||||
let preview = std::mem::take(&mut app.char_style_preview);
|
||||
let live = if owns_interaction { preview.live } else { LivePreview::default() };
|
||||
let (live, answer) = drive(app, live, tl!("Character Style Options"), "charStyle.edit", &frame);
|
||||
let owned = std::mem::take(preview(app));
|
||||
let live = if owns_interaction { owned.live } else { LivePreview::default() };
|
||||
let (live, answer) = drive(app, live, label, command, &frame);
|
||||
let interaction_selection =
|
||||
app.session.active().and_then(|doc| doc.interaction.as_ref().map(|interaction| interaction.selection.clone()));
|
||||
app.char_style_preview = Preview { live, activation: Some(activation), interaction_selection };
|
||||
*preview(app) = Preview { live, activation: Some(activation), interaction_selection };
|
||||
answer
|
||||
}
|
||||
} else if frame.ok {
|
||||
let reason = if app.session.documents().iter().any(|doc| doc.uid == document) {
|
||||
"switch back to the document where Character Style Options was opened"
|
||||
} else {
|
||||
"the document where Character Style Options was opened has closed"
|
||||
};
|
||||
Some(Err(reason.into()))
|
||||
let why = if app.session.documents().iter().any(|doc| doc.uid == document) { refusals.elsewhere } else { refusals.closed };
|
||||
Some(Err(why.into()))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if let Some(done) = done {
|
||||
let answer = done.map(drop).map_err(|why| reason(&why));
|
||||
dialogs.with(|host| {
|
||||
if let Some(d) = host.get_mut::<CharStyleOptions>() {
|
||||
d.hosted_mut().answer_ok(answer);
|
||||
if let Some(d) = host.get_mut::<D>() {
|
||||
hosted(d).answer_ok(answer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ use std::sync::Arc;
|
||||
|
||||
use craft::ui::buttons::Button;
|
||||
use craft::ui::contract::{Props as _, Show as _, ShowContainer as _, clicked};
|
||||
use craft::ui::dialog::DialogResult;
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::patterns::form_dialogs::{DialogFields, FieldValue, HostedPropertiesDialog, Param, ParamKind, PropertiesTab, PropertyRow};
|
||||
use craft::ui::runtime::env::Label;
|
||||
@@ -26,7 +25,7 @@ use vectorcraft_doc::text::DEFAULT_TAB_INTERVAL;
|
||||
use vectorcraft_doc::{HyphenationOptions, JustificationOptions, TabAlign, TabStop, Unit};
|
||||
|
||||
use super::char_style_options::{
|
||||
Values, canonical_map, drive, general_rows, reason, rows, select, style_dialog, text, to_fields, tri_state, value_of,
|
||||
Refusals, Values, canonical_map, general_rows, pump_in_opening_document, rows, select, style_dialog, text, to_fields, tri_state, value_of,
|
||||
};
|
||||
use crate::VectorcraftApp;
|
||||
|
||||
@@ -765,6 +764,7 @@ pub(crate) fn hosted(key: &'static str, title: &'static str, opening: &Arc<Openi
|
||||
pub(crate) struct ParaStyleOptions {
|
||||
inner: HostedPropertiesDialog,
|
||||
opening: Arc<Opening>,
|
||||
document: u64,
|
||||
}
|
||||
|
||||
impl ParaStyleOptions {
|
||||
@@ -783,10 +783,11 @@ style_dialog!(ParaStyleOptions, KIND);
|
||||
pub fn open(app: &mut VectorcraftApp, name: &str) -> Result<Value, String> {
|
||||
crate::panels::character::end_typing(app);
|
||||
let unit = app.session.general_unit();
|
||||
let doc = &app.session.active().ok_or("no document open")?.doc;
|
||||
let state = app.session.active().ok_or("no document open")?;
|
||||
let (document, doc) = (state.uid, &state.doc);
|
||||
let def = doc.para_styles.iter().find(|s| s.name == name).ok_or_else(|| format!("no style `{name}`"))?;
|
||||
let opening = Arc::new(Opening::new(name, def.attrs.clone(), unit, vertical_text(app)));
|
||||
let dialog = ParaStyleOptions { inner: hosted(KIND, tl!("Paragraph Style Options"), &opening, name).previews(), opening };
|
||||
let dialog = ParaStyleOptions { inner: hosted(KIND, tl!("Paragraph Style Options"), &opening, name).previews(), opening, document };
|
||||
app.dialogs().ok_or("no window")?.with(|host| host.open(dialog));
|
||||
Ok(json!({"dialog": KIND}))
|
||||
}
|
||||
@@ -810,24 +811,19 @@ pub fn reset_panel(app: &mut VectorcraftApp) -> Result<Value, String> {
|
||||
|
||||
/// The dialog's frame work: previews the values, commits at OK, and rolls the preview back at Cancel.
|
||||
pub(crate) fn pump(app: &mut VectorcraftApp, _ctx: &egui::Context) {
|
||||
let Some(dialogs) = app.dialogs() else { return };
|
||||
let Some(frame) = dialogs.with(|host| host.get_mut::<ParaStyleOptions>().map(ParaStyleOptions::frame)) else {
|
||||
if matches!(dialogs.with(|host| host.take::<ParaStyleOptions>()), Some(DialogResult::Cancel)) {
|
||||
std::mem::take(&mut app.para_style_preview).cancel(app);
|
||||
}
|
||||
return;
|
||||
let refusals = Refusals {
|
||||
busy: "finish the active edit before applying Paragraph Style Options",
|
||||
elsewhere: "switch back to the document where Paragraph Style Options was opened",
|
||||
closed: "the document where Paragraph Style Options was opened has closed",
|
||||
};
|
||||
let live = std::mem::take(&mut app.para_style_preview);
|
||||
let (live, done) = drive(app, live, tl!("Paragraph Style Options"), "paraStyle.edit", &frame);
|
||||
app.para_style_preview = live;
|
||||
if let Some(done) = done {
|
||||
let answer = done.map(drop).map_err(|why| reason(&why));
|
||||
dialogs.with(|host| {
|
||||
if let Some(d) = host.get_mut::<ParaStyleOptions>() {
|
||||
d.hosted_mut().answer_ok(answer);
|
||||
}
|
||||
});
|
||||
}
|
||||
pump_in_opening_document::<ParaStyleOptions>(
|
||||
app,
|
||||
|app| &mut app.para_style_preview,
|
||||
|d| (d.document, d.frame()),
|
||||
ParaStyleOptions::hosted_mut,
|
||||
(tl!("Paragraph Style Options"), "paraStyle.edit"),
|
||||
&refusals,
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -297,6 +297,185 @@ fn preview_cancel_and_ok_update_the_paragraphs_in_one_undo_step() {
|
||||
assert_eq!(app.session.doc().unwrap().doc, changed);
|
||||
}
|
||||
|
||||
/// A paragraph style Body with the left indent `left_indent` and a selected text object that uses it.
|
||||
fn styled(app: &mut VectorcraftApp, left_indent: f64, text: &str) {
|
||||
let id = app.run("text.create", json!({"x": 10, "y": 40, "text": text})).unwrap()["id"].as_u64().unwrap();
|
||||
app.run("paraStyle.new", json!({"name": "Body", "attrs": {"left_indent": left_indent}})).unwrap();
|
||||
app.run("paraStyle.apply", json!({"name": "Body", "id": id})).unwrap();
|
||||
}
|
||||
|
||||
/// Two documents that each have a paragraph style Body with their own left indent, with Paragraph
|
||||
/// Style Options open on Body in the first.
|
||||
fn options_in_the_first_of_two_documents() -> VectorcraftApp {
|
||||
let mut app = app();
|
||||
styled(&mut app, 6.0, "Opening document");
|
||||
app.run("file.new", json!({"width": 300, "height": 200})).unwrap();
|
||||
styled(&mut app, 3.0, "Other document");
|
||||
app.run("document.activate", json!({"index": 0})).unwrap();
|
||||
open(&mut app, "Body");
|
||||
app
|
||||
}
|
||||
|
||||
/// Preview changes only the document the dialog opened on: while another document is active it
|
||||
/// leaves that document's Body as it is, it resumes on switching back, and Cancel restores the
|
||||
/// opening document.
|
||||
#[test]
|
||||
fn the_style_preview_stays_in_its_opening_document() {
|
||||
let mut app = options_in_the_first_of_two_documents();
|
||||
let opening = app.session.doc().unwrap().doc.clone();
|
||||
set(&app, "name", json!("Revised"));
|
||||
pump(&mut app);
|
||||
assert!(app.session.in_interaction());
|
||||
app.run("document.activate", json!({"index": 1})).unwrap();
|
||||
let other = app.session.doc().unwrap().doc.clone();
|
||||
set(&app, "left_indent", json!("12"));
|
||||
pump(&mut app);
|
||||
assert_eq!(app.session.doc().unwrap().doc, other, "Preview leaves the other document's Body style unchanged");
|
||||
assert!(!app.session.in_interaction());
|
||||
|
||||
app.run("document.activate", json!({"index": 0})).unwrap();
|
||||
pump(&mut app);
|
||||
assert!(app.session.doc().unwrap().doc.para_styles.iter().any(|style| style.name == "Revised"));
|
||||
cancel(&mut app);
|
||||
assert_eq!(app.session.doc().unwrap().doc, opening);
|
||||
}
|
||||
|
||||
/// OK with another document active is refused and keeps the dialog open; OK back in the opening
|
||||
/// document saves the edit there.
|
||||
#[test]
|
||||
fn a_style_options_confirmation_stays_in_its_opening_document() {
|
||||
let mut app = options_in_the_first_of_two_documents();
|
||||
set(&app, "preview", json!(false));
|
||||
set(&app, "name", json!("Revised"));
|
||||
app.run("document.activate", json!({"index": 1})).unwrap();
|
||||
let other = app.session.doc().unwrap().doc.clone();
|
||||
let closed = ok(&mut app);
|
||||
|
||||
assert_eq!(app.session.doc().unwrap().doc, other, "OK leaves the other document's Body style unchanged");
|
||||
assert!(!closed, "the same draft remains available");
|
||||
app.run("document.activate", json!({"index": 0})).unwrap();
|
||||
assert!(ok(&mut app));
|
||||
assert!(app.session.doc().unwrap().doc.para_styles.iter().any(|style| style.name == "Revised"));
|
||||
}
|
||||
|
||||
/// OK after the opening document has closed is refused and leaves the remaining document as it is.
|
||||
#[test]
|
||||
fn a_style_options_confirmation_is_refused_after_its_document_closes() {
|
||||
let mut app = options_in_the_first_of_two_documents();
|
||||
set(&app, "preview", json!(false));
|
||||
set(&app, "name", json!("Revised"));
|
||||
assert!(app.session.close_document(0));
|
||||
let other = app.session.doc().unwrap().doc.clone();
|
||||
assert!(!ok(&mut app), "the dialog stays open with the refusal");
|
||||
assert_eq!(app.session.doc().unwrap().doc, other);
|
||||
}
|
||||
|
||||
/// Cancel with another document active leaves that document's own gesture running.
|
||||
#[test]
|
||||
fn cancelling_style_options_leaves_the_other_documents_gesture() {
|
||||
let mut app = options_in_the_first_of_two_documents();
|
||||
set(&app, "name", json!("Revised"));
|
||||
pump(&mut app);
|
||||
assert!(app.session.in_interaction());
|
||||
app.run("document.activate", json!({"index": 1})).unwrap();
|
||||
app.session.begin_interaction("Another gesture").unwrap();
|
||||
app.session.preview("object.move", &json!({"dx": 20, "dy": 0})).unwrap();
|
||||
let gesture = app.session.doc().unwrap().doc.clone();
|
||||
|
||||
cancel(&mut app);
|
||||
|
||||
assert_eq!(app.session.doc().unwrap().doc, gesture);
|
||||
assert!(app.session.in_interaction());
|
||||
}
|
||||
|
||||
/// A gesture started in the opening document after switching away and back is not the dialog's:
|
||||
/// Preview pauses, OK is refused, and Cancel leaves the gesture running.
|
||||
#[test]
|
||||
fn switching_back_leaves_a_new_gesture_in_the_opening_document() {
|
||||
let mut app = options_in_the_first_of_two_documents();
|
||||
set(&app, "name", json!("Revised"));
|
||||
pump(&mut app);
|
||||
assert!(app.session.in_interaction());
|
||||
app.run("document.activate", json!({"index": 1})).unwrap();
|
||||
app.run("document.activate", json!({"index": 0})).unwrap();
|
||||
app.session.begin_interaction("Another gesture").unwrap();
|
||||
app.session.preview("object.move", &json!({"dx": 20, "dy": 0})).unwrap();
|
||||
let gesture = app.session.doc().unwrap().doc.clone();
|
||||
|
||||
set(&app, "left_indent", json!("12"));
|
||||
pump(&mut app);
|
||||
assert!(!ok(&mut app));
|
||||
assert_eq!(app.session.doc().unwrap().doc, gesture);
|
||||
cancel(&mut app);
|
||||
assert_eq!(app.session.doc().unwrap().doc, gesture);
|
||||
assert!(app.session.in_interaction());
|
||||
}
|
||||
|
||||
/// Paragraph Style Options open with a preview that a newer gesture of the same name replaced in
|
||||
/// the same document.
|
||||
fn options_with_a_newer_gesture() -> VectorcraftApp {
|
||||
let mut app = app();
|
||||
styled(&mut app, 6.0, "Opening document");
|
||||
open(&mut app, "Body");
|
||||
set(&app, "name", json!("Revised"));
|
||||
pump(&mut app);
|
||||
assert!(app.session.in_interaction());
|
||||
let resets = app.session.tool_resets();
|
||||
app.session.cancel_interaction().unwrap();
|
||||
app.session.begin_interaction("Paragraph Style Options").unwrap();
|
||||
app.session.preview("object.move", &json!({"dx": 20, "dy": 0})).unwrap();
|
||||
assert_eq!(app.session.tool_resets(), resets);
|
||||
app
|
||||
}
|
||||
|
||||
/// Cancel leaves a newer gesture in the same document running.
|
||||
#[test]
|
||||
fn cancelling_style_options_preserves_a_newer_gesture_in_the_same_document() {
|
||||
let mut app = options_with_a_newer_gesture();
|
||||
let gesture = app.session.doc().unwrap().doc.clone();
|
||||
cancel(&mut app);
|
||||
assert_eq!(app.session.doc().unwrap().doc, gesture);
|
||||
assert!(app.session.in_interaction());
|
||||
}
|
||||
|
||||
/// Preview does not replace a newer gesture in the same document.
|
||||
#[test]
|
||||
fn style_options_preview_preserves_a_newer_gesture_in_the_same_document() {
|
||||
let mut app = options_with_a_newer_gesture();
|
||||
let gesture = app.session.doc().unwrap().doc.clone();
|
||||
set(&app, "left_indent", json!("12"));
|
||||
pump(&mut app);
|
||||
assert_eq!(app.session.doc().unwrap().doc, gesture);
|
||||
assert!(app.session.in_interaction());
|
||||
}
|
||||
|
||||
/// OK is refused while a newer gesture is active in the same document, and records no undo step.
|
||||
#[test]
|
||||
fn style_options_confirmation_preserves_a_newer_gesture_in_the_same_document() {
|
||||
let mut app = options_with_a_newer_gesture();
|
||||
let gesture = app.session.doc().unwrap().doc.clone();
|
||||
let undo = app.session.doc().unwrap().history.undo.len();
|
||||
assert!(!ok(&mut app));
|
||||
assert_eq!(app.session.doc().unwrap().doc, gesture);
|
||||
assert!(app.session.in_interaction());
|
||||
assert_eq!(app.session.doc().unwrap().history.undo.len(), undo);
|
||||
}
|
||||
|
||||
/// The first preview does not replace a gesture that was already active when the dialog opened.
|
||||
#[test]
|
||||
fn a_first_style_preview_preserves_an_existing_gesture() {
|
||||
let mut app = app();
|
||||
styled(&mut app, 6.0, "Opening document");
|
||||
open(&mut app, "Body");
|
||||
app.session.begin_interaction("Paragraph Style Options").unwrap();
|
||||
app.session.preview("object.move", &json!({"dx": 20, "dy": 0})).unwrap();
|
||||
let gesture = app.session.doc().unwrap().doc.clone();
|
||||
set(&app, "left_indent", json!("12"));
|
||||
pump(&mut app);
|
||||
assert_eq!(app.session.doc().unwrap().doc, gesture);
|
||||
assert!(app.session.in_interaction());
|
||||
}
|
||||
|
||||
/// East Asian Composition Settings › Korean Line Break Anywhere sets the style's attribute, which
|
||||
/// its paragraphs take; unset, the style leaves it out and the paragraphs keep their own.
|
||||
#[test]
|
||||
|
||||
@@ -317,7 +317,7 @@ pub struct VectorcraftApp {
|
||||
/// The Character Style Options dialog's live preview.
|
||||
pub(crate) char_style_preview: dialogs::char_style_options::Preview,
|
||||
/// The Paragraph Style Options dialog's live preview.
|
||||
pub(crate) para_style_preview: dialogs::preview::LivePreview,
|
||||
pub(crate) para_style_preview: dialogs::char_style_options::Preview,
|
||||
/// The Justification dialog, while it is open.
|
||||
pub(crate) justification: Option<dialogs::justification::Open>,
|
||||
/// The Bullets and Numbering dialog's live preview.
|
||||
|
||||
@@ -14127,6 +14127,8 @@ the Paragraph Styles panel, or Paragraph Style Options… in its menu, does the
|
||||
`paraStyle.edit {name, to, attrs}`, which takes the same arguments as `charStyle.edit` and replaces the style's
|
||||
name and attributes in one undo step; the paragraphs that use the style keep their local overrides. OK with no field
|
||||
changed records no undo step, and Preview updates the paragraphs while the dialog is open (Cancel restores them).
|
||||
The dialog previews and saves changes only in the document where it opened. If another edit is active in
|
||||
that document, preview pauses and OK reports an error until that edit ends. Cancel rolls back only the dialog's own preview.
|
||||
The `paraStyleOptions` dialog exposes `name`, `section` (`general`, `basic`, `tabs`, `composition`, `hyphenation`,
|
||||
`justification` or `eastAsian`) and `preview`, and these fields:
|
||||
|
||||
|
||||
@@ -890,7 +890,7 @@ since 2026-10-01.
|
||||
- **Character Style Options, Character Color and OpenType Features:** Character Style Options and New Character Style set a style's fill and stroke (None or a document swatch; a global swatch stays linked, with a Tint from 0% to 100%), stroke Weight, Overprint Fill and Overprint Stroke, and its Figure, Position, Standard and Discretionary Ligatures, Contextual, Stylistic and Titling Alternates, Swash, Ordinals, Fractions and Stylistic Sets 1 to 20; text that uses the style takes them and keeps its local overrides, and editing a global swatch later updates the style and its text. Empty controls remain unset, an explicit None, off, Default Figure or Default Position stays distinct from unset, each stylistic set is on, off or unset, a gradient or pattern paint stays until another paint is chosen, a changed OpenType control keeps the style's other feature tags, and each section's Reset Panel clears only its own attributes. Public references: [Character and paragraph styles](https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html) and [Format text with OpenType features](https://helpx.adobe.com/illustrator/desktop/design-with-text/special-characters-glyphs/format-text-with-opentype-features.html).
|
||||
- **Opening style options from the style panels:** a double-click on a user character style's row opens its Character Style Options (`ui.charStyleOptions`), as the panel menu's item does; a paragraph style's row opens its Paragraph Style Options (`ui.paraStyleOptions`), as the panel menu's item does. A single click still applies the style, the second click of the double-click does not apply it again, and the built-in Normal style opens no dialog. Test `panels::text_styles::tests::double_clicking_a_character_style_row_opens_its_options`.
|
||||
- **Character Style Options window size:** the dialog keeps a fixed width wide enough for the widest tab's controls and scrolls its sections inside a window shorter than them, so it stays on screen and its OK and Cancel buttons stay visible; the width is the same in every section and the height follows the section. Test `dialogs::char_style_options::tests::the_sections_scroll_in_a_window_shorter_than_the_general_list`.
|
||||
- **Paragraph Style Options, General, Basic Paragraph Formats, Composition, Hyphenation and Justification:** Paragraph Style Options (`ui.paraStyleOptions`, `paraStyle.edit`) and New Paragraph Style edit a style's name, Alignment, left, right and first-line indents, space before and after, composer, Roman Hanging Punctuation, Hyphenation with its options, and Word Spacing, Letter Spacing, Glyph Scaling, Auto Leading and Single Word Justification; paragraphs that use the style take them and keep their local overrides. Fields left as they were keep the style's values, empty fields remain unset, Reset Panel clears only the selected formatting section's attributes and is unavailable in General, Preview can be canceled without changing history, OK saves one undo step, and out-of-range values keep the dialog open. The character formats of a paragraph style are not in the dialog yet. Public reference: [Character and paragraph styles](https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html).
|
||||
- **Paragraph Style Options, General, Basic Paragraph Formats, Composition, Hyphenation and Justification:** Paragraph Style Options (`ui.paraStyleOptions`, `paraStyle.edit`) and New Paragraph Style edit a style's name, Alignment, left, right and first-line indents, space before and after, composer, Roman Hanging Punctuation, Hyphenation with its options, and Word Spacing, Letter Spacing, Glyph Scaling, Auto Leading and Single Word Justification; paragraphs that use the style take them and keep their local overrides. Fields left as they were keep the style's values, empty fields remain unset, Reset Panel clears only the selected formatting section's attributes and is unavailable in General, Preview can be canceled without changing history, the dialog previews and saves changes only in its opening document and preserves other active edits in that document, OK saves one undo step, and out-of-range values keep the dialog open. The character formats of a paragraph style are not in the dialog yet. Public reference: [Character and paragraph styles](https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html).
|
||||
- **Paragraph Style Options, Tabs:** the Tabs section of Paragraph Style Options and New Paragraph Style lists a style's tab stops and edits the selected stop's Alignment (Left, Center, Right or Decimal), position (X:, or Y: for vertical type), Leader and Align On character; Add, Delete Tab and Clear All Tabs add a stop 36 pt past the furthest, remove the selected one, or leave the style with no stops. OK sorts the stops by position, keeps the stop edited last of two at one position, and saves one undo step; Preview and Cancel restore the paragraphs, Reset Panel removes the style's tabs, and a position outside 0 to 100000 pt, a leader longer than 8 characters or more than 256 stops keeps the dialog open. Tests `dialogs::para_style_options::tests::tabs_section_edits_the_style_stops` and `tabs_preview_cancel_and_ok_update_the_paragraphs_in_one_undo_step`. Public reference: [Character and paragraph styles](https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html).
|
||||
- **Text styles redefined to the defaults:** New and Redefine Character Style and Paragraph Style capture every attribute of the selected text, including those at their defaults (Auto kerning, Roman baseline alignment, the default Hyphenation options, the Every-line Composer, no tab stops), and `charStyle.setAttrs` and `paraStyle.setAttrs` keep an attribute set to its default value. After a redefinition, text whose value still equals the old definition's takes the new value, a default included; local overrides stay, and text that still has the old value of an attribute the new definition leaves out goes back to the Normal style's value. The style panels show "+" only where the text differs from its style, including type with Auto alignment. Public reference: [Character and paragraph styles](https://web.archive.org/web/20260825113735/https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html).
|
||||
- **Text styles dragged onto the panel's buttons:** a style dragged from the Character Styles or Paragraph Styles panel onto Create New Style is copied (`charStyle.duplicate`, `paraStyle.duplicate`, which name the copy `<name> copy`) and the copy is highlighted; dragged onto Delete it is deleted (`charStyle.delete`, `paraStyle.delete`); the Normal style is not deleted. Each drop is one undo step. Public reference: [Character and paragraph styles](https://web.archive.org/web/20261015081534/https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html).
|
||||
|
||||
Reference in new issue
Block a user