Commit c56977cc by zhaochengxiang

bug fix

parent e35e42f4
......@@ -528,10 +528,10 @@ function getOffsetTop(element, container) {
return rect.top;
}
export function getInternalCurrentAnchor(_linkIds, _offsetTop = 0, _bounds = 5, container = window) {
export function getInternalCurrentAnchor(_linkIds, _offsetTop = 0, _bounds = 5, container) {
const linkSections: Section[] = [];
_linkIds.forEach((id) => {
const target = document.getElementById(id);
const target = container?.querySelector(`.${id}`);
if (target) {
const top = getOffsetTop(target, container);
if (top < _offsetTop + _bounds) {
......@@ -540,7 +540,6 @@ export function getInternalCurrentAnchor(_linkIds, _offsetTop = 0, _bounds = 5,
}
});
console.log('linkSections', linkSections);
if (linkSections.length) {
const maxSection = linkSections.reduce((prev, curr) => (curr.top > prev.top ? curr : prev));
return maxSection.id;
......
......@@ -150,9 +150,7 @@ const FC = (props) => {
}
key={inheritanceHistoricalType}
>
<div style={{ height: '75vh', overflowX: 'hidden' }}>
{ historicalModelerData && <ImportAction form={historicalForm} action='edit-inherite-modal' roughModelerData={historicalModelerData} onChange={onHistoricalChange} /> }
</div>
</Tabs.TabPane>
<Tabs.TabPane
tab={
......@@ -168,9 +166,7 @@ const FC = (props) => {
}
key={inheritanceZipperType}
>
<div style={{ height: '75vh', overflowX: 'hidden' }}>
{ zipperModelerData && <ImportAction form={zipperForm} action='edit-inherite-modal' roughModelerData={zipperModelerData} onChange={onZipperChange} /> }
</div>
</Tabs.TabPane>
</Tabs>
}
......
......@@ -577,7 +577,7 @@ const ImportAction = React.forwardRef((props, ref) => {
<div style={{ position: 'sticky', top: 0 }}>
<Tabs activeKey={activeValue} centered onChange={(val) => {
setActiveValue(val);
var targetElement = document.getElementById(val); // 找到目标元素
var targetElement = container?.querySelector(`.${val}`); // 找到目标元素
if (targetElement) {
animating.current = true;
targetElement.scrollIntoView();
......@@ -588,7 +588,7 @@ const ImportAction = React.forwardRef((props, ref) => {
<Tabs.TabPane tab='数据表索引' key="model-import-action-index" />
</Tabs>
</div>
<div ref={setContainer} style={{ height: 'calc(100vh - 44px - 64px - 82px)', overflow: 'auto', padding: '0 20px' }}>
<div ref={setContainer} style={{ height: action==='edit-inherite-modal'?'60vh':'calc(100vh - 44px - 64px - 82px)', overflow: 'auto', padding: '0 20px' }}>
<ImportActionHeader
form={form}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment