Add browser-only editor export and 2.5D runtime presentation
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import Editor from './Editor.tsx';
|
||||
import { validateProject } from '../engine/schema.ts';
|
||||
|
||||
const root = document.getElementById('root')!;
|
||||
async function start() {
|
||||
const response = await fetch('./project.forma.json');
|
||||
if (!response.ok) throw Error('Не удалось загрузить проект Forma');
|
||||
const project = await response.json();
|
||||
validateProject(project);
|
||||
createRoot(root).render(<Editor initialProject={project} browserOnly />);
|
||||
}
|
||||
void start().catch((error) => {
|
||||
root.replaceChildren();
|
||||
const message = document.createElement('p');
|
||||
message.style.cssText = 'padding:32px;font:16px/1.6 system-ui';
|
||||
message.textContent = 'Не удалось открыть проект. Обнови страницу. ' + String(error.message || error);
|
||||
root.append(message);
|
||||
});
|
||||
Reference in New Issue
Block a user