@prenta/admin 0.94.0 → 0.95.1

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 (60) hide show
  1. package/CHANGELOG.md +55 -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/page-section-editor.test.js +39 -1
  5. package/dist/__tests__/views/page-section-editor.test.js.map +1 -1
  6. package/dist/__tests__/views/post-section-editor.test.js +15 -1
  7. package/dist/__tests__/views/post-section-editor.test.js.map +1 -1
  8. package/dist/__tests__/views/section-edit-form.render.test.d.ts +2 -0
  9. package/dist/__tests__/views/section-edit-form.render.test.d.ts.map +1 -0
  10. package/dist/__tests__/views/section-edit-form.render.test.js +124 -0
  11. package/dist/__tests__/views/section-edit-form.render.test.js.map +1 -0
  12. package/dist/__tests__/views/section-inspector-media.test.js +1 -1
  13. package/dist/__tests__/views/section-inspector-media.test.js.map +1 -1
  14. package/dist/__tests__/views/section-inspector-repeater.render.test.js +2 -1
  15. package/dist/__tests__/views/section-inspector-repeater.render.test.js.map +1 -1
  16. package/dist/components/CanvasEditTip.js +1 -1
  17. package/dist/components/CanvasEditTip.js.map +1 -1
  18. package/dist/prenta-admin.css +1 -1
  19. package/dist/views/page-editor/PageSectionEditor.d.ts.map +1 -1
  20. package/dist/views/page-editor/PageSectionEditor.js +30 -11
  21. package/dist/views/page-editor/PageSectionEditor.js.map +1 -1
  22. package/dist/views/page-editor/SectionEditForm.d.ts +42 -0
  23. package/dist/views/page-editor/SectionEditForm.d.ts.map +1 -0
  24. package/dist/views/page-editor/SectionEditForm.js +48 -0
  25. package/dist/views/page-editor/SectionEditForm.js.map +1 -0
  26. package/dist/views/page-editor/SectionInspector.d.ts +0 -20
  27. package/dist/views/page-editor/SectionInspector.d.ts.map +1 -1
  28. package/dist/views/page-editor/SectionInspector.js +5 -223
  29. package/dist/views/page-editor/SectionInspector.js.map +1 -1
  30. package/dist/views/page-editor/SectionsPanel.d.ts +10 -1
  31. package/dist/views/page-editor/SectionsPanel.d.ts.map +1 -1
  32. package/dist/views/page-editor/SectionsPanel.js +11 -5
  33. package/dist/views/page-editor/SectionsPanel.js.map +1 -1
  34. package/dist/views/page-editor/section-fields.d.ts +43 -0
  35. package/dist/views/page-editor/section-fields.d.ts.map +1 -0
  36. package/dist/views/page-editor/section-fields.js +236 -0
  37. package/dist/views/page-editor/section-fields.js.map +1 -0
  38. package/dist/views/page-editor/sections/ArticleBodySection.js +1 -1
  39. package/dist/views/page-editor/sections/ArticleBodySection.js.map +1 -1
  40. package/dist/views/post-editor/PostEditorCanvas.js +1 -1
  41. package/dist/views/post-editor/PostEditorCanvas.js.map +1 -1
  42. package/dist/views/post-editor/PostSectionEditor.d.ts.map +1 -1
  43. package/dist/views/post-editor/PostSectionEditor.js +15 -10
  44. package/dist/views/post-editor/PostSectionEditor.js.map +1 -1
  45. package/package.json +3 -3
  46. package/src/__tests__/lib/page-editor-service-api.test.ts +44 -0
  47. package/src/__tests__/views/page-section-editor.test.tsx +58 -1
  48. package/src/__tests__/views/post-section-editor.test.tsx +29 -1
  49. package/src/__tests__/views/section-edit-form.render.test.tsx +162 -0
  50. package/src/__tests__/views/section-inspector-media.test.ts +1 -1
  51. package/src/__tests__/views/section-inspector-repeater.render.test.tsx +2 -1
  52. package/src/components/CanvasEditTip.tsx +3 -3
  53. package/src/views/page-editor/PageSectionEditor.tsx +35 -25
  54. package/src/views/page-editor/SectionEditForm.tsx +161 -0
  55. package/src/views/page-editor/SectionInspector.tsx +7 -552
  56. package/src/views/page-editor/SectionsPanel.tsx +70 -14
  57. package/src/views/page-editor/section-fields.tsx +563 -0
  58. package/src/views/page-editor/sections/ArticleBodySection.tsx +1 -1
  59. package/src/views/post-editor/PostEditorCanvas.tsx +1 -1
  60. package/src/views/post-editor/PostSectionEditor.tsx +22 -27
@@ -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
@@ -442,8 +436,11 @@ export function PostSectionEditor({
442
436
 
443
437
  const handleSelectSection = useCallback((id: string | null, fieldPath?: string) => {
444
438
  setSeoOpen(false)
445
- setSelectedId(id)
446
439
  setPendingFocusPath(fieldPath ?? null)
440
+ // Toggles, because selection is now disclosure — see the note on the page
441
+ // editor's copy. A `fieldPath` means the site preview is pointing at a
442
+ // specific field, which must open rather than toggle.
443
+ setSelectedId((current) => (fieldPath ? id : current === id ? null : id))
447
444
  }, [])
448
445
 
449
446
  const handleCanvasEdit = useCallback(
@@ -590,8 +587,6 @@ export function PostSectionEditor({
590
587
  )
591
588
  }
592
589
 
593
- const selected = post.sections.find((s) => s.id === selectedId) ?? null
594
-
595
590
  // Sections whose type has no registered definition (seed/code-owned, e.g.
596
591
  // `opal-*`). They are preserved verbatim on save but can't be edited here.
597
592
  const unmanagedTypes = Array.from(
@@ -677,6 +672,20 @@ export function PostSectionEditor({
677
672
  canEdit={canEdit}
678
673
  onSelect={handleSelectSection}
679
674
  onToggleVisibility={handleToggleVisibility}
675
+ // Same inline editor as the page editor. The post editor still has
676
+ // its own standalone panel rather than the rail (followup 20), but
677
+ // where the FORM lives is a separate question from what contains
678
+ // the list, and the answer is the same on both screens.
679
+ renderEditor={(section) => (
680
+ <SectionEditForm
681
+ section={section}
682
+ canEdit={canEdit}
683
+ onContentChange={handleContentChange}
684
+ onMetaChange={handleMetaChange}
685
+ postBody={post.body}
686
+ onPostBodyChange={handlePostBodyChange}
687
+ />
688
+ )}
680
689
  />
681
690
 
682
691
  <div className="flex-1 overflow-hidden">
@@ -707,20 +716,6 @@ export function PostSectionEditor({
707
716
  )}
708
717
  </div>
709
718
 
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
719
  {seoOpen && (
725
720
  <EditorSeoAside
726
721
  entityType="post"