Compare commits

..

No commits in common. "3ea6aa8fb347f7930cfa7f157c3a82e0f2bdaf84" and "4e4b0e428d979693b3a146964e707d796f2dde8e" have entirely different histories.

3 changed files with 4 additions and 69 deletions

View File

@ -563,7 +563,6 @@ export function EditorApp() {
<Inspector <Inspector
selected={selected} selected={selected}
onUpdateRect={(id, patch) => dispatch({ type: 'updateWidgetRect', id, rect: patch })}
onUpdateTextProps={(id, props) => onUpdateTextProps={(id, props) =>
dispatch({ type: 'updateWidgetProps', widgetType: 'text', id, props }) dispatch({ type: 'updateWidgetProps', widgetType: 'text', id, props })
} }

View File

@ -1,4 +1,4 @@
import { Divider, Input, InputNumber, Select, Space, Typography } from 'antd'; import { Input, InputNumber, Select, Space, Typography } from 'antd';
import { assertNever, type WidgetNode, type TextWidgetNode, type WidgetNodeByType } from '@astralview/sdk'; import { assertNever, type WidgetNode, type TextWidgetNode, type WidgetNodeByType } from '@astralview/sdk';
type ImageWidgetNode = WidgetNodeByType['image']; type ImageWidgetNode = WidgetNodeByType['image'];
@ -7,7 +7,6 @@ type VideoWidgetNode = WidgetNodeByType['video'];
export function Inspector(props: { export function Inspector(props: {
selected?: WidgetNode; selected?: WidgetNode;
onUpdateRect: (id: string, patch: Partial<WidgetNode['rect']>) => void;
onUpdateTextProps: (id: string, patch: Partial<TextWidgetNode['props']>) => void; onUpdateTextProps: (id: string, patch: Partial<TextWidgetNode['props']>) => void;
onUpdateImageProps: (id: string, patch: Partial<ImageWidgetNode['props']>) => void; onUpdateImageProps: (id: string, patch: Partial<ImageWidgetNode['props']>) => void;
onUpdateIframeProps: (id: string, patch: Partial<IframeWidgetNode['props']>) => void; onUpdateIframeProps: (id: string, patch: Partial<IframeWidgetNode['props']>) => void;
@ -19,60 +18,6 @@ export function Inspector(props: {
return <Typography.Paragraph style={{ color: '#666' }}>No selection.</Typography.Paragraph>; return <Typography.Paragraph style={{ color: '#666' }}>No selection.</Typography.Paragraph>;
} }
const rectDisabled = !!node.locked;
const RectSection = (
<div style={{ marginBottom: 12 }}>
<Typography.Text type="secondary">Rect</Typography.Text>
<Space style={{ width: '100%', marginTop: 6 }} size={8} wrap>
<InputNumber
size="small"
value={node.rect.x}
controls={false}
disabled={rectDisabled}
onChange={(v) => props.onUpdateRect(node.id, { x: typeof v === 'number' ? v : node.rect.x })}
style={{ width: 90 }}
addonBefore="X"
/>
<InputNumber
size="small"
value={node.rect.y}
controls={false}
disabled={rectDisabled}
onChange={(v) => props.onUpdateRect(node.id, { y: typeof v === 'number' ? v : node.rect.y })}
style={{ width: 90 }}
addonBefore="Y"
/>
<InputNumber
size="small"
value={node.rect.w}
controls={false}
disabled={rectDisabled}
min={1}
onChange={(v) => props.onUpdateRect(node.id, { w: typeof v === 'number' ? v : node.rect.w })}
style={{ width: 96 }}
addonBefore="W"
/>
<InputNumber
size="small"
value={node.rect.h}
controls={false}
disabled={rectDisabled}
min={1}
onChange={(v) => props.onUpdateRect(node.id, { h: typeof v === 'number' ? v : node.rect.h })}
style={{ width: 96 }}
addonBefore="H"
/>
</Space>
{rectDisabled ? (
<Typography.Text style={{ display: 'block', marginTop: 4, color: '#64748b', fontSize: 12 }}>
Locked layer: rect editing disabled.
</Typography.Text>
) : null}
<Divider style={{ margin: '12px 0', borderColor: 'rgba(255,255,255,0.08)' }} />
</div>
);
switch (node.type) { switch (node.type) {
case 'image': case 'image':
return ( return (
@ -81,8 +26,6 @@ export function Inspector(props: {
Image Image
</Typography.Title> </Typography.Title>
{RectSection}
<Typography.Text type="secondary">Source</Typography.Text> <Typography.Text type="secondary">Source</Typography.Text>
<Input <Input
value={node.props.src} value={node.props.src}
@ -122,8 +65,6 @@ export function Inspector(props: {
Iframe Iframe
</Typography.Title> </Typography.Title>
{RectSection}
<Typography.Text type="secondary">Source</Typography.Text> <Typography.Text type="secondary">Source</Typography.Text>
<Input <Input
value={node.props.src} value={node.props.src}
@ -149,8 +90,6 @@ export function Inspector(props: {
Video Video
</Typography.Title> </Typography.Title>
{RectSection}
<Typography.Text type="secondary">Source</Typography.Text> <Typography.Text type="secondary">Source</Typography.Text>
<Input <Input
value={node.props.src} value={node.props.src}
@ -234,8 +173,6 @@ export function Inspector(props: {
Text Text
</Typography.Title> </Typography.Title>
{RectSection}
<Typography.Text type="secondary">Content</Typography.Text> <Typography.Text type="secondary">Content</Typography.Text>
<Input <Input
value={node.props.text} value={node.props.text}

View File

@ -21,16 +21,15 @@ export function bindEditorHotkeys(getShift: () => boolean, dispatch: (a: EditorA
const onKeyDown = (e: KeyboardEvent) => { const onKeyDown = (e: KeyboardEvent) => {
const ctrl = e.ctrlKey || e.metaKey; const ctrl = e.ctrlKey || e.metaKey;
// Do not steal common hotkeys while typing in an input/editor.
// (Including Escape: inputs often use it to revert/blur.)
if (isEditableTarget(e.target)) return;
// Esc: clear selection (and closes context menu via selection parity effect). // Esc: clear selection (and closes context menu via selection parity effect).
if (e.key === 'Escape') { if (e.key === 'Escape') {
dispatch({ type: 'selectSingle', id: undefined }); dispatch({ type: 'selectSingle', id: undefined });
return; return;
} }
// Do not steal common hotkeys while typing in an input/editor.
if (isEditableTarget(e.target)) return;
// Undo/redo // Undo/redo
if (ctrl && e.key.toLowerCase() === 'z') { if (ctrl && e.key.toLowerCase() === 'z') {
e.preventDefault(); e.preventDefault();