Ga naar hoofdinhoud

CnOpenBuildEditButton

The universal in-app edit entry point (ADR-041). A Conduction-orange icon button bearing the OpenBuild glyph, designed to sit immediately to the right of a page's refresh control. It renders nothing unless available is true, and is deliberately OpenBuild-agnostic — it never imports OpenBuild app code and never calls useAppStatus; availability is passed in (wire it from useOpenBuildEditAvailability).

Its action menu drives a shared useManifestEditor instance: Edit page ⇄ Save page, Add widget… (disabled unless editing), Edit menu…, Edit sidebar…. Save emits @save(delta) with the minimal manifest delta (via diffManifest).

Import

import { CnOpenBuildEditButton } from '@conduction/nextcloud-vue'

Usage

<CnOpenBuildEditButton
:available="available"
:editor="editor"
:page-id="currentPageId"
@save="onSaveDelta" />
import { useOpenBuildEditAvailability, useManifestEditor } from '@conduction/nextcloud-vue'
const { available } = useOpenBuildEditAvailability()
const editor = useManifestEditor(manifestRef, { persist: persistDelta })

Props

PropTypeDefaultDescription
availableBooleanfalseWhether OpenBuild is available to this user. When falsey the component renders nothing. Wire from useOpenBuildEditAvailability().
editorObjectnullThe shared useManifestEditor instance ({ editing, working, dirty, enter, cancel, save }). Falls back to the injected cnManifestEditor.
pageIdString''The active page's id, forwarded to CnEditSidebarModal so it edits the right page's sidebar config.

Events

EventPayloadDescription
savedelta: objectEmitted after a successful save with the minimal delta.
editEmitted when edit mode is entered.
cancelEmitted when edits are discarded.
add-widgetEmitted when "Add widget…" is activated in edit mode (wired to CnAddWidgetModal by the cn-widget-library change).
edit-menuEmitted when the menu editor opens.
edit-sidebarEmitted when the sidebar editor opens.