优化布局和交互

This commit is contained in:
iqudoo
2026-06-14 12:03:05 +08:00
parent 55867ae12d
commit 4955b1f2e2
9 changed files with 454 additions and 15 deletions

View File

@@ -25,6 +25,7 @@ import { FieldSelect } from './PsSelect';
import { CommitInput } from './CommitInput';
import { useAppDialog } from './AppDialog';
import { useIsNarrowScreen } from '../hooks/useIsMobile';
import type { ElementClipboardActions } from '../hooks/useElementClipboard';
import {
TablePropertyFields,
TableCellContentFields,
@@ -53,6 +54,8 @@ import {
Move,
Layers,
Trash2,
Copy,
ClipboardPaste,
AlignHorizontalJustifyStart,
AlignHorizontalJustifyCenter,
AlignHorizontalJustifyEnd,
@@ -180,6 +183,7 @@ interface PropSidebarProps {
variant?: 'desktop' | 'mobile';
mobileModule?: MobilePropModule;
onMobileModuleChange?: (module: MobilePropModule) => void;
elementClipboard?: ElementClipboardActions;
}
const MOBILE_PROP_MODULES: { id: MobilePropModule; label: string; icon: React.ReactNode }[] = [
@@ -202,6 +206,7 @@ export const PropSidebar: React.FC<PropSidebarProps> = ({
variant = 'desktop',
mobileModule: mobileModuleProp,
onMobileModuleChange,
elementClipboard,
}) => {
const { showConfirm } = useAppDialog();
const isNarrowScreen = useIsNarrowScreen();
@@ -2307,6 +2312,29 @@ export const PropSidebar: React.FC<PropSidebarProps> = ({
</button>
))}
<div className="mobile-design-props-nav-spacer" aria-hidden />
{elementClipboard?.canPaste && (
<button
type="button"
onClick={() => elementClipboard.pasteClipboardElements()}
className="mobile-design-props-nav-btn"
aria-label="粘贴元素"
title={`粘贴 ${elementClipboard.clipboardCount} 个元素`}
>
<ClipboardPaste className="w-4 h-4" />
<span></span>
</button>
)}
<button
type="button"
onClick={() => elementClipboard?.copySelectedElements()}
disabled={!elementClipboard?.canCopy}
className="mobile-design-props-nav-btn"
aria-label="复制选中元素"
title="复制选中元素"
>
<Copy className="w-4 h-4" />
<span></span>
</button>
<button
type="button"
onClick={() => void deleteSelectedElements()}