Canvas: Add ability to edit selected connections in the inline editor (#83625)

This commit is contained in:
Nathan Marrs 2024-02-29 17:56:40 -07:00 committed by GitHub
parent 859ecf2a34
commit 5d7a979199
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,7 @@ import { activePanelSubject, InstanceState } from '../../CanvasPanel';
import { addStandardCanvasEditorOptions } from '../../module'; import { addStandardCanvasEditorOptions } from '../../module';
import { InlineEditTabs } from '../../types'; import { InlineEditTabs } from '../../types';
import { getElementTypes, onAddItem } from '../../utils'; import { getElementTypes, onAddItem } from '../../utils';
import { getConnectionEditor } from '../connectionEditor';
import { getElementEditor } from '../element/elementEditor'; import { getElementEditor } from '../element/elementEditor';
import { getLayerEditor } from '../layer/layerEditor'; import { getLayerEditor } from '../layer/layerEditor';
@ -42,6 +43,17 @@ export function InlineEditBody() {
builder.addNestedOptions(getLayerEditor(instanceState)); builder.addNestedOptions(getLayerEditor(instanceState));
} }
const selectedConnection = state.selectedConnection;
if (selectedConnection && activeTab === InlineEditTabs.SelectedElement) {
builder.addNestedOptions(
getConnectionEditor({
category: [`Selected connection`],
connection: selectedConnection,
scene: state.scene,
})
);
}
const selection = state.selected; const selection = state.selected;
if (selection?.length === 1 && activeTab === InlineEditTabs.SelectedElement) { if (selection?.length === 1 && activeTab === InlineEditTabs.SelectedElement) {
const element = selection[0]; const element = selection[0];
@ -82,7 +94,10 @@ export function InlineEditBody() {
const rootLayer: FrameState | undefined = instanceState?.layer; const rootLayer: FrameState | undefined = instanceState?.layer;
const noElementSelected = const noElementSelected =
instanceState && activeTab === InlineEditTabs.SelectedElement && instanceState.selected.length === 0; instanceState &&
activeTab === InlineEditTabs.SelectedElement &&
instanceState.selected.length === 0 &&
instanceState.selectedConnection === undefined;
return ( return (
<> <>