mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-28 12:36:41 +07:00
moved components to TypeScript
This commit is contained in:
parent
85b8860862
commit
0a01c91271
54 changed files with 2771 additions and 5134 deletions
|
@ -1,45 +0,0 @@
|
|||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
|
||||
type State = {
|
||||
text: String,
|
||||
}
|
||||
|
||||
export class StickerDesc extends React.PureComponent<void, State> {
|
||||
state = {
|
||||
text: this.props.value,
|
||||
};
|
||||
|
||||
setText = e => {
|
||||
this.setState({ text: e.target.value });
|
||||
this.props.onChange(e.target.value);
|
||||
};
|
||||
|
||||
blockMouse = e => e.stopPropagation(); // todo: pass here locker for moving markers from Sticker.js
|
||||
|
||||
render() {
|
||||
const { text } = this.state;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('sticker-desc', { is_empty: !text.trim() })}
|
||||
onMouseDown={this.blockMouse}
|
||||
onMouseUp={this.blockMouse}
|
||||
>
|
||||
<div className="sticker-desc-sizer">
|
||||
<span
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: (text.replace(/\n$/, '\n ').replace(/\n/g, '<br />') || ' ')
|
||||
}}
|
||||
/>
|
||||
<textarea
|
||||
onChange={this.setText}
|
||||
value={text}
|
||||
onMouseDown={this.blockMouse}
|
||||
onDragStart={this.blockMouse}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue