/** * Copyright (c) 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow * @format */ import React, {Component} from 'react'; import {Row, Col, Button, Tabs} from 'antd'; import EditValue from './EditValue'; import type {LayoutRecordT} from './LayoutRecord'; import type {Yoga$Direction} from 'yoga-layout'; import InfoText from './InfoText'; import './Editor.css'; const TabPane = Tabs.TabPane; type Props = { node: ?LayoutRecordT, onChangeLayout: (key: string, value: any) => void, onChangeSetting: (key: string, value: any) => void, direction: Yoga$Direction, selectedNodeIsRoot: boolean, onRemove?: () => void, onAdd?: () => void, }; export default class Editor extends Component { componentDidMount() { document.addEventListener('keydown', this.onKeyDown); } componentWillUnmount() { document.removeEventListener('keydown', this.onKeyDown); } onKeyDown = (e: KeyboardEvent) => { if ( (e.key === 'Delete' || e.key === 'Backspace') && this.props.onRemove && !(e.target instanceof HTMLInputElement) ) { this.props.onRemove(); } }; render() { const {node, selectedNodeIsRoot} = this.props; const disabled = !Boolean(node); return (

Direction The direction property specifies the text direction/writing direction

Flex direction Defining the direction of the main-axis

Flex grow Grow factor defined how much space this element should take up, relative to it's siblings

Flex shrink Shrink factor if elements don't fit into the parent node anymore.

Flex wrap Wrapping behaviour when child nodes don't fit into a single line

Justify content Aligns child nodes along the main-axis

Align items Aligns child nodes along the cross-axis

Align self Specifies alignment on the cross-axis for the node itself

Align content Alignment of lines along the cross-axis when wrapping

Width × height Dimensions of the node

Aspect ratio Aspect radio is an additon by Yoga which is handy e.g. for nodes displaying videos

Box model

{['padding', 'border', 'margin'].map(property => ( ))}

Position Relative position offsets the node from it's calculated position. Absolute position removes the node from the flexbox flow and positions it at the given position.

); } }