mirror of https://github.com/sgoudham/carbon.git
add dynamic styles, fix window control
parent
94e1ce5949
commit
eb75ecd320
@ -0,0 +1,25 @@
|
||||
const drop = (props, monitor, component) => {
|
||||
const bundle = monitor.getItem()
|
||||
const file = bundle.files[0]
|
||||
const reader = new FileReader()
|
||||
reader.onload = function(event) {
|
||||
component.setState({
|
||||
droppedContent: event.target.result
|
||||
})
|
||||
};
|
||||
reader.readAsText(file, "UTF-8");
|
||||
}
|
||||
|
||||
export default DropTarget(NativeTypes.FILE, { drop }, (connect, monitor) => ({
|
||||
connectDropTarget: connect.dropTarget(),
|
||||
isOver: monitor.isOver(),
|
||||
canDrop: monitor.canDrop(),
|
||||
item: monitor.getItem()
|
||||
}))(CodeImage)
|
||||
|
||||
|
||||
let code = this.props.content
|
||||
const split = code.split(EOL)
|
||||
if (split.length > MAX_LINES) code = [...split.slice(0, MAX_LINES - 1), '', '...'].join(EOL)
|
||||
|
||||
return this.props.connectDropTarget(
|
Loading…
Reference in New Issue