mirror of https://github.com/fantasticit/think.git
fix: fix flow wrapper style
This commit is contained in:
parent
ef947304cb
commit
aa90cd8dc5
|
@ -5,6 +5,7 @@
|
||||||
height: 100px;
|
height: 100px;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
overflow: visible;
|
||||||
|
|
||||||
.cloneNodeWrap {
|
.cloneNodeWrap {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -12,7 +12,6 @@ export function createEditor(div) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
editorUi.editor.graph.model.clear();
|
editorUi.editor.graph.model.clear();
|
||||||
editorUi.editor.graph.view.scale = 1;
|
|
||||||
editorUi.editor.updateGraphComponents();
|
editorUi.editor.updateGraphComponents();
|
||||||
codec.decode(xmlDoc.documentElement, editorUi.editor.graph.getModel());
|
codec.decode(xmlDoc.documentElement, editorUi.editor.graph.getModel());
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -22,7 +22,6 @@ export const Flow = Node.create({
|
||||||
group: 'block',
|
group: 'block',
|
||||||
selectable: true,
|
selectable: true,
|
||||||
atom: true,
|
atom: true,
|
||||||
inline: false,
|
|
||||||
|
|
||||||
addAttributes() {
|
addAttributes() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -56,7 +56,6 @@ export const FlowWrapper = ({ editor, node, updateAttributes }) => {
|
||||||
(div) => {
|
(div) => {
|
||||||
if (!div) return;
|
if (!div) return;
|
||||||
|
|
||||||
// load().then(() => {
|
|
||||||
if (!$graph.current) {
|
if (!$graph.current) {
|
||||||
const graph = renderXml(div, data);
|
const graph = renderXml(div, data);
|
||||||
$graph.current = graph;
|
$graph.current = graph;
|
||||||
|
@ -64,8 +63,9 @@ export const FlowWrapper = ({ editor, node, updateAttributes }) => {
|
||||||
$graph.current.setXml(data);
|
$graph.current.setXml(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$graph.current.fit();
|
||||||
|
$graph.current.zoom(0.8);
|
||||||
$graph.current.center();
|
$graph.current.center();
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
[data]
|
[data]
|
||||||
);
|
);
|
||||||
|
@ -79,22 +79,17 @@ export const FlowWrapper = ({ editor, node, updateAttributes }) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
load().catch(setError).finally(toggleLoading);
|
load()
|
||||||
}, [toggleLoading]);
|
.catch(setError)
|
||||||
|
.finally(() => toggleLoading(false));
|
||||||
|
}, [toggleLoading, data]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper className={cls(styles.wrap, isActive && styles.isActive)}>
|
<NodeViewWrapper className={cls(styles.wrap, isActive && styles.isActive)}>
|
||||||
<Resizeable
|
<Resizeable isEditable={isEditable} width={width} height={height} maxWidth={maxWidth} onChangeEnd={onResize}>
|
||||||
style={{ overflow: 'hidden' }}
|
|
||||||
isEditable={isEditable}
|
|
||||||
width={width}
|
|
||||||
height={height}
|
|
||||||
maxWidth={maxWidth}
|
|
||||||
onChangeEnd={onResize}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
className={cls(styles.renderWrap, 'render-wrapper')}
|
className={cls(styles.renderWrap, 'render-wrapper')}
|
||||||
style={{ ...INHERIT_SIZE_STYLE, backgroundColor: bgColor }}
|
style={{ ...INHERIT_SIZE_STYLE, overflow: 'hidden', backgroundColor: bgColor }}
|
||||||
>
|
>
|
||||||
{loading && (
|
{loading && (
|
||||||
<div>
|
<div>
|
||||||
|
@ -105,7 +100,7 @@ export const FlowWrapper = ({ editor, node, updateAttributes }) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{error && <Text>{(error && error.message) || '未知错误'}</Text>}
|
{error && <Text>{(error && error.message) || '未知错误'}</Text>}
|
||||||
{!loading && !error && <div ref={setMxgraph}></div>}
|
{!loading && !error && <div style={{ maxHeight: '100%' }} ref={setMxgraph}></div>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.toolbarWrap}>
|
<div className={styles.toolbarWrap}>
|
||||||
|
|
Loading…
Reference in New Issue