dotCMS / dotCMS/core

UVE inline editing: add `action` API (draft | publish) to SDK editable-text components

Open
#35,552 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale Team : Scout
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Description

Today, all inline-editing entry points always fire the default Save workflow action — there's no API to choose. We want a simple action API with two values: draft (default — current behavior, system Save) and publish (fires the system Publish workflow action).

Affected APIs:

  • @dotcms/reactDotCMSEditableText (core-web/libs/sdk/react/src/lib/next/components/DotCMSEditableText/DotCMSEditableText.tsx)
  • @dotcms/angularDotCMSEditableTextComponent (core-web/libs/sdk/angular/src/lib/components/dotcms-editable-text/dotcms-editable-text.component.ts)
  • @dotcms/uveinitInlineEditing / enableBlockEditorInline (core-web/libs/sdk/uve/src/lib/editor/public.ts)

Proposed API

// React
<DotCMSEditableText
  contentlet={contentlet}
  fieldName="title"
  mode="full"
  format="text"
  action="publish"  // NEW — "draft" (default) | "publish"
/>
<!-- Angular -->
<dotcms-editable-text
  [contentlet]="contentlet"
  fieldName="title"
  mode="full"
  format="text"
  action="publish"></dotcms-editable-text>
// @dotcms/uve
import { initInlineEditing, enableBlockEditorInline } from '@dotcms/uve';

initInlineEditing('BLOCK_EDITOR', {
  inode,
  language,
  contentType,
  fieldName,
  content,
  action: 'publish' // NEW — "draft" (default) | "publish"
});

enableBlockEditorInline(contentlet, 'body', { action: 'publish' });

Shared type:

type DotCMSEditableTextAction = 'draft' | 'publish'; // default: 'draft'

All three SDKs forward action in the UPDATE_CONTENTLET_INLINE_EDITING postMessage payload. The UVE host (edit-ema's dot-uve-actions-handler.service.ts) reads it and fires the matching workflow action; when action is omitted or 'draft', behavior is unchanged.

Acceptance Criteria

  • Add action?: 'draft' | 'publish' (default 'draft') to:
    • DotCMSEditableText prop (React)
    • DotCMSEditableTextComponent input (Angular)
    • InlineEditEventData in @dotcms/uve so initInlineEditing and enableBlockEditorInline accept it
  • Extend the UPDATE_CONTENTLET_INLINE_EDITING payload type in @dotcms/types / @dotcms/uve to include action.
  • UVE host handler (dot-uve-actions-handler.service.ts) honors action: 'publish' fires the system Publish workflow action; otherwise (or when omitted) keeps the current saveContentlet Save behavior.
  • Keep both initInlineEditing and enableBlockEditorInline for now (back-compat + ergonomics), but make sure the new action prop lands on both so they stay in sync. If we want to simplify, deprecate enableBlockEditorInline in favor of a unified initInlineEditing(contentlet, fieldName, opts) and remove it in the next major.
  • Add deprecation notes for enableBlockEditorInline:
    • JSDoc @deprecated tag on the function in core-web/libs/sdk/uve/src/lib/editor/public.ts pointing users to the unified initInlineEditing(contentlet, fieldName, opts) form.
    • TypeScript @deprecated so IDEs surface a strikethrough on usage.
    • "Deprecated" entry in sdk/uve CHANGELOG and README, including a migration snippet (before/after).
    • Note the planned removal target (next major) in the deprecation message.
  • Unit tests for both code paths (draft vs publish) in:
    • DotCMSEditableText.test.tsx
    • dotcms-editable-text.component.spec.ts
    • uve SDK public.spec.ts (for initInlineEditing / enableBlockEditorInline)
    • dot-uve-actions-handler.service.spec.ts
  • Backward compatibility: omitting action produces the exact same behavior as today.
  • Document the new field in sdk/react, sdk/angular, and sdk/uve READMEs/CHANGELOG.

Priority

Medium

Additional Context

Related: #22241 added data-workflow-fire for legacy VTL inline-edit. This ticket scopes a minimal, opinionated draft | publish API for the modern SDK surface.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the listed React, Angular, and UVE entry points, then run the named component, SDK, and dot-uve-actions-handler.service.spec.ts tests. Trace the UPDATE_CONTENTLET_INLINE_EDITING payload through dot-uve-actions-handler.service.ts. Done means draft or omitted action preserves Save behavior, publish triggers Publish, both UVE paths stay compatible, and the requested deprecation and documentation updates are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, react, typescript
Domain
api, documentation, frontend, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.