@actuate-media/cms-admin 0.76.6 → 0.77.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.
- package/CHANGELOG.md +33 -0
- package/dist/__tests__/lib/preview-link.test.d.ts +2 -0
- package/dist/__tests__/lib/preview-link.test.d.ts.map +1 -0
- package/dist/__tests__/lib/preview-link.test.js +27 -0
- package/dist/__tests__/lib/preview-link.test.js.map +1 -0
- package/dist/__tests__/views/editor-top-bar.render.test.js +19 -0
- package/dist/__tests__/views/editor-top-bar.render.test.js.map +1 -1
- package/dist/__tests__/views/form-editor.render.test.d.ts +2 -0
- package/dist/__tests__/views/form-editor.render.test.d.ts.map +1 -0
- package/dist/__tests__/views/form-editor.render.test.js +146 -0
- package/dist/__tests__/views/form-editor.render.test.js.map +1 -0
- package/dist/actuate-admin.css +1 -1
- package/dist/lib/forms-service.d.ts +15 -3
- package/dist/lib/forms-service.d.ts.map +1 -1
- package/dist/lib/forms-service.js.map +1 -1
- package/dist/lib/preview-link.d.ts +7 -0
- package/dist/lib/preview-link.d.ts.map +1 -1
- package/dist/lib/preview-link.js +16 -0
- package/dist/lib/preview-link.js.map +1 -1
- package/dist/views/FormEditor.d.ts.map +1 -1
- package/dist/views/FormEditor.js +211 -116
- package/dist/views/FormEditor.js.map +1 -1
- package/dist/views/page-editor/EditorTopBar.d.ts.map +1 -1
- package/dist/views/page-editor/EditorTopBar.js +6 -1
- package/dist/views/page-editor/EditorTopBar.js.map +1 -1
- package/dist/views/page-editor/PageSectionEditor.d.ts.map +1 -1
- package/dist/views/page-editor/PageSectionEditor.js +14 -1
- package/dist/views/page-editor/PageSectionEditor.js.map +1 -1
- package/dist/views/post-editor/PostSectionEditor.d.ts.map +1 -1
- package/dist/views/post-editor/PostSectionEditor.js +11 -1
- package/dist/views/post-editor/PostSectionEditor.js.map +1 -1
- package/package.json +9 -9
- package/src/__tests__/lib/preview-link.test.ts +39 -0
- package/src/__tests__/views/editor-top-bar.render.test.tsx +22 -0
- package/src/__tests__/views/form-editor.render.test.tsx +186 -0
- package/src/lib/forms-service.ts +16 -1
- package/src/lib/preview-link.ts +21 -0
- package/src/views/FormEditor.tsx +655 -510
- package/src/views/page-editor/EditorTopBar.tsx +11 -4
- package/src/views/page-editor/PageSectionEditor.tsx +18 -0
- package/src/views/post-editor/PostSectionEditor.tsx +15 -0
|
@@ -134,6 +134,9 @@ export function EditorTopBar({
|
|
|
134
134
|
const previewLabel = structural
|
|
135
135
|
? 'Preview structure (custom sections show placeholders)'
|
|
136
136
|
: 'Preview page'
|
|
137
|
+
// For a published document the external-link button opens the LIVE page (no
|
|
138
|
+
// preview token); otherwise it opens a token-gated preview of the draft.
|
|
139
|
+
const isLive = status === 'PUBLISHED'
|
|
137
140
|
|
|
138
141
|
const publishBlocked = !canPublish || !publishReady || publishing || saveState === 'saving'
|
|
139
142
|
const publishTitle = publishing
|
|
@@ -310,18 +313,22 @@ export function EditorTopBar({
|
|
|
310
313
|
<button
|
|
311
314
|
type="button"
|
|
312
315
|
onClick={onViewOnSite}
|
|
313
|
-
title=
|
|
316
|
+
title={
|
|
317
|
+
isLive
|
|
318
|
+
? 'Open the live published page in a new tab'
|
|
319
|
+
: 'Open the draft on your public site — the real design preview'
|
|
320
|
+
}
|
|
314
321
|
className="border-border text-foreground hover:bg-accent inline-flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-sm font-medium transition-colors"
|
|
315
322
|
>
|
|
316
323
|
<ExternalLink className="h-3.5 w-3.5" aria-hidden />
|
|
317
|
-
View on site
|
|
324
|
+
{isLive ? 'View live' : 'View on site'}
|
|
318
325
|
</button>
|
|
319
326
|
) : (
|
|
320
327
|
<button
|
|
321
328
|
type="button"
|
|
322
329
|
onClick={onViewOnSite}
|
|
323
|
-
aria-label=
|
|
324
|
-
title=
|
|
330
|
+
aria-label={isLive ? 'View live page' : 'View draft on site'}
|
|
331
|
+
title={isLive ? 'View live page' : 'View draft on site'}
|
|
325
332
|
className="text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg p-2"
|
|
326
333
|
>
|
|
327
334
|
<ExternalLink className="h-4 w-4" aria-hidden />
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
} from '../../lib/page-editor-service.js'
|
|
33
33
|
import {
|
|
34
34
|
buildPublicPreviewUrl,
|
|
35
|
+
buildPublicUrl,
|
|
35
36
|
createPreviewToken,
|
|
36
37
|
resolveSiteUrl,
|
|
37
38
|
} from '../../lib/preview-link.js'
|
|
@@ -446,6 +447,23 @@ export function PageSectionEditor({
|
|
|
446
447
|
toast.error('Save the page before viewing it on the site')
|
|
447
448
|
return
|
|
448
449
|
}
|
|
450
|
+
// Published → jump straight to the LIVE page: no preview token, no forced
|
|
451
|
+
// save. This is the fast "see it live" path. Pending edits stay previewable
|
|
452
|
+
// via the eye (canvas) and globe (inline site preview).
|
|
453
|
+
if (page.status === 'PUBLISHED') {
|
|
454
|
+
window.open(
|
|
455
|
+
buildPublicUrl({
|
|
456
|
+
siteUrl: resolveSiteUrl(config?.seo?.siteUrl),
|
|
457
|
+
urlPrefix: '',
|
|
458
|
+
slug: page.slug,
|
|
459
|
+
}),
|
|
460
|
+
'_blank',
|
|
461
|
+
'noopener',
|
|
462
|
+
)
|
|
463
|
+
return
|
|
464
|
+
}
|
|
465
|
+
// Not yet public (draft / scheduled / archived) → token-gated preview of
|
|
466
|
+
// the current draft through the real front-end.
|
|
449
467
|
const tab = window.open('about:blank', '_blank')
|
|
450
468
|
if (!tab) {
|
|
451
469
|
toast.error('Enable pop-ups for this site to open the preview in a new tab.')
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
import { defaultPostHeader } from '@actuate-media/cms-core/page-sections'
|
|
35
35
|
import {
|
|
36
36
|
buildPublicPreviewUrl,
|
|
37
|
+
buildPublicUrl,
|
|
37
38
|
createPreviewToken,
|
|
38
39
|
resolveSiteUrl,
|
|
39
40
|
} from '../../lib/preview-link.js'
|
|
@@ -494,6 +495,20 @@ export function PostSectionEditor({
|
|
|
494
495
|
toast.error('Save the post before viewing it on the site')
|
|
495
496
|
return
|
|
496
497
|
}
|
|
498
|
+
// Published → open the LIVE post directly (no preview token, no forced
|
|
499
|
+
// save). Pending edits stay previewable via the eye + globe.
|
|
500
|
+
if (post.status === 'PUBLISHED') {
|
|
501
|
+
window.open(
|
|
502
|
+
buildPublicUrl({
|
|
503
|
+
siteUrl: resolveSiteUrl(config?.seo?.siteUrl),
|
|
504
|
+
urlPrefix: config?.collections?.[postType]?.urlPrefix ?? postType,
|
|
505
|
+
slug: post.slug,
|
|
506
|
+
}),
|
|
507
|
+
'_blank',
|
|
508
|
+
'noopener',
|
|
509
|
+
)
|
|
510
|
+
return
|
|
511
|
+
}
|
|
497
512
|
const tab = window.open('about:blank', '_blank')
|
|
498
513
|
if (!tab) {
|
|
499
514
|
toast.error('Enable pop-ups for this site to open the preview in a new tab.')
|