Skip to content

Commit 0930d7d

Browse files
author
Weblate
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents 6c6178b + 1abe577 commit 0930d7d

13 files changed

Lines changed: 221 additions & 28 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ electron/dist
1616
electron/pub
1717
**/.idea
1818
/config.json
19+
/config.local*.json
1920
/src/component-index.js
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
Copyright 2017 New Vector Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
'use strict';
18+
19+
import React from 'react';
20+
import PropTypes from 'prop-types';
21+
22+
/*
23+
* This component can be used to display generic HTML content in a contextual
24+
* menu.
25+
*/
26+
27+
28+
export default class GenericElementContextMenu extends React.Component {
29+
static PropTypes = {
30+
element: PropTypes.element.isRequired,
31+
// Function to be called when the parent window is resized
32+
// This can be used to reposition or close the menu on resize and
33+
// ensure that it is not displayed in a stale position.
34+
onResize: PropTypes.func,
35+
};
36+
37+
constructor(props) {
38+
super(props);
39+
this.resize = this.resize.bind(this);
40+
}
41+
42+
componentDidMount() {
43+
this.resize = this.resize.bind(this);
44+
window.addEventListener("resize", this.resize);
45+
}
46+
47+
componentWillUnmount() {
48+
window.removeEventListener("resize", this.resize);
49+
}
50+
51+
resize() {
52+
if (this.props.onResize) {
53+
this.props.onResize();
54+
}
55+
}
56+
57+
render() {
58+
return <div>{ this.props.element }</div>;
59+
}
60+
}

‎src/components/views/rooms/RoomTooltip.js‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ var ReactDOM = require('react-dom');
2121
var dis = require('matrix-react-sdk/lib/dispatcher');
2222
import classNames from 'classnames';
2323

24+
const MIN_TOOLTIP_HEIGHT = 25;
25+
2426
module.exports = React.createClass({
2527
displayName: 'RoomTooltip',
2628

@@ -39,6 +41,9 @@ module.exports = React.createClass({
3941
this.tooltipContainer = document.createElement("div");
4042
this.tooltipContainer.className = "mx_RoomTileTooltip_wrapper";
4143
document.body.appendChild(this.tooltipContainer);
44+
window.addEventListener('scroll', this._renderTooltip, true);
45+
46+
this.parent = ReactDOM.findDOMNode(this).parentNode;
4247

4348
this._renderTooltip();
4449
},
@@ -57,6 +62,18 @@ module.exports = React.createClass({
5762

5863
ReactDOM.unmountComponentAtNode(this.tooltipContainer);
5964
document.body.removeChild(this.tooltipContainer);
65+
window.removeEventListener('scroll', this._renderTooltip, true);
66+
},
67+
68+
_updatePosition(style) {
69+
const parentBox = this.parent.getBoundingClientRect();
70+
let offset = 0;
71+
if (parentBox.height > MIN_TOOLTIP_HEIGHT) {
72+
offset = Math.floor((parentBox.height - MIN_TOOLTIP_HEIGHT) / 2);
73+
}
74+
style.top = (parentBox.top - 2) + window.pageYOffset + offset;
75+
style.left = 6 + parentBox.right + window.pageXOffset;
76+
return style;
6077
},
6178

6279
_renderTooltip: function() {
@@ -66,10 +83,9 @@ module.exports = React.createClass({
6683
// positioned, also taking into account any window zoom
6784
// NOTE: The additional 6 pixels for the left position, is to take account of the
6885
// tooltips chevron
69-
var parent = ReactDOM.findDOMNode(this);
86+
var parent = ReactDOM.findDOMNode(this).parentNode;
7087
var style = {};
71-
style.top = parent.getBoundingClientRect().top + window.pageYOffset;
72-
style.left = 6 + parent.getBoundingClientRect().right + window.pageXOffset;
88+
style = this._updatePosition(style);
7389
style.display = "block";
7490

7591
const tooltipClasses = classNames(
@@ -97,8 +113,8 @@ module.exports = React.createClass({
97113
render: function() {
98114
// Render a placeholder
99115
return (
100-
<div className={ this.props.className } >
116+
<div className={this.props.className} >
101117
</div>
102118
);
103-
}
119+
},
104120
});

‎src/skins/vector/css/_components.scss‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
@import "./matrix-react-sdk/views/messages/_MEmoteBody.scss";
4949
@import "./matrix-react-sdk/views/messages/_MFileBody.scss";
5050
@import "./matrix-react-sdk/views/messages/_MImageBody.scss";
51+
@import "./matrix-react-sdk/views/messages/_MStickerBody.scss";
5152
@import "./matrix-react-sdk/views/messages/_MNoticeBody.scss";
5253
@import "./matrix-react-sdk/views/messages/_MTextBody.scss";
5354
@import "./matrix-react-sdk/views/messages/_RoomAvatarEvent.scss";
@@ -62,6 +63,7 @@
6263
@import "./matrix-react-sdk/views/rooms/_MemberInfo.scss";
6364
@import "./matrix-react-sdk/views/rooms/_MemberList.scss";
6465
@import "./matrix-react-sdk/views/rooms/_MessageComposer.scss";
66+
@import "./matrix-react-sdk/views/rooms/_Stickers.scss";
6567
@import "./matrix-react-sdk/views/rooms/_PinnedEventTile.scss";
6668
@import "./matrix-react-sdk/views/rooms/_PinnedEventsPanel.scss";
6769
@import "./matrix-react-sdk/views/rooms/_PresenceLabel.scss";

‎src/skins/vector/css/matrix-react-sdk/views/messages/_MImageBody.scss‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ limitations under the License.
1515
*/
1616

1717
.mx_MImageBody {
18-
display: block;
19-
margin-right: 34px;
20-
}
21-
22-
.mx_MImageBody_thumbnail {
23-
max-width: 100%;
24-
/*
25-
background-color: $primary-bg-color;
26-
border: 2px solid $primary-bg-color;
27-
border-radius: 1px;
28-
*/
18+
display: block;
19+
margin-right: 34px;
2920
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
Copyright 2018 New Vector Ltd.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
.mx_MStickerBody {
18+
display: block;
19+
margin-right: 34px;
20+
min-height: 110px;
21+
padding: 20px 0;
22+
}
23+
24+
.mx_MStickerBody_image_container {
25+
display: inline-block;
26+
position: relative;
27+
}
28+
29+
.mx_MStickerBody_image {
30+
max-width: 100%;
31+
opacity: 0;
32+
}
33+
34+
.mx_MStickerBody_image_visible {
35+
opacity: 1;
36+
}
37+
38+
.mx_MStickerBody_placeholder {
39+
position: absolute;
40+
opacity: 1;
41+
}
42+
43+
.mx_MStickerBody_placeholder_invisible {
44+
transition: 500ms;
45+
opacity: 0;
46+
}

‎src/skins/vector/css/matrix-react-sdk/views/rooms/_AppsDrawer.scss‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ limitations under the License.
1818
margin: 5px;
1919
}
2020

21+
.mx_AppsDrawer_hidden {
22+
display: none;
23+
}
24+
2125
.mx_AppsContainer {
2226
display: flex;
2327
flex-direction: row;
@@ -54,6 +58,7 @@ limitations under the License.
5458
margin-right: 5px;
5559
border: 1px solid $primary-hairline-color;
5660
border-radius: 2px;
61+
background-color: $dialog-background-bg-color;
5762
}
5863

5964
.mx_AppTile:last-child {
@@ -67,8 +72,6 @@ limitations under the License.
6772
padding: 0;
6873
border: 1px solid $primary-hairline-color;
6974
border-radius: 2px;
70-
// height: 350px;
71-
// display: inline-block;
7275
}
7376

7477
.mx_AppTile, .mx_AppTileFullWidth {
@@ -103,7 +106,6 @@ limitations under the License.
103106
}
104107

105108
.mx_AppTileMenuBarWidget {
106-
// pointer-events: none;
107109
cursor: pointer;
108110
width: 10px;
109111
height: 10px;
@@ -122,24 +124,21 @@ limitations under the License.
122124
}
123125

124126
.mx_AppTileBody{
125-
height: 350px;
127+
height: 280px;
126128
width: 100%;
127129
overflow: hidden;
128130
}
129131

130132
.mx_AppTileBody iframe {
131133
width: 100%;
132-
height: 350px;
134+
height: 280px;
133135
overflow: hidden;
134136
border: none;
135137
padding: 0;
136138
margin: 0;
137139
display: block;
138140
}
139141

140-
// .mx_CloseAppWidget {
141-
// }
142-
143142
.mx_AppTileMenuBarWidgetPadding {
144143
margin-right: 5px;
145144
}
@@ -253,12 +252,21 @@ form.mx_Custom_Widget_Form div {
253252
}
254253

255254
.mx_AppLoading {
256-
min-height: 305px;
257255
display: flex;
258256
flex-direction: column;
259257
justify-content: center;
260258
align-items: center;
261259
font-weight: bold;
260+
position: relative;
261+
height: 280px;
262+
}
263+
264+
.mx_AppLoading .mx_Spinner {
265+
position: absolute;
266+
top: 0;
267+
bottom: 0;
268+
left: 0;
269+
right: 0;
262270
}
263271

264272
.mx_AppLoading iframe {

‎src/skins/vector/css/matrix-react-sdk/views/rooms/_MessageComposer.scss‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ limitations under the License.
3434
width: 100%;
3535
}
3636

37+
.mx_MessageComposer_row div:last-child{
38+
padding-right: 0;
39+
}
40+
3741
.mx_MessageComposer .mx_MessageComposer_avatar {
3842
padding-left: 10px;
3943
padding-right: 28px;
@@ -158,7 +162,8 @@ limitations under the License.
158162
.mx_MessageComposer_hangup,
159163
.mx_MessageComposer_voicecall,
160164
.mx_MessageComposer_videocall,
161-
.mx_MessageComposer_apps {
165+
.mx_MessageComposer_apps,
166+
.mx_MessageComposer_stickers {
162167
/*display: table-cell;*/
163168
/*vertical-align: middle;*/
164169
/*padding-left: 10px;*/
@@ -171,7 +176,8 @@ limitations under the License.
171176
.mx_MessageComposer_hangup object,
172177
.mx_MessageComposer_voicecall object,
173178
.mx_MessageComposer_videocall object,
174-
.mx_MessageComposer_apps object {
179+
.mx_MessageComposer_apps object,
180+
.mx_MessageComposer_stickers object {
175181
pointer-events: none;
176182
}
177183

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.mx_Stickers_content {
2+
overflow: hidden;
3+
}
4+
5+
.mx_Stickers_content .mx_AppTileFullWidth {
6+
border: none;
7+
}
8+
9+
.mx_Stickers_contentPlaceholder {
10+
display: flex;
11+
flex-grow: 1;
12+
flex-direction: column;
13+
align-items: center;
14+
justify-content: center;
15+
text-align: center;
16+
}
17+
18+
.mx_Stickers_contentPlaceholder p {
19+
max-width: 200px;
20+
}
21+
22+
.mx_Stickers_addLink {
23+
display: inline;
24+
cursor: pointer;
25+
text-decoration: underline;
26+
}
27+
28+
.mx_Stickers_hideStickers {
29+
z-index: 2001;
30+
}

‎src/skins/vector/css/vector-web/views/rooms/_RoomTooltip.scss‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ limitations under the License.
4949
line-height: 14px;
5050
font-size: 13px;
5151
color: $primary-fg-color;
52+
max-width: 600px;
53+
margin-right: 50px;
5254
}
53-

0 commit comments

Comments
 (0)