@rimelight/cms 0.0.4 → 0.0.5
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/dist/index.d.mts +17 -17
- package/dist/index.mjs +47 -47
- package/dist/schema/index.d.mts +13 -13
- package/dist/schema/sqlite.d.mts +12 -12
- package/package.json +9 -4
- package/src/admin/api/media-file.ts +1 -1
- package/src/admin/pages/assets.astro +11 -11
- package/src/admin/pages/pages-edit.astro +3 -3
- package/src/admin/pages/pages-index.astro +2 -2
- package/src/admin/pages/pages-preview.astro +3 -3
- package/src/admin/pages/pages-review.astro +2 -2
- package/src/admin/pages/templates-edit.astro +1 -1
- package/src/admin/pages/templates-index.astro +1 -1
- package/src/astro/BlockRenderer.astro +1 -1
- package/src/astro/blocks/CalloutBlock.astro +1 -1
- package/src/astro/blocks/OrderedListBlock.astro +2 -2
- package/src/astro/blocks/ParagraphBlock.astro +1 -1
- package/src/astro/blocks/TabsBlock.astro +5 -5
- package/src/astro/blocks/UnorderedListBlock.astro +2 -2
- package/src/auth/editor-guards.ts +1 -1
- package/src/cache/purge.ts +2 -2
- package/src/client/components/RimelightBlock.tsx +1 -1
- package/src/client/components/RimelightBlockPicker.tsx +1 -1
- package/src/client/components/RimelightPreview.tsx +27 -27
- package/src/client/components/RimelightPropertiesPanel.tsx +4 -4
- package/src/client/components/RimelightTemplateEditor.tsx +9 -5
- package/src/client/components/editors/CalloutEditor.tsx +10 -10
- package/src/client/components/editors/CardEditor.tsx +5 -5
- package/src/client/components/editors/CardsEditor.tsx +2 -2
- package/src/client/components/editors/CodeEditor.tsx +5 -5
- package/src/client/components/editors/DialogueEditor.tsx +6 -6
- package/src/client/components/editors/FileTreeEditor.tsx +1 -1
- package/src/client/components/editors/ImageEditor.tsx +9 -9
- package/src/client/components/editors/ParagraphEditor.tsx +1 -1
- package/src/client/components/editors/SceneEditor.tsx +9 -9
- package/src/client/components/editors/ScriptEditor.tsx +8 -8
- package/src/client/components/editors/SectionEditor.tsx +3 -3
- package/src/client/components/editors/StepItemEditor.tsx +6 -5
- package/src/client/components/editors/StepsEditor.tsx +1 -1
- package/src/client/components/editors/TabItemEditor.tsx +3 -3
- package/src/client/components/editors/TableEditor.tsx +4 -4
- package/src/client/components/editors/TabsEditor.tsx +1 -1
- package/src/client/state/editor-store.ts +23 -23
- package/src/client/utils/sortable.ts +13 -12
- package/src/client/utils/tree-sanitizer.ts +1 -1
- package/src/core/excerpt.ts +16 -16
- package/src/core/page-definitions.ts +2 -2
- package/src/docs/agent.ts +1 -1
- package/src/docs/routing.ts +2 -2
- package/src/loader/live.ts +1 -1
- package/src/markdown/serializer.ts +26 -26
|
@@ -11,10 +11,10 @@ export const DialogueEditor: Component<DialogueEditorProps> = (componentProps) =
|
|
|
11
11
|
const saveProps = (character?: string, parenthetical?: string, line?: string) => {
|
|
12
12
|
componentProps.onPropsChange({
|
|
13
13
|
...componentProps.props,
|
|
14
|
-
character: character !== undefined ? character : componentProps.props
|
|
14
|
+
character: character !== undefined ? character : componentProps.props["character"] || "",
|
|
15
15
|
parenthetical:
|
|
16
|
-
parenthetical !== undefined ? parenthetical : componentProps.props
|
|
17
|
-
line: line !== undefined ? line : componentProps.props
|
|
16
|
+
parenthetical !== undefined ? parenthetical : componentProps.props["parenthetical"] || "",
|
|
17
|
+
line: line !== undefined ? line : componentProps.props["line"] || ""
|
|
18
18
|
})
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ export const DialogueEditor: Component<DialogueEditorProps> = (componentProps) =
|
|
|
23
23
|
<div class="w-48 mx-auto">
|
|
24
24
|
<RLSInput
|
|
25
25
|
data-field="character"
|
|
26
|
-
value={componentProps.props
|
|
26
|
+
value={componentProps.props["character"] || ""}
|
|
27
27
|
onBlur={(e) => saveProps(e.currentTarget.value)}
|
|
28
28
|
class="text-center font-bold text-sm uppercase"
|
|
29
29
|
placeholder="CHARACTER"
|
|
@@ -33,7 +33,7 @@ export const DialogueEditor: Component<DialogueEditorProps> = (componentProps) =
|
|
|
33
33
|
<div class="w-64 mx-auto">
|
|
34
34
|
<RLSInput
|
|
35
35
|
data-field="parenthetical"
|
|
36
|
-
value={componentProps.props
|
|
36
|
+
value={componentProps.props["parenthetical"] || ""}
|
|
37
37
|
onBlur={(e) => saveProps(undefined, e.currentTarget.value)}
|
|
38
38
|
class="text-center italic text-sm"
|
|
39
39
|
placeholder="(parenthetical)"
|
|
@@ -42,7 +42,7 @@ export const DialogueEditor: Component<DialogueEditorProps> = (componentProps) =
|
|
|
42
42
|
</div>
|
|
43
43
|
<RLSTextarea
|
|
44
44
|
data-field="line"
|
|
45
|
-
value={componentProps.props
|
|
45
|
+
value={componentProps.props["line"] || ""}
|
|
46
46
|
onBlur={(e) => saveProps(undefined, undefined, e.currentTarget.value)}
|
|
47
47
|
placeholder="Dialogue line..."
|
|
48
48
|
rows={2}
|
|
@@ -10,7 +10,7 @@ export const FileTreeEditor: Component<FileTreeEditorProps> = (componentProps) =
|
|
|
10
10
|
let jsonTextarea: HTMLTextAreaElement | undefined
|
|
11
11
|
|
|
12
12
|
const tree = (): FileTreeNode[] =>
|
|
13
|
-
componentProps.props
|
|
13
|
+
componentProps.props["tree"] || [
|
|
14
14
|
{ name: "src", isDir: true, children: [{ name: "index.ts", isDir: false }] },
|
|
15
15
|
{ name: "package.json", isDir: false }
|
|
16
16
|
]
|
|
@@ -10,9 +10,9 @@ export const ImageEditor: Component<ImageEditorProps> = (componentProps) => {
|
|
|
10
10
|
const saveProps = (src?: string, alt?: string, caption?: string) => {
|
|
11
11
|
componentProps.onPropsChange({
|
|
12
12
|
...componentProps.props,
|
|
13
|
-
src: src !== undefined ? src : componentProps.props
|
|
14
|
-
alt: alt !== undefined ? alt : componentProps.props
|
|
15
|
-
caption: caption !== undefined ? caption : componentProps.props
|
|
13
|
+
src: src !== undefined ? src : componentProps.props["src"] || "",
|
|
14
|
+
alt: alt !== undefined ? alt : componentProps.props["alt"] || "",
|
|
15
|
+
caption: caption !== undefined ? caption : componentProps.props["caption"] || ""
|
|
16
16
|
})
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -23,7 +23,7 @@ export const ImageEditor: Component<ImageEditorProps> = (componentProps) => {
|
|
|
23
23
|
<RLSInput
|
|
24
24
|
id="image-src-input"
|
|
25
25
|
type="text"
|
|
26
|
-
value={componentProps.props
|
|
26
|
+
value={componentProps.props["src"] || ""}
|
|
27
27
|
onBlur={(e) => saveProps(e.currentTarget.value)}
|
|
28
28
|
placeholder="https://..."
|
|
29
29
|
leadingIcon="image"
|
|
@@ -36,7 +36,7 @@ export const ImageEditor: Component<ImageEditorProps> = (componentProps) => {
|
|
|
36
36
|
<RLSInput
|
|
37
37
|
id="image-alt-input"
|
|
38
38
|
type="text"
|
|
39
|
-
value={componentProps.props
|
|
39
|
+
value={componentProps.props["alt"] || ""}
|
|
40
40
|
onBlur={(e) => saveProps(undefined, e.currentTarget.value)}
|
|
41
41
|
placeholder="Alt description"
|
|
42
42
|
size="sm"
|
|
@@ -48,7 +48,7 @@ export const ImageEditor: Component<ImageEditorProps> = (componentProps) => {
|
|
|
48
48
|
<RLSInput
|
|
49
49
|
id="image-caption-input"
|
|
50
50
|
type="text"
|
|
51
|
-
value={componentProps.props
|
|
51
|
+
value={componentProps.props["caption"] || ""}
|
|
52
52
|
onBlur={(e) => saveProps(undefined, undefined, e.currentTarget.value)}
|
|
53
53
|
placeholder="Image caption"
|
|
54
54
|
size="sm"
|
|
@@ -56,11 +56,11 @@ export const ImageEditor: Component<ImageEditorProps> = (componentProps) => {
|
|
|
56
56
|
</div>
|
|
57
57
|
</div>
|
|
58
58
|
|
|
59
|
-
{componentProps.props
|
|
59
|
+
{componentProps.props["src"] && (
|
|
60
60
|
<div class="mt-2 flex justify-center p-2 rounded-lg border border-default">
|
|
61
61
|
<img
|
|
62
|
-
src={componentProps.props
|
|
63
|
-
alt={componentProps.props
|
|
62
|
+
src={componentProps.props["src"]}
|
|
63
|
+
alt={componentProps.props["alt"] || "Image preview"}
|
|
64
64
|
class="max-h-48 object-cover rounded shadow-sm"
|
|
65
65
|
/>
|
|
66
66
|
</div>
|
|
@@ -155,7 +155,7 @@ export const ParagraphEditor: Component<ParagraphEditorProps> = (componentProps)
|
|
|
155
155
|
|
|
156
156
|
onMount(() => {
|
|
157
157
|
if (!editableDiv) return
|
|
158
|
-
const text = componentProps.props
|
|
158
|
+
const text = componentProps.props["text"]
|
|
159
159
|
if (!text) {
|
|
160
160
|
editableDiv.innerHTML = ""
|
|
161
161
|
} else if (Array.isArray(text)) {
|
|
@@ -41,13 +41,13 @@ export const SceneEditor: Component<SceneEditorProps> = (componentProps) => {
|
|
|
41
41
|
if (typeof componentProps.children === "function") {
|
|
42
42
|
return componentProps.children() || []
|
|
43
43
|
}
|
|
44
|
-
return componentProps.children || componentProps.props
|
|
44
|
+
return componentProps.children || componentProps.props["children"] || []
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const slugText = () => {
|
|
48
|
-
const setting = componentProps.props
|
|
49
|
-
const loc = (componentProps.props
|
|
50
|
-
const time = componentProps.props
|
|
48
|
+
const setting = componentProps.props["setting"] || "INT."
|
|
49
|
+
const loc = (componentProps.props["location"] || "LOCATION").toUpperCase()
|
|
50
|
+
const time = componentProps.props["timeOfDay"] || "MORNING"
|
|
51
51
|
return `${setting} ${loc} - ${time}`
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -114,7 +114,7 @@ export const SceneEditor: Component<SceneEditorProps> = (componentProps) => {
|
|
|
114
114
|
<RLSInput
|
|
115
115
|
id="scene-location-input"
|
|
116
116
|
data-field="location"
|
|
117
|
-
value={componentProps.props
|
|
117
|
+
value={componentProps.props["location"] || ""}
|
|
118
118
|
onBlur={(e) => saveProps({ location: e.currentTarget.value })}
|
|
119
119
|
placeholder="E.g. LIVING ROOM"
|
|
120
120
|
size="sm"
|
|
@@ -125,7 +125,7 @@ export const SceneEditor: Component<SceneEditorProps> = (componentProps) => {
|
|
|
125
125
|
<span class="text-xs font-semibold text-muted uppercase tracking-wide">Setting</span>
|
|
126
126
|
<RLSSelect
|
|
127
127
|
items={SETTINGS}
|
|
128
|
-
value={componentProps.props
|
|
128
|
+
value={componentProps.props["setting"] || "INT."}
|
|
129
129
|
onChange={(e) => saveProps({ setting: e.currentTarget.value })}
|
|
130
130
|
size="sm"
|
|
131
131
|
/>
|
|
@@ -135,7 +135,7 @@ export const SceneEditor: Component<SceneEditorProps> = (componentProps) => {
|
|
|
135
135
|
<span class="text-xs font-semibold text-muted uppercase tracking-wide">Time of Day</span>
|
|
136
136
|
<RLSSelect
|
|
137
137
|
items={TIMES_OF_DAY}
|
|
138
|
-
value={componentProps.props
|
|
138
|
+
value={componentProps.props["timeOfDay"] || "MORNING"}
|
|
139
139
|
onChange={(e) => saveProps({ timeOfDay: e.currentTarget.value })}
|
|
140
140
|
size="sm"
|
|
141
141
|
/>
|
|
@@ -149,7 +149,7 @@ export const SceneEditor: Component<SceneEditorProps> = (componentProps) => {
|
|
|
149
149
|
<RLSTextarea
|
|
150
150
|
id="scene-description-textarea"
|
|
151
151
|
data-field="description"
|
|
152
|
-
value={componentProps.props
|
|
152
|
+
value={componentProps.props["description"] || ""}
|
|
153
153
|
onBlur={(e) => saveProps({ description: e.currentTarget.value })}
|
|
154
154
|
placeholder="Action lines..."
|
|
155
155
|
rows={3}
|
|
@@ -163,7 +163,7 @@ export const SceneEditor: Component<SceneEditorProps> = (componentProps) => {
|
|
|
163
163
|
<div class="w-48">
|
|
164
164
|
<RLSSelect
|
|
165
165
|
items={TRANSITIONS}
|
|
166
|
-
value={componentProps.props
|
|
166
|
+
value={componentProps.props["transition"] || "NONE"}
|
|
167
167
|
onChange={(e) => saveProps({ transition: e.currentTarget.value })}
|
|
168
168
|
size="sm"
|
|
169
169
|
/>
|
|
@@ -22,12 +22,12 @@ export const ScriptEditor: Component<ScriptEditorProps> = (componentProps) => {
|
|
|
22
22
|
let childrenContainer: HTMLDivElement | null = null as HTMLDivElement | null
|
|
23
23
|
let sortableInstance: any = null
|
|
24
24
|
|
|
25
|
-
const characters = (): string[] => componentProps.props
|
|
25
|
+
const characters = (): string[] => componentProps.props["characters"] || []
|
|
26
26
|
const childrenBlocks = (): BaseBlock[] => {
|
|
27
27
|
if (typeof componentProps.children === "function") {
|
|
28
28
|
return componentProps.children() || []
|
|
29
29
|
}
|
|
30
|
-
return componentProps.children || componentProps.props
|
|
30
|
+
return componentProps.children || componentProps.props["children"] || []
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
onMount(() => {
|
|
@@ -96,7 +96,7 @@ export const ScriptEditor: Component<ScriptEditorProps> = (componentProps) => {
|
|
|
96
96
|
<span class="text-xs font-bold text-muted uppercase tracking-widest">Script Title</span>
|
|
97
97
|
<RLSInput
|
|
98
98
|
data-field="title"
|
|
99
|
-
value={componentProps.props
|
|
99
|
+
value={componentProps.props["title"] || ""}
|
|
100
100
|
onInput={(e) => saveProps({ title: e.currentTarget.value })}
|
|
101
101
|
placeholder="Script Title"
|
|
102
102
|
size="sm"
|
|
@@ -107,7 +107,7 @@ export const ScriptEditor: Component<ScriptEditorProps> = (componentProps) => {
|
|
|
107
107
|
<span class="text-xs font-bold text-muted uppercase tracking-widest">Synopsis</span>
|
|
108
108
|
<RLSTextarea
|
|
109
109
|
data-field="synopsis"
|
|
110
|
-
value={componentProps.props
|
|
110
|
+
value={componentProps.props["synopsis"] || ""}
|
|
111
111
|
onInput={(e) => saveProps({ synopsis: e.currentTarget.value })}
|
|
112
112
|
placeholder="Synopsis..."
|
|
113
113
|
rows={2}
|
|
@@ -167,21 +167,21 @@ export const ScriptEditor: Component<ScriptEditorProps> = (componentProps) => {
|
|
|
167
167
|
<div class="grid grid-cols-3 gap-2">
|
|
168
168
|
<RLSInput
|
|
169
169
|
data-field="aPlot"
|
|
170
|
-
value={componentProps.props
|
|
170
|
+
value={componentProps.props["aPlot"] || ""}
|
|
171
171
|
onInput={(e) => saveProps({ aPlot: e.currentTarget.value })}
|
|
172
172
|
placeholder="A-Plot"
|
|
173
173
|
size="sm"
|
|
174
174
|
/>
|
|
175
175
|
<RLSInput
|
|
176
176
|
data-field="bPlot"
|
|
177
|
-
value={componentProps.props
|
|
177
|
+
value={componentProps.props["bPlot"] || ""}
|
|
178
178
|
onInput={(e) => saveProps({ bPlot: e.currentTarget.value })}
|
|
179
179
|
placeholder="B-Plot"
|
|
180
180
|
size="sm"
|
|
181
181
|
/>
|
|
182
182
|
<RLSInput
|
|
183
183
|
data-field="cPlot"
|
|
184
|
-
value={componentProps.props
|
|
184
|
+
value={componentProps.props["cPlot"] || ""}
|
|
185
185
|
onInput={(e) => saveProps({ cPlot: e.currentTarget.value })}
|
|
186
186
|
placeholder="C-Plot"
|
|
187
187
|
size="sm"
|
|
@@ -193,7 +193,7 @@ export const ScriptEditor: Component<ScriptEditorProps> = (componentProps) => {
|
|
|
193
193
|
<span class="text-xs font-bold text-muted uppercase tracking-widest">Stinger</span>
|
|
194
194
|
<RLSInput
|
|
195
195
|
data-field="stinger"
|
|
196
|
-
value={componentProps.props
|
|
196
|
+
value={componentProps.props["stinger"] || ""}
|
|
197
197
|
onInput={(e) => saveProps({ stinger: e.currentTarget.value })}
|
|
198
198
|
placeholder="Stinger (post-credits etc)"
|
|
199
199
|
size="sm"
|
|
@@ -26,7 +26,7 @@ export const SectionEditor: Component<SectionEditorProps> = (componentProps) =>
|
|
|
26
26
|
if (typeof componentProps.children === "function") {
|
|
27
27
|
return componentProps.children() || []
|
|
28
28
|
}
|
|
29
|
-
return componentProps.children || componentProps.props
|
|
29
|
+
return componentProps.children || componentProps.props["children"] || []
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
onMount(() => {
|
|
@@ -84,7 +84,7 @@ export const SectionEditor: Component<SectionEditorProps> = (componentProps) =>
|
|
|
84
84
|
<input
|
|
85
85
|
ref={(el) => (titleInput = el)}
|
|
86
86
|
type="text"
|
|
87
|
-
value={componentProps.props
|
|
87
|
+
value={componentProps.props["title"] || ""}
|
|
88
88
|
onInput={saveProps}
|
|
89
89
|
placeholder="Section Title"
|
|
90
90
|
class="flex-1 font-bold text-lg bg-transparent border-0 focus:outline-none text-highlighted placeholder:text-muted/60 py-0.5"
|
|
@@ -94,7 +94,7 @@ export const SectionEditor: Component<SectionEditorProps> = (componentProps) =>
|
|
|
94
94
|
<input
|
|
95
95
|
ref={(el) => (descInput = el)}
|
|
96
96
|
type="text"
|
|
97
|
-
value={componentProps.props
|
|
97
|
+
value={componentProps.props["description"] || ""}
|
|
98
98
|
onInput={saveProps}
|
|
99
99
|
placeholder="Section description (optional)..."
|
|
100
100
|
class="text-sm text-muted bg-transparent border-0 focus:outline-none placeholder:text-muted/50 py-0.5"
|
|
@@ -23,7 +23,7 @@ export const StepItemEditor: Component<StepItemEditorProps> = (componentProps) =
|
|
|
23
23
|
if (typeof componentProps.children === "function") {
|
|
24
24
|
return componentProps.children() || []
|
|
25
25
|
}
|
|
26
|
-
return componentProps.children || componentProps.props
|
|
26
|
+
return componentProps.children || componentProps.props["children"] || []
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
onMount(() => {
|
|
@@ -65,8 +65,9 @@ export const StepItemEditor: Component<StepItemEditorProps> = (componentProps) =
|
|
|
65
65
|
const saveMeta = (title?: string, description?: string) => {
|
|
66
66
|
componentProps.onPropsChange({
|
|
67
67
|
...componentProps.props,
|
|
68
|
-
title: title !== undefined ? title : componentProps.props
|
|
69
|
-
description:
|
|
68
|
+
title: title !== undefined ? title : componentProps.props["title"] || "",
|
|
69
|
+
description:
|
|
70
|
+
description !== undefined ? description : componentProps.props["description"] || ""
|
|
70
71
|
})
|
|
71
72
|
}
|
|
72
73
|
|
|
@@ -76,14 +77,14 @@ export const StepItemEditor: Component<StepItemEditorProps> = (componentProps) =
|
|
|
76
77
|
<RLSInput
|
|
77
78
|
type="text"
|
|
78
79
|
placeholder="Step title (e.g. Install Dependencies)"
|
|
79
|
-
value={componentProps.props
|
|
80
|
+
value={componentProps.props["title"] || ""}
|
|
80
81
|
onBlur={(e) => saveMeta(e.currentTarget.value, undefined)}
|
|
81
82
|
size="sm"
|
|
82
83
|
/>
|
|
83
84
|
<RLSInput
|
|
84
85
|
type="text"
|
|
85
86
|
placeholder="Step description (optional)"
|
|
86
|
-
value={componentProps.props
|
|
87
|
+
value={componentProps.props["description"] || ""}
|
|
87
88
|
onBlur={(e) => saveMeta(undefined, e.currentTarget.value)}
|
|
88
89
|
size="sm"
|
|
89
90
|
/>
|
|
@@ -22,7 +22,7 @@ export const StepsEditor: Component<StepsEditorProps> = (componentProps) => {
|
|
|
22
22
|
if (typeof componentProps.children === "function") {
|
|
23
23
|
return componentProps.children() || []
|
|
24
24
|
}
|
|
25
|
-
return componentProps.children || componentProps.props
|
|
25
|
+
return componentProps.children || componentProps.props["children"] || []
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
onMount(() => {
|
|
@@ -23,7 +23,7 @@ export const TabItemEditor: Component<TabItemEditorProps> = (componentProps) =>
|
|
|
23
23
|
if (typeof componentProps.children === "function") {
|
|
24
24
|
return componentProps.children() || []
|
|
25
25
|
}
|
|
26
|
-
return componentProps.children || componentProps.props
|
|
26
|
+
return componentProps.children || componentProps.props["children"] || []
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
onMount(() => {
|
|
@@ -66,7 +66,7 @@ export const TabItemEditor: Component<TabItemEditorProps> = (componentProps) =>
|
|
|
66
66
|
componentProps.onPropsChange({
|
|
67
67
|
...componentProps.props,
|
|
68
68
|
label,
|
|
69
|
-
value: componentProps.props
|
|
69
|
+
value: componentProps.props["value"] || label.toLowerCase().replace(/\s+/g, "-")
|
|
70
70
|
})
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -78,7 +78,7 @@ export const TabItemEditor: Component<TabItemEditorProps> = (componentProps) =>
|
|
|
78
78
|
<RLSInput
|
|
79
79
|
type="text"
|
|
80
80
|
placeholder="e.g. pnpm, Astro, TypeScript"
|
|
81
|
-
value={componentProps.props
|
|
81
|
+
value={componentProps.props["label"] || ""}
|
|
82
82
|
onBlur={(e) => saveLabel(e.currentTarget.value)}
|
|
83
83
|
size="sm"
|
|
84
84
|
/>
|
|
@@ -10,20 +10,20 @@ export interface TableEditorProps {
|
|
|
10
10
|
|
|
11
11
|
export const TableEditor: Component<TableEditorProps> = (componentProps) => {
|
|
12
12
|
const columns = (): TableColumnDef[] =>
|
|
13
|
-
componentProps.props
|
|
13
|
+
componentProps.props["columns"] || [
|
|
14
14
|
{ key: "col1", header: "Header 1", align: "left" },
|
|
15
15
|
{ key: "col2", header: "Header 2", align: "left" }
|
|
16
16
|
]
|
|
17
17
|
|
|
18
18
|
const rows = (): Record<string, string>[] =>
|
|
19
|
-
componentProps.props
|
|
19
|
+
componentProps.props["rows"] || [{ col1: "Cell 1", col2: "Cell 2" }]
|
|
20
20
|
|
|
21
21
|
const save = (newCols: TableColumnDef[], newRows: Record<string, string>[], caption?: string) => {
|
|
22
22
|
componentProps.onPropsChange({
|
|
23
23
|
...componentProps.props,
|
|
24
24
|
columns: newCols,
|
|
25
25
|
rows: newRows,
|
|
26
|
-
caption: caption !== undefined ? caption : componentProps.props
|
|
26
|
+
caption: caption !== undefined ? caption : componentProps.props["caption"] || ""
|
|
27
27
|
})
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -172,7 +172,7 @@ export const TableEditor: Component<TableEditorProps> = (componentProps) => {
|
|
|
172
172
|
<RLSInput
|
|
173
173
|
type="text"
|
|
174
174
|
placeholder="Table caption (optional)"
|
|
175
|
-
value={componentProps.props
|
|
175
|
+
value={componentProps.props["caption"] || ""}
|
|
176
176
|
onBlur={(e) => save(columns(), rows(), e.currentTarget.value)}
|
|
177
177
|
size="sm"
|
|
178
178
|
/>
|
|
@@ -22,7 +22,7 @@ export const TabsEditor: Component<TabsEditorProps> = (componentProps) => {
|
|
|
22
22
|
if (typeof componentProps.children === "function") {
|
|
23
23
|
return componentProps.children() || []
|
|
24
24
|
}
|
|
25
|
-
return componentProps.children || componentProps.props
|
|
25
|
+
return componentProps.children || componentProps.props["children"] || []
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
onMount(() => {
|
|
@@ -20,7 +20,7 @@ function findBlockInfo(
|
|
|
20
20
|
}
|
|
21
21
|
const isSec = b.type === "SectionBlock"
|
|
22
22
|
const nextDepth = isSec ? currentDepth + 1 : currentDepth
|
|
23
|
-
const children = b.children || b.props?.children
|
|
23
|
+
const children = b.children || b.props?.["children"]
|
|
24
24
|
if (Array.isArray(children)) {
|
|
25
25
|
const found = findBlockInfo(children, targetId, nextDepth)
|
|
26
26
|
if (found) {
|
|
@@ -37,7 +37,7 @@ function findBlockInfo(
|
|
|
37
37
|
function getMaxSubtreeSectionHeight(b: BaseBlock | null): number {
|
|
38
38
|
if (!b) return 0
|
|
39
39
|
const isSec = b.type === "SectionBlock"
|
|
40
|
-
const children = b.children || b.props?.children
|
|
40
|
+
const children = b.children || b.props?.["children"]
|
|
41
41
|
let maxChildHeight = 0
|
|
42
42
|
if (Array.isArray(children)) {
|
|
43
43
|
for (const c of children) {
|
|
@@ -106,13 +106,13 @@ export function createEditorState(
|
|
|
106
106
|
if (!item) continue
|
|
107
107
|
if (item.id === id) {
|
|
108
108
|
item.props = { ...item.props, ...newProps }
|
|
109
|
-
if (newProps
|
|
110
|
-
item.children = newProps
|
|
111
|
-
item.props
|
|
109
|
+
if (newProps["children"] !== undefined) {
|
|
110
|
+
item.children = newProps["children"]
|
|
111
|
+
item.props["children"] = newProps["children"]
|
|
112
112
|
}
|
|
113
113
|
return true
|
|
114
114
|
}
|
|
115
|
-
const childrenList = item.children || item.props?.children
|
|
115
|
+
const childrenList = item.children || item.props?.["children"]
|
|
116
116
|
if (childrenList && findAndUpdate(childrenList)) {
|
|
117
117
|
return true
|
|
118
118
|
}
|
|
@@ -148,8 +148,8 @@ export function createEditorState(
|
|
|
148
148
|
if (b.children) {
|
|
149
149
|
b.children = removeFromList(b.children)
|
|
150
150
|
}
|
|
151
|
-
if (b.props?.children) {
|
|
152
|
-
b.props
|
|
151
|
+
if (b.props?.["children"]) {
|
|
152
|
+
b.props["children"] = removeFromList(b.props["children"])
|
|
153
153
|
}
|
|
154
154
|
return true
|
|
155
155
|
})
|
|
@@ -172,10 +172,10 @@ export function createEditorState(
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
for (const item of list) {
|
|
175
|
-
const children = item.children || item.props?.children
|
|
175
|
+
const children = item.children || item.props?.["children"]
|
|
176
176
|
if (children && findAndMove(children)) {
|
|
177
177
|
item.children = children
|
|
178
|
-
item.props
|
|
178
|
+
item.props["children"] = children
|
|
179
179
|
return true
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -200,10 +200,10 @@ export function createEditorState(
|
|
|
200
200
|
return true
|
|
201
201
|
}
|
|
202
202
|
for (const item of list) {
|
|
203
|
-
const children = item.children || item.props?.children
|
|
203
|
+
const children = item.children || item.props?.["children"]
|
|
204
204
|
if (children && findAndDup(children)) {
|
|
205
205
|
item.children = children
|
|
206
|
-
item.props
|
|
206
|
+
item.props["children"] = children
|
|
207
207
|
return true
|
|
208
208
|
}
|
|
209
209
|
}
|
|
@@ -259,23 +259,23 @@ export function createEditorState(
|
|
|
259
259
|
if (parentId) {
|
|
260
260
|
for (const item of list) {
|
|
261
261
|
if (item.id === parentId) {
|
|
262
|
-
const children = item.children || item.props?.children || []
|
|
262
|
+
const children = item.children || item.props?.["children"] || []
|
|
263
263
|
if (position === "after") {
|
|
264
264
|
children.push(newBlock)
|
|
265
265
|
} else {
|
|
266
266
|
children.unshift(newBlock)
|
|
267
267
|
}
|
|
268
268
|
item.children = children
|
|
269
|
-
item.props
|
|
269
|
+
item.props["children"] = children
|
|
270
270
|
return true
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
for (const item of list) {
|
|
275
|
-
const children = item.children || item.props?.children
|
|
275
|
+
const children = item.children || item.props?.["children"]
|
|
276
276
|
if (children && insertIntoList(children)) {
|
|
277
277
|
item.children = children
|
|
278
|
-
item.props
|
|
278
|
+
item.props["children"] = children
|
|
279
279
|
return true
|
|
280
280
|
}
|
|
281
281
|
}
|
|
@@ -319,10 +319,10 @@ export function createEditorState(
|
|
|
319
319
|
}
|
|
320
320
|
if (b.children) {
|
|
321
321
|
b.children = remove(b.children)
|
|
322
|
-
if (b.props) b.props
|
|
323
|
-
} else if (b.props?.children) {
|
|
324
|
-
b.props
|
|
325
|
-
b.children = b.props
|
|
322
|
+
if (b.props) b.props["children"] = b.children
|
|
323
|
+
} else if (b.props?.["children"]) {
|
|
324
|
+
b.props["children"] = remove(b.props["children"])
|
|
325
|
+
b.children = b.props["children"]
|
|
326
326
|
}
|
|
327
327
|
return true
|
|
328
328
|
})
|
|
@@ -361,14 +361,14 @@ export function createEditorState(
|
|
|
361
361
|
const insertIntoTarget = (list: BaseBlock[]): boolean => {
|
|
362
362
|
for (const item of list) {
|
|
363
363
|
if (item.id === targetParentId) {
|
|
364
|
-
const children = item.children || item.props?.children || []
|
|
364
|
+
const children = item.children || item.props?.["children"] || []
|
|
365
365
|
const idx = Math.min(Math.max(0, newIndex), children.length)
|
|
366
366
|
children.splice(idx, 0, extractedBlock!)
|
|
367
367
|
item.children = children
|
|
368
|
-
item.props
|
|
368
|
+
item.props["children"] = children
|
|
369
369
|
return true
|
|
370
370
|
}
|
|
371
|
-
const sub = item.children || item.props?.children
|
|
371
|
+
const sub = item.children || item.props?.["children"]
|
|
372
372
|
if (sub && insertIntoTarget(sub)) return true
|
|
373
373
|
}
|
|
374
374
|
return false
|
|
@@ -2,8 +2,8 @@ import Sortable from "sortablejs"
|
|
|
2
2
|
|
|
3
3
|
const sortableProto: Record<string, any> | undefined = Sortable?.prototype
|
|
4
4
|
|
|
5
|
-
if (typeof window !== "undefined" && sortableProto && !sortableProto
|
|
6
|
-
sortableProto
|
|
5
|
+
if (typeof window !== "undefined" && sortableProto && !sortableProto["patchedParentNodeGuard"]) {
|
|
6
|
+
sortableProto["patchedParentNodeGuard"] = true
|
|
7
7
|
const originalOnDragOver = sortableProto["_onDragOver"]
|
|
8
8
|
if (typeof originalOnDragOver === "function") {
|
|
9
9
|
sortableProto["_onDragOver"] = function (evt: Event) {
|
|
@@ -109,10 +109,11 @@ export function initBlockSortable(container: HTMLElement, options: SortableOptio
|
|
|
109
109
|
onAdd: (evt) => {
|
|
110
110
|
runCleanup(evt.item)
|
|
111
111
|
const itemEl = evt.item
|
|
112
|
-
const blockId = itemEl.dataset
|
|
112
|
+
const blockId = itemEl.dataset["id"] || itemEl.getAttribute("data-id")
|
|
113
113
|
if (blockId && evt.newIndex !== undefined && options.onAdd) {
|
|
114
114
|
const target = evt.from.closest("[data-block-id]")
|
|
115
|
-
const containerBlockId =
|
|
115
|
+
const containerBlockId =
|
|
116
|
+
target instanceof HTMLElement ? target.dataset["blockId"] : undefined
|
|
116
117
|
// Remove the physically-moved DOM node before calling the callback.
|
|
117
118
|
// The reactive framework (SolidJS) will re-render the authoritative element
|
|
118
119
|
// from state, so leaving the SortableJS-placed node causes a visual duplicate.
|
|
@@ -123,7 +124,7 @@ export function initBlockSortable(container: HTMLElement, options: SortableOptio
|
|
|
123
124
|
onRemove: (evt) => {
|
|
124
125
|
runCleanup(evt.item)
|
|
125
126
|
const itemEl = evt.item
|
|
126
|
-
const blockId = itemEl.dataset
|
|
127
|
+
const blockId = itemEl.dataset["id"] || itemEl.getAttribute("data-id")
|
|
127
128
|
if (blockId && evt.oldIndex !== undefined && options.onRemove) {
|
|
128
129
|
options.onRemove(blockId, evt.oldIndex)
|
|
129
130
|
}
|
|
@@ -167,8 +168,8 @@ export function cleanAllSortableClasses(specificItem?: HTMLElement | Element) {
|
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
const customWin: Record<string, any> | null = typeof window !== "undefined" ? window : null
|
|
170
|
-
if (customWin && !customWin
|
|
171
|
-
customWin
|
|
171
|
+
if (customWin && !customWin["cmsSortableGlobalListenersAttached"]) {
|
|
172
|
+
customWin["cmsSortableGlobalListenersAttached"] = true
|
|
172
173
|
const globalClean = () => {
|
|
173
174
|
const doClean = () => cleanAllSortableClasses()
|
|
174
175
|
doClean()
|
|
@@ -176,9 +177,9 @@ if (customWin && !customWin.cmsSortableGlobalListenersAttached) {
|
|
|
176
177
|
setTimeout(doClean, 150)
|
|
177
178
|
setTimeout(doClean, 300)
|
|
178
179
|
}
|
|
179
|
-
customWin
|
|
180
|
-
customWin
|
|
181
|
-
customWin
|
|
182
|
-
customWin
|
|
183
|
-
customWin
|
|
180
|
+
customWin["addEventListener"]("mouseup", globalClean, { capture: true })
|
|
181
|
+
customWin["addEventListener"]("pointerup", globalClean, { capture: true })
|
|
182
|
+
customWin["addEventListener"]("touchend", globalClean, { capture: true })
|
|
183
|
+
customWin["addEventListener"]("dragend", globalClean, { capture: true })
|
|
184
|
+
customWin["addEventListener"]("drop", globalClean, { capture: true })
|
|
184
185
|
}
|
|
@@ -2,7 +2,7 @@ import type { BaseBlock } from "../../core/types/blocks"
|
|
|
2
2
|
|
|
3
3
|
export function getBlockChildren(b: BaseBlock): BaseBlock[] {
|
|
4
4
|
if (!b) return []
|
|
5
|
-
if (Array.isArray(b.props?.children)) return b.props
|
|
5
|
+
if (Array.isArray(b.props?.["children"])) return b.props["children"]
|
|
6
6
|
if (Array.isArray(b.children)) return b.children
|
|
7
7
|
return []
|
|
8
8
|
}
|