Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: flex容器内的子元素工具栏无拖拽按钮 + 工具栏样式问题 #11657

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/amis-editor-core/scss/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,8 @@
position: absolute;
top: -24px;
left: -2px;
z-index: 20;
z-index: 199; // 图层需要高于尺寸重置框,不遮挡工具栏按钮提示浮层
border: 0;
padding-right: 8px;
white-space: nowrap;
background: $Editor-hlbox--onActive-bg;
// border-radius: 3px 3px 0px 0px;
Expand Down Expand Up @@ -529,7 +528,7 @@

.ae-Editor-toolbar {
position: relative;
padding-left: 8px;
padding: 0 8px;
display: inline-flex !important;
pointer-events: all;
align-items: center;
Expand Down
7 changes: 6 additions & 1 deletion packages/amis-editor-core/src/component/HighlightBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,12 @@ export default observer(function ({
) : null}
</div>

<div className="ae-Editor-toolbar" key="toolbar">
<div
className={cx('ae-Editor-toolbar', {
invisible: toolbars.length === 0
})}
key="toolbar"
>
{toolbars.map(item => (
<button
key={item.id}
Expand Down
3 changes: 2 additions & 1 deletion packages/amis-editor/src/plugin/Layout/FlexPluginBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ export class FlexPluginBase extends LayoutBasePlugin {
regions: Array<RegionConfig> = [
{
key: 'items',
label: '子节点集合'
label: '子节点集合',
renderMethod: 'renderItems'
}
];

Expand Down
2 changes: 1 addition & 1 deletion packages/amis-editor/src/plugin/Tpl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export class TplPlugin extends BasePlugin {
]);
};

popOverBody = [
popOverBody?: any[] = [
getSchemaTpl('tpl:content'),
getSchemaTpl('tpl:rich-text'),
getSchemaTpl('tpl:wrapperComponent')
Expand Down
20 changes: 13 additions & 7 deletions packages/amis/src/renderers/Flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ export default class Flex extends React.Component<FlexProps, object> {
super(props);
}

renderItems() {
const {items, render, disabled, classnames: cx} = this.props;
let children = Array.isArray(items) ? items : items ? [items] : [];

return children.map((item, key) =>
render(`items/${key}`, item, {
key: `items/${key}`,
disabled: (item as SchemaObject)?.disabled ?? disabled
})
);
}

render() {
const {
items,
Expand Down Expand Up @@ -153,13 +165,7 @@ export default class Flex extends React.Component<FlexProps, object> {
data-id={id}
data-role="container"
>
{(Array.isArray(items) ? items : items ? [items] : []).map(
(item, key) =>
render(`flexItem/${key}`, item, {
key: `flexItem/${key}`,
disabled: (item as SchemaObject)?.disabled ?? disabled
})
)}
{this.renderItems()}
<CustomStyle
{...this.props}
config={{
Expand Down
Loading