Skip to content

Commit 65cd5ef

Browse files
CodePreview still ugly but functional
1 parent a3d933b commit 65cd5ef

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/components/CodePreview.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@ class CodePreview extends Component {
77
render(): JSX.Element {
88
const { focusComponent, components } = this.props;
99
return (
10-
<div>
11-
{/* <p> */}
12-
<pre>{format(componentRender(focusComponent, components))}</pre>
13-
{/* </p> */}
10+
<div
11+
style={{
12+
width: '500px',
13+
height: '290px',
14+
direction: 'rtl',
15+
paddingLeft: '20px',
16+
color: '#D3D3D3',
17+
fontSize: 16,
18+
overflow: 'auto',
19+
}}
20+
>
21+
<pre style={{ direction: 'ltr' }}>
22+
{format(componentRender(focusComponent, components))}
23+
</pre>
1424
</div>
1525
);
1626
}

src/components/KonvaStage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class KonvaStage extends Component {
196196
imageSource={child.htmlElement == 'Image' && child.HTMLInfo.Src ? child.HTMLInfo.Src : null}
197197
/>
198198
))
199-
.sort((rectA, rectB) => rectB.props.width * rectB.props.height - rectA.props.width * rectA.props.height) // shouldnt this be subtraction instead of < ? see MDN
199+
.sort((rectA, rectB) => rectB.props.width * rectB.props.height - rectA.props.width * rectA.props.height)
200200
// reasoning for the sort:
201201
// Konva determines zIndex (which rect is clicked on if rects overlap) based on rendering order
202202
// as long as the smallest components are rendered last they will always be accessible over the big boys

0 commit comments

Comments
 (0)