uncial-cms 4.0.1 → 4.0.2
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
CHANGED
|
@@ -392,7 +392,7 @@ export function getStaticPaths() {
|
|
|
392
392
|
|
|
393
393
|
`EditorSurface` forwards `extensions`, `toolbarFeatures` and
|
|
394
394
|
`toolbarExtensions` to `Editor`, for custom marks and their controls, and takes
|
|
395
|
-
a `sessionProvider
|
|
395
|
+
a `sessionProvider` and an `imageSource` (see [Media](#media)). Against the GitHub forge it shows a Sign in button first,
|
|
396
396
|
since a sign-in popup opened outside a click is blocked.
|
|
397
397
|
|
|
398
398
|
Astro bundles a `client:only` island for any page file that renders it, even
|
|
@@ -633,8 +633,9 @@ Residual risks accepted for v1 (see the spec's §6.5 for the full treatment):
|
|
|
633
633
|
## Media
|
|
634
634
|
|
|
635
635
|
A Block gets image upload by declaring an attribute with `input: 'image'`:
|
|
636
|
-
`EditorPage` and `
|
|
637
|
-
`cmsImageSource(config, { base, staticDir })`,
|
|
636
|
+
`EditorPage`, `mountEditorPage` and the Astro `EditorSurface` back its
|
|
637
|
+
attributes-panel field with `cmsImageSource(config, { base, staticDir })`,
|
|
638
|
+
which fits an upload under the
|
|
638
639
|
forge limit, commits it under `mediaDir`, stores its served URL and lists the
|
|
639
640
|
media dir for Choose existing. Pass `list` and `thumbnail` to override the
|
|
640
641
|
listing and tile URLs for a rendition pipeline, or `imageSource` to replace the
|
|
@@ -11,10 +11,16 @@
|
|
|
11
11
|
import 'uncial/styles/chrome.css';
|
|
12
12
|
import { onMount, type ComponentProps } from 'svelte';
|
|
13
13
|
import type { BlockRegistry, ContentDocument, ContentSchema } from 'uncial/core';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
Editor,
|
|
16
|
+
type ImageSource,
|
|
17
|
+
type ToolbarFeature,
|
|
18
|
+
type ToolbarFeatureSelection
|
|
19
|
+
} from 'uncial/editor';
|
|
15
20
|
import type { Site } from '../define-site.js';
|
|
16
21
|
import type { EditorController, StatusView } from '../editor-controller.js';
|
|
17
22
|
import { createEditorSession } from '../editor-session.js';
|
|
23
|
+
import { cmsImageSource } from '../image-source.js';
|
|
18
24
|
import { UNCIAL_CMS_RUNTIME_SENTINEL } from '../sentinel.js';
|
|
19
25
|
import type { SessionProvider } from '../types.js';
|
|
20
26
|
import { clearActiveForge } from '../upload-context.js';
|
|
@@ -41,6 +47,8 @@
|
|
|
41
47
|
attributesPanel?: 'docked' | 'overlay' | 'off';
|
|
42
48
|
/** Forwarded to `Editor`; `'bare'` draws no surface of the editor's own. */
|
|
43
49
|
presentation?: 'card' | 'bare';
|
|
50
|
+
/** Forwarded to `Editor`; defaults to `cmsImageSource(site.config)`. */
|
|
51
|
+
imageSource?: ImageSource;
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
let {
|
|
@@ -54,10 +62,12 @@
|
|
|
54
62
|
toolbarFeatures,
|
|
55
63
|
toolbarExtensions,
|
|
56
64
|
attributesPanel = 'overlay',
|
|
57
|
-
presentation = 'bare'
|
|
65
|
+
presentation = 'bare',
|
|
66
|
+
imageSource
|
|
58
67
|
}: Props = $props();
|
|
59
68
|
|
|
60
69
|
const resolvedSchema = $derived(typeof schema === 'function' ? schema(pagePath) : schema);
|
|
70
|
+
const resolvedImageSource = $derived(imageSource ?? cmsImageSource(site.config));
|
|
61
71
|
const signIn = $derived(site.config.forge === 'github');
|
|
62
72
|
const branch = $derived(
|
|
63
73
|
site.config.forge === 'github' ? site.config.branch : 'the local checkout'
|
|
@@ -165,6 +175,7 @@
|
|
|
165
175
|
{toolbarExtensions}
|
|
166
176
|
{attributesPanel}
|
|
167
177
|
{presentation}
|
|
178
|
+
imageSource={resolvedImageSource}
|
|
168
179
|
onChange={(next) => controller?.documentChanged(next as ContentDocument)}
|
|
169
180
|
/>
|
|
170
181
|
{/if}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import 'uncial/styles/chrome.css';
|
|
11
11
|
import { type ComponentProps } from 'svelte';
|
|
12
12
|
import type { BlockRegistry, ContentSchema } from 'uncial/core';
|
|
13
|
-
import { Editor, type ToolbarFeature, type ToolbarFeatureSelection } from 'uncial/editor';
|
|
13
|
+
import { Editor, type ImageSource, type ToolbarFeature, type ToolbarFeatureSelection } from 'uncial/editor';
|
|
14
14
|
import type { Site } from '../define-site.js';
|
|
15
15
|
import type { SessionProvider } from '../types.js';
|
|
16
16
|
interface Props {
|
|
@@ -35,6 +35,8 @@ interface Props {
|
|
|
35
35
|
attributesPanel?: 'docked' | 'overlay' | 'off';
|
|
36
36
|
/** Forwarded to `Editor`; `'bare'` draws no surface of the editor's own. */
|
|
37
37
|
presentation?: 'card' | 'bare';
|
|
38
|
+
/** Forwarded to `Editor`; defaults to `cmsImageSource(site.config)`. */
|
|
39
|
+
imageSource?: ImageSource;
|
|
38
40
|
}
|
|
39
41
|
declare const EditorSurface: import("svelte").Component<Props, {}, "">;
|
|
40
42
|
type EditorSurface = ReturnType<typeof EditorSurface>;
|