Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/feat/widgets
Conflicts: src/resizer/distributors/collapse.ts src/resizer/distributors/fixed.ts src/resizer/index.ts src/resizer/item.ts src/resizer/resizer.ts src/resizer/sizer.tspull/21833/head
commit
a5468c918e
|
@ -1,3 +1,12 @@
|
|||
Changes in [3.6.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.6.1) (2020-10-20)
|
||||
===================================================================================================
|
||||
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.6.0...v3.6.1)
|
||||
|
||||
* [Release] Adjust for new widget messaging APIs
|
||||
[\#5342](https://github.com/matrix-org/matrix-react-sdk/pull/5342)
|
||||
* [Release] Fix Jitsi OpenIDC auth
|
||||
[\#5335](https://github.com/matrix-org/matrix-react-sdk/pull/5335)
|
||||
|
||||
Changes in [3.6.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.6.0) (2020-10-12)
|
||||
===================================================================================================
|
||||
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.6.0-rc.1...v3.6.0)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "matrix-react-sdk",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"description": "SDK for matrix.org using React",
|
||||
"author": "matrix.org",
|
||||
"repository": {
|
||||
|
|
|
@ -32,9 +32,7 @@ do
|
|||
echo "Upgrading $i to $latestver..."
|
||||
yarn add -E $i@$latestver
|
||||
git add -u
|
||||
# The `-e` flag opens the editor and gives you a chance to check
|
||||
# the upgrade for correctness.
|
||||
git commit -m "Upgrade $i to $latestver" -e
|
||||
git commit -m "Upgrade $i to $latestver"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -230,6 +230,10 @@ limitations under the License.
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&.mx_UserMenu_contextMenu_hostingLink {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.mx_IconizedContextMenu_icon {
|
||||
|
|
|
@ -360,7 +360,7 @@ function combineEvents(previousSearchResult, localEvents = undefined, serverEven
|
|||
let oldestEventFrom = previousSearchResult.oldestEventFrom;
|
||||
response.highlights = previousSearchResult.highlights;
|
||||
|
||||
if (localEvents && serverEvents) {
|
||||
if (localEvents && serverEvents && serverEvents.results) {
|
||||
// This is a first search call, combine the events from the server and
|
||||
// the local index. Note where our oldest event came from, we shall
|
||||
// fetch the next batch of events from the other source.
|
||||
|
@ -379,7 +379,7 @@ function combineEvents(previousSearchResult, localEvents = undefined, serverEven
|
|||
oldestEventFrom = "local";
|
||||
}
|
||||
combineEventSources(previousSearchResult, response, localEvents.results, cachedEvents);
|
||||
} else if (serverEvents) {
|
||||
} else if (serverEvents && serverEvents.results) {
|
||||
// This is a pagination call fetching more events from the server,
|
||||
// meaning that our oldest event was in the local index.
|
||||
// Change the source of the oldest event if our server event is older
|
||||
|
@ -454,7 +454,7 @@ function combineResponses(previousSearchResult, localEvents = undefined, serverE
|
|||
return response;
|
||||
}
|
||||
|
||||
function restoreEncryptionInfo(searchResultSlice) {
|
||||
function restoreEncryptionInfo(searchResultSlice = []) {
|
||||
for (let i = 0; i < searchResultSlice.length; i++) {
|
||||
const timeline = searchResultSlice[i].context.getTimeline();
|
||||
|
||||
|
@ -517,7 +517,7 @@ async function combinedPagination(searchResult) {
|
|||
},
|
||||
};
|
||||
|
||||
const oldResultCount = searchResult.results.length;
|
||||
const oldResultCount = searchResult.results ? searchResult.results.length : 0;
|
||||
|
||||
// Let the client process the combined result.
|
||||
const result = client._processRoomEventsSearch(searchResult, response);
|
||||
|
|
|
@ -388,7 +388,6 @@ export default class LeftPanel extends React.Component<IProps, IState> {
|
|||
const roomList = <RoomList
|
||||
onKeyDown={this.onKeyDown}
|
||||
resizeNotifier={null}
|
||||
collapsed={false}
|
||||
onFocus={this.onFocus}
|
||||
onBlur={this.onBlur}
|
||||
isMinimized={this.props.isMinimized}
|
||||
|
|
|
@ -52,6 +52,7 @@ import RoomListStore from "../../stores/room-list/RoomListStore";
|
|||
import NonUrgentToastContainer from "./NonUrgentToastContainer";
|
||||
import { ToggleRightPanelPayload } from "../../dispatcher/payloads/ToggleRightPanelPayload";
|
||||
import { IThreepidInvite } from "../../stores/ThreepidInviteStore";
|
||||
import { ICollapseConfig } from "../../resizer/distributors/collapse";
|
||||
|
||||
// We need to fetch each pinned message individually (if we don't already have it)
|
||||
// so each pinned message may trigger a request. Limit the number per room for sanity.
|
||||
|
@ -205,13 +206,8 @@ class LoggedInView extends React.Component<IProps, IState> {
|
|||
};
|
||||
|
||||
_createResizer() {
|
||||
const classNames = {
|
||||
handle: "mx_ResizeHandle",
|
||||
vertical: "mx_ResizeHandle_vertical",
|
||||
reverse: "mx_ResizeHandle_reverse",
|
||||
};
|
||||
let size;
|
||||
const collapseConfig = {
|
||||
const collapseConfig: ICollapseConfig = {
|
||||
toggleSize: 260 - 50,
|
||||
onCollapsed: (collapsed) => {
|
||||
if (collapsed) {
|
||||
|
@ -234,7 +230,11 @@ class LoggedInView extends React.Component<IProps, IState> {
|
|||
},
|
||||
};
|
||||
const resizer = new Resizer(this._resizeContainer.current, CollapseDistributor, collapseConfig);
|
||||
resizer.setClassNames(classNames);
|
||||
resizer.setClassNames({
|
||||
handle: "mx_ResizeHandle",
|
||||
vertical: "mx_ResizeHandle_vertical",
|
||||
reverse: "mx_ResizeHandle_reverse",
|
||||
});
|
||||
return resizer;
|
||||
}
|
||||
|
||||
|
|
|
@ -1277,7 +1277,7 @@ export default class RoomView extends React.Component<IProps, IState> {
|
|||
}
|
||||
|
||||
if (!this.state.searchResults.next_batch) {
|
||||
if (this.state.searchResults.results.length == 0) {
|
||||
if (!this.state.searchResults?.results?.length) {
|
||||
ret.push(<li key="search-top-marker">
|
||||
<h2 className="mx_RoomView_topMarker">{ _t("No results") }</h2>
|
||||
</li>,
|
||||
|
@ -1301,7 +1301,7 @@ export default class RoomView extends React.Component<IProps, IState> {
|
|||
|
||||
let lastRoomId;
|
||||
|
||||
for (let i = this.state.searchResults.results.length - 1; i >= 0; i--) {
|
||||
for (let i = (this.state.searchResults?.results?.length || 0) - 1; i >= 0; i--) {
|
||||
const result = this.state.searchResults.results[i];
|
||||
|
||||
const mxEv = result.context.getEvent();
|
||||
|
@ -1970,7 +1970,7 @@ export default class RoomView extends React.Component<IProps, IState> {
|
|||
|
||||
if (this.state.searchResults) {
|
||||
// show searching spinner
|
||||
if (this.state.searchResults.results === undefined) {
|
||||
if (this.state.searchResults.count === undefined) {
|
||||
searchResultsPanel = (
|
||||
<div className="mx_RoomView_messagePanel mx_RoomView_messagePanelSearchSpinner" />
|
||||
);
|
||||
|
|
|
@ -257,7 +257,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
|||
const signupLink = getHostingLink("user-context-menu");
|
||||
if (signupLink) {
|
||||
hostingLink = (
|
||||
<div className="mx_UserMenu_contextMenu_header">
|
||||
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_hostingLink">
|
||||
{_t(
|
||||
"<a>Upgrade</a> to your own domain", {},
|
||||
{
|
||||
|
|
|
@ -53,7 +53,6 @@ interface IProps {
|
|||
onBlur: (ev: React.FocusEvent) => void;
|
||||
onResize: () => void;
|
||||
resizeNotifier: ResizeNotifier;
|
||||
collapsed: boolean;
|
||||
isMinimized: boolean;
|
||||
}
|
||||
|
||||
|
@ -366,7 +365,7 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
|
||||
public render() {
|
||||
let explorePrompt: JSX.Element;
|
||||
if (RoomListStore.instance.getFirstNameFilterCondition()) {
|
||||
if (!this.props.isMinimized && RoomListStore.instance.getFirstNameFilterCondition()) {
|
||||
explorePrompt = <div className="mx_RoomList_explorePrompt">
|
||||
<div>{_t("Can't see what you’re looking for?")}</div>
|
||||
<AccessibleButton kind="link" onClick={this.onExplore}>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2019 New Vector Ltd
|
||||
Copyright 2019 - 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -16,9 +16,10 @@ limitations under the License.
|
|||
|
||||
import FixedDistributor from "./fixed";
|
||||
import ResizeItem from "../item";
|
||||
import {IConfig} from "../resizer";
|
||||
import Resizer, {IConfig} from "../resizer";
|
||||
import Sizer from "../sizer";
|
||||
|
||||
interface ICollapseConfig extends IConfig {
|
||||
export interface ICollapseConfig extends IConfig {
|
||||
toggleSize: number;
|
||||
onCollapsed?(collapsed: boolean, id: string, element: HTMLElement): void;
|
||||
}
|
||||
|
@ -33,17 +34,16 @@ class CollapseItem extends ResizeItem<ICollapseConfig> {
|
|||
}
|
||||
|
||||
export default class CollapseDistributor extends FixedDistributor<ICollapseConfig, CollapseItem> {
|
||||
static createItem(resizeHandle, resizer, sizer) {
|
||||
static createItem(resizeHandle: HTMLDivElement, resizer: Resizer<ICollapseConfig>, sizer: Sizer) {
|
||||
return new CollapseItem(resizeHandle, resizer, sizer);
|
||||
}
|
||||
|
||||
private readonly toggleSize: number;
|
||||
private isCollapsed: boolean;
|
||||
private isCollapsed = false;
|
||||
|
||||
constructor(item: CollapseItem) {
|
||||
super(item);
|
||||
this.toggleSize = item.resizer?.config?.toggleSize;
|
||||
this.isCollapsed = false;
|
||||
}
|
||||
|
||||
public resize(newSize: number) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2019 New Vector Ltd
|
||||
Copyright 2019 - 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -29,11 +29,11 @@ they have two methods:
|
|||
This method usually ends up calling `resize` once the start offset is subtracted.
|
||||
*/
|
||||
export default class FixedDistributor<C extends IConfig, I extends ResizeItem<any> = ResizeItem<C>> {
|
||||
static createItem(resizeHandle: HTMLDivElement, resizer: Resizer, sizer: Sizer) {
|
||||
static createItem(resizeHandle: HTMLDivElement, resizer: Resizer, sizer: Sizer): ResizeItem {
|
||||
return new ResizeItem(resizeHandle, resizer, sizer);
|
||||
}
|
||||
|
||||
static createSizer(containerElement: HTMLElement, vertical: boolean, reverse: boolean) {
|
||||
static createSizer(containerElement: HTMLElement, vertical: boolean, reverse: boolean): Sizer {
|
||||
return new Sizer(containerElement, vertical, reverse);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*
|
||||
Copyright 2018 New Vector Ltd
|
||||
Copyright 2019 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
Copyright 2019 New Vector Ltd
|
||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
Copyright 2019 - 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -15,8 +14,8 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import Sizer from "./sizer";
|
||||
import Resizer, {IConfig} from "./resizer";
|
||||
import Sizer from "./sizer";
|
||||
|
||||
export default class ResizeItem<C extends IConfig = IConfig> {
|
||||
public readonly domNode: HTMLElement;
|
||||
|
@ -28,38 +27,31 @@ export default class ResizeItem<C extends IConfig = IConfig> {
|
|||
public readonly resizer: Resizer<C>,
|
||||
public readonly sizer: Sizer,
|
||||
) {
|
||||
const id = handle.getAttribute("data-id");
|
||||
const reverse = resizer.isReverseResizeHandle(handle);
|
||||
|
||||
this.domNode = <HTMLElement>(reverse ? handle.nextElementSibling : handle.previousElementSibling);
|
||||
this.id = id;
|
||||
this.reverse = reverse;
|
||||
this.resizer = resizer;
|
||||
this.sizer = sizer;
|
||||
this.reverse = resizer.isReverseResizeHandle(handle);
|
||||
this.domNode = <HTMLElement>(this.reverse ? handle.nextElementSibling : handle.previousElementSibling);
|
||||
this.id = handle.getAttribute("data-id");
|
||||
}
|
||||
|
||||
private copyWith(handle: Element, resizer: Resizer, sizer: Sizer) {
|
||||
private copyWith(handle: HTMLElement, resizer: Resizer, sizer: Sizer) {
|
||||
const Ctor = this.constructor as typeof ResizeItem;
|
||||
return new Ctor(<HTMLElement>handle, resizer, sizer);
|
||||
return new Ctor(handle, resizer, sizer);
|
||||
}
|
||||
|
||||
private advance(forwards: boolean) {
|
||||
// opposite direction from fromResizeHandle to get back to handle
|
||||
let handle = <HTMLElement>(this.reverse ?
|
||||
this.domNode.previousElementSibling :
|
||||
this.domNode.nextElementSibling);
|
||||
let handle = this.reverse ? this.domNode.previousElementSibling : this.domNode.nextElementSibling;
|
||||
const moveNext = forwards !== this.reverse; // xor
|
||||
// iterate at least once to avoid infinite loop
|
||||
do {
|
||||
if (moveNext) {
|
||||
handle = <HTMLElement>handle.nextElementSibling;
|
||||
handle = handle.nextElementSibling;
|
||||
} else {
|
||||
handle = <HTMLElement>handle.previousElementSibling;
|
||||
handle = handle.previousElementSibling;
|
||||
}
|
||||
} while (handle && !this.resizer.isResizeHandle(handle));
|
||||
} while (handle && !this.resizer.isResizeHandle(<HTMLElement>handle));
|
||||
|
||||
if (handle) {
|
||||
const nextHandle = this.copyWith(handle, this.resizer, this.sizer);
|
||||
const nextHandle = this.copyWith(<HTMLElement>handle, this.resizer, this.sizer);
|
||||
nextHandle.reverse = this.reverse;
|
||||
return nextHandle;
|
||||
}
|
||||
|
@ -118,7 +110,7 @@ export default class ResizeItem<C extends IConfig = IConfig> {
|
|||
return this.resizer.isResizeHandle(<HTMLElement>el);
|
||||
});
|
||||
if (firstHandle) {
|
||||
return this.copyWith(firstHandle, this.resizer, this.sizer);
|
||||
return this.copyWith(<HTMLElement>firstHandle, this.resizer, this.sizer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +119,7 @@ export default class ResizeItem<C extends IConfig = IConfig> {
|
|||
return this.resizer.isResizeHandle(<HTMLElement>el);
|
||||
});
|
||||
if (lastHandle) {
|
||||
return this.copyWith(lastHandle, this.resizer, this.sizer);
|
||||
return this.copyWith(<HTMLElement>lastHandle, this.resizer, this.sizer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
Copyright 2018 New Vector Ltd
|
||||
Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
|
||||
Copyright 2018 - 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -15,28 +14,20 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
classNames:
|
||||
// class on resize-handle
|
||||
handle: string
|
||||
// class on resize-handle
|
||||
reverse: string
|
||||
// class on resize-handle
|
||||
vertical: string
|
||||
// class on container
|
||||
resizing: string
|
||||
*/
|
||||
|
||||
import {throttle} from "lodash";
|
||||
|
||||
import FixedDistributor from "./distributors/fixed";
|
||||
import Sizer from "./sizer";
|
||||
import ResizeItem from "./item";
|
||||
import Sizer from "./sizer";
|
||||
|
||||
interface IClassNames {
|
||||
// class on resize-handle
|
||||
handle?: string;
|
||||
// class on resize-handle
|
||||
reverse?: string;
|
||||
// class on resize-handle
|
||||
vertical?: string;
|
||||
// class on container
|
||||
resizing?: string;
|
||||
}
|
||||
|
||||
|
@ -90,7 +81,7 @@ export default class Resizer<C extends IConfig = IConfig> {
|
|||
Gives the distributor for a specific resize handle, as if you would have started
|
||||
to drag that handle. Can be used to manipulate the size of an item programmatically.
|
||||
@param {number} handleIndex the index of the resize handle in the container
|
||||
@return {Distributor} a new distributor for the given handle
|
||||
@return {FixedDistributor} a new distributor for the given handle
|
||||
*/
|
||||
public forHandleAt(handleIndex: number): FixedDistributor<C> {
|
||||
const handles = this.getResizeHandles();
|
||||
|
@ -121,7 +112,7 @@ export default class Resizer<C extends IConfig = IConfig> {
|
|||
private onMouseDown = (event: MouseEvent) => {
|
||||
// use closest in case the resize handle contains
|
||||
// child dom nodes that can be the target
|
||||
const resizeHandle = event.target && (<HTMLElement>event.target).closest(`.${this.classNames.handle}`);
|
||||
const resizeHandle = event.target && (<HTMLDivElement>event.target).closest(`.${this.classNames.handle}`);
|
||||
if (!resizeHandle || resizeHandle.parentElement !== this.container) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2018 New Vector Ltd
|
||||
Copyright 2018 - 2020 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -57,13 +57,13 @@ export default class Sizer {
|
|||
}
|
||||
|
||||
/** @return {number} container offset to document */
|
||||
private getPageOffset() {
|
||||
private getPageOffset(): number {
|
||||
let element = this.container;
|
||||
let offset = 0;
|
||||
while (element) {
|
||||
const pos = this.vertical ? element.offsetTop : element.offsetLeft;
|
||||
offset = offset + pos;
|
||||
element = element.offsetParent as HTMLElement;
|
||||
element = <HTMLElement>element.offsetParent;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
|
|
@ -6507,7 +6507,7 @@ mathml-tag-names@^2.0.1:
|
|||
|
||||
"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop":
|
||||
version "8.5.0"
|
||||
resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/d8c4101fdd521e189f4755c6f02a8971b991ef5f"
|
||||
resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/9f713781cdfea2349115ffaac2d665e8b07fd5dc"
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.11.2"
|
||||
another-json "^0.2.0"
|
||||
|
|
Loading…
Reference in New Issue