@byline/cli 1.11.2 → 1.12.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.
|
@@ -27,7 +27,7 @@ export const NewsCategories = defineCollection({
|
|
|
27
27
|
// Demonstration of `orderable: true` — short, finite, naturally ordered.
|
|
28
28
|
// Editors can drag rows in the list view to set a canonical order; the
|
|
29
29
|
// value persists on `byline_documents.order_key` without bumping the
|
|
30
|
-
// document version. See docs/
|
|
30
|
+
// document version. See docs/COLLECTIONS.md (Orderable collections).
|
|
31
31
|
orderable: true,
|
|
32
32
|
fields: [
|
|
33
33
|
{ name: 'name', label: 'Name', type: 'text', localized: true },
|
|
@@ -7,40 +7,41 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { RichTextField } from '@byline/core'
|
|
10
|
-
|
|
10
|
+
// Import from `/server` (data-only) rather than the package root so this
|
|
11
|
+
// schema helper stays tsx-loadable. The root barrel evaluates `RichTextField`
|
|
12
|
+
// / `EditorField` and their CSS imports, which would break seeds that load
|
|
13
|
+
// any collection schema using this factory.
|
|
14
|
+
import { defaultEditorConfig, type EditorConfig } from '@byline/richtext-lexical/server'
|
|
11
15
|
|
|
12
16
|
type Options = Partial<Omit<RichTextField, 'type' | 'editorConfig'>> & {
|
|
13
17
|
/**
|
|
14
18
|
* Optional callback to further customise the compact defaults. Receives a
|
|
15
|
-
* mutable copy of the compact
|
|
19
|
+
* mutable copy of the compact settings; mutate and return, or return a new
|
|
16
20
|
* object. Runs after the compact preset is applied, so callers can re-enable
|
|
17
21
|
* specific options for a particular field without re-listing the full set.
|
|
22
|
+
*
|
|
23
|
+
* The compact preset only touches `settings`. Do not assign extensions
|
|
24
|
+
* here — schema-side `editorConfig` must remain JSON-safe.
|
|
18
25
|
*/
|
|
19
26
|
configure?: (config: EditorConfig) => EditorConfig
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
|
-
* Compact preset — disables
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
30
|
+
* Compact preset — disables secondary toolbar UI (text alignment,
|
|
31
|
+
* inline-code, undo/redo, text style) for inline body copy like image
|
|
32
|
+
* captions, byline strap-lines, or compact form fields. Bold / italic /
|
|
33
|
+
* link editing remain on.
|
|
34
|
+
*
|
|
35
|
+
* To narrow the *extension* set per-field — drop tables, lists, embeds,
|
|
36
|
+
* the floating format toolbar, the table action menu — register a
|
|
37
|
+
* `LexicalRichTextCompact` wrapper component via `FieldAdminConfig.editor`
|
|
38
|
+
* (same pattern as `aiRichTextAdmin()`). Extension references aren't safe
|
|
39
|
+
* to bake into schemas, and floating UIs are now extension-presence
|
|
40
|
+
* controlled rather than settings-controlled.
|
|
27
41
|
*/
|
|
28
42
|
function applyCompactPreset(config: EditorConfig): EditorConfig {
|
|
29
43
|
const o = config.settings.options
|
|
30
44
|
o.textAlignment = false
|
|
31
|
-
o.tablePlugin = false
|
|
32
|
-
o.tableActionMenuPlugin = false
|
|
33
|
-
o.tableCellBackgroundColor = false
|
|
34
|
-
o.tableCellMerge = false
|
|
35
|
-
o.layoutPlugin = false
|
|
36
|
-
o.admonitionPlugin = false
|
|
37
|
-
o.codeHighlightPlugin = false
|
|
38
|
-
o.horizontalRulePlugin = false
|
|
39
|
-
o.listPlugin = false
|
|
40
|
-
o.checkListPlugin = false
|
|
41
|
-
o.inlineImagePlugin = false
|
|
42
|
-
o.autoEmbedPlugin = false
|
|
43
|
-
o.floatingTextFormatToolbarPlugin = false
|
|
44
45
|
o.textStyle = false
|
|
45
46
|
o.inlineCode = false
|
|
46
47
|
o.undoRedo = false
|
|
@@ -48,24 +49,20 @@ function applyCompactPreset(config: EditorConfig): EditorConfig {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
|
-
* Returns a `RichTextField` with
|
|
52
|
-
* `editorConfig`. Use this for caption-style or otherwise constrained
|
|
53
|
-
* fields where the full editor
|
|
54
|
-
*
|
|
55
|
-
* The compact preset disables tables, layouts, lists, code highlight, inline
|
|
56
|
-
* images, embeds, and most secondary toolbar features while keeping bold /
|
|
57
|
-
* italic / link editing and the floating link editor.
|
|
52
|
+
* Returns a `RichTextField` with reduced toolbar settings baked into
|
|
53
|
+
* `editorConfig`. Use this for caption-style or otherwise constrained
|
|
54
|
+
* rich-text fields where the full editor toolbar would be inappropriate.
|
|
58
55
|
*
|
|
59
56
|
* @example
|
|
60
57
|
* ```ts
|
|
61
58
|
* fields: [
|
|
62
59
|
* lexicalRichTextCompact({ name: 'caption', label: 'Caption' }),
|
|
63
|
-
* // Compact +
|
|
60
|
+
* // Compact + custom placeholder for one field:
|
|
64
61
|
* lexicalRichTextCompact({
|
|
65
62
|
* name: 'summary',
|
|
66
63
|
* label: 'Summary',
|
|
67
64
|
* configure: (c) => {
|
|
68
|
-
* c.settings.
|
|
65
|
+
* c.settings.placeholderText = 'One sentence summary…'
|
|
69
66
|
* return c
|
|
70
67
|
* },
|
|
71
68
|
* }),
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@byline/cli",
|
|
3
3
|
"private": false,
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.12.0",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.9.0"
|
|
8
8
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsc -p tsconfig.json && tsc-alias && node ./scripts/copy-templates.js && chmod +x dist/cli.js",
|
|
63
63
|
"dev": "tsc -w -p tsconfig.json",
|
|
64
|
-
"clean": "
|
|
64
|
+
"clean": "node scripts/clean.js node_modules dist .turbo",
|
|
65
65
|
"lint": "biome check --write --unsafe --diagnostic-level=error",
|
|
66
66
|
"test": "vitest run --passWithNoTests",
|
|
67
67
|
"typecheck": "tsc --noEmit"
|