update 0.12.4

This commit is contained in:
hufeixiong
2022-02-15 18:02:32 +08:00
parent 012b578519
commit 958ddd3a09
12 changed files with 89 additions and 33 deletions

View File

@@ -4,7 +4,7 @@ import { innerContainerDrag } from '../core/innerDrag';
import { NormalMarkLineRender } from '../core/markline';
import { IStoreData } from '../core/store/storetype';
import { wrapperMoveState } from './wrapperMove/event';
import { CSSProperties, PropsWithChildren, useMemo, useState } from 'react';
import { CSSProperties, PropsWithChildren, useEffect, useMemo, useState } from 'react';
import Blocks from './blocks';
import { containerResizer } from '../core/resizeHandler/containerResizer';
import React from 'react';
@@ -42,6 +42,19 @@ function Container(props: PropsWithChildren<ContainerProps>) {
forceUpdate((p) => p + 1);
};
useEffect(() => {
if (props.context === 'preview') {
props.config.onMounted();
props.config.onMountedFn.forEach((v) => v());
}
return () => {
if (props.context === 'preview') {
props.config.destroyed();
props.config.destroyedFn.forEach((v) => v());
}
};
}, [props.config, props.context]);
return (
<>
{props.context === 'edit' && (