@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.
- package/CHANGELOG.md +55 -0
- package/dist/__tests__/lib/page-editor-service-api.test.js +37 -0
- package/dist/__tests__/lib/page-editor-service-api.test.js.map +1 -1
- package/dist/__tests__/views/page-section-editor.test.js +39 -1
- package/dist/__tests__/views/page-section-editor.test.js.map +1 -1
- package/dist/__tests__/views/post-section-editor.test.js +15 -1
- package/dist/__tests__/views/post-section-editor.test.js.map +1 -1
- package/dist/__tests__/views/section-edit-form.render.test.d.ts +2 -0
- package/dist/__tests__/views/section-edit-form.render.test.d.ts.map +1 -0
- package/dist/__tests__/views/section-edit-form.render.test.js +124 -0
- package/dist/__tests__/views/section-edit-form.render.test.js.map +1 -0
- package/dist/__tests__/views/section-inspector-media.test.js +1 -1
- package/dist/__tests__/views/section-inspector-media.test.js.map +1 -1
- package/dist/__tests__/views/section-inspector-repeater.render.test.js +2 -1
- package/dist/__tests__/views/section-inspector-repeater.render.test.js.map +1 -1
- package/dist/components/CanvasEditTip.js +1 -1
- package/dist/components/CanvasEditTip.js.map +1 -1
- package/dist/prenta-admin.css +1 -1
- package/dist/views/page-editor/PageSectionEditor.d.ts.map +1 -1
- package/dist/views/page-editor/PageSectionEditor.js +30 -11
- package/dist/views/page-editor/PageSectionEditor.js.map +1 -1
- package/dist/views/page-editor/SectionEditForm.d.ts +42 -0
- package/dist/views/page-editor/SectionEditForm.d.ts.map +1 -0
- package/dist/views/page-editor/SectionEditForm.js +48 -0
- package/dist/views/page-editor/SectionEditForm.js.map +1 -0
- package/dist/views/page-editor/SectionInspector.d.ts +0 -20
- package/dist/views/page-editor/SectionInspector.d.ts.map +1 -1
- package/dist/views/page-editor/SectionInspector.js +5 -223
- package/dist/views/page-editor/SectionInspector.js.map +1 -1
- package/dist/views/page-editor/SectionsPanel.d.ts +10 -1
- package/dist/views/page-editor/SectionsPanel.d.ts.map +1 -1
- package/dist/views/page-editor/SectionsPanel.js +11 -5
- package/dist/views/page-editor/SectionsPanel.js.map +1 -1
- package/dist/views/page-editor/section-fields.d.ts +43 -0
- package/dist/views/page-editor/section-fields.d.ts.map +1 -0
- package/dist/views/page-editor/section-fields.js +236 -0
- package/dist/views/page-editor/section-fields.js.map +1 -0
- package/dist/views/page-editor/sections/ArticleBodySection.js +1 -1
- package/dist/views/page-editor/sections/ArticleBodySection.js.map +1 -1
- package/dist/views/post-editor/PostEditorCanvas.js +1 -1
- package/dist/views/post-editor/PostEditorCanvas.js.map +1 -1
- package/dist/views/post-editor/PostSectionEditor.d.ts.map +1 -1
- package/dist/views/post-editor/PostSectionEditor.js +15 -10
- package/dist/views/post-editor/PostSectionEditor.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/lib/page-editor-service-api.test.ts +44 -0
- package/src/__tests__/views/page-section-editor.test.tsx +58 -1
- package/src/__tests__/views/post-section-editor.test.tsx +29 -1
- package/src/__tests__/views/section-edit-form.render.test.tsx +162 -0
- package/src/__tests__/views/section-inspector-media.test.ts +1 -1
- package/src/__tests__/views/section-inspector-repeater.render.test.tsx +2 -1
- package/src/components/CanvasEditTip.tsx +3 -3
- package/src/views/page-editor/PageSectionEditor.tsx +35 -25
- package/src/views/page-editor/SectionEditForm.tsx +161 -0
- package/src/views/page-editor/SectionInspector.tsx +7 -552
- package/src/views/page-editor/SectionsPanel.tsx +70 -14
- package/src/views/page-editor/section-fields.tsx +563 -0
- package/src/views/page-editor/sections/ArticleBodySection.tsx +1 -1
- package/src/views/post-editor/PostEditorCanvas.tsx +1 -1
- 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
|
|
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
|
|
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 {
|
|
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
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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"
|