@conloca/cms-spa 0.2.2 → 0.2.4
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/README.md +26 -0
- package/dist/spa/main.css +229 -1
- package/dist/ts/.build-inputs.json +187 -0
- package/dist/ts/App.d.ts +5 -1
- package/dist/ts/App.d.ts.map +1 -1
- package/dist/ts/App.js +13 -6
- package/dist/ts/App.js.map +1 -1
- package/dist/ts/CmsSpaApp.d.ts.map +1 -1
- package/dist/ts/CmsSpaApp.js +4 -1
- package/dist/ts/CmsSpaApp.js.map +1 -1
- package/dist/ts/components/CMSDashboard.d.ts.map +1 -1
- package/dist/ts/components/CMSDashboard.js +2 -1
- package/dist/ts/components/CMSDashboard.js.map +1 -1
- package/dist/ts/components/cards/DataEntryCard.d.ts +1 -1
- package/dist/ts/components/cards/DataEntryCard.d.ts.map +1 -1
- package/dist/ts/components/cards/SectionCard.d.ts +1 -1
- package/dist/ts/components/cards/SectionCard.d.ts.map +1 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts +6 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.js +2 -2
- package/dist/ts/components/dialogs/DeleteConfirmDialog.js.map +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/MakePagesEditableDialog.d.ts +10 -0
- package/dist/ts/components/dialogs/MakePagesEditableDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/MakePagesEditableDialog.js +35 -0
- package/dist/ts/components/dialogs/MakePagesEditableDialog.js.map +1 -0
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts +6 -1
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/MoveFolderDialog.js +3 -3
- package/dist/ts/components/dialogs/MoveFolderDialog.js.map +1 -1
- package/dist/ts/components/editor/CMSMDXEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/CMSMDXEditor.js +53 -62
- package/dist/ts/components/editor/CMSMDXEditor.js.map +1 -1
- package/dist/ts/components/editor/DocsPreviewButton.d.ts +6 -0
- package/dist/ts/components/editor/DocsPreviewButton.d.ts.map +1 -0
- package/dist/ts/components/editor/DocsPreviewButton.js +15 -0
- package/dist/ts/components/editor/DocsPreviewButton.js.map +1 -0
- package/dist/ts/components/editor/ImagePickerDialog.js +2 -2
- package/dist/ts/components/editor/ImagePickerDialog.js.map +1 -1
- package/dist/ts/components/editor/LocaleSelector.d.ts +1 -1
- package/dist/ts/components/editor/LocaleSelector.d.ts.map +1 -1
- package/dist/ts/components/editor/MdxPageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/MdxPageEditor.js +2 -1
- package/dist/ts/components/editor/MdxPageEditor.js.map +1 -1
- package/dist/ts/components/editor/PageEditor.d.ts +1 -1
- package/dist/ts/components/editor/PageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditor.js +47 -19
- package/dist/ts/components/editor/PageEditor.js.map +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditorWrapper.js +31 -5
- package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -1
- package/dist/ts/components/editor/draft-media-config.d.ts +32 -2
- package/dist/ts/components/editor/draft-media-config.d.ts.map +1 -1
- package/dist/ts/components/editor/draft-media-config.js +194 -39
- package/dist/ts/components/editor/draft-media-config.js.map +1 -1
- package/dist/ts/components/editor/page-setting-targets.d.ts +1 -1
- package/dist/ts/components/editor/page-setting-targets.d.ts.map +1 -1
- package/dist/ts/components/editor/preview-availability.d.ts +8 -5
- package/dist/ts/components/editor/preview-availability.d.ts.map +1 -1
- package/dist/ts/components/editor/preview-availability.js +8 -5
- package/dist/ts/components/editor/preview-availability.js.map +1 -1
- package/dist/ts/components/editors/DataEditor.d.ts +6 -2
- package/dist/ts/components/editors/DataEditor.d.ts.map +1 -1
- package/dist/ts/components/editors/DataEditor.js +46 -19
- package/dist/ts/components/editors/DataEditor.js.map +1 -1
- package/dist/ts/components/fields/ImageField.js +2 -2
- package/dist/ts/components/fields/ImageField.js.map +1 -1
- package/dist/ts/components/media/AssetCard.d.ts +1 -1
- package/dist/ts/components/media/AssetCard.d.ts.map +1 -1
- package/dist/ts/components/media/AssetCard.js +3 -2
- package/dist/ts/components/media/AssetCard.js.map +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.d.ts +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.d.ts.map +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.js +7 -2
- package/dist/ts/components/media/AssetDetailSidebar.js.map +1 -1
- package/dist/ts/components/media/AssetUsageList.d.ts +13 -0
- package/dist/ts/components/media/AssetUsageList.d.ts.map +1 -0
- package/dist/ts/components/media/AssetUsageList.js +35 -0
- package/dist/ts/components/media/AssetUsageList.js.map +1 -0
- package/dist/ts/components/media/MediaLibrary.d.ts +1 -1
- package/dist/ts/components/media/MediaLibrary.d.ts.map +1 -1
- package/dist/ts/components/media/MediaLibrary.js +6 -4
- package/dist/ts/components/media/MediaLibrary.js.map +1 -1
- package/dist/ts/components/media/MediaToolbar.d.ts +1 -1
- package/dist/ts/components/media/MediaToolbar.d.ts.map +1 -1
- package/dist/ts/components/media/index.d.ts +1 -0
- package/dist/ts/components/media/index.d.ts.map +1 -1
- package/dist/ts/components/media/index.js +1 -0
- package/dist/ts/components/media/index.js.map +1 -1
- package/dist/ts/components/pages/DataList.d.ts.map +1 -1
- package/dist/ts/components/pages/DataList.js +48 -31
- package/dist/ts/components/pages/DataList.js.map +1 -1
- package/dist/ts/components/pages/MediaPage.d.ts.map +1 -1
- package/dist/ts/components/pages/MediaPage.js +7 -5
- package/dist/ts/components/pages/MediaPage.js.map +1 -1
- package/dist/ts/components/pages/NoPagesYet.d.ts +5 -0
- package/dist/ts/components/pages/NoPagesYet.d.ts.map +1 -0
- package/dist/ts/components/pages/NoPagesYet.js +16 -0
- package/dist/ts/components/pages/NoPagesYet.js.map +1 -0
- package/dist/ts/components/pages/PageList.d.ts.map +1 -1
- package/dist/ts/components/pages/PageList.js +19 -8
- package/dist/ts/components/pages/PageList.js.map +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.d.ts +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.d.ts.map +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.js +36 -5
- package/dist/ts/components/sandbox/ContentSandbox.js.map +1 -1
- package/dist/ts/components/ui/IconButton.d.ts +1 -1
- package/dist/ts/components/ui/IconButton.d.ts.map +1 -1
- package/dist/ts/content-wrapper.d.ts +65 -0
- package/dist/ts/content-wrapper.d.ts.map +1 -0
- package/dist/ts/content-wrapper.js +190 -0
- package/dist/ts/content-wrapper.js.map +1 -0
- package/dist/ts/convert-pages.d.ts +30 -0
- package/dist/ts/convert-pages.d.ts.map +1 -0
- package/dist/ts/convert-pages.js +85 -0
- package/dist/ts/convert-pages.js.map +1 -0
- package/dist/ts/data-schemas.d.ts.map +1 -1
- package/dist/ts/frame/channel.d.ts +40 -0
- package/dist/ts/frame/channel.d.ts.map +1 -0
- package/dist/ts/frame/channel.js +233 -0
- package/dist/ts/frame/channel.js.map +1 -0
- package/dist/ts/frame/editor-frame.d.ts +23 -0
- package/dist/ts/frame/editor-frame.d.ts.map +1 -0
- package/dist/ts/frame/editor-frame.js +159 -0
- package/dist/ts/frame/editor-frame.js.map +1 -0
- package/dist/ts/frame/media-cache.d.ts +37 -0
- package/dist/ts/frame/media-cache.d.ts.map +1 -0
- package/dist/ts/frame/media-cache.js +138 -0
- package/dist/ts/frame/media-cache.js.map +1 -0
- package/dist/ts/frame/memory-router.d.ts +10 -0
- package/dist/ts/frame/memory-router.d.ts.map +1 -0
- package/dist/ts/frame/memory-router.js +39 -0
- package/dist/ts/frame/memory-router.js.map +1 -0
- package/dist/ts/frame/parent-hello.d.ts +11 -0
- package/dist/ts/frame/parent-hello.d.ts.map +1 -0
- package/dist/ts/frame/parent-hello.js +53 -0
- package/dist/ts/frame/parent-hello.js.map +1 -0
- package/dist/ts/frame/protocol.d.ts +209 -0
- package/dist/ts/frame/protocol.d.ts.map +1 -0
- package/dist/ts/frame/protocol.js +200 -0
- package/dist/ts/frame/protocol.js.map +1 -0
- package/dist/ts/frame/rpc-content-client.d.ts +10 -0
- package/dist/ts/frame/rpc-content-client.d.ts.map +1 -0
- package/dist/ts/frame/rpc-content-client.js +51 -0
- package/dist/ts/frame/rpc-content-client.js.map +1 -0
- package/dist/ts/frame/save-shortcut.d.ts +8 -0
- package/dist/ts/frame/save-shortcut.d.ts.map +1 -0
- package/dist/ts/frame/save-shortcut.js +26 -0
- package/dist/ts/frame/save-shortcut.js.map +1 -0
- package/dist/ts/hooks/index.d.ts +2 -0
- package/dist/ts/hooks/index.d.ts.map +1 -1
- package/dist/ts/hooks/index.js +1 -0
- package/dist/ts/hooks/index.js.map +1 -1
- package/dist/ts/hooks/usePageConversion.d.ts +11 -0
- package/dist/ts/hooks/usePageConversion.d.ts.map +1 -0
- package/dist/ts/hooks/usePageConversion.js +47 -0
- package/dist/ts/hooks/usePageConversion.js.map +1 -0
- package/dist/ts/hooks/useUploadFlow.d.ts.map +1 -1
- package/dist/ts/hooks/useUploadFlow.js +41 -7
- package/dist/ts/hooks/useUploadFlow.js.map +1 -1
- package/dist/ts/host-style-probe.d.ts +32 -37
- package/dist/ts/host-style-probe.d.ts.map +1 -1
- package/dist/ts/host-style-probe.js +86 -68
- package/dist/ts/host-style-probe.js.map +1 -1
- package/dist/ts/index.d.ts +6 -2
- package/dist/ts/index.d.ts.map +1 -1
- package/dist/ts/index.js +9 -2
- package/dist/ts/index.js.map +1 -1
- package/dist/ts/main-spa.d.ts.map +1 -1
- package/dist/ts/main-spa.js +2 -1
- package/dist/ts/main-spa.js.map +1 -1
- package/dist/ts/media/prepare-image-upload.d.ts +19 -0
- package/dist/ts/media/prepare-image-upload.d.ts.map +1 -0
- package/dist/ts/media/prepare-image-upload.js +93 -0
- package/dist/ts/media/prepare-image-upload.js.map +1 -0
- package/dist/ts/media/use-asset-serve-src.d.ts +7 -0
- package/dist/ts/media/use-asset-serve-src.d.ts.map +1 -0
- package/dist/ts/media/use-asset-serve-src.js +17 -0
- package/dist/ts/media/use-asset-serve-src.js.map +1 -0
- package/dist/ts/page-schemas.d.ts.map +1 -1
- package/dist/ts/prose-surface-css.d.ts +3 -5
- package/dist/ts/prose-surface-css.d.ts.map +1 -1
- package/dist/ts/prose-surface-css.js +3 -5
- package/dist/ts/prose-surface-css.js.map +1 -1
- package/dist/ts/puck-config.d.ts.map +1 -1
- package/dist/ts/selected-block.d.ts.map +1 -1
- package/dist/ts/site-styles.d.ts +4 -21
- package/dist/ts/site-styles.d.ts.map +1 -1
- package/dist/ts/site-styles.js.map +1 -1
- package/dist/ts/ui-config.d.ts +62 -3
- package/dist/ts/ui-config.d.ts.map +1 -1
- package/dist/ts/ui-config.js +18 -0
- package/dist/ts/ui-config.js.map +1 -1
- package/dist/ts/utils/asset-url.d.ts +3 -0
- package/dist/ts/utils/asset-url.d.ts.map +1 -1
- package/dist/ts/utils/asset-url.js +4 -0
- package/dist/ts/utils/asset-url.js.map +1 -1
- package/dist/ts/utils/data-entry-validation.d.ts +11 -0
- package/dist/ts/utils/data-entry-validation.d.ts.map +1 -0
- package/dist/ts/utils/data-entry-validation.js +15 -0
- package/dist/ts/utils/data-entry-validation.js.map +1 -0
- package/package.json +20 -11
- package/src/App.tsx +22 -10
- package/src/CmsSpaApp.tsx +5 -1
- package/src/components/CMSDashboard.tsx +16 -8
- package/src/components/dialogs/DeleteConfirmDialog.tsx +14 -1
- package/src/components/dialogs/MakePagesEditableDialog.tsx +112 -0
- package/src/components/dialogs/MoveFolderDialog.tsx +9 -2
- package/src/components/editor/CMSMDXEditor.tsx +56 -76
- package/src/components/editor/DocsPreviewButton.tsx +25 -0
- package/src/components/editor/ImagePickerDialog.tsx +2 -2
- package/src/components/editor/MdxPageEditor.tsx +2 -0
- package/src/components/editor/PageEditor.tsx +46 -22
- package/src/components/editor/PageEditorWrapper.tsx +34 -5
- package/src/components/editor/draft-media-config.ts +199 -41
- package/src/components/editor/preview-availability.ts +9 -5
- package/src/components/editors/DataEditor.tsx +65 -32
- package/src/components/fields/ImageField.tsx +2 -2
- package/src/components/media/AssetCard.tsx +12 -9
- package/src/components/media/AssetDetailSidebar.tsx +38 -25
- package/src/components/media/AssetUsageList.tsx +84 -0
- package/src/components/media/MediaLibrary.tsx +6 -4
- package/src/components/media/index.ts +1 -0
- package/src/components/pages/DataList.tsx +53 -29
- package/src/components/pages/MediaPage.tsx +14 -5
- package/src/components/pages/NoPagesYet.tsx +41 -0
- package/src/components/pages/PageList.tsx +40 -27
- package/src/components/sandbox/ContentSandbox.tsx +34 -5
- package/src/content-wrapper.ts +284 -0
- package/src/convert-pages.ts +110 -0
- package/src/frame/channel.ts +258 -0
- package/src/frame/editor-frame.ts +184 -0
- package/src/frame/media-cache.ts +157 -0
- package/src/frame/memory-router.ts +39 -0
- package/src/frame/parent-hello.ts +62 -0
- package/src/frame/protocol.ts +332 -0
- package/src/frame/rpc-content-client.ts +58 -0
- package/src/frame/save-shortcut.ts +25 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/usePageConversion.ts +55 -0
- package/src/hooks/useUploadFlow.ts +44 -7
- package/src/host-style-probe.ts +104 -90
- package/src/index.ts +10 -2
- package/src/main-spa.tsx +2 -0
- package/src/main.css +2 -1
- package/src/media/prepare-image-upload.ts +118 -0
- package/src/media/use-asset-serve-src.ts +22 -0
- package/src/prose-surface-css.ts +3 -5
- package/src/site-styles.ts +4 -22
- package/src/ui-config.ts +74 -3
- package/src/utils/asset-url.ts +6 -0
- package/src/utils/data-entry-validation.ts +16 -0
- package/dist/ts/host-discovery.d.ts +0 -40
- package/dist/ts/host-discovery.d.ts.map +0 -1
- package/dist/ts/host-discovery.js +0 -39
- package/dist/ts/host-discovery.js.map +0 -1
- package/src/host-discovery.ts +0 -77
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useUploadAsset } from '@conloca/content-api-client';
|
|
1
|
+
import { DEFAULT_MAX_FILE_SIZE, useUploadAsset } from '@conloca/content-api-client';
|
|
2
2
|
import { BaseMDXEditor, type BaseMDXEditorProps } from '@conloca/mdx';
|
|
3
3
|
// The editor stylesheet; it pulls MDXEditor's own sheet in first. Position
|
|
4
4
|
// would not decide the cascade anyway: MDXEditor injects its CSS-module
|
|
@@ -10,9 +10,9 @@ import type { JsxComponentDescriptor, MDXEditorMethods, RealmPlugin } from '@mdx
|
|
|
10
10
|
import { forwardRef, useCallback, useMemo, useRef } from 'react';
|
|
11
11
|
import { useTheme } from '../../hooks/useTheme.js';
|
|
12
12
|
import { buildUploadFormData } from '../../hooks/useUpload.js';
|
|
13
|
-
import { useHostDiscovery } from '../../host-discovery.js';
|
|
14
13
|
import { useProbedHostStyles } from '../../host-style-probe.js';
|
|
15
14
|
import { isJsxDescriptor, toJsxComponentDescriptor, useMdxComponents } from '../../mdx-components.js';
|
|
15
|
+
import { prepareImageUpload } from '../../media/prepare-image-upload.js';
|
|
16
16
|
import { deriveProseSurfaceStyles } from '../../prose-surface-css.js';
|
|
17
17
|
import {
|
|
18
18
|
type SiteStyles,
|
|
@@ -22,7 +22,9 @@ import {
|
|
|
22
22
|
useInjectHostStyles,
|
|
23
23
|
useSiteStyles,
|
|
24
24
|
} from '../../site-styles.js';
|
|
25
|
-
import {
|
|
25
|
+
import { getUIConfig, inEditorFrame } from '../../ui-config.js';
|
|
26
|
+
import { assetRefOf } from '../../utils/asset-url.js';
|
|
27
|
+
import { draftImagePreview } from './draft-media-config.js';
|
|
26
28
|
import { GenericBlock } from './GenericBlock.js';
|
|
27
29
|
import { hostWrapperPlugin } from './host-wrapper-plugin.js';
|
|
28
30
|
import { ImagePickerDialog } from './ImagePickerDialog.js';
|
|
@@ -68,35 +70,13 @@ export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(({ p
|
|
|
68
70
|
// Full host CSS must stay inside the editor surface. Site styles often
|
|
69
71
|
// contain bare `h1`, `button`, and Tailwind reset rules that would otherwise
|
|
70
72
|
// restyle the admin header and any host app around it.
|
|
71
|
-
const fetchedStyles = useFetchedSiteStyles(previewRouteUrl);
|
|
72
|
-
const staticEditorStyles = useEditorStyles();
|
|
73
|
-
// Registered discovery: the same facts the endpoints above serve, handed in
|
|
74
|
-
// by a host app (`setHostDiscovery`) when the editor cannot reach the site's
|
|
75
|
-
// dev server. Sits one tier below live discovery so the dev server always
|
|
76
|
-
// wins, and above the manual editorStyles path. Empty unless a host app
|
|
77
|
-
// writes the registry.
|
|
78
|
-
const registeredDiscovery = useHostDiscovery();
|
|
79
|
-
const registeredRouteStyles = useMemo<SiteStyles>(
|
|
80
|
-
() => (registeredDiscovery.routeCss ? [registeredDiscovery.routeCss] : []),
|
|
81
|
-
[registeredDiscovery],
|
|
82
|
-
);
|
|
83
|
-
// First tier with content wins: live discovery, then registered discovery,
|
|
84
|
-
// then the manually-configured path.
|
|
85
|
-
const activeStyles = [fetchedStyles, registeredRouteStyles, staticEditorStyles].find((tier) => tier.length > 0) ?? [];
|
|
86
|
-
// The editor mounts directly in the parent SPA's React tree, so the broad
|
|
87
|
-
// stylesheet is confined to `.conloca-mdx-editor-surround` below. The
|
|
88
|
-
// content still receives the site's complete cascade while adjacent admin
|
|
89
|
-
// chrome keeps its own tokens and utilities.
|
|
90
73
|
//
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
() => (EDITOR_CSS ? [...activeStyles, EDITOR_CSS] : activeStyles),
|
|
98
|
-
[activeStyles],
|
|
99
|
-
);
|
|
74
|
+
// Inside a parent frame the dev-server endpoints do not exist, so the
|
|
75
|
+
// probe's load of the real page stands in for them (see `routeStyles`).
|
|
76
|
+
const inFrame = inEditorFrame();
|
|
77
|
+
const devServerRouteUrl = inFrame ? undefined : previewRouteUrl;
|
|
78
|
+
const fetchedStyles = useFetchedSiteStyles(devServerRouteUrl);
|
|
79
|
+
const staticEditorStyles = useEditorStyles();
|
|
100
80
|
// Probe the host's computed styles for each prose tag from the
|
|
101
81
|
// actual live page and synthesize a stylesheet scoped to the
|
|
102
82
|
// editor's contenteditable. This catches what the wrapper auto-
|
|
@@ -116,13 +96,7 @@ export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(({ p
|
|
|
116
96
|
// surface naturally. It also threads `codeBlock` through to the
|
|
117
97
|
// code-block frame component (in @conloca/mdx) so it can carry the host's
|
|
118
98
|
// code-block classes and inherit the host's code-block CSS the same way.
|
|
119
|
-
const fetchedWrappers = useFetchedHostWrappers(
|
|
120
|
-
// Same tiering for the wrapper clone: whatever live discovery found, else
|
|
121
|
-
// the shape a host app registered.
|
|
122
|
-
const hostWrappers =
|
|
123
|
-
fetchedWrappers.content !== null || fetchedWrappers.codeBlock !== null
|
|
124
|
-
? fetchedWrappers
|
|
125
|
-
: (registeredDiscovery.wrappers ?? fetchedWrappers);
|
|
99
|
+
const fetchedWrappers = useFetchedHostWrappers(devServerRouteUrl);
|
|
126
100
|
// Editor and published page maintain independent theme preferences
|
|
127
101
|
// (CMS SPA → `conloca-theme`; Starlight → `starlight-theme`). The
|
|
128
102
|
// probe needs to capture styles in the EDITOR's current scheme, not
|
|
@@ -130,20 +104,32 @@ export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(({ p
|
|
|
130
104
|
// the user toggles theme inside the editor, the hook's dep on
|
|
131
105
|
// `theme` re-runs the probe and the new computed values land.
|
|
132
106
|
const { resolvedTheme } = useTheme();
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
107
|
+
const probe = useProbedHostStyles(previewRouteUrl, fetchedWrappers.content?.className ?? null, {
|
|
108
|
+
theme: resolvedTheme,
|
|
109
|
+
discover: inFrame,
|
|
110
|
+
});
|
|
111
|
+
const { css: probedStyles, settled: probeSettled } = probe;
|
|
112
|
+
// The route's own CSS and wrappers: from the dev endpoints locally, from the
|
|
113
|
+
// page the probe loaded in a frame.
|
|
114
|
+
const routeStyles = inFrame ? probe.styles : fetchedStyles;
|
|
115
|
+
const hostWrappers = inFrame ? probe.wrappers : fetchedWrappers;
|
|
116
|
+
// First tier with content wins: live discovery, then the manually-configured
|
|
117
|
+
// path.
|
|
118
|
+
const activeStyles = routeStyles.length > 0 ? routeStyles : staticEditorStyles;
|
|
119
|
+
// The editor mounts directly in the parent SPA's React tree, so the broad
|
|
120
|
+
// stylesheet is confined to `.conloca-mdx-editor-surround` below. The
|
|
121
|
+
// content still receives the site's complete cascade while adjacent admin
|
|
122
|
+
// chrome keeps its own tokens and utilities.
|
|
123
|
+
//
|
|
124
|
+
// The host can also append raw CSS via the integration's `editorCSS`
|
|
125
|
+
// option (see `ConlocaCMSOptions`) — concatenated AFTER auto-
|
|
126
|
+
// discovered styles so it sits later in the same cascade layer and
|
|
127
|
+
// wins on tie-breaks. Empty string when the host didn't set it; no
|
|
128
|
+
// marker `<style>` is emitted for the no-op case.
|
|
129
|
+
const editorCss = getUIConfig().editorCss ?? EDITOR_CSS;
|
|
130
|
+
const styleStack = useMemo<SiteStyles>(
|
|
131
|
+
() => (editorCss ? [...activeStyles, editorCss] : activeStyles),
|
|
132
|
+
[activeStyles, editorCss],
|
|
147
133
|
);
|
|
148
134
|
const probedStack = useMemo<SiteStyles>(() => (probedStyles ? [probedStyles] : []), [probedStyles]);
|
|
149
135
|
// Injected here, AFTER the probe has been read, so the bridge inside this
|
|
@@ -168,26 +154,19 @@ export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(({ p
|
|
|
168
154
|
});
|
|
169
155
|
useInjectHostStyles('conloca-host-defaults', probedStack, { layered: false });
|
|
170
156
|
// Production styles tier: prose-safe rules derived from the siteStyles
|
|
171
|
-
// registry (the
|
|
172
|
-
//
|
|
173
|
-
// discovery endpoint delivered (dev server), this stays empty so
|
|
157
|
+
// registry (the siteStyles option's CSS) plus a paper base. Fallback ONLY —
|
|
158
|
+
// when the discovery endpoint delivered (dev server), this stays empty so
|
|
174
159
|
// discovery-styled surfaces keep their host-painted look, paper included.
|
|
175
160
|
// Unlayered for the same reason as the probe stack: the editor's default
|
|
176
161
|
// prose scale is unlayered and would beat any layered override.
|
|
177
162
|
const siteStyles = useSiteStyles();
|
|
178
|
-
const activeHostCss = useMemo<SiteStyles>(
|
|
179
|
-
() => (registeredRouteStyles.length > 0 ? registeredRouteStyles : siteStyles),
|
|
180
|
-
[registeredRouteStyles, siteStyles],
|
|
181
|
-
);
|
|
182
163
|
const proseSurface = useMemo<SiteStyles>(
|
|
183
|
-
// Derived from
|
|
184
|
-
// have it, else the siteStyles registry), never from one fixed registry:
|
|
185
|
-
// the tier has to describe the same sheet the surface is showing.
|
|
164
|
+
// Derived from the siteStyles registry, the host CSS the surface shows.
|
|
186
165
|
//
|
|
187
|
-
// It must run ALONGSIDE
|
|
188
|
-
// into a cascade LAYER, the editor's default prose scale is
|
|
189
|
-
// layered always loses to unlayered — so
|
|
190
|
-
// heading metrics. This tier is the prose-scoped subset that is safe to
|
|
166
|
+
// It must run ALONGSIDE the layered host CSS, not instead of it. That CSS is
|
|
167
|
+
// injected into a cascade LAYER, the editor's default prose scale is
|
|
168
|
+
// unlayered, and layered always loses to unlayered — so the layered tier
|
|
169
|
+
// alone cannot restore heading metrics. This tier is the prose-scoped subset that is safe to
|
|
191
170
|
// inject unlayered, which is what actually beats the defaults. Live
|
|
192
171
|
// discovery is the exception: it ships the computed-style probe, itself
|
|
193
172
|
// unlayered and better at the same job.
|
|
@@ -203,20 +182,20 @@ export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(({ p
|
|
|
203
182
|
// `.sl-markdown-content h2:not(:where(…))` (0,1,1), since `:not(:where())`
|
|
204
183
|
// contributes nothing — so whichever is later in head order wins, and that
|
|
205
184
|
// is this tier. Without this gate a working probe would be a measurable
|
|
206
|
-
// no-op wherever a host
|
|
185
|
+
// no-op wherever a host sets siteStyles.
|
|
207
186
|
//
|
|
208
187
|
// `probeSettled` is the load-bearing half of the gate. `probedStyles === ''`
|
|
209
188
|
// alone is true on the initial render (probe still in flight) AND after a
|
|
210
189
|
// definitive empty failure, so gating only on the string paints this tier
|
|
211
190
|
// first, then tears it down when the probe lands — a visible flash on
|
|
212
|
-
// every editor open that relies on
|
|
191
|
+
// every editor open that relies on siteStyles. Hold the tier
|
|
213
192
|
// until the probe has resolved once; only then, if it settled empty, fill in
|
|
214
193
|
// with derived rules.
|
|
215
194
|
() =>
|
|
216
|
-
|
|
217
|
-
? deriveProseSurfaceStyles(
|
|
195
|
+
routeStyles.length === 0 && probeSettled && probedStyles === ''
|
|
196
|
+
? deriveProseSurfaceStyles(siteStyles, hostWrappers.content?.className)
|
|
218
197
|
: [],
|
|
219
|
-
[
|
|
198
|
+
[routeStyles, probeSettled, probedStyles, siteStyles, hostWrappers],
|
|
220
199
|
);
|
|
221
200
|
useInjectHostStyles('conloca-prose-surface', proseSurface, { layered: false });
|
|
222
201
|
// Recompose the plugins list whenever the wrappers change so the plugin
|
|
@@ -243,14 +222,13 @@ export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(({ p
|
|
|
243
222
|
|
|
244
223
|
// Wire paste/drop image uploads to the same backend mutation that powers
|
|
245
224
|
// the asset library's UploadModal. The library expects a Promise<string>
|
|
246
|
-
// resolving to the image src; we hand back the
|
|
247
|
-
//
|
|
248
|
-
// from the asset browser.
|
|
225
|
+
// resolving to the image src; we hand back the link `assetRefOf` stores,
|
|
226
|
+
// so it round-trips identically to a path picked from the asset browser.
|
|
249
227
|
const imageUploadHandler = useCallback(
|
|
250
228
|
async (file: File) => {
|
|
251
|
-
const formData = buildUploadFormData(file, undefined, '/');
|
|
229
|
+
const formData = buildUploadFormData(await prepareImageUpload(file, DEFAULT_MAX_FILE_SIZE), undefined, '/');
|
|
252
230
|
const asset = await uploadAsset.mutateAsync(formData);
|
|
253
|
-
return
|
|
231
|
+
return assetRefOf(asset);
|
|
254
232
|
},
|
|
255
233
|
[uploadAsset],
|
|
256
234
|
);
|
|
@@ -263,6 +241,8 @@ export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(({ p
|
|
|
263
241
|
disableImageSettingsButton={true}
|
|
264
242
|
imageButtonRef={insertImageRef}
|
|
265
243
|
imageUploadHandler={imageUploadHandler}
|
|
244
|
+
// The site does not serve branch drafts: draft images show their loaded bytes, draft addresses a placeholder until then.
|
|
245
|
+
imagePreviewHandler={draftImagePreview}
|
|
266
246
|
jsxComponentDescriptors={jsxComponentDescriptors}
|
|
267
247
|
extraPlugins={extraPlugins}
|
|
268
248
|
extraToolbarItems={<InsertMdxComponentButton />}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getUIConfig } from '../../ui-config.js';
|
|
2
|
+
import { cn } from '../../utils/cn.js';
|
|
3
|
+
import { toast } from '../toast.js';
|
|
4
|
+
import { DOCS_PREVIEW_UNAVAILABLE } from './preview-availability.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Preview control of a docs page in the workspace editor. Docs pages are prerendered, so a preview link would show
|
|
8
|
+
* the published page: the control stays, focusable and explained, rather than opening something that looks wrong.
|
|
9
|
+
*/
|
|
10
|
+
export function DocsPreviewButton() {
|
|
11
|
+
if (getUIConfig().openPreview === undefined) return null;
|
|
12
|
+
return (
|
|
13
|
+
<button
|
|
14
|
+
type="button"
|
|
15
|
+
aria-disabled="true"
|
|
16
|
+
title={DOCS_PREVIEW_UNAVAILABLE}
|
|
17
|
+
aria-label={`Preview unavailable. ${DOCS_PREVIEW_UNAVAILABLE}`}
|
|
18
|
+
onClick={() => toast.info(DOCS_PREVIEW_UNAVAILABLE)}
|
|
19
|
+
className={cn('px-3 py-1.5 text-sm border border-line rounded text-muted cursor-not-allowed')}
|
|
20
|
+
data-testid="mdx-page-preview"
|
|
21
|
+
>
|
|
22
|
+
Preview
|
|
23
|
+
</button>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// as the editor internals, avoiding React context isolation issues.
|
|
4
4
|
import { closeImageDialog$, imageDialogState$, insertImage$, useCellValue, usePublisher } from '@mdxeditor/editor';
|
|
5
5
|
import type { AssetEntry } from '../../hooks/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { assetRefOf } from '../../utils/asset-url.js';
|
|
7
7
|
import { ImagePicker } from '../media/ImagePicker.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -17,7 +17,7 @@ export function ImagePickerDialog() {
|
|
|
17
17
|
|
|
18
18
|
const handleSelect = (asset: AssetEntry) => {
|
|
19
19
|
// Insert image at cursor - no alt text per CONTEXT.md
|
|
20
|
-
insertImage({ src:
|
|
20
|
+
insertImage({ src: assetRefOf(asset) });
|
|
21
21
|
closeDialog();
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -21,6 +21,7 @@ import { ErrorModal } from '../dialogs/ErrorModal.js';
|
|
|
21
21
|
import { PageMetadataDialog } from '../dialogs/PageMetadataDialog.js';
|
|
22
22
|
import { UnsavedChangesDialog } from '../dialogs/UnsavedChangesDialog.js';
|
|
23
23
|
import { CMSMDXEditor } from './CMSMDXEditor.js';
|
|
24
|
+
import { DocsPreviewButton } from './DocsPreviewButton.js';
|
|
24
25
|
import { JsxPropsPanel } from './JsxPropsPanel.js';
|
|
25
26
|
import { LocaleSelector } from './LocaleSelector.js';
|
|
26
27
|
|
|
@@ -382,6 +383,7 @@ export function MdxPageEditor() {
|
|
|
382
383
|
availableLocales={availableLocales}
|
|
383
384
|
onChange={handleLocaleChange}
|
|
384
385
|
/>
|
|
386
|
+
<DocsPreviewButton />
|
|
385
387
|
{publishedPathname && (
|
|
386
388
|
<a
|
|
387
389
|
// Resolve against the site (siteBaseUrl), not
|
|
@@ -3,6 +3,7 @@ import { type Config, createUsePuck } from '@puckeditor/core';
|
|
|
3
3
|
import { Monitor, Smartphone, Tablet } from 'lucide-react';
|
|
4
4
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { notifyEditorDirtyChanged, registerEditorFlushHandler } from '../../editor-flush.js';
|
|
6
|
+
import { useCanvasSaveShortcut } from '../../frame/save-shortcut.js';
|
|
6
7
|
import { useSiteBaseUrl } from '../../hooks/index.js';
|
|
7
8
|
import { useCanvasTheme } from '../../hooks/useCanvasTheme.js';
|
|
8
9
|
import { useUnsavedChangesGuard } from '../../hooks/useUnsavedChangesGuard.js';
|
|
@@ -185,6 +186,7 @@ export function IframeBridge({ children, document: iframeDoc }: { children: Reac
|
|
|
185
186
|
const { canvasTheme } = useCanvasTheme();
|
|
186
187
|
const siteStyles = useSiteStyles();
|
|
187
188
|
usePageSettingTargets(iframeDoc);
|
|
189
|
+
useCanvasSaveShortcut(iframeDoc);
|
|
188
190
|
|
|
189
191
|
React.useEffect(() => {
|
|
190
192
|
if (!iframeDoc?.documentElement) return;
|
|
@@ -260,6 +262,17 @@ function IframeWithInsertMarker({ children, document: iframeDoc }: { children: R
|
|
|
260
262
|
return <IframeBridge document={iframeDoc}>{children}</IframeBridge>;
|
|
261
263
|
}
|
|
262
264
|
|
|
265
|
+
/**
|
|
266
|
+
* A genuine preview failure, which is a DIFFERENT situation and must not read as though the site is misconfigured.
|
|
267
|
+
* Not latched: a transient fault must not disable a working button.
|
|
268
|
+
*/
|
|
269
|
+
function reportPreviewFailure(error: unknown) {
|
|
270
|
+
toast.error('Could not open preview', {
|
|
271
|
+
description: 'Something went wrong creating the preview link. Please try again.',
|
|
272
|
+
});
|
|
273
|
+
console.error('[PageEditor] openPreview failed:', error);
|
|
274
|
+
}
|
|
275
|
+
|
|
263
276
|
export function PageEditor({
|
|
264
277
|
entry,
|
|
265
278
|
config,
|
|
@@ -272,11 +285,7 @@ export function PageEditor({
|
|
|
272
285
|
onReload,
|
|
273
286
|
onPublish,
|
|
274
287
|
}: PageEditorProps) {
|
|
275
|
-
const
|
|
276
|
-
const renderConfig = useMemo(
|
|
277
|
-
() => withDraftMediaRendering(config, draftAssetsBasePath),
|
|
278
|
-
[config, draftAssetsBasePath],
|
|
279
|
-
);
|
|
288
|
+
const renderConfig = useMemo(() => withDraftMediaRendering(config), [config]);
|
|
280
289
|
const [data, setData] = useState(entry.localized.content.puckData);
|
|
281
290
|
const [saveState, setSaveState] = useState<SaveState>('idle');
|
|
282
291
|
const [isDirty, setIsDirty] = useState(false);
|
|
@@ -404,7 +413,7 @@ export function PageEditor({
|
|
|
404
413
|
|
|
405
414
|
const handlePreview = useCallback(() => {
|
|
406
415
|
const pathname = entry.localized.pathname || '/';
|
|
407
|
-
const openPreview = getUIConfig()
|
|
416
|
+
const { openPreview, openSiteUrl, previewTab: previewTabOwner } = getUIConfig();
|
|
408
417
|
if (openPreview) {
|
|
409
418
|
// Already known to be impossible: explain it without flashing a blank
|
|
410
419
|
// tab open and shut, which reads as a bug even when it is correct.
|
|
@@ -412,6 +421,26 @@ export function PageEditor({
|
|
|
412
421
|
toast.error(PREVIEW_UNAVAILABLE_TITLE, { description: previewBlockedReason, duration: 10_000 });
|
|
413
422
|
return;
|
|
414
423
|
}
|
|
424
|
+
// The site does not serve draft preview, so no URL exists that could
|
|
425
|
+
// work. Say so where the user is looking instead of navigating a tab to
|
|
426
|
+
// a 404 on their own domain, and remember it so the control goes
|
|
427
|
+
// disabled rather than staying a trap.
|
|
428
|
+
const markPreviewUnavailable = (message: string) => {
|
|
429
|
+
const detail = message !== '' ? message : PREVIEW_UNAVAILABLE_DETAIL;
|
|
430
|
+
setPreviewBlockedReason(detail);
|
|
431
|
+
setPreviewCapability('unavailable');
|
|
432
|
+
toast.error(PREVIEW_UNAVAILABLE_TITLE, { description: detail, duration: 10_000 });
|
|
433
|
+
};
|
|
434
|
+
// The parent frame opens the tab during the click itself; a blocked
|
|
435
|
+
// popup is the parent's to explain, so the editor shows nothing for it.
|
|
436
|
+
if (previewTabOwner === 'parent') {
|
|
437
|
+
void openPreview({ path: pathname })
|
|
438
|
+
.then((result) => {
|
|
439
|
+
if (!result.ok && result.reason === 'not-deployed') markPreviewUnavailable(result.message);
|
|
440
|
+
})
|
|
441
|
+
.catch(reportPreviewFailure);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
415
444
|
// Popup blockers only allow window creation during the click itself.
|
|
416
445
|
// `openPreview` answers asynchronously, so reserve a blank tab now and
|
|
417
446
|
// navigate it once the preview URL arrives.
|
|
@@ -424,31 +453,26 @@ export function PageEditor({
|
|
|
424
453
|
void openPreview({ path: pathname })
|
|
425
454
|
.then((result) => {
|
|
426
455
|
if (result.ok) {
|
|
427
|
-
previewTab.location.href = result.url;
|
|
456
|
+
if ('url' in result) previewTab.location.href = result.url;
|
|
457
|
+
else previewTab.close();
|
|
428
458
|
return;
|
|
429
459
|
}
|
|
430
|
-
// The site does not serve draft preview, so no URL exists that could
|
|
431
|
-
// work. Say so where the user is looking instead of navigating the
|
|
432
|
-
// tab to a 404 on their own domain, and remember it so the control
|
|
433
|
-
// goes disabled rather than staying a trap.
|
|
434
460
|
previewTab.close();
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
setPreviewCapability('unavailable');
|
|
438
|
-
toast.error(PREVIEW_UNAVAILABLE_TITLE, { description: detail, duration: 10_000 });
|
|
461
|
+
// `popup-blocked` cannot happen here, the editor holds the tab.
|
|
462
|
+
if (result.reason === 'not-deployed') markPreviewUnavailable(result.message);
|
|
439
463
|
})
|
|
440
464
|
.catch((error: unknown) => {
|
|
441
|
-
// A genuine failure, which is a DIFFERENT situation and must not
|
|
442
|
-
// read as though the site is misconfigured. Not latched:
|
|
443
|
-
// a transient fault must not disable a working button.
|
|
444
465
|
previewTab.close();
|
|
445
|
-
|
|
446
|
-
description: 'Something went wrong creating the preview link. Please try again.',
|
|
447
|
-
});
|
|
448
|
-
console.error('[PageEditor] openPreview failed:', error);
|
|
466
|
+
reportPreviewFailure(error);
|
|
449
467
|
});
|
|
450
468
|
return;
|
|
451
469
|
}
|
|
470
|
+
if (openSiteUrl) {
|
|
471
|
+
void openSiteUrl({ path: pathname }).catch((error: unknown) =>
|
|
472
|
+
console.error('[PageEditor] openSiteUrl failed:', error),
|
|
473
|
+
);
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
452
476
|
const previewUrl = buildUrl(pathname);
|
|
453
477
|
const cacheBustedUrl = `${previewUrl}${previewUrl.includes('?') ? '&' : '?'}_t=${Date.now()}`;
|
|
454
478
|
window.open(cacheBustedUrl, '_blank');
|
|
@@ -330,9 +330,28 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
|
|
|
330
330
|
const puckData = content?.localized?.content?.puckData;
|
|
331
331
|
|
|
332
332
|
// Resolving again replaces the editor, unsaved block edits included, so it
|
|
333
|
-
// runs when the blocks
|
|
334
|
-
//
|
|
335
|
-
// canvas takes from
|
|
333
|
+
// runs when the blocks change other than by the editor's own save, or the
|
|
334
|
+
// data their route binds changes, and reads the page when it runs: a Page
|
|
335
|
+
// settings save changes only the page, which the canvas takes from
|
|
336
|
+
// `metadata` without remounting.
|
|
337
|
+
//
|
|
338
|
+
// The editor's own save puts the page it read back into the cache, but the
|
|
339
|
+
// editor already holds that page, and anything typed while the save was
|
|
340
|
+
// out, which a new editor would drop. So a change to the blocks counts only
|
|
341
|
+
// when it is not that page: another etag, or another locale than the one the
|
|
342
|
+
// editor holds.
|
|
343
|
+
const ownSaveRef = useRef<{ locale: string; etag: string } | null>(null);
|
|
344
|
+
const blocksRef = useRef({ puckData, locale: currentLocale, changes: 0 });
|
|
345
|
+
if (puckData !== blocksRef.current.puckData) {
|
|
346
|
+
const own = ownSaveRef.current;
|
|
347
|
+
const ownSave =
|
|
348
|
+
own !== null &&
|
|
349
|
+
own.locale === currentLocale &&
|
|
350
|
+
blocksRef.current.locale === currentLocale &&
|
|
351
|
+
own.etag === content?.localized?.etag;
|
|
352
|
+
blocksRef.current = { puckData, locale: currentLocale, changes: blocksRef.current.changes + (ownSave ? 0 : 1) };
|
|
353
|
+
}
|
|
354
|
+
const blockChanges = blocksRef.current.changes;
|
|
336
355
|
const dataContextRef = useRef(dataContext);
|
|
337
356
|
dataContextRef.current = dataContext;
|
|
338
357
|
const routeCollections = dataContext?.collections;
|
|
@@ -341,7 +360,7 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
|
|
|
341
360
|
// Pre-resolve component data using resolveAllData.
|
|
342
361
|
// This runs each component's resolveData with the data context as its
|
|
343
362
|
// metadata, ensuring data-bound components have their data BEFORE Puck mounts.
|
|
344
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: the route's bound data
|
|
363
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: the blocks' changes and the route's bound data are the events; the page and its data context are read when it runs.
|
|
345
364
|
useEffect(() => {
|
|
346
365
|
let cancelled = false;
|
|
347
366
|
|
|
@@ -375,7 +394,7 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
|
|
|
375
394
|
return () => {
|
|
376
395
|
cancelled = true;
|
|
377
396
|
};
|
|
378
|
-
}, [
|
|
397
|
+
}, [blockChanges, enhancedConfig, routeCollections, routePages]);
|
|
379
398
|
|
|
380
399
|
const pageMetadata = useMemo(() => (content?.localized ? extractPageMetadata(content) : null), [content]);
|
|
381
400
|
|
|
@@ -439,6 +458,16 @@ function PuckPageEditorInner({ puckConfig, initialLocale }: PageEditorWrapperPro
|
|
|
439
458
|
if (result.success && result.etag) {
|
|
440
459
|
setCurrentEtag(result.etag);
|
|
441
460
|
}
|
|
461
|
+
// Recorded before this component renders the page the save read back: the cache tells its readers
|
|
462
|
+
// on a later task, and `mutateAsync` settles first. Only a read-back of exactly this write is the
|
|
463
|
+
// editor's own; one someone else saved since must open, or the next save would write over it.
|
|
464
|
+
if (
|
|
465
|
+
'updatedContent' in result &&
|
|
466
|
+
result.updatedContent &&
|
|
467
|
+
result.updatedContent.localized.etag === result.etag
|
|
468
|
+
) {
|
|
469
|
+
ownSaveRef.current = { locale: currentLocale, etag: result.updatedContent.localized.etag };
|
|
470
|
+
}
|
|
442
471
|
|
|
443
472
|
return result;
|
|
444
473
|
} catch (error) {
|