Merge branch 'develop' into bwindels/verification-right-panel
This commit is contained in:
commit
d1fcef1211
515 changed files with 9064 additions and 7392 deletions
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
import EventEmitter from 'events';
|
||||
|
||||
import MatrixClientPeg from '../MatrixClientPeg';
|
||||
import {MatrixClientPeg} from '../MatrixClientPeg';
|
||||
|
||||
/**
|
||||
* Stores information about the widgets active in the app right now:
|
||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
import EventEmitter from 'events';
|
||||
import { groupMemberFromApiObject, groupRoomFromApiObject } from '../groups';
|
||||
import FlairStore from './FlairStore';
|
||||
import MatrixClientPeg from '../MatrixClientPeg';
|
||||
import {MatrixClientPeg} from '../MatrixClientPeg';
|
||||
|
||||
function parseMembersResponse(response) {
|
||||
return response.chunk.map((apiMember) => groupMemberFromApiObject(apiMember));
|
||||
|
@ -340,4 +340,4 @@ let singletonGroupStore = null;
|
|||
if (!singletonGroupStore) {
|
||||
singletonGroupStore = new GroupStore();
|
||||
}
|
||||
module.exports = singletonGroupStore;
|
||||
export default singletonGroupStore;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
Copyright 2018 New Vector Ltd
|
||||
Copyright 2019 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.
|
||||
|
@ -79,4 +80,4 @@ let singletonLifecycleStore = null;
|
|||
if (!singletonLifecycleStore) {
|
||||
singletonLifecycleStore = new LifecycleStore();
|
||||
}
|
||||
module.exports = singletonLifecycleStore;
|
||||
export default singletonLifecycleStore;
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
Copyright 2017, 2018 Vector Creations Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import { Value } from 'slate';
|
||||
|
||||
const localStoragePrefix = 'editor_state_';
|
||||
|
||||
/**
|
||||
* A class for storing application state to do with the message composer (specifically in-progress message drafts).
|
||||
* It does not worry about cleaning up on log out as this is handled in Lifecycle.js by localStorage.clear()
|
||||
*/
|
||||
class MessageComposerStore {
|
||||
constructor() {
|
||||
this.prefix = localStoragePrefix;
|
||||
}
|
||||
|
||||
_getKey(roomId: string): string {
|
||||
return this.prefix + roomId;
|
||||
}
|
||||
|
||||
setEditorState(roomId: string, editorState: Value, richText: boolean) {
|
||||
localStorage.setItem(this._getKey(roomId), JSON.stringify({
|
||||
editor_state: editorState.toJSON({
|
||||
preserveSelection: true,
|
||||
// XXX: re-hydrating history is not currently supported by fromJSON
|
||||
// preserveHistory: true,
|
||||
// XXX: this seems like a workaround for selection.isSet being based on anchorKey instead of anchorPath
|
||||
preserveKeys: true,
|
||||
}),
|
||||
rich_text: richText,
|
||||
}));
|
||||
}
|
||||
|
||||
getEditorState(roomId): {editor_state: Value, rich_text: boolean} {
|
||||
const stateStr = localStorage.getItem(this._getKey(roomId));
|
||||
|
||||
let state;
|
||||
if (stateStr) {
|
||||
state = JSON.parse(stateStr);
|
||||
|
||||
// if it does not have the fields we expect then bail
|
||||
if (!state || state.rich_text === undefined || state.editor_state === undefined) return;
|
||||
state.editor_state = Value.fromJSON(state.editor_state);
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
let singletonMessageComposerStore = null;
|
||||
if (!singletonMessageComposerStore) {
|
||||
singletonMessageComposerStore = new MessageComposerStore();
|
||||
}
|
||||
module.exports = singletonMessageComposerStore;
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
import {Store} from 'flux/utils';
|
||||
import dis from '../dispatcher';
|
||||
import DMRoomMap from '../utils/DMRoomMap';
|
||||
import Unread from '../Unread';
|
||||
import * as Unread from '../Unread';
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
Copyright 2017, 2018 New Vector Ltd
|
||||
Copyright 2019 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,8 +17,8 @@ limitations under the License.
|
|||
*/
|
||||
import dis from '../dispatcher';
|
||||
import {Store} from 'flux/utils';
|
||||
import MatrixClientPeg from '../MatrixClientPeg';
|
||||
import sdk from '../index';
|
||||
import {MatrixClientPeg} from '../MatrixClientPeg';
|
||||
import * as sdk from '../index';
|
||||
import Modal from '../Modal';
|
||||
import { _t } from '../languageHandler';
|
||||
import { getCachedRoomIDForAlias, storeRoomAliasInCache } from '../RoomAliasCache';
|
||||
|
@ -357,4 +358,4 @@ let singletonRoomViewStore = null;
|
|||
if (!singletonRoomViewStore) {
|
||||
singletonRoomViewStore = new RoomViewStore();
|
||||
}
|
||||
module.exports = singletonRoomViewStore;
|
||||
export default singletonRoomViewStore;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
Copyright 2019 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.
|
||||
|
@ -86,4 +87,4 @@ let singletonSessionStore = null;
|
|||
if (!singletonSessionStore) {
|
||||
singletonSessionStore = new SessionStore();
|
||||
}
|
||||
module.exports = singletonSessionStore;
|
||||
export default singletonSessionStore;
|
||||
|
|
|
@ -18,7 +18,7 @@ import dis from '../dispatcher';
|
|||
import GroupStore from './GroupStore';
|
||||
import Analytics from '../Analytics';
|
||||
import * as RoomNotifs from "../RoomNotifs";
|
||||
import MatrixClientPeg from '../MatrixClientPeg';
|
||||
import {MatrixClientPeg} from '../MatrixClientPeg';
|
||||
|
||||
const INITIAL_STATE = {
|
||||
orderedTags: null,
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import MatrixClientPeg from "../MatrixClientPeg";
|
||||
import {MatrixClientPeg} from "../MatrixClientPeg";
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
import Timer from "../utils/Timer";
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright 2018 New Vector Ltd
|
||||
Copyright 2019 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.
|
||||
|
@ -105,4 +106,4 @@ let singletonWidgetEchoStore = null;
|
|||
if (!singletonWidgetEchoStore) {
|
||||
singletonWidgetEchoStore = new WidgetEchoStore();
|
||||
}
|
||||
module.exports = singletonWidgetEchoStore;
|
||||
export default singletonWidgetEchoStore;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue