in src/framework/MViewerDebug.tsx [18:48]
export function MViewerDebug(props: React.PropsWithChildren<MViewerProp & {debug?: boolean}>):JSX.Element {
const [dataVersion, setDataVersion] = useState(0);
const debug = props.debug ?? (window.location.search.indexOf("debug")>=0 || window.location.hash.indexOf("debug")>=0);
if(!debug){
return <MViewer {...props}/>;
}
function finalData(){
return MUtil.filterHide(props.schema, props.database);
}
return <Tabs style={props.style} onTabClick={(key:string)=>{
if(key === TEXTAREAKEY){
setTimeout(() => { // 让编辑器满屏
const textarea = document.querySelector("#_data");
// @ts-ignore
const h = document.body.clientHeight - textarea.offsetTop;
// @ts-ignore
textarea.style.height=(h - 10) + "px";
// @ts-ignore
textarea.value = JSON.stringify(props.database, null, 2);
})
} else if(key === FINALDATAKEY) {
setTimeout(() => {
let myContainer = document.getElementById('finalData') as HTMLInputElement;
myContainer.innerHTML = JSON.stringify(finalData() , null, 2);
});
} else if(key == OTHERMORPH) {
setDataVersion(dataVersion + 1);
}
}}>