Skip to content

Preserve entity selection across viewer/editor and unify continuous editing #98

@JohnRDOrazio

Description

@JohnRDOrazio

Problem

Three related UX issues in the viewer ↔ editor navigation flow:

  1. "Open Editor" loses selection — Clicking "Open Editor" on the viewer page (/projects/{id}) navigates to /projects/{id}/editor without passing the classIri query parameter, so the currently viewed class/property/individual is lost and no entity is selected in the editor.

  2. No "Close Editor" to return to viewer — Once in the editor, there is no obvious way to return to the read-only viewer with the current selection preserved. The user must manually navigate back.

  3. "Continuous editing" toggle is redundant — The continuous editing mode (auto-enter edit mode on class selection) is functionally identical to simply being "in the editor". Meanwhile, the existing continuousEditing user preference could serve a better purpose: controlling whether the ontology opens in view mode or edit mode by default.

Current Implementation

Component File Issue
"Open Editor" button app/projects/[id]/page.tsx:259-266 <Link href={/projects/${projectId}/editor}> — no classIri param
ContinuousEditingToggle components/editor/ContinuousEditingToggle.tsx Separate toggle that duplicates what "being in the editor" already means
continuousEditing preference lib/stores/editorModeStore.ts:43 Stored in localStorage via zustand persist; defaults to false
URL param restoration app/projects/[id]/editor/page.tsx:92-96 Already supports classIri param — just not passed by "Open Editor"
Auto-enter edit logic components/editor/ClassDetailPanel.tsx:205-229 Checks continuousEditing to auto-enter edit mode on class selection

Proposed Changes

1. Pass selected entity IRI when navigating to editor

In app/projects/[id]/page.tsx, update the "Open Editor" link to include the current selection:

<Link href={`/projects/${projectId}/editor${selectedIri ? `?classIri=${encodeURIComponent(selectedIri)}` : ''}`}>

The editor page already handles classIri restoration (lines 92-96), so this is essentially a one-line fix.

2. Replace "Open Editor" with a toggle: "Open Editor" / "Close Editor"

  • In the viewer (/projects/{id}): keep the "Open Editor" button as-is (with the fix from step 1)
  • In the editor (/projects/{id}/editor): add a "Close Editor" button that navigates back to /projects/{id} with the classIri param preserved
  • Both buttons should use the Pencil / Eye icons to clearly indicate the mode switch

3. Remove the ContinuousEditingToggle button from the editor toolbar

Delete components/editor/ContinuousEditingToggle.tsx and remove its usage from the editor page toolbar (line 837 in app/projects/[id]/editor/page.tsx).

4. Repurpose the continuousEditing preference

Rename or redefine the continuousEditing preference to mean: "open ontology in edit mode by default" (for users with edit capabilities).

  • If true: navigating to a project opens the editor page directly (or the viewer auto-redirects to editor)
  • If false (default): navigating to a project opens the read-only viewer
  • Move the toggle to user/project settings rather than a toolbar button
  • The existing ClassDetailPanel auto-enter logic can be simplified: when in the editor, the user is always in edit mode for the selected entity (no need to check continuousEditing per-entity)

5. Simplify detail panel edit state management

Since being in the editor now implies edit mode:

  • ClassDetailPanel, PropertyDetailPanel, IndividualDetailPanel can default isEditing = true when in the editor context
  • The per-entity "Edit" button in the detail panels becomes unnecessary in editor mode (but remains useful if we keep a read-only preview somewhere)
  • cancelledIriRef tracking can be removed

Acceptance Criteria

  • Clicking "Open Editor" from the viewer preserves the currently selected class/property/individual
  • Editor has a "Close Editor" button that returns to the viewer with selection preserved
  • The ContinuousEditingToggle button is removed from the editor toolbar
  • The continuousEditing user preference determines whether ontologies open in view or edit mode by default
  • The preference toggle is accessible in user or project settings
  • Detail panels in the editor auto-enter edit mode without requiring an extra click
  • Keyboard shortcut for toggling between view/edit mode (nice-to-have)

Notes

  • The classIri URL param mechanism already works in both the viewer and editor pages, so preserving selection is straightforward
  • The editorMode ("standard" vs "developer") is a separate concept and should not be affected
  • Suggestion mode behavior should be preserved as-is

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions