@prenta/admin 0.94.0 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/__tests__/lib/page-editor-service-api.test.js +37 -0
  3. package/dist/__tests__/lib/page-editor-service-api.test.js.map +1 -1
  4. package/dist/__tests__/views/section-edit-form.render.test.d.ts +2 -0
  5. package/dist/__tests__/views/section-edit-form.render.test.d.ts.map +1 -0
  6. package/dist/__tests__/views/section-edit-form.render.test.js +124 -0
  7. package/dist/__tests__/views/section-edit-form.render.test.js.map +1 -0
  8. package/dist/__tests__/views/section-inspector-media.test.js +1 -1
  9. package/dist/__tests__/views/section-inspector-media.test.js.map +1 -1
  10. package/dist/__tests__/views/section-inspector-repeater.render.test.js +2 -1
  11. package/dist/__tests__/views/section-inspector-repeater.render.test.js.map +1 -1
  12. package/dist/components/CanvasEditTip.js +1 -1
  13. package/dist/components/CanvasEditTip.js.map +1 -1
  14. package/dist/prenta-admin.css +1 -1
  15. package/dist/views/page-editor/PageSectionEditor.d.ts.map +1 -1
  16. package/dist/views/page-editor/PageSectionEditor.js +16 -10
  17. package/dist/views/page-editor/PageSectionEditor.js.map +1 -1
  18. package/dist/views/page-editor/SectionEditForm.d.ts +42 -0
  19. package/dist/views/page-editor/SectionEditForm.d.ts.map +1 -0
  20. package/dist/views/page-editor/SectionEditForm.js +48 -0
  21. package/dist/views/page-editor/SectionEditForm.js.map +1 -0
  22. package/dist/views/page-editor/SectionInspector.d.ts +0 -20
  23. package/dist/views/page-editor/SectionInspector.d.ts.map +1 -1
  24. package/dist/views/page-editor/SectionInspector.js +5 -223
  25. package/dist/views/page-editor/SectionInspector.js.map +1 -1
  26. package/dist/views/page-editor/SectionsPanel.d.ts +10 -1
  27. package/dist/views/page-editor/SectionsPanel.d.ts.map +1 -1
  28. package/dist/views/page-editor/SectionsPanel.js +11 -5
  29. package/dist/views/page-editor/SectionsPanel.js.map +1 -1
  30. package/dist/views/page-editor/section-fields.d.ts +43 -0
  31. package/dist/views/page-editor/section-fields.d.ts.map +1 -0
  32. package/dist/views/page-editor/section-fields.js +236 -0
  33. package/dist/views/page-editor/section-fields.js.map +1 -0
  34. package/dist/views/page-editor/sections/ArticleBodySection.js +1 -1
  35. package/dist/views/page-editor/sections/ArticleBodySection.js.map +1 -1
  36. package/dist/views/post-editor/PostEditorCanvas.js +1 -1
  37. package/dist/views/post-editor/PostEditorCanvas.js.map +1 -1
  38. package/dist/views/post-editor/PostSectionEditor.d.ts.map +1 -1
  39. package/dist/views/post-editor/PostSectionEditor.js +11 -9
  40. package/dist/views/post-editor/PostSectionEditor.js.map +1 -1
  41. package/package.json +3 -3
  42. package/src/__tests__/lib/page-editor-service-api.test.ts +44 -0
  43. package/src/__tests__/views/section-edit-form.render.test.tsx +162 -0
  44. package/src/__tests__/views/section-inspector-media.test.ts +1 -1
  45. package/src/__tests__/views/section-inspector-repeater.render.test.tsx +2 -1
  46. package/src/components/CanvasEditTip.tsx +3 -3
  47. package/src/views/page-editor/PageSectionEditor.tsx +22 -24
  48. package/src/views/page-editor/SectionEditForm.tsx +161 -0
  49. package/src/views/page-editor/SectionInspector.tsx +7 -552
  50. package/src/views/page-editor/SectionsPanel.tsx +70 -14
  51. package/src/views/page-editor/section-fields.tsx +563 -0
  52. package/src/views/page-editor/sections/ArticleBodySection.tsx +1 -1
  53. package/src/views/post-editor/PostEditorCanvas.tsx +1 -1
  54. package/src/views/post-editor/PostSectionEditor.tsx +18 -26
@@ -42,7 +42,7 @@ export function ArticleBodySection({
42
42
  <p className="text-muted-foreground text-base leading-relaxed italic">
43
43
  {source === 'field'
44
44
  ? "This will show the post's Body content."
45
- : 'Add body copy in the inspector.'}
45
+ : 'Add body copy in the section list.'}
46
46
  </p>
47
47
  )}
48
48
  </div>
@@ -129,7 +129,7 @@ function EmptyBody({ onAddSection }: { onAddSection?: () => void }) {
129
129
  </span>
130
130
  <p className="text-muted-foreground text-sm">
131
131
  {onAddSection
132
- ? 'The header is set by the template. Add body sections to build out this post. Hover sections for a light outline, click to select, and edit in the inspector — or use Site preview to click text and images in place.'
132
+ ? 'The header is set by the template. Add body sections to build out this post. Hover sections for a light outline, click to open its editor in the section list — or use Site preview to click text and images in place.'
133
133
  : 'This post’s template renders no body sections. Layout is design-owned — sections come from the template in code. Pick a different template in Post settings, or edit the template itself.'}
134
134
  </p>
135
135
  {onAddSection && (
@@ -20,7 +20,6 @@ import {
20
20
  updateSectionContent,
21
21
  updateSectionContentAtPath,
22
22
  updateSectionMeta,
23
- updateSectionSettings,
24
23
  validatePost,
25
24
  type EditorPost,
26
25
  type PostHeaderConfig,
@@ -34,7 +33,6 @@ import {
34
33
  createPreviewToken,
35
34
  } from '../../lib/preview-link.js'
36
35
  import { usePublicSiteUrl } from '../../hooks/usePublicSiteUrl.js'
37
- import type { SectionSettings } from '../page-editor/section-types.js'
38
36
  import {
39
37
  hasCanvasRenderer,
40
38
  useAdminSectionRenderers,
@@ -45,7 +43,7 @@ import { EditorTopBar, type SaveState } from '../page-editor/EditorTopBar.js'
45
43
  import { SitePreviewFrame } from '../page-editor/SitePreviewFrame.js'
46
44
  import { useSitePreview } from '../page-editor/useSitePreview.js'
47
45
  import { SectionsPanel } from '../page-editor/SectionsPanel.js'
48
- import { SectionInspector } from '../page-editor/SectionInspector.js'
46
+ import { SectionEditForm } from '../page-editor/SectionEditForm.js'
49
47
  import { ValidationSummary } from '../page-editor/ValidationSummary.js'
50
48
  import { resolveDefaultSitePreview } from '../../lib/editor-preview.js'
51
49
  import { computeLiveSeoScore } from '../../lib/editor-seo-content.js'
@@ -271,13 +269,9 @@ export function PostSectionEditor({
271
269
  },
272
270
  [selectedId, mutateSections],
273
271
  )
274
- const handleSettingsChange = useCallback(
275
- (patch: Partial<SectionSettings>) => {
276
- if (!selectedId) return
277
- mutateSections((s) => updateSectionSettings(s, selectedId, patch))
278
- },
279
- [selectedId, mutateSections],
280
- )
272
+ // No `handleSettingsChange`: background, spacing, anchor and CSS class are
273
+ // template-authored (docs/design-owned-sections.md). Values round-trip on
274
+ // save untouched; the post TEMPLATE editor still edits them.
281
275
  const handleMetaChange = useCallback(
282
276
  (patch: { name?: string; internalLabel?: string }) => {
283
277
  if (!selectedId) return
@@ -590,8 +584,6 @@ export function PostSectionEditor({
590
584
  )
591
585
  }
592
586
 
593
- const selected = post.sections.find((s) => s.id === selectedId) ?? null
594
-
595
587
  // Sections whose type has no registered definition (seed/code-owned, e.g.
596
588
  // `opal-*`). They are preserved verbatim on save but can't be edited here.
597
589
  const unmanagedTypes = Array.from(
@@ -677,6 +669,20 @@ export function PostSectionEditor({
677
669
  canEdit={canEdit}
678
670
  onSelect={handleSelectSection}
679
671
  onToggleVisibility={handleToggleVisibility}
672
+ // Same inline editor as the page editor. The post editor still has
673
+ // its own standalone panel rather than the rail (followup 20), but
674
+ // where the FORM lives is a separate question from what contains
675
+ // the list, and the answer is the same on both screens.
676
+ renderEditor={(section) => (
677
+ <SectionEditForm
678
+ section={section}
679
+ canEdit={canEdit}
680
+ onContentChange={handleContentChange}
681
+ onMetaChange={handleMetaChange}
682
+ postBody={post.body}
683
+ onPostBodyChange={handlePostBodyChange}
684
+ />
685
+ )}
680
686
  />
681
687
 
682
688
  <div className="flex-1 overflow-hidden">
@@ -707,20 +713,6 @@ export function PostSectionEditor({
707
713
  )}
708
714
  </div>
709
715
 
710
- {selected && !seoOpen && (
711
- <SectionInspector
712
- section={selected}
713
- canEdit={canEdit}
714
- onClose={() => setSelectedId(null)}
715
- onContentChange={handleContentChange}
716
- onSettingsChange={handleSettingsChange}
717
- onMetaChange={handleMetaChange}
718
- onToggleVisibility={() => handleToggleVisibility(selected.id)}
719
- postBody={post.body}
720
- onPostBodyChange={handlePostBodyChange}
721
- />
722
- )}
723
-
724
716
  {seoOpen && (
725
717
  <EditorSeoAside
726
718
  entityType="post"