Skip to content

calternal_plugin_notes::canvas_text

Checked Note/Task text synchronization for linked Canvas drawings (#977, §60). The authenticated editor supplies authority for the item. Canvas ownership grants no item access. Compare title and prose under the Notes writer lock; preserve properties, workflow state and the generated element backlink.

Source: crates/plugins/notes/src/canvas_text.rs

pub struct CanvasItemText

Authorized drawing text. This projection is never an authorization token.

Fields

  • pub owner: String
  • pub path: String
  • pub title: String
  • pub body: String
  • pub editable: bool
  • pub status: Option<String>: Task workflow state remains separate from title and prose.

Implements: Clone, Debug

Source: crates/plugins/notes/src/canvas_text.rs:22

pub struct CanvasTextWrite

A durable item save supplies the Files adapter with its original identity.

Fields

  • pub owner: String
  • pub path: String
  • pub before: FileFingerprint

Source: crates/plugins/notes/src/canvas_text.rs:33

pub enum CanvasTextAccess

Current security-state result; callers must resolve this again before writes.

Variants

  • Denied
  • Viewer
  • Editor

Implements: Clone, Copy, PartialEq, Eq

Source: crates/plugins/notes/src/canvas_text.rs:14

pub async fn read<F, Fut>(
root: &Root,
db: &Db,
author: &str,
link: &str,
authorize: F,
) -> Result<CanvasItemText>
where
F: Fn(String, String) -> Fut,
Fut: Future<Output = CanvasTextAccess>,

Read under the editing User’s current grant. The owner shortcut belongs to the item owner, never the owner of the Canvas containing the link (#977).

Source: crates/plugins/notes/src/canvas_text.rs:114

pub async fn sync<F, Fut>(
root: &Root,
db: &Db,
author: &str,
link: &str,
before: &str,
after: &str,
authorize: F,
) -> Result<Option<CanvasTextWrite>>
where
F: Fn(String, String) -> Fut,
Fut: Future<Output = CanvasTextAccess>,

Compare drawing text with the current item while holding its writer lock. A matching projection is a read-only refresh, not an item write. Recheck the edit grant after the baseline read so revocation during an edit fails closed.

Source: crates/plugins/notes/src/canvas_text.rs:164