Render saved Studio results directly by ID without an editor
This commit is contained in:
@@ -5,7 +5,7 @@ export type Design={id:string;name:string;layoutId:string;parameters:Parameters;
|
||||
// getRandomValues is available on the deployment's HTTP origin; randomUUID is not.
|
||||
export const newElementId=()=> 'user-'+Array.from(globalThis.crypto.getRandomValues(new Uint32Array(4)),n=>n.toString(16).padStart(8,'0')).join('');
|
||||
export const emptyParameters=():Parameters=>({texts:{},images:{},decorations:{}});
|
||||
export const designUrl=(layoutId:string,id:string)=>`/studio/layouts/${layoutId}?id=${id}`;
|
||||
export const designUrl=(_layoutId:string,id:string)=>`/studio/template-layout?id=${id}`;
|
||||
export function nativeLayout(layout:Layout):Layout {
|
||||
return {id:layout.id,name:layout.name,width:layout.width,height:layout.height,elements:layout.elements.map(({id,kind,role,box,direction,text,reading})=>({id,kind,role,box,direction,text,reading}))};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user