1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | 'use strict';
|
12 |
|
13 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
14 |
|
15 | var React = require("react");
|
16 |
|
17 | var cx = require("fbjs/lib/cx");
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | var DraftEditorPlaceholder = function (_React$Component) {
|
26 | _inheritsLoose(DraftEditorPlaceholder, _React$Component);
|
27 |
|
28 | function DraftEditorPlaceholder() {
|
29 | return _React$Component.apply(this, arguments) || this;
|
30 | }
|
31 |
|
32 | var _proto = DraftEditorPlaceholder.prototype;
|
33 |
|
34 | _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
35 | return this.props.text !== nextProps.text || this.props.editorState.getSelection().getHasFocus() !== nextProps.editorState.getSelection().getHasFocus();
|
36 | };
|
37 |
|
38 | _proto.render = function render() {
|
39 | var hasFocus = this.props.editorState.getSelection().getHasFocus();
|
40 | var className = cx({
|
41 | 'public/DraftEditorPlaceholder/root': true,
|
42 | 'public/DraftEditorPlaceholder/hasFocus': hasFocus
|
43 | });
|
44 | var contentStyle = {
|
45 | whiteSpace: 'pre-wrap'
|
46 | };
|
47 | return React.createElement("div", {
|
48 | className: className
|
49 | }, React.createElement("div", {
|
50 | className: cx('public/DraftEditorPlaceholder/inner'),
|
51 | id: this.props.accessibilityID,
|
52 | style: contentStyle
|
53 | }, this.props.text));
|
54 | };
|
55 |
|
56 | return DraftEditorPlaceholder;
|
57 | }(React.Component);
|
58 |
|
59 | module.exports = DraftEditorPlaceholder; |
\ | No newline at end of file |