more fixes

This commit is contained in:
2026-03-12 07:22:38 +01:00
parent 547215cbe8
commit 4f576ceb04
226 changed files with 14380 additions and 4453 deletions

View File

@@ -23,3 +23,37 @@ document.querySelectorAll('[data-avatar-uploader="true"]').forEach((element) =>
})
);
});
const storyEditorRoot = document.getElementById('story-editor-react-root');
if (storyEditorRoot) {
const mode = storyEditorRoot.getAttribute('data-mode') || 'create';
const storyRaw = storyEditorRoot.getAttribute('data-story') || '{}';
const storyTypesRaw = storyEditorRoot.getAttribute('data-story-types') || '[]';
const endpointsRaw = storyEditorRoot.getAttribute('data-endpoints') || '{}';
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content') || '';
let initialStory = {};
let storyTypes = [];
let endpoints = {};
try {
initialStory = JSON.parse(storyRaw);
storyTypes = JSON.parse(storyTypesRaw);
endpoints = JSON.parse(endpointsRaw);
} catch (_) {
// If parsing fails, the editor falls back to empty defaults in the component.
}
void import('./components/editor/StoryEditor').then(({ default: StoryEditor }) => {
createRoot(storyEditorRoot).render(
React.createElement(StoryEditor, {
mode,
initialStory,
storyTypes,
endpoints,
csrfToken,
})
);
});
}