|
@@ -78,13 +78,10 @@ class E2EESection extends Component<Props, State> {
|
78
|
78
|
super(props);
|
79
|
79
|
|
80
|
80
|
this.state = {
|
81
|
|
- enabled: false,
|
82
|
|
- expand: false
|
|
81
|
+ enabled: false
|
83
|
82
|
};
|
84
|
83
|
|
85
|
84
|
// Bind event handlers so they are only bound once for every instance.
|
86
|
|
- this._onExpand = this._onExpand.bind(this);
|
87
|
|
- this._onExpandKeyPress = this._onExpandKeyPress.bind(this);
|
88
|
85
|
this._onToggle = this._onToggle.bind(this);
|
89
|
86
|
}
|
90
|
87
|
|
|
@@ -96,7 +93,7 @@ class E2EESection extends Component<Props, State> {
|
96
|
93
|
*/
|
97
|
94
|
render() {
|
98
|
95
|
const { _everyoneSupportE2EE, t } = this.props;
|
99
|
|
- const { enabled, expand } = this.state;
|
|
96
|
+ const { enabled } = this.state;
|
100
|
97
|
const description = t('dialog.e2eeDescription');
|
101
|
98
|
|
102
|
99
|
return (
|
|
@@ -105,25 +102,10 @@ class E2EESection extends Component<Props, State> {
|
105
|
102
|
aria-live = 'polite'
|
106
|
103
|
className = 'description'
|
107
|
104
|
id = 'e2ee-section-description'>
|
108
|
|
- { expand && description }
|
109
|
|
- { !expand && description.substring(0, 100) }
|
110
|
|
- { !expand && <span
|
111
|
|
- aria-controls = 'e2ee-section-description'
|
112
|
|
- aria-expanded = { expand }
|
113
|
|
- className = 'read-more'
|
114
|
|
- onClick = { this._onExpand }
|
115
|
|
- onKeyPress = { this._onExpandKeyPress }
|
116
|
|
- role = 'button'
|
117
|
|
- tabIndex = { 0 }>
|
118
|
|
- ... { t('dialog.readMore') }
|
119
|
|
- </span> }
|
|
105
|
+ { description }
|
|
106
|
+ { !_everyoneSupportE2EE && <br /> }
|
|
107
|
+ { !_everyoneSupportE2EE && t('dialog.e2eeWarning') }
|
120
|
108
|
</p>
|
121
|
|
- {
|
122
|
|
- !_everyoneSupportE2EE
|
123
|
|
- && <span className = 'warning'>
|
124
|
|
- { t('dialog.e2eeWarning') }
|
125
|
|
- </span>
|
126
|
|
- }
|
127
|
109
|
<div className = 'control-row'>
|
128
|
110
|
<label htmlFor = 'e2ee-section-switch'>
|
129
|
111
|
{ t('dialog.e2eeLabel') }
|
|
@@ -137,35 +119,6 @@ class E2EESection extends Component<Props, State> {
|
137
|
119
|
);
|
138
|
120
|
}
|
139
|
121
|
|
140
|
|
- _onExpand: () => void;
|
141
|
|
-
|
142
|
|
- /**
|
143
|
|
- * Callback to be invoked when the description is expanded.
|
144
|
|
- *
|
145
|
|
- * @returns {void}
|
146
|
|
- */
|
147
|
|
- _onExpand() {
|
148
|
|
- this.setState({
|
149
|
|
- expand: true
|
150
|
|
- });
|
151
|
|
- }
|
152
|
|
-
|
153
|
|
- _onExpandKeyPress: (Object) => void;
|
154
|
|
-
|
155
|
|
- /**
|
156
|
|
- * KeyPress handler for accessibility.
|
157
|
|
- *
|
158
|
|
- * @param {Object} e - The key event to handle.
|
159
|
|
- *
|
160
|
|
- * @returns {void}
|
161
|
|
- */
|
162
|
|
- _onExpandKeyPress(e) {
|
163
|
|
- if (e.key === ' ' || e.key === 'Enter') {
|
164
|
|
- e.preventDefault();
|
165
|
|
- this._onExpand();
|
166
|
|
- }
|
167
|
|
- }
|
168
|
|
-
|
169
|
122
|
_onToggle: () => void;
|
170
|
123
|
|
171
|
124
|
/**
|