feat(context): transition guards — addons can veto context switches #386
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Allow addons to register guard callbacks that can prevent context transitions. Critical for addons managing locks or unsaved state (e.g., silo preventing a context switch while a document has uncommitted changes).
Current state (MISSING)
EditingContextResolverresolves and applies unconditionally. No guard/veto callbacks. NocanTransitionTo()hook. Addons cannot prevent or delay context switches.Proposed API
reasonstring is surfaced to the user via a warning dialog(allowed: bool, reason: str | None)Implementation notes
addTransitionGuard()/removeTransitionGuard()toEditingContextResolverstd::function<std::pair<bool, QString>(EditingContext, EditingContext)>applyContext()before any toolbar/breadcrumb changesQMessageBox::warningwith the reasonadd_transition_guard(),remove_transition_guard()inkindred_sdk/context.pyRoadmap
v0.2.0 — Context System