Skip to content

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

T: editorial notes — anchored, flagged on screen, never printed; Notes panel

Brandon Thomas3b462285c5ab
diff --git a/ROADMAP.md b/ROADMAP.md
index c7b11f1c5..b0b8f8a45 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -47,6 +47,7 @@ DesignCraft aims at full Adobe InDesign parity — and to be better: faster, ope
- Object ▸ Generate QR Code (`object.qrCode`: web link, text, SMS, email, business card; vector modules as a compound path, into a frame or re-encoded in place).
- Conditional text (`condition.new/options/delete/apply/list`, Conditional Text panel): hidden conditions drop their text from layout and exports, indicators underline on screen, IDML Condition/AppliedConditions.
- Endnotes (`endnote.insert/edit/delete/list/options`, Type ▸ Insert Endnote): references number through the document, the endnote frame on a new last page lists them under a heading; IDML keeps the listed text only.
+- Editorial notes (`note.new/edit/delete/convertToText/list`, Notes panel): anchored in text, flagged on screen, never printed or exported.
- Drag and drop text editing: drag selected text to move it (Alt copies) with its formatting (`text.release`).
- Image Import Options: place any page of a multi-page PDF (`file.place {pdfPage}`; the app asks which page), shown on screen and embedded as that page in PDF export.
- Define Lists: named numbered lists that continue across stories in page order (`list.define`, paragraph `listName` / `startAt`), round-tripped through IDML; `null` in `type.para` / `type.char` now removes an override.
diff --git a/crates/compose/src/shape.rs b/crates/compose/src/shape.rs
index c3a7580fa..80238b259 100644
--- a/crates/compose/src/shape.rs
+++ b/crates/compose/src/shape.rs
@@ -318,6 +318,7 @@ fn shape_run(
| story::TABLE_ANCHOR
| designcraft_doc::FOOTNOTE_REF
| designcraft_doc::ENDNOTE_REF
+ | designcraft_doc::NOTE_MARK
| designcraft_doc::XREF_MARK
| designcraft_doc::ANCHOR_MARK
| designcraft_doc::INDEX_MARK
diff --git a/crates/doc/src/endnotes.rs b/crates/doc/src/endnotes.rs
index 6fad0c686..5e8e54099 100644
--- a/crates/doc/src/endnotes.rs
+++ b/crates/doc/src/endnotes.rs
@@ -18,6 +18,19 @@ use crate::story::{BASIC_PARAGRAPH, CharFormat, ParaFormat, Story};
/// Endnote reference character (the number shown in the text).
pub const ENDNOTE_REF: char = '\u{E00F}';
+/// Editorial note anchor (Type › Notes): never printed; the note's text is in
+/// [`Story::editorial`], one per anchor in text order.
+pub const NOTE_MARK: char = '\u{E010}';
+
+/// An editorial note.
+#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct EditorialNote {
+ pub id: u64,
+ pub author: String,
+ pub text: String,
+}
+
/// Document Endnote Options.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", default)]
diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs
index cd5f05711..4397d9649 100644
--- a/crates/doc/src/lib.rs
+++ b/crates/doc/src/lib.rs
@@ -36,7 +36,7 @@ pub use attrs::*;
pub use designcraft_color as color;
pub use designcraft_geom as geom;
pub use edit::{ItemLoc, ItemPath, SpreadRef, item_hit as edit_hit};
-pub use endnotes::{ENDNOTE_REF, EndnoteOptions};
+pub use endnotes::{ENDNOTE_REF, EditorialNote, EndnoteOptions, NOTE_MARK};
pub use ids::*;
pub use index::{INDEX_MARK, IndexRef};
pub use item::*;
diff --git a/crates/doc/src/story.rs b/crates/doc/src/story.rs
index 152b83e80..abf693644 100644
--- a/crates/doc/src/story.rs
+++ b/crates/doc/src/story.rs
@@ -113,6 +113,9 @@ pub struct Story {
/// Anchored objects, one per [`crate::anchored::OBJECT_MARK`] in text order.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub objects: Vec<Arc<crate::anchored::AnchoredObject>>,
+ /// Editorial notes, one per [`crate::endnotes::NOTE_MARK`] in text order.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ pub editorial: Vec<Arc<crate::endnotes::EditorialNote>>,
}
impl Story {
@@ -131,6 +134,7 @@ impl Story {
xrefs: Vec::new(),
index_refs: Vec::new(),
objects: Vec::new(),
+ editorial: Vec::new(),
}
}
@@ -224,7 +228,13 @@ impl Story {
let k = self.endnotes_before(pos);
self.endnotes_inserted(k, erefs);
}
- if text.contains([crate::xref::ANCHOR_MARK, crate::xref::XREF_MARK, crate::index::INDEX_MARK, crate::anchored::OBJECT_MARK]) {
+ if text.contains([
+ crate::xref::ANCHOR_MARK,
+ crate::xref::XREF_MARK,
+ crate::index::INDEX_MARK,
+ crate::anchored::OBJECT_MARK,
+ crate::endnotes::NOTE_MARK,
+ ]) {
self.marks_inserted(pos, text);
}
// Paragraph formats: each new '\n' splits the current paragraph; the new paragraphs copy it.
diff --git a/crates/doc/src/xref.rs b/crates/doc/src/xref.rs
index bdaca7ee1..a76a6473a 100644
--- a/crates/doc/src/xref.rs
+++ b/crates/doc/src/xref.rs
@@ -208,6 +208,14 @@ impl Story {
self.index_refs.insert(k + i, Arc::new(crate::index::IndexRef::default()));
}
}
+ let n = text.matches(crate::endnotes::NOTE_MARK).count();
+ if n > 0 {
+ let k = self.marks_before(crate::endnotes::NOTE_MARK, pos);
+ for i in 0..n {
+ let id = self.editorial.iter().map(|x| x.id).max().unwrap_or(0) + 1;
+ self.editorial.insert((k + i).min(self.editorial.len()), Arc::new(crate::endnotes::EditorialNote { id, ..Default::default() }));
+ }
+ }
let n = text.matches(crate::anchored::OBJECT_MARK).count();
if n > 0 {
let k = self.marks_before(crate::anchored::OBJECT_MARK, pos);
@@ -227,7 +235,7 @@ impl Story {
/// Keep anchor/xref lists in step with a deletion of `a..b` (before it happens).
pub(crate) fn marks_deleted(&mut self, a: usize, b: usize) {
- for mark in [ANCHOR_MARK, XREF_MARK, crate::index::INDEX_MARK, crate::anchored::OBJECT_MARK] {
+ for mark in [ANCHOR_MARK, XREF_MARK, crate::index::INDEX_MARK, crate::anchored::OBJECT_MARK, crate::endnotes::NOTE_MARK] {
let n = self.text[a..b].matches(mark).count();
if n == 0 {
continue;
@@ -239,6 +247,8 @@ impl Story {
self.xrefs.drain(k..(k + n).min(self.xrefs.len()));
} else if mark == crate::index::INDEX_MARK {
self.index_refs.drain(k..(k + n).min(self.index_refs.len()));
+ } else if mark == crate::endnotes::NOTE_MARK {
+ self.editorial.drain(k..(k + n).min(self.editorial.len()));
} else {
self.objects.drain(k..(k + n).min(self.objects.len()));
}
@@ -265,6 +275,12 @@ impl Story {
while self.index_refs.len() < n {
self.index_refs.push(Arc::new(crate::index::IndexRef::default()));
}
+ let n = self.text.matches(crate::endnotes::NOTE_MARK).count();
+ self.editorial.truncate(n);
+ while self.editorial.len() < n {
+ let id = self.editorial.iter().map(|x| x.id).max().unwrap_or(0) + 1;
+ self.editorial.push(Arc::new(crate::endnotes::EditorialNote { id, ..Default::default() }));
+ }
let n = self.text.matches(crate::anchored::OBJECT_MARK).count();
self.objects.truncate(n);
while self.objects.len() < n {
@@ -281,6 +297,10 @@ impl Story {
if o != self.objects.len() {
return Err(format!("story {}: {o} object marks for {} anchored objects", self.id.0, self.objects.len()));
}
+ let e = self.text.matches(crate::endnotes::NOTE_MARK).count();
+ if e != self.editorial.len() {
+ return Err(format!("story {}: {e} note marks for {} notes", self.id.0, self.editorial.len()));
+ }
let i = self.text.matches(crate::index::INDEX_MARK).count();
if i != self.index_refs.len() {
return Err(format!("story {}: {i} index marks for {} references", self.id.0, self.index_refs.len()));
diff --git a/crates/engine/src/cmd/editorial.rs b/crates/engine/src/cmd/editorial.rs
new file mode 100644
index 000000000..6cee420ed
--- /dev/null
+++ b/crates/engine/src/cmd/editorial.rs
@@ -0,0 +1,135 @@
+//! Type › Notes: editorial notes anchored in text (never printed or exported).
+
+use std::sync::Arc;
+
+use designcraft_doc::{EditorialNote, NOTE_MARK, StoryId};
+use serde_json::{Value, json};
+
+use super::{CommandSpec, bad, cmd, has_doc, has_text, ok, str_param};
+use crate::Result;
+
+pub fn specs() -> Vec<CommandSpec> {
+ vec![
+ cmd!("note.new", "New Note", ["Type", "Notes"], None, "{text, author?} — at the insertion point → {story, id}", has_text, |s, p| {
+ let st = s.doc()?;
+ let ts = st.selection.text.ok_or_else(|| bad("note.new", "place the insertion point in text"))?;
+ if ts.cell.is_some() {
+ return Err(bad("note.new", "notes go in story text"));
+ }
+ let text = str_param(p, "text").unwrap_or("").to_string();
+ let author = str_param(p, "author").unwrap_or("").to_string();
+ let at = ts.anchor.max(ts.focus);
+ s.edit(|d, sel| {
+ let story = d.story_mut(ts.story).ok_or_else(|| bad("note.new", "no such story"))?;
+ let fmt = story.char_format_at(at).clone();
+ story.insert_with(at, &NOTE_MARK.to_string(), fmt);
+ let k = story.text[..at].matches(NOTE_MARK).count();
+ let n = Arc::make_mut(&mut story.editorial[k]);
+ (n.text, n.author) = (text, author);
+ let id = n.id;
+ if let Some(t) = &mut sel.text {
+ let c = at + NOTE_MARK.len_utf8();
+ (t.anchor, t.focus) = (c, c);
+ }
+ Ok(json!({"story": ts.story.0, "id": id}))
+ })
+ }),
+ cmd!("note.edit", "Edit Note", [], None, "{story, id, text?, author?}", has_doc, |s, p| {
+ let (sid, id) = target(p)?;
+ let (text, author) = (str_param(p, "text").map(str::to_string), str_param(p, "author").map(str::to_string));
+ s.edit(|d, _| {
+ let st = d.story_mut(sid).ok_or_else(|| bad("note.edit", "no such story"))?;
+ let n = st.editorial.iter_mut().find(|n| n.id == id).ok_or_else(|| bad("note.edit", format!("no note {id}")))?;
+ let n = Arc::make_mut(n);
+ if let Some(t) = text {
+ n.text = t;
+ }
+ if let Some(a) = author {
+ n.author = a;
+ }
+ st.rev += 1;
+ ok()
+ })
+ }),
+ cmd!("note.delete", "Delete Note", ["Type", "Notes"], None, "{story, id}", has_doc, |s, p| {
+ let (sid, id) = target(p)?;
+ s.edit(|d, _| {
+ let st = d.story_mut(sid).ok_or_else(|| bad("note.delete", "no such story"))?;
+ let at = anchor(st, id).ok_or_else(|| bad("note.delete", format!("no note {id}")))?;
+ st.delete(at..at + NOTE_MARK.len_utf8());
+ ok()
+ })
+ }),
+ cmd!(
+ "note.convertToText",
+ "Convert Note to Text",
+ ["Type", "Notes"],
+ None,
+ "{story, id} — the note's text replaces its anchor",
+ has_doc,
+ |s, p| {
+ let (sid, id) = target(p)?;
+ s.edit(|d, _| {
+ let st = d.story_mut(sid).ok_or_else(|| bad("note.convertToText", "no such story"))?;
+ let at = anchor(st, id).ok_or_else(|| bad("note.convertToText", format!("no note {id}")))?;
+ let text = st.editorial.iter().find(|n| n.id == id).map(|n| n.text.clone()).unwrap_or_default();
+ st.replace(at..at + NOTE_MARK.len_utf8(), &text);
+ ok()
+ })
+ }
+ ),
+ cmd!(query "note.list", "Notes", [], None, "{} → [{story, id, at, author, text}] in story order", has_doc, |s, _| {
+ let d = &s.doc()?.doc;
+ let mut out = Vec::new();
+ for st in d.stories.values() {
+ for (k, (at, _)) in st.text.match_indices(NOTE_MARK).enumerate() {
+ if let Some(n) = st.editorial.get(k) {
+ out.push(json!({"story": st.id.0, "id": n.id, "at": at, "author": n.author, "text": n.text}));
+ }
+ }
+ }
+ Ok(Value::Array(out))
+ }),
+ ]
+}
+
+fn target(p: &Value) -> Result<(StoryId, u64)> {
+ let sid = p.get("story").and_then(Value::as_u64).ok_or_else(|| bad("note", "`story` required"))?;
+ let id = p.get("id").and_then(Value::as_u64).ok_or_else(|| bad("note", "`id` required"))?;
+ Ok((StoryId(sid), id))
+}
+
+/// Byte offset of note `id`'s anchor.
+fn anchor(st: &designcraft_doc::Story, id: u64) -> Option<usize> {
+ let k = st.editorial.iter().position(|n: &Arc<EditorialNote>| n.id == id)?;
+ st.text.match_indices(NOTE_MARK).nth(k).map(|(i, _)| i)
+}
+
+#[cfg(test)]
+mod tests {
+ use serde_json::json;
+
+ use crate::Session;
+
+ #[test]
+ fn notes_are_anchored_unprinted_and_convertible() {
+ let mut s = Session::new();
+ s.execute("file.new", &json!({})).unwrap();
+ let r = s.execute("frame.create", &json!({"rect": [72, 72, 400, 300], "content": "text", "text": "Draft copy."})).unwrap();
+ let sid = designcraft_doc::StoryId(r["story"].as_u64().unwrap());
+ let end_x = |s: &Session| s.cache.get(&s.doc().unwrap().doc, sid, None).frames[0].lines[0].end_x;
+ let before = end_x(&s);
+ s.execute("text.select", &json!({"story": r["story"], "anchor": 5, "focus": 5})).unwrap();
+ let n = s.execute("note.new", &json!({"text": "check this", "author": "Ed"})).unwrap();
+ assert!((end_x(&s) - before).abs() < 1e-6, "a note takes no space");
+ let list = s.execute("note.list", &json!({})).unwrap();
+ assert_eq!(list[0]["text"], "check this");
+ assert_eq!(list[0]["at"], 5);
+ let txt = s.execute("file.exportText", &json!({"story": r["story"]})).unwrap();
+ assert_eq!(txt["text"], "Draft copy.", "not exported");
+ s.execute("note.edit", &json!({"story": n["story"], "id": n["id"], "text": " (checked)"})).unwrap();
+ s.execute("note.convertToText", &json!({"story": n["story"], "id": n["id"]})).unwrap();
+ assert_eq!(s.doc().unwrap().doc.stories[&sid].text, "Draft (checked) copy.");
+ assert!(s.doc().unwrap().doc.stories[&sid].editorial.is_empty());
+ }
+}
diff --git a/crates/engine/src/cmd/mod.rs b/crates/engine/src/cmd/mod.rs
index 76767f305..5c2ef84dc 100644
--- a/crates/engine/src/cmd/mod.rs
+++ b/crates/engine/src/cmd/mod.rs
@@ -6,6 +6,7 @@ mod captions;
mod conditions;
mod datamerge;
mod edit;
+mod editorial;
mod endnotes;
mod export;
mod file;
@@ -135,6 +136,7 @@ pub fn command_specs() -> &'static [CommandSpec] {
v.extend(export::specs());
v.extend(edit::specs());
v.extend(endnotes::specs());
+ v.extend(editorial::specs());
v.extend(object::specs());
v.extend(anchors::specs());
v.extend(paths::specs());
diff --git a/crates/idml/src/export.rs b/crates/idml/src/export.rs
index fab6fc019..674ca3073 100644
--- a/crates/idml/src/export.rs
+++ b/crates/idml/src/export.rs
@@ -1776,6 +1776,8 @@ impl<'a> Ex<'a> {
csrs.push(src);
self.xref_sources.push((me, x.target));
}
+ } else if ch == designcraft_doc::NOTE_MARK {
+ // Editorial notes aren't written to IDML yet.
} else if ch == designcraft_doc::ENDNOTE_REF {
// Endnotes aren't written to IDML yet: the endnote frame keeps their text
// (numbers included) and the references are left out.
diff --git a/crates/idml/src/import.rs b/crates/idml/src/import.rs
index d94e2793f..176ec97b8 100644
--- a/crates/idml/src/import.rs
+++ b/crates/idml/src/import.rs
@@ -1238,6 +1238,7 @@ impl<'r> Importer<'r> {
xrefs: xref_list,
index_refs: index_refs.into_iter().map(Arc::new).collect(),
objects: objects.into_iter().map(Arc::new).collect(),
+ editorial: Vec::new(),
};
st.fix_notes();
st.fix_marks();
diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs
index a3d2b6811..410cf162c 100644
--- a/crates/render/src/lib.rs
+++ b/crates/render/src/lib.rs
@@ -107,6 +107,8 @@ pub struct RenderOptions {
pub highlight_custom_tracking: bool,
/// Conditional text indicators: an underline in each condition's colour (screen view).
pub condition_indicators: bool,
+ /// Editorial note anchors (screen view).
+ pub note_indicators: bool,
/// View › Display Performance.
pub quality: DisplayQuality,
/// Preferences › Appearance of Black: show 100% K as rich (pure) black instead of the
@@ -143,6 +145,7 @@ impl Default for RenderOptions {
highlight_keeps: false,
highlight_custom_tracking: false,
condition_indicators: false,
+ note_indicators: false,
quality: DisplayQuality::High,
rich_black: false,
overprint_preview: false,
diff --git a/crates/render/src/text.rs b/crates/render/src/text.rs
index fc57274a2..8baf9ee3c 100644
--- a/crates/render/src/text.rs
+++ b/crates/render/src/text.rs
@@ -229,6 +229,25 @@ impl Renderer {
}
}
}
+ if f.opts.note_indicators
+ && let Some(st) = f.doc.story(cs.story).filter(|st| !st.editorial.is_empty())
+ {
+ // A small flag at each note anchor, in the notes' amber.
+ ctx.set_transform(m);
+ ctx.set_paint(peniko::Color::from_rgb8(232, 160, 32));
+ for l in &ft.lines {
+ for g in l.glyphs.iter().filter(|g| st.text.get(g.byte..).is_some_and(|t| t.starts_with(designcraft_doc::NOTE_MARK))) {
+ let h = l.ascent.max(4.0);
+ let mut p = BezPath::new();
+ p.move_to((g.x - h * 0.25, l.baseline - h));
+ p.line_to((g.x + h * 0.25, l.baseline - h));
+ p.line_to((g.x, l.baseline - h * 0.55));
+ p.close_path();
+ ctx.fill_path(&p);
+ ctx.fill_rect(&kurbo::Rect::new(g.x - h * 0.03, l.baseline - h * 0.6, g.x + h * 0.03, l.baseline + l.descent * 0.5));
+ }
+ }
+ }
if f.opts.condition_indicators && !f.doc.conditions.is_empty() && cs.styles.iter().any(|s| s.condition.is_some()) {
ctx.set_transform(m);
let px = 1.0 / m.determinant().abs().sqrt().max(1e-9);
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index a0a743dd5..4a625638a 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -313,6 +313,7 @@ fn render_texture(app: &mut DesignApp, ctx: &egui::Context, rect: Rect, xf: &Xf,
highlight_missing_fonts: !preview && app.session.prefs.highlight_substituted_fonts,
highlight_hj: !preview && app.session.prefs.highlight_hj,
condition_indicators: !preview,
+ note_indicators: !preview,
highlight_keeps: !preview && app.session.prefs.highlight_keeps,
highlight_custom_tracking: !preview && app.session.prefs.highlight_custom_tracking,
quality: app.ui.display_quality,
@@ -422,6 +423,7 @@ fn patch_texture(app: &mut DesignApp, layout: &CanvasLayout, ppp: f64, doc_key:
highlight_missing_fonts: !preview && app.session.prefs.highlight_substituted_fonts,
highlight_hj: !preview && app.session.prefs.highlight_hj,
condition_indicators: !preview,
+ note_indicators: !preview,
highlight_keeps: !preview && app.session.prefs.highlight_keeps,
highlight_custom_tracking: !preview && app.session.prefs.highlight_custom_tracking,
quality: app.ui.display_quality,
diff --git a/crates/ui-egui/src/dock.rs b/crates/ui-egui/src/dock.rs
index 30ba798ad..9e98064be 100644
--- a/crates/ui-egui/src/dock.rs
+++ b/crates/ui-egui/src/dock.rs
@@ -31,6 +31,7 @@ pub const ICON_PANELS: &[(&str, &str, &str)] = &[
("preflight", "Preflight", "panel-preflight"),
("attributes", "Attributes", "panel-attributes"),
("conditions", "Conditional Text", "panel-conditions"),
+ ("notes", "Notes", "panel-notes"),
];
pub fn show(app: &mut DesignApp, ui: &mut egui::Ui) {
@@ -167,6 +168,7 @@ pub fn panel_body(app: &mut DesignApp, ui: &mut egui::Ui, id: &str) {
"preflight" => panels::properties::preflight_panel(app, ui),
"attributes" => panels::properties::attributes_panel(app, ui),
"conditions" => panels::conditions::show(app, ui),
+ "notes" => panels::notes::show(app, ui),
"table" => panels::table::show(app, ui),
_ => panels::properties::info_panel(app, ui),
}
diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs
index 4885eaf64..478a38ad5 100644
--- a/crates/ui-egui/src/icons.rs
+++ b/crates/ui-egui/src/icons.rs
@@ -310,6 +310,11 @@ pub fn paint(p: &Painter, r: Rect, name: &str, c: Color32) {
pen.circle(10.0, 10.0, 7.0);
pen.line(&[(6.5, 10.0), (9.0, 12.5), (13.5, 7.5)]);
}
+ "panel-notes" => {
+ // A note with a folded corner.
+ pen.closed(&[(4.0, 3.0), (16.0, 3.0), (16.0, 13.0), (12.0, 17.0), (4.0, 17.0)]);
+ pen.line(&[(16.0, 13.0), (12.0, 13.0), (12.0, 17.0)]);
+ }
"panel-conditions" => {
// Text lines, one marked.
pen.line(&[(3.0, 6.0), (17.0, 6.0)]);
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index 0dc41dd78..8fb6f7a73 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -465,6 +465,7 @@ pub const MENUS: &[(&str, &[&str])] = &[
"-",
">Type & Tables",
"ui:window.panel|Conditional Text|{\"panel\": \"conditions\"}",
+ "ui:window.panel|Notes|{\"panel\": \"notes\"}",
"ui:window.panel|Glyphs|{\"panel\": \"glyphs\"}",
"<",
">Utilities",
diff --git a/crates/ui-egui/src/panels/mod.rs b/crates/ui-egui/src/panels/mod.rs
index 904ac3f31..647c5ba45 100644
--- a/crates/ui-egui/src/panels/mod.rs
+++ b/crates/ui-egui/src/panels/mod.rs
@@ -3,6 +3,7 @@
pub mod conditions;
pub mod glyphs;
pub mod layers;
+pub mod notes;
pub mod pages;
pub mod properties;
pub mod styles;
diff --git a/crates/ui-egui/src/panels/notes.rs b/crates/ui-egui/src/panels/notes.rs
new file mode 100644
index 000000000..b8ddf4e6d
--- /dev/null
+++ b/crates/ui-egui/src/panels/notes.rs
@@ -0,0 +1,49 @@
+//! Notes panel: the document's editorial notes; add one at the text cursor, go to, convert or
+//! delete a note.
+
+use serde_json::json;
+
+use crate::DesignApp;
+use crate::theme::Tokens;
+
+pub fn show(app: &mut DesignApp, ui: &mut egui::Ui) {
+ let t = Tokens::get(ui.ctx());
+ let Ok(list) = app.session.execute("note.list", &json!({})) else { return };
+ let notes = list.as_array().cloned().unwrap_or_default();
+ let has_text = app.session.active().is_some_and(|d| d.selection.text.is_some());
+ let id = egui::Id::new("new_note_text");
+ let mut draft: String = ui.data(|d| d.get_temp(id)).unwrap_or_default();
+ ui.add(egui::TextEdit::multiline(&mut draft).hint_text("Note text").desired_rows(2).desired_width(f32::INFINITY));
+ if ui.add_enabled(has_text && !draft.trim().is_empty(), egui::Button::new("New Note at Cursor")).clicked() {
+ match app.run("note.new", json!({"text": draft.trim()})) {
+ Ok(_) => draft.clear(),
+ Err(e) => app.status(format!("Notes: {e}")),
+ }
+ }
+ ui.data_mut(|d| d.insert_temp(id, draft));
+ ui.separator();
+ if notes.is_empty() {
+ ui.label(egui::RichText::new("No notes in this document.").size(11.0).color(t.text_dim));
+ }
+ for n in notes {
+ let (story, nid, at) = (n["story"].clone(), n["id"].clone(), n["at"].as_u64().unwrap_or(0));
+ ui.group(|ui| {
+ let author = n["author"].as_str().unwrap_or("");
+ if !author.is_empty() {
+ ui.label(egui::RichText::new(author).size(10.5).color(t.text_dim));
+ }
+ ui.label(n["text"].as_str().unwrap_or(""));
+ ui.horizontal(|ui| {
+ if ui.small_button("Go To").clicked() {
+ let _ = app.run("text.select", json!({"story": story, "anchor": at, "focus": at + 3}));
+ }
+ if ui.small_button("Convert to Text").clicked() {
+ let _ = app.run("note.convertToText", json!({"story": story, "id": nid}));
+ }
+ if ui.small_button("Delete").clicked() {
+ let _ = app.run("note.delete", json!({"story": story, "id": nid}));
+ }
+ });
+ });
+ }
+}
diff --git a/docs/parity.md b/docs/parity.md
index ff09079bc..939b949ab 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -11,7 +11,7 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia
|---|---|---|---|---|---|
| P0 | 102 | 99 | 3 | 0 | 99% |
| P1 | 97 | 75 | 20 | 2 | 88% |
-| P2 | 76 | 17 | 13 | 46 | 31% |
+| P2 | 76 | 18 | 13 | 45 | 32% |
| Area | Parity |
|---|---|
@@ -23,7 +23,7 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia
| Fill, stroke, colour | 88% |
| Effects & transparency | 62% |
| Placing & links | 82% |
-| Type & text frames | 91% |
+| Type & text frames | 92% |
| Typography | 88% |
| Styles | 92% |
| Tables | 88% |
@@ -189,7 +189,7 @@ Open P0 items: Preferences, Vector/page formats (PDF/AI/SVG/EPS place), Export t
| Type & text frames | Vertical type | P2 | M |
| Type & text frames | Story Editor | P1 | D |
| Type & text frames | Track Changes | P2 | M |
-| Type & text frames | Notes | P2 | M |
+| Type & text frames | Notes | P2 | D |
| Type & text frames | Find/Change | P0 | D |
| Type & text frames | Find Font | P0 | D |
| Type & text frames | Spell checking | P1 | D |