From 75a2be1a8d2564bbd531652afc17ca7734e842c8 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 23 Apr 2018 01:13:18 +0100 Subject: [PATCH 001/702] WIP (doesn't build yet) replacing draft with slate --- package.json | 7 +- src/ComposerHistoryManager.js | 51 ++++--- .../views/rooms/MessageComposerInput.js | 135 ++++++++++-------- src/stores/MessageComposerStore.js | 20 +-- 4 files changed, 125 insertions(+), 88 deletions(-) diff --git a/package.json b/package.json index 77338b4874..7856304757 100644 --- a/package.json +++ b/package.json @@ -58,9 +58,6 @@ "classnames": "^2.1.2", "commonmark": "^0.28.1", "counterpart": "^0.18.0", - "draft-js": "^0.11.0-alpha", - "draft-js-export-html": "^0.6.0", - "draft-js-export-markdown": "^0.3.0", "emojione": "2.2.7", "file-saver": "^1.3.3", "filesize": "3.5.6", @@ -84,6 +81,10 @@ "react-beautiful-dnd": "^4.0.1", "react-dom": "^15.6.0", "react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#5e97aef", + "slate": "^0.33.4", + "slate-react": "^0.12.4", + "slate-html-serializer": "^0.6.1", + "slate-md-serializer": "^3.0.3", "sanitize-html": "^1.14.1", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index 2757c5bd3d..5c9ae26af0 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -15,38 +15,55 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {ContentState, convertToRaw, convertFromRaw} from 'draft-js'; +import { Value } from 'slate'; +import Html from 'slate-html-serializer'; +import Markdown as Md from 'slate-md-serializer'; +import Plain from 'slate-plain-serializer'; import * as RichText from './RichText'; import Markdown from './Markdown'; + import _clamp from 'lodash/clamp'; -type MessageFormat = 'html' | 'markdown'; +type MessageFormat = 'rich' | 'markdown'; class HistoryItem { // Keeping message for backwards-compatibility message: string; - rawContentState: RawDraftContentState; - format: MessageFormat = 'html'; + value: Value; + format: MessageFormat = 'rich'; - constructor(contentState: ?ContentState, format: ?MessageFormat) { + constructor(value: ?Value, format: ?MessageFormat) { this.rawContentState = contentState ? convertToRaw(contentState) : null; this.format = format; + } - toContentState(outputFormat: MessageFormat): ContentState { - const contentState = convertFromRaw(this.rawContentState); + toValue(outputFormat: MessageFormat): Value { if (outputFormat === 'markdown') { - if (this.format === 'html') { - return ContentState.createFromText(RichText.stateToMarkdown(contentState)); + if (this.format === 'rich') { + // convert a rich formatted history entry to its MD equivalent + const markdown = new Markdown({}); + return new Value({ data: markdown.serialize(value) }); + // return ContentState.createFromText(RichText.stateToMarkdown(contentState)); } - } else { + else if (this.format === 'markdown') { + return value; + } + } else if (outputFormat === 'rich') { if (this.format === 'markdown') { - return RichText.htmlToContentState(new Markdown(contentState.getPlainText()).toHTML()); + // convert MD formatted string to its rich equivalent. + const plain = new Plain({}); + const md = new Md({}); + return md.deserialize(plain.serialize(value)); + // return RichText.htmlToContentState(new Markdown(contentState.getPlainText()).toHTML()); + } + else if (this.format === 'rich') { + return value; } } - // history item has format === outputFormat - return contentState; + log.error("unknown format -> outputFormat conversion"); + return value; } } @@ -69,16 +86,16 @@ export default class ComposerHistoryManager { this.lastIndex = this.currentIndex; } - save(contentState: ContentState, format: MessageFormat) { - const item = new HistoryItem(contentState, format); + save(value: Value, format: MessageFormat) { + const item = new HistoryItem(value, format); this.history.push(item); this.currentIndex = this.lastIndex + 1; sessionStorage.setItem(`${this.prefix}[${this.lastIndex++}]`, JSON.stringify(item)); } - getItem(offset: number, format: MessageFormat): ?ContentState { + getItem(offset: number, format: MessageFormat): ?Value { this.currentIndex = _clamp(this.currentIndex + offset, 0, this.lastIndex - 1); const item = this.history[this.currentIndex]; - return item ? item.toContentState(format) : null; + return item ? item.toValue(format) : null; } } diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index c142d97b28..1984f72bf9 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -18,9 +18,16 @@ import React from 'react'; import PropTypes from 'prop-types'; import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent'; -import {Editor, EditorState, RichUtils, CompositeDecorator, Modifier, - getDefaultKeyBinding, KeyBindingUtil, ContentState, ContentBlock, SelectionState, - Entity} from 'draft-js'; +import { Editor } from 'slate-react'; +import { Value } from 'slate'; + +import Html from 'slate-html-serializer'; +import Markdown as Md from 'slate-md-serializer'; +import Plain from 'slate-plain-serializer'; + +// import {Editor, EditorState, RichUtils, CompositeDecorator, Modifier, +// getDefaultKeyBinding, KeyBindingUtil, ContentState, ContentBlock, SelectionState, +// Entity} from 'draft-js'; import classNames from 'classnames'; import escape from 'lodash/escape'; @@ -61,20 +68,10 @@ const REGEX_EMOJI_WHITESPACE = new RegExp('(?:^|\\s)(' + asciiRegexp + ')\\s$'); const TYPING_USER_TIMEOUT = 10000, TYPING_SERVER_TIMEOUT = 30000; -const ZWS_CODE = 8203; -const ZWS = String.fromCharCode(ZWS_CODE); // zero width space - const ENTITY_TYPES = { AT_ROOM_PILL: 'ATROOMPILL', }; -function stateToMarkdown(state) { - return __stateToMarkdown(state) - .replace( - ZWS, // draft-js-export-markdown adds these - ''); // this is *not* a zero width space, trust me :) -} - function onSendMessageFailed(err, room) { // XXX: temporary logging to try to diagnose // https://github.com/vector-im/riot-web/issues/3148 @@ -103,8 +100,6 @@ export default class MessageComposerInput extends React.Component { }; static getKeyBinding(ev: SyntheticKeyboardEvent): string { - const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev); - // Restrict a subset of key bindings to ONLY having ctrl/meta* pressed and // importantly NOT having alt, shift, meta/ctrl* pressed. draft-js does not // handle this in `getDefaultKeyBinding` so we do it ourselves here. @@ -121,7 +116,7 @@ export default class MessageComposerInput extends React.Component { }[ev.keyCode]; if (ctrlCmdCommand) { - if (!ctrlCmdOnly) { + if (!isOnlyCtrlOrCmdKeyEvent(ev)) { return null; } return ctrlCmdCommand; @@ -145,17 +140,6 @@ export default class MessageComposerInput extends React.Component { constructor(props, context) { super(props, context); - this.onAction = this.onAction.bind(this); - this.handleReturn = this.handleReturn.bind(this); - this.handleKeyCommand = this.handleKeyCommand.bind(this); - this.onEditorContentChanged = this.onEditorContentChanged.bind(this); - this.onUpArrow = this.onUpArrow.bind(this); - this.onDownArrow = this.onDownArrow.bind(this); - this.onTab = this.onTab.bind(this); - this.onEscape = this.onEscape.bind(this); - this.setDisplayedCompletion = this.setDisplayedCompletion.bind(this); - this.onMarkdownToggleClicked = this.onMarkdownToggleClicked.bind(this); - this.onTextPasted = this.onTextPasted.bind(this); const isRichtextEnabled = SettingsStore.getValue('MessageComposerInput.isRichTextEnabled'); @@ -185,6 +169,7 @@ export default class MessageComposerInput extends React.Component { this.client = MatrixClientPeg.get(); } +/* findPillEntities(contentState: ContentState, contentBlock: ContentBlock, callback) { contentBlock.findEntityRanges( (character) => { @@ -199,13 +184,15 @@ export default class MessageComposerInput extends React.Component { }, callback, ); } +*/ /* - * "Does the right thing" to create an EditorState, based on: + * "Does the right thing" to create an Editor value, based on: * - whether we've got rich text mode enabled * - contentState was passed in */ - createEditorState(richText: boolean, contentState: ?ContentState): EditorState { + createEditorState(richText: boolean, value: ?Value): Value { +/* const decorators = richText ? RichText.getScopedRTDecorators(this.props) : RichText.getScopedMDDecorators(this.props); const shouldShowPillAvatar = !SettingsStore.getValue("Pill.shouldHidePillAvatar"); @@ -239,7 +226,6 @@ export default class MessageComposerInput extends React.Component { }, }); const compositeDecorator = new CompositeDecorator(decorators); - let editorState = null; if (contentState) { editorState = EditorState.createWithContent(contentState, compositeDecorator); @@ -248,6 +234,8 @@ export default class MessageComposerInput extends React.Component { } return EditorState.moveFocusToEnd(editorState); +*/ + return value; } componentDidMount() { @@ -260,12 +248,14 @@ export default class MessageComposerInput extends React.Component { } componentWillUpdate(nextProps, nextState) { +/* // this is dirty, but moving all this state to MessageComposer is dirtier if (this.props.onInputStateChanged && nextState !== this.state) { const state = this.getSelectionInfo(nextState.editorState); state.isRichtextEnabled = nextState.isRichtextEnabled; this.props.onInputStateChanged(state); } +*/ } onAction = (payload) => { @@ -277,6 +267,7 @@ export default class MessageComposerInput extends React.Component { case 'focus_composer': editor.focus(); break; +/* case 'insert_mention': { // Pretend that we've autocompleted this user because keeping two code // paths for inserting a user pill is not fun @@ -322,6 +313,7 @@ export default class MessageComposerInput extends React.Component { } } break; +*/ } }; @@ -372,7 +364,7 @@ export default class MessageComposerInput extends React.Component { stopServerTypingTimer() { if (this.serverTypingTimer) { - clearTimeout(this.servrTypingTimer); + clearTimeout(this.serverTypingTimer); this.serverTypingTimer = null; } } @@ -492,9 +484,9 @@ export default class MessageComposerInput extends React.Component { // Record the editor state for this room so that it can be retrieved after // switching to another room and back dis.dispatch({ - action: 'content_state', + action: 'editor_state', room_id: this.props.room.roomId, - content_state: state.editorState.getCurrentContent(), + editor_state: state.editorState.getCurrentContent(), }); if (!state.hasOwnProperty('originalEditorState')) { @@ -528,28 +520,36 @@ export default class MessageComposerInput extends React.Component { enableRichtext(enabled: boolean) { if (enabled === this.state.isRichtextEnabled) return; - let contentState = null; + // FIXME: this conversion should be handled in the store, surely + // i.e. "convert my current composer value into Rich or MD, as ComposerHistoryManager already does" + + let value = null; if (enabled) { - const md = new Markdown(this.state.editorState.getCurrentContent().getPlainText()); - contentState = RichText.htmlToContentState(md.toHTML()); + // const md = new Markdown(this.state.editorState.getCurrentContent().getPlainText()); + // contentState = RichText.htmlToContentState(md.toHTML()); + + const plain = new Plain({}); + const md = new Md({}); + value = md.deserialize(plain.serialize(this.state.editorState)); } else { - let markdown = RichText.stateToMarkdown(this.state.editorState.getCurrentContent()); - if (markdown[markdown.length - 1] === '\n') { - markdown = markdown.substring(0, markdown.length - 1); // stateToMarkdown tacks on an extra newline (?!?) - } - contentState = ContentState.createFromText(markdown); + // let markdown = RichText.stateToMarkdown(this.state.editorState.getCurrentContent()); + // value = ContentState.createFromText(markdown); + + const markdown = new Markdown({}); + value = Value({ data: markdown.serialize(value) }); } Analytics.setRichtextMode(enabled); this.setState({ - editorState: this.createEditorState(enabled, contentState), + editorState: this.createEditorState(enabled, value), isRichtextEnabled: enabled, }); SettingsStore.setValue("MessageComposerInput.isRichTextEnabled", null, SettingLevel.ACCOUNT, enabled); } handleKeyCommand = (command: string): boolean => { +/* if (command === 'toggle-mode') { this.enableRichtext(!this.state.isRichtextEnabled); return true; @@ -658,11 +658,11 @@ export default class MessageComposerInput extends React.Component { this.setState({editorState: newState}); return true; } - +*/ return false; }; - - onTextPasted(text: string, html?: string) { +/* + onTextPasted = (text: string, html?: string) => { const currentSelection = this.state.editorState.getSelection(); const currentContent = this.state.editorState.getCurrentContent(); @@ -682,9 +682,10 @@ export default class MessageComposerInput extends React.Component { newEditorState = EditorState.forceSelection(newEditorState, contentState.getSelectionAfter()); this.onEditorContentChanged(newEditorState); return true; - } - - handleReturn(ev) { + }; +*/ + handleReturn = (ev) => { +/* if (ev.shiftKey) { this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState)); return true; @@ -701,15 +702,21 @@ export default class MessageComposerInput extends React.Component { // See handleKeyCommand (when command === 'backspace') return false; } - - const contentState = this.state.editorState.getCurrentContent(); +*/ + const contentState = this.state.editorState; +/* if (!contentState.hasText()) { return true; } +*/ + const plain = new Plain({}); + value = md.deserialize(); - let contentText = contentState.getPlainText(), contentHTML; + let contentText = plain.serialize(contentState); + let contentHTML; +/* // Strip MD user (tab-completed) mentions to preserve plaintext mention behaviour. // We have to do this now as opposed to after calculating the contentText for MD // mode because entity positions may not be maintained when using @@ -720,10 +727,12 @@ export default class MessageComposerInput extends React.Component { // Some commands (/join) require pills to be replaced with their text content const commandText = this.removeMDLinks(contentState, ['#']); +*/ + const commandText = contentText; const cmd = SlashCommands.processInput(this.props.room.roomId, commandText); if (cmd) { if (!cmd.error) { - this.historyManager.save(contentState, this.state.isRichtextEnabled ? 'html' : 'markdown'); + this.historyManager.save(contentState, this.state.isRichtextEnabled ? 'rich' : 'markdown'); this.setState({ editorState: this.createEditorState(), }); @@ -754,6 +763,7 @@ export default class MessageComposerInput extends React.Component { const quotingEv = RoomViewStore.getQuotingEvent(); if (this.state.isRichtextEnabled) { +/* // We should only send HTML if any block is styled or contains inline style let shouldSendHTML = false; @@ -788,6 +798,8 @@ export default class MessageComposerInput extends React.Component { }); shouldSendHTML = hasLink; } +*/ + let shouldSendHTML = true; if (shouldSendHTML) { contentHTML = HtmlUtils.processHtmlForSending( RichText.contentStateToHTML(contentState), @@ -797,6 +809,7 @@ export default class MessageComposerInput extends React.Component { // Use the original contentState because `contentText` has had mentions // stripped and these need to end up in contentHTML. +/* // Replace all Entities of type `LINK` with markdown link equivalents. // TODO: move this into `Markdown` and do the same conversion in the other // two places (toggling from MD->RT mode and loading MD history into RT mode) @@ -817,7 +830,7 @@ export default class MessageComposerInput extends React.Component { }); return blockText; }).join('\n'); - +*/ const md = new Markdown(pt); // if contains no HTML and we're not quoting (needing HTML) if (md.isPlainText() && !quotingEv) { @@ -832,7 +845,7 @@ export default class MessageComposerInput extends React.Component { this.historyManager.save( contentState, - this.state.isRichtextEnabled ? 'html' : 'markdown', + this.state.isRichtextEnabled ? 'rich' : 'markdown', ); if (contentText.startsWith('/me')) { @@ -881,7 +894,7 @@ export default class MessageComposerInput extends React.Component { }); return true; - } + }; onUpArrow = (e) => { this.onVerticalArrow(e, true); @@ -896,6 +909,7 @@ export default class MessageComposerInput extends React.Component { return; } +/* // Select history only if we are not currently auto-completing if (this.autocomplete.state.completionList.length === 0) { // Don't go back in history if we're in the middle of a multi-line message @@ -927,8 +941,10 @@ export default class MessageComposerInput extends React.Component { this.moveAutocompleteSelection(up); e.preventDefault(); } +*/ }; +/* selectHistory = async (up) => { const delta = up ? -1 : 1; @@ -950,7 +966,7 @@ export default class MessageComposerInput extends React.Component { return; } - const newContent = this.historyManager.getItem(delta, this.state.isRichtextEnabled ? 'html' : 'markdown'); + const newContent = this.historyManager.getItem(delta, this.state.isRichtextEnabled ? 'rich' : 'markdown'); if (!newContent) return false; let editorState = EditorState.push( this.state.editorState, @@ -969,6 +985,7 @@ export default class MessageComposerInput extends React.Component { this.setState({editorState}); return true; }; +*/ onTab = async (e) => { this.setState({ @@ -1061,8 +1078,9 @@ export default class MessageComposerInput extends React.Component { return true; }; - onFormatButtonClicked(name: "bold" | "italic" | "strike" | "code" | "underline" | "quote" | "bullet" | "numbullet", e) { + onFormatButtonClicked = (name: "bold" | "italic" | "strike" | "code" | "underline" | "quote" | "bullet" | "numbullet", e) => { e.preventDefault(); // don't steal focus from the editor! +/* const command = { code: 'code-block', quote: 'blockquote', @@ -1070,7 +1088,8 @@ export default class MessageComposerInput extends React.Component { numbullet: 'ordered-list-item', }[name] || name; this.handleKeyCommand(command); - } +*/ + }; /* returns inline style and block type of current SelectionState so MessageComposer can render formatting buttons. */ diff --git a/src/stores/MessageComposerStore.js b/src/stores/MessageComposerStore.js index d02bcf953f..3b1ab1fa72 100644 --- a/src/stores/MessageComposerStore.js +++ b/src/stores/MessageComposerStore.js @@ -14,16 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ import dis from '../dispatcher'; -import {Store} from 'flux/utils'; -import {convertToRaw, convertFromRaw} from 'draft-js'; +import { Store } from 'flux/utils'; const INITIAL_STATE = { - editorStateMap: localStorage.getItem('content_state') ? - JSON.parse(localStorage.getItem('content_state')) : {}, + // a map of room_id to rich text editor composer state + editorStateMap: localStorage.getItem('editor_state') ? + JSON.parse(localStorage.getItem('editor_state')) : {}, }; /** - * A class for storing application state to do with the message composer. This is a simple + * A class for storing application state to do with the message composer (specifically + * in-progress message drafts). This is a simple * flux store that listens for actions and updates its state accordingly, informing any * listeners (views) of state changes. */ @@ -42,7 +43,7 @@ class MessageComposerStore extends Store { __onDispatch(payload) { switch (payload.action) { - case 'content_state': + case 'editor_state': this._contentState(payload); break; case 'on_logged_out': @@ -53,16 +54,15 @@ class MessageComposerStore extends Store { _contentState(payload) { const editorStateMap = this._state.editorStateMap; - editorStateMap[payload.room_id] = convertToRaw(payload.content_state); - localStorage.setItem('content_state', JSON.stringify(editorStateMap)); + editorStateMap[payload.room_id] = payload.editor_state; + localStorage.setItem('editor_state', JSON.stringify(editorStateMap)); this._setState({ editorStateMap: editorStateMap, }); } getContentState(roomId) { - return this._state.editorStateMap[roomId] ? - convertFromRaw(this._state.editorStateMap[roomId]) : null; + return this._state.editorStateMap[roomId]; } reset() { From e62e43def6401a0c9c518308418f5a90fc2b10b1 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 5 May 2018 23:25:04 +0100 Subject: [PATCH 002/702] comment out more draft stuff --- src/ComposerHistoryManager.js | 2 +- src/components/views/avatars/RoomAvatar.js | 2 +- .../views/rooms/MessageComposerInput.js | 36 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index 5c9ae26af0..938be9eee4 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -17,7 +17,7 @@ limitations under the License. import { Value } from 'slate'; import Html from 'slate-html-serializer'; -import Markdown as Md from 'slate-md-serializer'; +import { Markdown as Md } from 'slate-md-serializer'; import Plain from 'slate-plain-serializer'; import * as RichText from './RichText'; import Markdown from './Markdown'; diff --git a/src/components/views/avatars/RoomAvatar.js b/src/components/views/avatars/RoomAvatar.js index 499e575227..e37d8d5d19 100644 --- a/src/components/views/avatars/RoomAvatar.js +++ b/src/components/views/avatars/RoomAvatar.js @@ -177,7 +177,7 @@ module.exports = React.createClass({ render: function() { const BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); - const {room, oobData, ...otherProps} = this.props; + const {room, oobData, viewAvatarOnClick, ...otherProps} = this.props; const roomName = room ? room.name : oobData.name; diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index c8523acea1..af942a75e6 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -22,7 +22,7 @@ import { Editor } from 'slate-react'; import { Value } from 'slate'; import Html from 'slate-html-serializer'; -import Markdown as Md from 'slate-md-serializer'; +import { Markdown as Md } from 'slate-md-serializer'; import Plain from 'slate-plain-serializer'; // import {Editor, EditorState, RichUtils, CompositeDecorator, Modifier, @@ -1103,6 +1103,10 @@ export default class MessageComposerInput extends React.Component { /* returns inline style and block type of current SelectionState so MessageComposer can render formatting buttons. */ getSelectionInfo(editorState: EditorState) { + return { + [], null + }; +/* const styleName = { BOLD: _td('bold'), ITALIC: _td('italic'), @@ -1130,13 +1134,17 @@ export default class MessageComposerInput extends React.Component { style, blockType, }; +*/ } getAutocompleteQuery(contentState: ContentState) { + return []; + // Don't send markdown links to the autocompleter - return this.removeMDLinks(contentState, ['@', '#']); + // return this.removeMDLinks(contentState, ['@', '#']); } +/* removeMDLinks(contentState: ContentState, prefixes: string[]) { const plaintext = contentState.getPlainText(); if (!plaintext) return ''; @@ -1169,7 +1177,7 @@ export default class MessageComposerInput extends React.Component { } }); } - +*/ onMarkdownToggleClicked = (e) => { e.preventDefault(); // don't steal focus from the editor! this.handleKeyCommand('toggle-mode'); @@ -1178,25 +1186,14 @@ export default class MessageComposerInput extends React.Component { render() { const activeEditorState = this.state.originalEditorState || this.state.editorState; - // From https://github.com/facebook/draft-js/blob/master/examples/rich/rich.html#L92 - // If the user changes block type before entering any text, we can - // either style the placeholder or hide it. - let hidePlaceholder = false; - const contentState = activeEditorState.getCurrentContent(); - if (!contentState.hasText()) { - if (contentState.getBlockMap().first().getType() !== 'unstyled') { - hidePlaceholder = true; - } - } - const className = classNames('mx_MessageComposer_input', { mx_MessageComposer_input_empty: hidePlaceholder, mx_MessageComposer_input_error: this.state.someCompletions === false, }); - const content = activeEditorState.getCurrentContent(); - const selection = RichText.selectionStateToTextOffsets(activeEditorState.getSelection(), - activeEditorState.getCurrentContent().getBlocksAsArray()); + // const content = activeEditorState.getCurrentContent(); + // const selection = RichText.selectionStateToTextOffsets(activeEditorState.getSelection(), + // activeEditorState.getCurrentContent().getBlocksAsArray()); return (
@@ -1219,6 +1216,7 @@ export default class MessageComposerInput extends React.Component { + spellCheck={true} + */ + />
); From f4ed820b6f0d8bb4d0aa6441c7633a334d47afcc Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 5 May 2018 23:38:14 +0100 Subject: [PATCH 003/702] fix stubbing --- src/components/views/rooms/MessageComposerInput.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index af942a75e6..6290a5c15d 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -1103,9 +1103,7 @@ export default class MessageComposerInput extends React.Component { /* returns inline style and block type of current SelectionState so MessageComposer can render formatting buttons. */ getSelectionInfo(editorState: EditorState) { - return { - [], null - }; + return {}; /* const styleName = { BOLD: _td('bold'), From 05eba3fa32703b075c9012f125b9a79cf135e038 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 6 May 2018 00:18:11 +0100 Subject: [PATCH 004/702] stub out more until it loads... --- .../views/rooms/MessageComposerInput.js | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 6290a5c15d..e7cbb1abde 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -237,7 +237,13 @@ export default class MessageComposerInput extends React.Component { return EditorState.moveFocusToEnd(editorState); */ - return value; + if (value) { + // create with this value + } + else { + value = Value.create(); + } + return value; } componentDidMount() { @@ -262,7 +268,7 @@ export default class MessageComposerInput extends React.Component { onAction = (payload) => { const editor = this.refs.editor; - let contentState = this.state.editorState.getCurrentContent(); + let editorState = this.state.editorState; switch (payload.action) { case 'reply_to_event': @@ -1030,6 +1036,7 @@ export default class MessageComposerInput extends React.Component { * If passed a non-null displayedCompletion, modifies state.originalEditorState to compute new state.editorState. */ setDisplayedCompletion = async (displayedCompletion: ?Completion): boolean => { +/* const activeEditorState = this.state.originalEditorState || this.state.editorState; if (displayedCompletion == null) { @@ -1084,6 +1091,7 @@ export default class MessageComposerInput extends React.Component { // for some reason, doing this right away does not update the editor :( // setTimeout(() => this.refs.editor.focus(), 50); +*/ return true; }; @@ -1102,7 +1110,7 @@ export default class MessageComposerInput extends React.Component { /* returns inline style and block type of current SelectionState so MessageComposer can render formatting buttons. */ - getSelectionInfo(editorState: EditorState) { + getSelectionInfo(editorState: Value) { return {}; /* const styleName = { @@ -1136,7 +1144,7 @@ export default class MessageComposerInput extends React.Component { } getAutocompleteQuery(contentState: ContentState) { - return []; + return ''; // Don't send markdown links to the autocompleter // return this.removeMDLinks(contentState, ['@', '#']); @@ -1184,11 +1192,20 @@ export default class MessageComposerInput extends React.Component { render() { const activeEditorState = this.state.originalEditorState || this.state.editorState; + let hidePlaceholder = false; + // FIXME: in case we need to implement manual placeholdering + const className = classNames('mx_MessageComposer_input', { mx_MessageComposer_input_empty: hidePlaceholder, mx_MessageComposer_input_error: this.state.someCompletions === false, }); + const content = null; + const selection = { + start: 0, + end: 0, + }; + // const content = activeEditorState.getCurrentContent(); // const selection = RichText.selectionStateToTextOffsets(activeEditorState.getSelection(), // activeEditorState.getCurrentContent().getBlocksAsArray()); @@ -1214,6 +1231,7 @@ export default class MessageComposerInput extends React.Component { Date: Sun, 6 May 2018 01:18:26 +0100 Subject: [PATCH 005/702] stub out yet more --- res/css/views/rooms/_MessageComposer.scss | 8 ++++++ .../views/rooms/MessageComposerInput.js | 26 ++++++++++++------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/res/css/views/rooms/_MessageComposer.scss b/res/css/views/rooms/_MessageComposer.scss index 2e8f07b7ef..531c4442c1 100644 --- a/res/css/views/rooms/_MessageComposer.scss +++ b/res/css/views/rooms/_MessageComposer.scss @@ -84,6 +84,14 @@ limitations under the License. margin-right: 6px; } +.mx_MessageComposer_editor { + width: 100%; + flex: 1; + max-height: 120px; + min-height: 21px; + overflow: auto; +} + @keyframes visualbell { from { background-color: #faa } diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index e7cbb1abde..e560ddb5c7 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -19,7 +19,7 @@ import PropTypes from 'prop-types'; import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent'; import { Editor } from 'slate-react'; -import { Value } from 'slate'; +import { Value, Document } from 'slate'; import Html from 'slate-html-serializer'; import { Markdown as Md } from 'slate-md-serializer'; @@ -238,12 +238,17 @@ export default class MessageComposerInput extends React.Component { return EditorState.moveFocusToEnd(editorState); */ if (value) { - // create with this value + // create from the existing value... } else { - value = Value.create(); + // ...or create a new one. } - return value; + + return Value.create({ + document: Document.create({ + nodes: [], + }), + }); } componentDidMount() { @@ -394,6 +399,7 @@ export default class MessageComposerInput extends React.Component { // Called by Draft to change editor contents onEditorContentChanged = (editorState: EditorState) => { +/* editorState = RichText.attachImmutableEntitiesToEmoji(editorState); const currentBlock = editorState.getSelection().getStartKey(); @@ -449,7 +455,7 @@ export default class MessageComposerInput extends React.Component { editorState = EditorState.forceSelection(editorState, newContentState.getSelectionAfter()); } } - +*/ /* Since a modification was made, set originalEditorState to null, since newState is now our original */ this.setState({ editorState, @@ -466,6 +472,7 @@ export default class MessageComposerInput extends React.Component { * @param callback */ setState(state, callback) { +/* if (state.editorState != null) { state.editorState = RichText.attachImmutableEntitiesToEmoji( state.editorState); @@ -501,12 +508,12 @@ export default class MessageComposerInput extends React.Component { state.originalEditorState = null; } } - +*/ super.setState(state, () => { if (callback != null) { callback(); } - +/* const textContent = this.state.editorState.getCurrentContent().getPlainText(); const selection = RichText.selectionStateToTextOffsets( this.state.editorState.getSelection(), @@ -522,6 +529,7 @@ export default class MessageComposerInput extends React.Component { let editorRoot = this.refs.editor.refs.editor.parentNode.parentNode; editorRoot.scrollTop = editorRoot.scrollHeight; } +*/ }); } @@ -1230,11 +1238,11 @@ export default class MessageComposerInput extends React.Component { src={`img/button-md-${!this.state.isRichtextEnabled}.png`} /> Date: Sun, 6 May 2018 15:27:27 +0100 Subject: [PATCH 006/702] make slate actually work as a textarea --- .../views/rooms/MessageComposerInput.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index e560ddb5c7..9a0863810e 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -237,18 +237,13 @@ export default class MessageComposerInput extends React.Component { return EditorState.moveFocusToEnd(editorState); */ - if (value) { - // create from the existing value... + if (value instanceof Value) { + return value; } else { // ...or create a new one. + return Plain.deserialize('') } - - return Value.create({ - document: Document.create({ - nodes: [], - }), - }); } componentDidMount() { @@ -398,7 +393,7 @@ export default class MessageComposerInput extends React.Component { } // Called by Draft to change editor contents - onEditorContentChanged = (editorState: EditorState) => { + onEditorContentChanged = (change: Change) => { /* editorState = RichText.attachImmutableEntitiesToEmoji(editorState); @@ -458,7 +453,7 @@ export default class MessageComposerInput extends React.Component { */ /* Since a modification was made, set originalEditorState to null, since newState is now our original */ this.setState({ - editorState, + editorState: change.value, originalEditorState: null, }); }; From ff42ef4a58baf57580cd504b103b474a46dbb4cf Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 6 May 2018 22:08:36 +0100 Subject: [PATCH 007/702] make it work for MD mode (modulo history) --- src/ComposerHistoryManager.js | 10 ++-- src/RichText.js | 48 +++++++++++++------ .../views/rooms/MessageComposerInput.js | 31 ++++++------ 3 files changed, 52 insertions(+), 37 deletions(-) diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index 938be9eee4..e52a8a677f 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -34,17 +34,15 @@ class HistoryItem { format: MessageFormat = 'rich'; constructor(value: ?Value, format: ?MessageFormat) { - this.rawContentState = contentState ? convertToRaw(contentState) : null; + this.value = value; this.format = format; - } toValue(outputFormat: MessageFormat): Value { if (outputFormat === 'markdown') { if (this.format === 'rich') { // convert a rich formatted history entry to its MD equivalent - const markdown = new Markdown({}); - return new Value({ data: markdown.serialize(value) }); + return Plain.deserialize(Md.serialize(value)); // return ContentState.createFromText(RichText.stateToMarkdown(contentState)); } else if (this.format === 'markdown') { @@ -53,9 +51,7 @@ class HistoryItem { } else if (outputFormat === 'rich') { if (this.format === 'markdown') { // convert MD formatted string to its rich equivalent. - const plain = new Plain({}); - const md = new Md({}); - return md.deserialize(plain.serialize(value)); + return Md.deserialize(Plain.serialize(value)); // return RichText.htmlToContentState(new Markdown(contentState.getPlainText()).toHTML()); } else if (this.format === 'rich') { diff --git a/src/RichText.js b/src/RichText.js index 12274ee9f3..7ffb4dd785 100644 --- a/src/RichText.js +++ b/src/RichText.js @@ -1,4 +1,24 @@ +/* +Copyright 2015 - 2017 OpenMarket Ltd +Copyright 2017 Vector Creations Ltd +Copyright 2018 New Vector 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 React from 'react'; + +/* import { Editor, EditorState, @@ -12,11 +32,15 @@ import { SelectionState, Entity, } from 'draft-js'; +import { stateToMarkdown as __stateToMarkdown } from 'draft-js-export-markdown'; +*/ + +import Html from 'slate-html-serializer'; + import * as sdk from './index'; import * as emojione from 'emojione'; -import {stateToHTML} from 'draft-js-export-html'; -import {SelectionRange} from "./autocomplete/Autocompleter"; -import {stateToMarkdown as __stateToMarkdown} from 'draft-js-export-markdown'; + +import { SelectionRange } from "./autocomplete/Autocompleter"; const MARKDOWN_REGEX = { LINK: /(?:\[([^\]]+)\]\(([^\)]+)\))|\<(\w+:\/\/[^\>]+)\>/g, @@ -33,6 +57,7 @@ const EMOJI_REGEX = new RegExp(emojione.unicodeRegexp, 'g'); const ZWS_CODE = 8203; const ZWS = String.fromCharCode(ZWS_CODE); // zero width space + export function stateToMarkdown(state) { return __stateToMarkdown(state) .replace( @@ -40,19 +65,12 @@ export function stateToMarkdown(state) { ''); // this is *not* a zero width space, trust me :) } -export const contentStateToHTML = (contentState: ContentState) => { - return stateToHTML(contentState, { - inlineStyles: { - UNDERLINE: { - element: 'u', - }, - }, - }); -}; +export const editorStateToHTML = (editorState: Value) => { + return Html.deserialize(editorState); +} -export function htmlToContentState(html: string): ContentState { - const blockArray = convertFromHTML(html).contentBlocks; - return ContentState.createFromBlockArray(blockArray); +export function htmlToEditorState(html: string): Value { + return Html.serialize(html); } function unicodeToEmojiUri(str) { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 9a0863810e..53f7a6d474 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -19,7 +19,7 @@ import PropTypes from 'prop-types'; import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent'; import { Editor } from 'slate-react'; -import { Value, Document } from 'slate'; +import { Value, Document, Event } from 'slate'; import Html from 'slate-html-serializer'; import { Markdown as Md } from 'slate-md-serializer'; @@ -539,15 +539,12 @@ export default class MessageComposerInput extends React.Component { // const md = new Markdown(this.state.editorState.getCurrentContent().getPlainText()); // contentState = RichText.htmlToContentState(md.toHTML()); - const plain = new Plain({}); - const md = new Md({}); - value = md.deserialize(plain.serialize(this.state.editorState)); + value = Md.deserialize(Plain.serialize(this.state.editorState)); } else { // let markdown = RichText.stateToMarkdown(this.state.editorState.getCurrentContent()); // value = ContentState.createFromText(markdown); - const markdown = new Markdown({}); - value = Value({ data: markdown.serialize(value) }); + value = Plain.deserialize(Md.serialize(this.state.editorState)); } Analytics.setRichtextMode(enabled); @@ -559,6 +556,12 @@ export default class MessageComposerInput extends React.Component { SettingsStore.setValue("MessageComposerInput.isRichTextEnabled", null, SettingLevel.ACCOUNT, enabled); } + onKeyDown = (ev: Event, change: Change, editor: Editor) => { + if (ev.keyCode === KeyCode.ENTER) { + return this.handleReturn(ev); + } + } + handleKeyCommand = (command: string): boolean => { /* if (command === 'toggle-mode') { @@ -721,10 +724,7 @@ export default class MessageComposerInput extends React.Component { } */ - const plain = new Plain({}); - value = md.deserialize(); - - let contentText = plain.serialize(contentState); + let contentText = Plain.serialize(contentState); let contentHTML; /* @@ -808,10 +808,10 @@ export default class MessageComposerInput extends React.Component { shouldSendHTML = hasLink; } */ - let shouldSendHTML = true; + let shouldSendHTML = true; if (shouldSendHTML) { contentHTML = HtmlUtils.processHtmlForSending( - RichText.contentStateToHTML(contentState), + RichText.editorStateToHTML(contentState), ); } } else { @@ -840,11 +840,12 @@ export default class MessageComposerInput extends React.Component { return blockText; }).join('\n'); */ - const md = new Markdown(pt); + const md = new Markdown(contentText); // if contains no HTML and we're not quoting (needing HTML) if (md.isPlainText() && !mustSendHTML) { contentText = md.toPlaintext(); } else { + contentText = md.toPlaintext(); contentHTML = md.toHTML(); } } @@ -898,7 +899,6 @@ export default class MessageComposerInput extends React.Component { }); } - this.client.sendMessage(this.props.room.roomId, content).then((res) => { dis.dispatch({ action: 'message_sent', @@ -909,7 +909,7 @@ export default class MessageComposerInput extends React.Component { this.setState({ editorState: this.createEditorState(), - }); + }, ()=>{ this.refs.editor.focus() }); return true; }; @@ -1237,6 +1237,7 @@ export default class MessageComposerInput extends React.Component { placeholder={this.props.placeholder} value={this.state.editorState} onChange={this.onEditorContentChanged} + onKeyDown={this.onKeyDown} /* blockStyleFn={MessageComposerInput.getBlockStyle} keyBindingFn={MessageComposerInput.getKeyBinding} From 8b2eb2c4003acc63af3689e9ff7e4f235b32ed39 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 8 May 2018 01:54:06 +0100 Subject: [PATCH 008/702] make history work again --- res/css/views/rooms/_MessageComposer.scss | 7 +- src/ComposerHistoryManager.js | 30 +++-- .../views/rooms/MessageComposerInput.js | 108 +++++++++--------- 3 files changed, 78 insertions(+), 67 deletions(-) diff --git a/res/css/views/rooms/_MessageComposer.scss b/res/css/views/rooms/_MessageComposer.scss index 531c4442c1..a11ebeff7b 100644 --- a/res/css/views/rooms/_MessageComposer.scss +++ b/res/css/views/rooms/_MessageComposer.scss @@ -78,7 +78,7 @@ limitations under the License. display: flex; flex-direction: column; min-height: 60px; - justify-content: center; + justify-content: start; align-items: flex-start; font-size: 14px; margin-right: 6px; @@ -86,9 +86,8 @@ limitations under the License. .mx_MessageComposer_editor { width: 100%; - flex: 1; max-height: 120px; - min-height: 21px; + min-height: 19px; overflow: auto; } @@ -106,6 +105,7 @@ limitations under the License. display: none; } +/* .mx_MessageComposer_input .DraftEditor-root { width: 100%; flex: 1; @@ -114,6 +114,7 @@ limitations under the License. min-height: 21px; overflow: auto; } +*/ .mx_MessageComposer_input .DraftEditor-root .DraftEditor-editorContainer { /* Ensure mx_UserPill and mx_RoomPill (see _RichText) are not obscured from the top */ diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index e52a8a677f..9a6970a376 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -38,28 +38,44 @@ class HistoryItem { this.format = format; } + static fromJSON(obj): HistoryItem { + return new HistoryItem( + Value.fromJSON(obj.value), + obj.format + ); + } + + toJSON(): Object { + return { + value: this.value.toJSON(), + format: this.format + }; + } + + // FIXME: rather than supporting storing history in either format, why don't we pick + // one canonical form? toValue(outputFormat: MessageFormat): Value { if (outputFormat === 'markdown') { if (this.format === 'rich') { // convert a rich formatted history entry to its MD equivalent - return Plain.deserialize(Md.serialize(value)); + return Plain.deserialize(Md.serialize(this.value)); // return ContentState.createFromText(RichText.stateToMarkdown(contentState)); } else if (this.format === 'markdown') { - return value; + return this.value; } } else if (outputFormat === 'rich') { if (this.format === 'markdown') { // convert MD formatted string to its rich equivalent. - return Md.deserialize(Plain.serialize(value)); + return Md.deserialize(Plain.serialize(this.value)); // return RichText.htmlToContentState(new Markdown(contentState.getPlainText()).toHTML()); } else if (this.format === 'rich') { - return value; + return this.value; } } log.error("unknown format -> outputFormat conversion"); - return value; + return this.value; } } @@ -76,7 +92,7 @@ export default class ComposerHistoryManager { let item; for (; item = sessionStorage.getItem(`${this.prefix}[${this.currentIndex}]`); this.currentIndex++) { this.history.push( - Object.assign(new HistoryItem(), JSON.parse(item)), + HistoryItem.fromJSON(JSON.parse(item)) ); } this.lastIndex = this.currentIndex; @@ -86,7 +102,7 @@ export default class ComposerHistoryManager { const item = new HistoryItem(value, format); this.history.push(item); this.currentIndex = this.lastIndex + 1; - sessionStorage.setItem(`${this.prefix}[${this.lastIndex++}]`, JSON.stringify(item)); + sessionStorage.setItem(`${this.prefix}[${this.lastIndex++}]`, JSON.stringify(item.toJSON())); } getItem(offset: number, format: MessageFormat): ?Value { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 53f7a6d474..4b950c429d 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -15,6 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ import React from 'react'; +import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent'; @@ -101,6 +102,7 @@ export default class MessageComposerInput extends React.Component { onInputStateChanged: PropTypes.func, }; +/* static getKeyBinding(ev: SyntheticKeyboardEvent): string { // Restrict a subset of key bindings to ONLY having ctrl/meta* pressed and // importantly NOT having alt, shift, meta/ctrl* pressed. draft-js does not @@ -135,6 +137,7 @@ export default class MessageComposerInput extends React.Component { return null; } +*/ client: MatrixClient; autocomplete: Autocomplete; @@ -392,8 +395,7 @@ export default class MessageComposerInput extends React.Component { } } - // Called by Draft to change editor contents - onEditorContentChanged = (change: Change) => { + onChange = (change: Change) => { /* editorState = RichText.attachImmutableEntitiesToEmoji(editorState); @@ -557,17 +559,25 @@ export default class MessageComposerInput extends React.Component { } onKeyDown = (ev: Event, change: Change, editor: Editor) => { - if (ev.keyCode === KeyCode.ENTER) { - return this.handleReturn(ev); + switch (ev.keyCode) { + case KeyCode.ENTER: + return this.handleReturn(ev); + case KeyCode.UP: + return this.onVerticalArrow(ev, true); + case KeyCode.DOWN: + return this.onVerticalArrow(ev, false); + default: + // don't intercept it + return; } } handleKeyCommand = (command: string): boolean => { -/* if (command === 'toggle-mode') { this.enableRichtext(!this.state.isRichtextEnabled); return true; } +/* let newState: ?EditorState = null; // Draft handles rich text mode commands by default but we need to do it ourselves for Markdown. @@ -699,12 +709,10 @@ export default class MessageComposerInput extends React.Component { }; */ handleReturn = (ev) => { -/* if (ev.shiftKey) { - this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState)); - return true; + return; } - +/* const currentBlockType = RichUtils.getCurrentBlockType(this.state.editorState); if ( ['code-block', 'blockquote', 'unordered-list-item', 'ordered-list-item'] @@ -718,15 +726,12 @@ export default class MessageComposerInput extends React.Component { } */ const contentState = this.state.editorState; -/* - if (!contentState.hasText()) { - return true; - } -*/ let contentText = Plain.serialize(contentState); let contentHTML; + if (contentText === '') return true; + /* // Strip MD user (tab-completed) mentions to preserve plaintext mention behaviour. // We have to do this now as opposed to after calculating the contentText for MD @@ -914,41 +919,39 @@ export default class MessageComposerInput extends React.Component { return true; }; - onUpArrow = (e) => { - this.onVerticalArrow(e, true); - }; - - onDownArrow = (e) => { - this.onVerticalArrow(e, false); - }; - onVerticalArrow = (e, up) => { if (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) { return; } -/* // Select history only if we are not currently auto-completing if (this.autocomplete.state.completionList.length === 0) { - // Don't go back in history if we're in the middle of a multi-line message - const selection = this.state.editorState.getSelection(); - const blockKey = selection.getStartKey(); - const firstBlock = this.state.editorState.getCurrentContent().getFirstBlock(); - const lastBlock = this.state.editorState.getCurrentContent().getLastBlock(); - let canMoveUp = false; - let canMoveDown = false; - if (blockKey === firstBlock.getKey()) { - canMoveUp = selection.getStartOffset() === selection.getEndOffset() && - selection.getStartOffset() === 0; + // determine whether our cursor is at the top or bottom of the multiline + // input box by just looking at the position of the plain old DOM selection. + const selection = window.getSelection(); + const range = selection.getRangeAt(0); + const cursorRect = range.getBoundingClientRect(); + + const editorNode = ReactDOM.findDOMNode(this.refs.editor); + const editorRect = editorNode.getBoundingClientRect(); + + let navigateHistory = false; + if (up) { + let scrollCorrection = editorNode.scrollTop; + if (cursorRect.top - editorRect.top + scrollCorrection == 0) { + navigateHistory = true; + } + } + else { + let scrollCorrection = + editorNode.scrollHeight - editorNode.clientHeight - editorNode.scrollTop; + if (cursorRect.bottom - editorRect.bottom + scrollCorrection == 0) { + navigateHistory = true; + } } - if (blockKey === lastBlock.getKey()) { - canMoveDown = selection.getStartOffset() === selection.getEndOffset() && - selection.getStartOffset() === lastBlock.getText().length; - } - - if ((up && !canMoveUp) || (!up && !canMoveDown)) return; + if (!navigateHistory) return; const selected = this.selectHistory(up); if (selected) { @@ -959,10 +962,8 @@ export default class MessageComposerInput extends React.Component { this.moveAutocompleteSelection(up); e.preventDefault(); } -*/ }; -/* selectHistory = async (up) => { const delta = up ? -1 : 1; @@ -984,26 +985,19 @@ export default class MessageComposerInput extends React.Component { return; } - const newContent = this.historyManager.getItem(delta, this.state.isRichtextEnabled ? 'rich' : 'markdown'); - if (!newContent) return false; - let editorState = EditorState.push( - this.state.editorState, - newContent, - 'insert-characters', - ); + let editorState = this.historyManager.getItem(delta, this.state.isRichtextEnabled ? 'rich' : 'markdown'); // Move selection to the end of the selected history - let newSelection = SelectionState.createEmpty(newContent.getLastBlock().getKey()); - newSelection = newSelection.merge({ - focusOffset: newContent.getLastBlock().getLength(), - anchorOffset: newContent.getLastBlock().getLength(), - }); - editorState = EditorState.forceSelection(editorState, newSelection); + const change = editorState.change().collapseToEndOf(editorState.document); + // XXX: should we be calling this.onChange(change) now? + // we skip it for now given we know we're about to setState anyway + editorState = change.value; - this.setState({editorState}); + this.setState({ editorState }, ()=>{ + this.refs.editor.focus(); + }); return true; }; -*/ onTab = async (e) => { this.setState({ @@ -1236,7 +1230,7 @@ export default class MessageComposerInput extends React.Component { className="mx_MessageComposer_editor" placeholder={this.props.placeholder} value={this.state.editorState} - onChange={this.onEditorContentChanged} + onChange={this.onChange} onKeyDown={this.onKeyDown} /* blockStyleFn={MessageComposerInput.getBlockStyle} From 984961a3ed22ddd233266c9f014c0a71fc1d05bd Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 8 May 2018 09:49:53 +0100 Subject: [PATCH 009/702] blind fix to the overlapping sticker bug --- src/components/views/messages/MStickerBody.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/messages/MStickerBody.js b/src/components/views/messages/MStickerBody.js index 08ddb6de20..501db5e22b 100644 --- a/src/components/views/messages/MStickerBody.js +++ b/src/components/views/messages/MStickerBody.js @@ -40,6 +40,7 @@ export default class MStickerBody extends MImageBody { } _onImageLoad() { + this.fixupHeight(); this.setState({ placeholderClasses: 'mx_MStickerBody_placeholder_invisible', }); From cbb8432873937e0fb4c03b26a5f7194b7cac907a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 9 May 2018 01:03:40 +0100 Subject: [PATCH 010/702] unbreak switching from draft to slate --- src/ComposerHistoryManager.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index 9a6970a376..ce0eb8f0c3 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -74,7 +74,7 @@ class HistoryItem { return this.value; } } - log.error("unknown format -> outputFormat conversion"); + console.error("unknown format -> outputFormat conversion"); return this.value; } } @@ -91,9 +91,14 @@ export default class ComposerHistoryManager { // TODO: Performance issues? let item; for (; item = sessionStorage.getItem(`${this.prefix}[${this.currentIndex}]`); this.currentIndex++) { - this.history.push( - HistoryItem.fromJSON(JSON.parse(item)) - ); + try { + this.history.push( + HistoryItem.fromJSON(JSON.parse(item)) + ); + } + catch (e) { + console.warn("Throwing away unserialisable history", e); + } } this.lastIndex = this.currentIndex; } From 410a1683fe05862e1b777aa32ba9cfe7fb0f069f Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 12 May 2018 01:10:38 +0100 Subject: [PATCH 011/702] make autocomplete selection work --- .../views/rooms/MessageComposerInput.js | 203 ++++++++++-------- 1 file changed, 112 insertions(+), 91 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 4b950c429d..f50acb8bef 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent'; import { Editor } from 'slate-react'; -import { Value, Document, Event } from 'slate'; +import { Value, Document, Event, Inline, Range, Node } from 'slate'; import Html from 'slate-html-serializer'; import { Markdown as Md } from 'slate-md-serializer'; @@ -197,49 +197,6 @@ export default class MessageComposerInput extends React.Component { * - contentState was passed in */ createEditorState(richText: boolean, value: ?Value): Value { -/* - const decorators = richText ? RichText.getScopedRTDecorators(this.props) : - RichText.getScopedMDDecorators(this.props); - const shouldShowPillAvatar = !SettingsStore.getValue("Pill.shouldHidePillAvatar"); - decorators.push({ - strategy: this.findPillEntities.bind(this), - component: (entityProps) => { - const Pill = sdk.getComponent('elements.Pill'); - const type = entityProps.contentState.getEntity(entityProps.entityKey).getType(); - const {url} = entityProps.contentState.getEntity(entityProps.entityKey).getData(); - if (type === ENTITY_TYPES.AT_ROOM_PILL) { - return ; - } else if (Pill.isPillUrl(url)) { - return ; - } - - return ( - - { entityProps.children } - - ); - }, - }); - const compositeDecorator = new CompositeDecorator(decorators); - let editorState = null; - if (contentState) { - editorState = EditorState.createWithContent(contentState, compositeDecorator); - } else { - editorState = EditorState.createEmpty(compositeDecorator); - } - - return EditorState.moveFocusToEnd(editorState); -*/ if (value instanceof Value) { return value; } @@ -566,6 +523,10 @@ export default class MessageComposerInput extends React.Component { return this.onVerticalArrow(ev, true); case KeyCode.DOWN: return this.onVerticalArrow(ev, false); + case KeyCode.TAB: + return this.onTab(ev); + case KeyCode.ESCAPE: + return this.onEscape(ev); default: // don't intercept it return; @@ -938,15 +899,19 @@ export default class MessageComposerInput extends React.Component { let navigateHistory = false; if (up) { - let scrollCorrection = editorNode.scrollTop; - if (cursorRect.top - editorRect.top + scrollCorrection == 0) { + const scrollCorrection = editorNode.scrollTop; + const distanceFromTop = cursorRect.top - editorRect.top + scrollCorrection; + //console.log(`Cursor distance from editor top is ${distanceFromTop}`); + if (distanceFromTop == 0) { navigateHistory = true; } } else { - let scrollCorrection = + const scrollCorrection = editorNode.scrollHeight - editorNode.clientHeight - editorNode.scrollTop; - if (cursorRect.bottom - editorRect.bottom + scrollCorrection == 0) { + const distanceFromBottom = cursorRect.bottom - editorRect.bottom + scrollCorrection; + //console.log(`Cursor distance from editor bottom is ${distanceFromBottom}`); + if (distanceFromBottom == 0) { navigateHistory = true; } } @@ -1033,38 +998,50 @@ export default class MessageComposerInput extends React.Component { * If passed a non-null displayedCompletion, modifies state.originalEditorState to compute new state.editorState. */ setDisplayedCompletion = async (displayedCompletion: ?Completion): boolean => { -/* const activeEditorState = this.state.originalEditorState || this.state.editorState; if (displayedCompletion == null) { if (this.state.originalEditorState) { let editorState = this.state.originalEditorState; - // This is a workaround from https://github.com/facebook/draft-js/issues/458 - // Due to the way we swap editorStates, Draft does not rerender at times - editorState = EditorState.forceSelection(editorState, - editorState.getSelection()); this.setState({editorState}); } return false; } const {range = null, completion = '', href = null, suffix = ''} = displayedCompletion; - let contentState = activeEditorState.getCurrentContent(); - let entityKey; + let inline; if (href) { - contentState = contentState.createEntity('LINK', 'IMMUTABLE', { - url: href, - isCompletion: true, + inline = Inline.create({ + type: 'pill', + isVoid: true, + data: { url: href }, }); - entityKey = contentState.getLastCreatedEntityKey(); } else if (completion === '@room') { - contentState = contentState.createEntity(ENTITY_TYPES.AT_ROOM_PILL, 'IMMUTABLE', { - isCompletion: true, + inline = Inline.create({ + type: 'pill', + isVoid: true, + data: { type: Pill.TYPE_AT_ROOM_MENTION }, }); - entityKey = contentState.getLastCreatedEntityKey(); } + let editorState = activeEditorState; + + if (range) { + const change = editorState.change().moveOffsetsTo(range.start, range.end); + editorState = change.value; + } + + const change = editorState.change().insertInlineAtRange( + editorState.selection, inline + ); + editorState = change.value; + + this.setState({ editorState, originalEditorState: activeEditorState }, ()=>{ +// this.refs.editor.focus(); + }); + +/* let selection; if (range) { selection = RichText.textOffsetsToSelectionState( @@ -1085,16 +1062,51 @@ export default class MessageComposerInput extends React.Component { let editorState = EditorState.push(activeEditorState, contentState, 'insert-characters'); editorState = EditorState.forceSelection(editorState, contentState.getSelectionAfter()); this.setState({editorState, originalEditorState: activeEditorState}); - - // for some reason, doing this right away does not update the editor :( - // setTimeout(() => this.refs.editor.focus(), 50); -*/ +*/ return true; }; + renderNode = props => { + const { attributes, children, node, isSelected } = props; + + switch (node.type) { + case 'paragraph': { + return

{children}

+ } + case 'pill': { + const { data, text } = node; + const url = data.get('url'); + const type = data.get('type'); + + const shouldShowPillAvatar = !SettingsStore.getValue("Pill.shouldHidePillAvatar"); + const Pill = sdk.getComponent('elements.Pill'); + + if (type === Pill.TYPE_AT_ROOM_MENTION) { + return ; + } + else if (Pill.isPillUrl(url)) { + return ; + } + else { + return + { text } + ; + } + } + } + }; + onFormatButtonClicked = (name: "bold" | "italic" | "strike" | "code" | "underline" | "quote" | "bullet" | "numbullet", e) => { e.preventDefault(); // don't steal focus from the editor! -/* + const command = { code: 'code-block', quote: 'blockquote', @@ -1102,7 +1114,6 @@ export default class MessageComposerInput extends React.Component { numbullet: 'ordered-list-item', }[name] || name; this.handleKeyCommand(command); -*/ }; /* returns inline style and block type of current SelectionState so MessageComposer can render formatting @@ -1140,14 +1151,41 @@ export default class MessageComposerInput extends React.Component { */ } - getAutocompleteQuery(contentState: ContentState) { - return ''; + getAutocompleteQuery(editorState: Value) { + // FIXME: do we really want to regenerate this every time the control is rerendered? + + // We can just return the current block where the selection begins, which + // should be enough to capture any autocompletion input, given autocompletion + // providers only search for the first match which intersects with the current selection. + // This avoids us having to serialize the whole thing to plaintext and convert + // selection offsets in & out of the plaintext domain. + return editorState.document.getDescendant(editorState.selection.anchorKey).text; // Don't send markdown links to the autocompleter // return this.removeMDLinks(contentState, ['@', '#']); } + getSelectionRange(editorState: Value) { + // return a character range suitable for handing to an autocomplete provider. + // the range is relative to the anchor of the current editor selection. + // if the selection spans multiple blocks, then we collapse it for the calculation. + const range = { + start: editorState.selection.anchorOffset, + end: (editorState.selection.anchorKey == editorState.selection.focusKey) ? + editorState.selection.focusOffset : editorState.selection.anchorOffset, + } + if (range.start > range.end) { + const tmp = range.start; + range.start = range.end; + range.end = tmp; + } + return range; + } + /* + // delinkifies any matrix.to markdown links (i.e. pills) of form + // [#foo:matrix.org](https://matrix.to/#/#foo:matrix.org). + // the prefixes is an array of sigils that will be matched on. removeMDLinks(contentState: ContentState, prefixes: string[]) { const plaintext = contentState.getPlainText(); if (!plaintext) return ''; @@ -1189,24 +1227,10 @@ export default class MessageComposerInput extends React.Component { render() { const activeEditorState = this.state.originalEditorState || this.state.editorState; - let hidePlaceholder = false; - // FIXME: in case we need to implement manual placeholdering - const className = classNames('mx_MessageComposer_input', { - mx_MessageComposer_input_empty: hidePlaceholder, mx_MessageComposer_input_error: this.state.someCompletions === false, }); - const content = null; - const selection = { - start: 0, - end: 0, - }; - - // const content = activeEditorState.getCurrentContent(); - // const selection = RichText.selectionStateToTextOffsets(activeEditorState.getSelection(), - // activeEditorState.getCurrentContent().getBlocksAsArray()); - return (
@@ -1216,8 +1240,8 @@ export default class MessageComposerInput extends React.Component { room={this.props.room} onConfirm={this.setDisplayedCompletion} onSelectionChange={this.setDisplayedCompletion} - query={this.getAutocompleteQuery(content)} - selection={selection} + query={this.getAutocompleteQuery(activeEditorState)} + selection={this.getSelectionRange(activeEditorState)} />
@@ -1232,6 +1256,8 @@ export default class MessageComposerInput extends React.Component { value={this.state.editorState} onChange={this.onChange} onKeyDown={this.onKeyDown} + renderNode={this.renderNode} + spellCheck={true} /* blockStyleFn={MessageComposerInput.getBlockStyle} keyBindingFn={MessageComposerInput.getKeyBinding} @@ -1240,11 +1266,6 @@ export default class MessageComposerInput extends React.Component { handlePastedText={this.onTextPasted} handlePastedFiles={this.props.onFilesPasted} stripPastedStyles={!this.state.isRichtextEnabled} - onTab={this.onTab} - onUpArrow={this.onUpArrow} - onDownArrow={this.onDownArrow} - onEscape={this.onEscape} - spellCheck={true} */ />
From d7c2c8ba7bfc8229176a588cdf530295e438792e Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 12 May 2018 16:21:36 +0100 Subject: [PATCH 012/702] include the plaintext representation of a pill within it --- src/components/views/rooms/MessageComposerInput.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index f50acb8bef..e1c5d1a190 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -20,7 +20,7 @@ import PropTypes from 'prop-types'; import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent'; import { Editor } from 'slate-react'; -import { Value, Document, Event, Inline, Range, Node } from 'slate'; +import { Value, Document, Event, Inline, Text, Range, Node } from 'slate'; import Html from 'slate-html-serializer'; import { Markdown as Md } from 'slate-md-serializer'; @@ -781,6 +781,7 @@ export default class MessageComposerInput extends React.Component { ); } } else { + // Use the original contentState because `contentText` has had mentions // stripped and these need to end up in contentHTML. @@ -1014,14 +1015,14 @@ export default class MessageComposerInput extends React.Component { if (href) { inline = Inline.create({ type: 'pill', - isVoid: true, data: { url: href }, + nodes: [Text.create(completion)], }); } else if (completion === '@room') { inline = Inline.create({ type: 'pill', - isVoid: true, data: { type: Pill.TYPE_AT_ROOM_MENTION }, + nodes: [Text.create(completion)], }); } @@ -1262,7 +1263,6 @@ export default class MessageComposerInput extends React.Component { blockStyleFn={MessageComposerInput.getBlockStyle} keyBindingFn={MessageComposerInput.getKeyBinding} handleKeyCommand={this.handleKeyCommand} - handleReturn={this.handleReturn} handlePastedText={this.onTextPasted} handlePastedFiles={this.props.onFilesPasted} stripPastedStyles={!this.state.isRichtextEnabled} From 9c0c806af4b272458cdd8874347982d86cc70ea0 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 12 May 2018 20:04:58 +0100 Subject: [PATCH 013/702] correctly send pills in messages --- src/Markdown.js | 13 ++- src/autocomplete/NotifProvider.js | 1 + src/autocomplete/PlainWithPillsSerializer.js | 89 ++++++++++++++ src/autocomplete/RoomProvider.js | 1 + src/autocomplete/UserProvider.js | 1 + src/components/views/rooms/Autocomplete.js | 2 - .../views/rooms/MessageComposerInput.js | 109 +++++++++--------- src/stores/MessageComposerStore.js | 6 +- 8 files changed, 159 insertions(+), 63 deletions(-) create mode 100644 src/autocomplete/PlainWithPillsSerializer.js diff --git a/src/Markdown.js b/src/Markdown.js index aa1c7e45b1..e67f4df4fd 100644 --- a/src/Markdown.js +++ b/src/Markdown.js @@ -133,7 +133,10 @@ export default class Markdown { * Render the markdown message to plain text. That is, essentially * just remove any backslashes escaping what would otherwise be * markdown syntax - * (to fix https://github.com/vector-im/riot-web/issues/2870) + * (to fix https://github.com/vector-im/riot-web/issues/2870). + * + * N.B. this does **NOT** render arbitrary MD to plain text - only MD + * which has no formatting. Otherwise it emits HTML(!). */ toPlaintext() { const renderer = new commonmark.HtmlRenderer({safe: false}); @@ -161,6 +164,14 @@ export default class Markdown { if (is_multi_line(node) && node.next) this.lit('\n\n'); }; + // convert MD links into console-friendly ' < http://foo >' style links + // ...except given this function never gets called with links, it's useless. + // renderer.link = function(node, entering) { + // if (!entering) { + // this.lit(` < ${node.destination} >`); + // } + // }; + return renderer.render(this.parsed); } } diff --git a/src/autocomplete/NotifProvider.js b/src/autocomplete/NotifProvider.js index b7ac645525..5d2f05ecb9 100644 --- a/src/autocomplete/NotifProvider.js +++ b/src/autocomplete/NotifProvider.js @@ -40,6 +40,7 @@ export default class NotifProvider extends AutocompleteProvider { if (command && command[0] && '@room'.startsWith(command[0]) && command[0].length > 1) { return [{ completion: '@room', + completionId: '@room', suffix: ' ', component: ( } title="@room" description={_t("Notify the whole room")} /> diff --git a/src/autocomplete/PlainWithPillsSerializer.js b/src/autocomplete/PlainWithPillsSerializer.js new file mode 100644 index 0000000000..77391d5bbb --- /dev/null +++ b/src/autocomplete/PlainWithPillsSerializer.js @@ -0,0 +1,89 @@ +/* +Copyright 2018 New Vector 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. +*/ + +// Based originally on slate-plain-serializer + +import { Block } from 'slate'; + +/** + * Plain text serializer, which converts a Slate `value` to a plain text string, + * serializing pills into various different formats as required. + * + * @type {PlainWithPillsSerializer} + */ + +class PlainWithPillsSerializer { + + /* + * @param {String} options.pillFormat - either 'md', 'plain', 'id' + */ + constructor(options = {}) { + let { + pillFormat = 'plain', + } = options; + this.pillFormat = pillFormat; + } + + /** + * Serialize a Slate `value` to a plain text string, + * serializing pills as either MD links, plain text representations or + * ID representations as required. + * + * @param {Value} value + * @return {String} + */ + serialize = value => { + return this._serializeNode(value.document) + } + + /** + * Serialize a `node` to plain text. + * + * @param {Node} node + * @return {String} + */ + _serializeNode = node => { + if ( + node.object == 'document' || + (node.object == 'block' && Block.isBlockList(node.nodes)) + ) { + return node.nodes.map(this._serializeNode).join('\n'); + } else if (node.type == 'pill') { + switch (this.pillFormat) { + case 'plain': + return node.text; + case 'md': + return `[${ node.text }](${ node.data.get('url') })`; + case 'id': + return node.data.completionId || node.text; + } + } + else if (node.nodes) { + return node.nodes.map(this._serializeNode).join(''); + } + else { + return node.text; + } + } +} + +/** + * Export. + * + * @type {PlainWithPillsSerializer} + */ + +export default PlainWithPillsSerializer \ No newline at end of file diff --git a/src/autocomplete/RoomProvider.js b/src/autocomplete/RoomProvider.js index 31599703c2..b9346e75cc 100644 --- a/src/autocomplete/RoomProvider.js +++ b/src/autocomplete/RoomProvider.js @@ -78,6 +78,7 @@ export default class RoomProvider extends AutocompleteProvider { const displayAlias = getDisplayAliasForRoom(room.room) || room.roomId; return { completion: displayAlias, + completionId: displayAlias, suffix: ' ', href: makeRoomPermalink(displayAlias), component: ( diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index ce8f1020a1..a6dd13051b 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -113,6 +113,7 @@ export default class UserProvider extends AutocompleteProvider { // Length of completion should equal length of text in decorator. draft-js // relies on the length of the entity === length of the text in the decoration. completion: user.rawDisplayName.replace(' (IRC)', ''), + completionId: user.userId, suffix: range.start === 0 ? ': ' : ' ', href: makeUserPermalink(user.userId), component: ( diff --git a/src/components/views/rooms/Autocomplete.js b/src/components/views/rooms/Autocomplete.js index 4fb2a29381..5b56727705 100644 --- a/src/components/views/rooms/Autocomplete.js +++ b/src/components/views/rooms/Autocomplete.js @@ -263,7 +263,6 @@ export default class Autocomplete extends React.Component { const componentPosition = position; position++; - const onMouseMove = () => this.setSelection(componentPosition); const onClick = () => { this.setSelection(componentPosition); this.onCompletionClicked(); @@ -273,7 +272,6 @@ export default class Autocomplete extends React.Component { key: i, ref: `completion${position - 1}`, className, - onMouseMove, onClick, }); }); diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index e1c5d1a190..1bdbb86549 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -25,6 +25,7 @@ import { Value, Document, Event, Inline, Text, Range, Node } from 'slate'; import Html from 'slate-html-serializer'; import { Markdown as Md } from 'slate-md-serializer'; import Plain from 'slate-plain-serializer'; +import PlainWithPillsSerializer from "../../../autocomplete/PlainWithPillsSerializer"; // import {Editor, EditorState, RichUtils, CompositeDecorator, Modifier, // getDefaultKeyBinding, KeyBindingUtil, ContentState, ContentBlock, SelectionState, @@ -157,7 +158,7 @@ export default class MessageComposerInput extends React.Component { // the currently displayed editor state (note: this is always what is modified on input) editorState: this.createEditorState( isRichtextEnabled, - MessageComposerStore.getContentState(this.props.room.roomId), + MessageComposerStore.getEditorState(this.props.room.roomId), ), // the original editor state, before we started tabbing through completions @@ -172,6 +173,10 @@ export default class MessageComposerInput extends React.Component { }; this.client = MatrixClientPeg.get(); + + this.plainWithMdPills = new PlainWithPillsSerializer({ pillFormat: 'md' }); + this.plainWithIdPills = new PlainWithPillsSerializer({ pillFormat: 'id' }); + this.plainWithPlainPills = new PlainWithPillsSerializer({ pillFormat: 'plain' }); } /* @@ -686,30 +691,27 @@ export default class MessageComposerInput extends React.Component { return false; } */ - const contentState = this.state.editorState; + const editorState = this.state.editorState; - let contentText = Plain.serialize(contentState); + let contentText; let contentHTML; - if (contentText === '') return true; + // only look for commands if the first block contains simple unformatted text + // i.e. no pills or rich-text formatting. + let cmd, commandText; + const firstChild = editorState.document.nodes.get(0); + const firstGrandChild = firstChild && firstChild.nodes.get(0); + if (firstChild && firstGrandChild && + firstChild.object === 'block' && firstGrandChild.object === 'text' && + firstGrandChild.text[0] === '/' && firstGrandChild.text[1] !== '/') + { + commandText = this.plainWithIdPills.serialize(editorState); + cmd = SlashCommands.processInput(this.props.room.roomId, commandText); + } -/* - // Strip MD user (tab-completed) mentions to preserve plaintext mention behaviour. - // We have to do this now as opposed to after calculating the contentText for MD - // mode because entity positions may not be maintained when using - // md.toPlaintext(). - // Unfortunately this means we lose mentions in history when in MD mode. This - // would be fixed if history was stored as contentState. - contentText = this.removeMDLinks(contentState, ['@']); - - // Some commands (/join) require pills to be replaced with their text content - const commandText = this.removeMDLinks(contentState, ['#']); -*/ - const commandText = contentText; - const cmd = SlashCommands.processInput(this.props.room.roomId, commandText); if (cmd) { if (!cmd.error) { - this.historyManager.save(contentState, this.state.isRichtextEnabled ? 'rich' : 'markdown'); + this.historyManager.save(editorState, this.state.isRichtextEnabled ? 'rich' : 'markdown'); this.setState({ editorState: this.createEditorState(), }); @@ -774,46 +776,31 @@ export default class MessageComposerInput extends React.Component { shouldSendHTML = hasLink; } */ + contentText = this.plainWithPlainPills.serialize(editorState); + if (contentText === '') return true; + let shouldSendHTML = true; if (shouldSendHTML) { contentHTML = HtmlUtils.processHtmlForSending( - RichText.editorStateToHTML(contentState), + RichText.editorStateToHTML(editorState), ); } } else { + const sourceWithPills = this.plainWithMdPills.serialize(editorState); + if (sourceWithPills === '') return true; - // Use the original contentState because `contentText` has had mentions - // stripped and these need to end up in contentHTML. + const mdWithPills = new Markdown(sourceWithPills); -/* - // Replace all Entities of type `LINK` with markdown link equivalents. - // TODO: move this into `Markdown` and do the same conversion in the other - // two places (toggling from MD->RT mode and loading MD history into RT mode) - // but this can only be done when history includes Entities. - const pt = contentState.getBlocksAsArray().map((block) => { - let blockText = block.getText(); - let offset = 0; - this.findPillEntities(contentState, block, (start, end) => { - const entity = contentState.getEntity(block.getEntityAt(start)); - if (entity.getType() !== 'LINK') { - return; - } - const text = blockText.slice(offset + start, offset + end); - const url = entity.getData().url; - const mdLink = `[${text}](${url})`; - blockText = blockText.slice(0, offset + start) + mdLink + blockText.slice(offset + end); - offset += mdLink.length - text.length; - }); - return blockText; - }).join('\n'); -*/ - const md = new Markdown(contentText); // if contains no HTML and we're not quoting (needing HTML) - if (md.isPlainText() && !mustSendHTML) { - contentText = md.toPlaintext(); + if (mdWithPills.isPlainText() && !mustSendHTML) { + // N.B. toPlainText is only usable here because we know that the MD + // didn't contain any formatting in the first place... + contentText = mdWithPills.toPlaintext(); } else { - contentText = md.toPlaintext(); - contentHTML = md.toHTML(); + // to avoid ugliness clients which can't parse HTML we don't send pills + // in the plaintext body. + contentText = this.plainWithPlainPills.serialize(editorState); + contentHTML = mdWithPills.toHTML(); } } @@ -821,11 +808,11 @@ export default class MessageComposerInput extends React.Component { let sendTextFn = ContentHelpers.makeTextMessage; this.historyManager.save( - contentState, + editorState, this.state.isRichtextEnabled ? 'rich' : 'markdown', ); - if (contentText.startsWith('/me')) { + if (commandText && commandText.startsWith('/me')) { if (replyingToEv) { const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); Modal.createTrackedDialog('Emote Reply Fail', '', ErrorDialog, { @@ -842,14 +829,16 @@ export default class MessageComposerInput extends React.Component { sendTextFn = ContentHelpers.makeEmoteMessage; } - - let content = contentHTML ? sendHtmlFn(contentText, contentHTML) : sendTextFn(contentText); + let content = contentHTML ? + sendHtmlFn(contentText, contentHTML) : + sendTextFn(contentText); if (replyingToEv) { const replyContent = ReplyThread.makeReplyMixIn(replyingToEv); content = Object.assign(replyContent, content); - // Part of Replies fallback support - prepend the text we're sending with the text we're replying to + // Part of Replies fallback support - prepend the text we're sending + // with the text we're replying to const nestedReply = ReplyThread.getNestedReplyText(replyingToEv); if (nestedReply) { if (content.formatted_body) { @@ -1009,20 +998,26 @@ export default class MessageComposerInput extends React.Component { return false; } - const {range = null, completion = '', href = null, suffix = ''} = displayedCompletion; + const { + range = null, + completion = '', + completionId = '', + href = null, + suffix = '' + } = displayedCompletion; let inline; if (href) { inline = Inline.create({ type: 'pill', data: { url: href }, - nodes: [Text.create(completion)], + nodes: [Text.create(completionId || completion)], }); } else if (completion === '@room') { inline = Inline.create({ type: 'pill', data: { type: Pill.TYPE_AT_ROOM_MENTION }, - nodes: [Text.create(completion)], + nodes: [Text.create(completionId || completion)], }); } diff --git a/src/stores/MessageComposerStore.js b/src/stores/MessageComposerStore.js index 3b1ab1fa72..0e6c856e1b 100644 --- a/src/stores/MessageComposerStore.js +++ b/src/stores/MessageComposerStore.js @@ -44,7 +44,7 @@ class MessageComposerStore extends Store { __onDispatch(payload) { switch (payload.action) { case 'editor_state': - this._contentState(payload); + this._editorState(payload); break; case 'on_logged_out': this.reset(); @@ -52,7 +52,7 @@ class MessageComposerStore extends Store { } } - _contentState(payload) { + _editorState(payload) { const editorStateMap = this._state.editorStateMap; editorStateMap[payload.room_id] = payload.editor_state; localStorage.setItem('editor_state', JSON.stringify(editorStateMap)); @@ -61,7 +61,7 @@ class MessageComposerStore extends Store { }); } - getContentState(roomId) { + getEditorState(roomId) { return this._state.editorStateMap[roomId]; } From c91dcffe82605c7ca1cb3693029089a6438cab06 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 00:40:54 +0100 Subject: [PATCH 014/702] fix cursor behaviour around pills --- src/autocomplete/PlainWithPillsSerializer.js | 4 +- .../views/rooms/MessageComposerInput.js | 48 ++++++++++++++++--- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/autocomplete/PlainWithPillsSerializer.js b/src/autocomplete/PlainWithPillsSerializer.js index 77391d5bbb..6827f1fe73 100644 --- a/src/autocomplete/PlainWithPillsSerializer.js +++ b/src/autocomplete/PlainWithPillsSerializer.js @@ -64,11 +64,11 @@ class PlainWithPillsSerializer { } else if (node.type == 'pill') { switch (this.pillFormat) { case 'plain': - return node.text; + return node.data.get('completion'); case 'md': return `[${ node.text }](${ node.data.get('url') })`; case 'id': - return node.data.completionId || node.text; + return node.data.get('completionId') || node.data.get('completion'); } } else if (node.nodes) { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 1bdbb86549..dfc0a2ee21 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -177,6 +177,8 @@ export default class MessageComposerInput extends React.Component { this.plainWithMdPills = new PlainWithPillsSerializer({ pillFormat: 'md' }); this.plainWithIdPills = new PlainWithPillsSerializer({ pillFormat: 'id' }); this.plainWithPlainPills = new PlainWithPillsSerializer({ pillFormat: 'plain' }); + + this.direction = ''; } /* @@ -358,6 +360,17 @@ export default class MessageComposerInput extends React.Component { } onChange = (change: Change) => { + + let editorState = change.value; + + if (this.direction !== '') { + const focusedNode = editorState.focusInline || editorState.focusText; + if (focusedNode.isVoid) { + change = change[`collapseToEndOf${ this.direction }Text`](); + editorState = change.value; + } + } + /* editorState = RichText.attachImmutableEntitiesToEmoji(editorState); @@ -417,7 +430,7 @@ export default class MessageComposerInput extends React.Component { */ /* Since a modification was made, set originalEditorState to null, since newState is now our original */ this.setState({ - editorState: change.value, + editorState, originalEditorState: null, }); }; @@ -521,6 +534,18 @@ export default class MessageComposerInput extends React.Component { } onKeyDown = (ev: Event, change: Change, editor: Editor) => { + + // skip void nodes - see + // https://github.com/ianstormtaylor/slate/issues/762#issuecomment-304855095 + if (ev.keyCode === KeyCode.LEFT) { + this.direction = 'Previous'; + } + else if (ev.keyCode === KeyCode.RIGHT) { + this.direction = 'Next'; + } else { + this.direction = ''; + } + switch (ev.keyCode) { case KeyCode.ENTER: return this.handleReturn(ev); @@ -1010,14 +1035,23 @@ export default class MessageComposerInput extends React.Component { if (href) { inline = Inline.create({ type: 'pill', - data: { url: href }, - nodes: [Text.create(completionId || completion)], + data: { completion, completionId, url: href }, + // we can't put text in here otherwise the editor tries to select it + isVoid: true, + nodes: [], }); } else if (completion === '@room') { inline = Inline.create({ type: 'pill', - data: { type: Pill.TYPE_AT_ROOM_MENTION }, - nodes: [Text.create(completionId || completion)], + data: { completion, completionId }, + // we can't put text in here otherwise the editor tries to select it + isVoid: true, + nodes: [], + }); + } else { + inline = Inline.create({ + type: 'autocompletion', + nodes: [Text.create(completion)] }); } @@ -1072,12 +1106,12 @@ export default class MessageComposerInput extends React.Component { case 'pill': { const { data, text } = node; const url = data.get('url'); - const type = data.get('type'); + const completion = data.get('completion'); const shouldShowPillAvatar = !SettingsStore.getValue("Pill.shouldHidePillAvatar"); const Pill = sdk.getComponent('elements.Pill'); - if (type === Pill.TYPE_AT_ROOM_MENTION) { + if (completion === '@room') { return Date: Sun, 13 May 2018 00:48:52 +0100 Subject: [PATCH 015/702] fix NPEs when deleting mentions --- src/components/views/rooms/MessageComposerInput.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index dfc0a2ee21..919b38e741 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -1038,7 +1038,6 @@ export default class MessageComposerInput extends React.Component { data: { completion, completionId, url: href }, // we can't put text in here otherwise the editor tries to select it isVoid: true, - nodes: [], }); } else if (completion === '@room') { inline = Inline.create({ @@ -1046,7 +1045,6 @@ export default class MessageComposerInput extends React.Component { data: { completion, completionId }, // we can't put text in here otherwise the editor tries to select it isVoid: true, - nodes: [], }); } else { inline = Inline.create({ From 877a6195ae9c73f29908286347639e9112ef5b0f Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 00:54:01 +0100 Subject: [PATCH 016/702] unbreak history scrolling for pills & emoji --- src/components/views/rooms/MessageComposerInput.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 919b38e741..a8a9188971 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -912,12 +912,17 @@ export default class MessageComposerInput extends React.Component { const editorNode = ReactDOM.findDOMNode(this.refs.editor); const editorRect = editorNode.getBoundingClientRect(); + // heuristic to handle tall emoji, pills, etc pushing the cursor away from the top + // or bottom of the page. + // XXX: is this going to break on large inline images or top-to-bottom scripts? + const EDGE_THRESHOLD = 8; + let navigateHistory = false; if (up) { const scrollCorrection = editorNode.scrollTop; const distanceFromTop = cursorRect.top - editorRect.top + scrollCorrection; - //console.log(`Cursor distance from editor top is ${distanceFromTop}`); - if (distanceFromTop == 0) { + console.log(`Cursor distance from editor top is ${distanceFromTop}`); + if (distanceFromTop < EDGE_THRESHOLD) { navigateHistory = true; } } @@ -925,8 +930,8 @@ export default class MessageComposerInput extends React.Component { const scrollCorrection = editorNode.scrollHeight - editorNode.clientHeight - editorNode.scrollTop; const distanceFromBottom = cursorRect.bottom - editorRect.bottom + scrollCorrection; - //console.log(`Cursor distance from editor bottom is ${distanceFromBottom}`); - if (distanceFromBottom == 0) { + console.log(`Cursor distance from editor bottom is ${distanceFromBottom}`); + if (distanceFromBottom < EDGE_THRESHOLD) { navigateHistory = true; } } From c967ecc4e59cc475feaed9f36a6f447fa327b139 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 03:04:40 +0100 Subject: [PATCH 017/702] autocomplete polishing * suppress autocomplete when navigating through history * only search for slashcommands if in the first block of the editor * handle suffix returns from providers correctly * fix SelectionRange typing in the providers * fix bugs when pressing ctrl-a, typing and then tab to complete a replacement by collapsing selection to anchor when inserting a completion in the editor * fix https://github.com/vector-im/riot-web/issues/4762 --- src/autocomplete/AutocompleteProvider.js | 12 +++++++++--- src/autocomplete/Autocompleter.js | 9 +++++---- src/autocomplete/CommandProvider.js | 4 +++- src/autocomplete/DuckDuckGoProvider.js | 3 ++- src/autocomplete/NotifProvider.js | 3 ++- src/autocomplete/RoomProvider.js | 9 ++------- src/autocomplete/UserProvider.js | 19 ++++++++----------- 7 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/autocomplete/AutocompleteProvider.js b/src/autocomplete/AutocompleteProvider.js index c93ae4fb2a..2d3bad14c5 100644 --- a/src/autocomplete/AutocompleteProvider.js +++ b/src/autocomplete/AutocompleteProvider.js @@ -20,13 +20,19 @@ import React from 'react'; import type {Completion, SelectionRange} from './Autocompleter'; export default class AutocompleteProvider { - constructor(commandRegex?: RegExp) { + constructor(commandRegex?: RegExp, forcedCommandRegex?: RegExp) { if (commandRegex) { if (!commandRegex.global) { throw new Error('commandRegex must have global flag set'); } this.commandRegex = commandRegex; } + if (forcedCommandRegex) { + if (!forcedCommandRegex.global) { + throw new Error('forcedCommandRegex must have global flag set'); + } + this.forcedCommandRegex = forcedCommandRegex; + } } destroy() { @@ -36,11 +42,11 @@ export default class AutocompleteProvider { /** * Of the matched commands in the query, returns the first that contains or is contained by the selection, or null. */ - getCurrentCommand(query: string, selection: {start: number, end: number}, force: boolean = false): ?string { + getCurrentCommand(query: string, selection: SelectionRange, force: boolean = false): ?string { let commandRegex = this.commandRegex; if (force && this.shouldForceComplete()) { - commandRegex = /\S+/g; + commandRegex = this.forcedCommandRegex || /\S+/g; } if (commandRegex == null) { diff --git a/src/autocomplete/Autocompleter.js b/src/autocomplete/Autocompleter.js index 3d30363d9f..db3ba5a7e1 100644 --- a/src/autocomplete/Autocompleter.js +++ b/src/autocomplete/Autocompleter.js @@ -27,6 +27,7 @@ import NotifProvider from './NotifProvider'; import Promise from 'bluebird'; export type SelectionRange = { + beginning: boolean, start: number, end: number }; @@ -77,12 +78,12 @@ export default class Autocompleter { // Array of inspections of promises that might timeout. Instead of allowing a // single timeout to reject the Promise.all, reflect each one and once they've all // settled, filter for the fulfilled ones - this.providers.map((provider) => { - return provider + this.providers.map(provider => + provider .getCompletions(query, selection, force) .timeout(PROVIDER_COMPLETION_TIMEOUT) - .reflect(); - }), + .reflect() + ), ); return completionsList.filter( diff --git a/src/autocomplete/CommandProvider.js b/src/autocomplete/CommandProvider.js index e33fa7861f..0545095cf0 100644 --- a/src/autocomplete/CommandProvider.js +++ b/src/autocomplete/CommandProvider.js @@ -21,6 +21,7 @@ import { _t, _td } from '../languageHandler'; import AutocompleteProvider from './AutocompleteProvider'; import FuzzyMatcher from './FuzzyMatcher'; import {TextualCompletion} from './Components'; +import type {SelectionRange} from './Autocompleter'; // TODO merge this with the factory mechanics of SlashCommands? // Warning: Since the description string will be translated in _t(result.description), all these strings below must be in i18n/strings/en_EN.json file @@ -123,8 +124,9 @@ export default class CommandProvider extends AutocompleteProvider { }); } - async getCompletions(query: string, selection: {start: number, end: number}) { + async getCompletions(query: string, selection: SelectionRange) { let completions = []; + if (!selection.beginning) return completions; const {command, range} = this.getCurrentCommand(query, selection); if (command) { completions = this.matcher.match(command[0]).map((result) => { diff --git a/src/autocomplete/DuckDuckGoProvider.js b/src/autocomplete/DuckDuckGoProvider.js index 68d4915f56..236ab49b62 100644 --- a/src/autocomplete/DuckDuckGoProvider.js +++ b/src/autocomplete/DuckDuckGoProvider.js @@ -22,6 +22,7 @@ import AutocompleteProvider from './AutocompleteProvider'; import 'whatwg-fetch'; import {TextualCompletion} from './Components'; +import type {SelectionRange} from './Autocompleter'; const DDG_REGEX = /\/ddg\s+(.+)$/g; const REFERRER = 'vector'; @@ -36,7 +37,7 @@ export default class DuckDuckGoProvider extends AutocompleteProvider { + `&format=json&no_redirect=1&no_html=1&t=${encodeURIComponent(REFERRER)}`; } - async getCompletions(query: string, selection: {start: number, end: number}) { + async getCompletions(query: string, selection: SelectionRange) { const {command, range} = this.getCurrentCommand(query, selection); if (!query || !command) { return []; diff --git a/src/autocomplete/NotifProvider.js b/src/autocomplete/NotifProvider.js index 5d2f05ecb9..a426528567 100644 --- a/src/autocomplete/NotifProvider.js +++ b/src/autocomplete/NotifProvider.js @@ -20,6 +20,7 @@ import { _t } from '../languageHandler'; import MatrixClientPeg from '../MatrixClientPeg'; import {PillCompletion} from './Components'; import sdk from '../index'; +import type {SelectionRange} from './Autocompleter'; const AT_ROOM_REGEX = /@\S*/g; @@ -29,7 +30,7 @@ export default class NotifProvider extends AutocompleteProvider { this.room = room; } - async getCompletions(query: string, selection: {start: number, end: number}, force = false) { + async getCompletions(query: string, selection: SelectionRange, force = false) { const RoomAvatar = sdk.getComponent('views.avatars.RoomAvatar'); const client = MatrixClientPeg.get(); diff --git a/src/autocomplete/RoomProvider.js b/src/autocomplete/RoomProvider.js index b9346e75cc..139ac87041 100644 --- a/src/autocomplete/RoomProvider.js +++ b/src/autocomplete/RoomProvider.js @@ -26,6 +26,7 @@ import {getDisplayAliasForRoom} from '../Rooms'; import sdk from '../index'; import _sortBy from 'lodash/sortBy'; import {makeRoomPermalink} from "../matrix-to"; +import type {SelectionRange} from './Autocompleter'; const ROOM_REGEX = /(?=#)(\S*)/g; @@ -46,15 +47,9 @@ export default class RoomProvider extends AutocompleteProvider { }); } - async getCompletions(query: string, selection: {start: number, end: number}, force = false) { + async getCompletions(query: string, selection: SelectionRange, force = false) { const RoomAvatar = sdk.getComponent('views.avatars.RoomAvatar'); - // Disable autocompletions when composing commands because of various issues - // (see https://github.com/vector-im/riot-web/issues/4762) - if (/^(\/join|\/leave)/.test(query)) { - return []; - } - const client = MatrixClientPeg.get(); let completions = []; const {command, range} = this.getCurrentCommand(query, selection, force); diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index a6dd13051b..c25dad8877 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -28,18 +28,21 @@ import _sortBy from 'lodash/sortBy'; import MatrixClientPeg from '../MatrixClientPeg'; import type {Room, RoomMember} from 'matrix-js-sdk'; +import type {SelectionRange} from './Autocompleter'; import {makeUserPermalink} from "../matrix-to"; const USER_REGEX = /@\S*/g; +// used when you hit 'tab' - we allow some separator chars at the beginning +// to allow you to tab-complete /mat into /(matthew) +const FORCED_USER_REGEX = /[^/,:; \t\n]\S*/g; + export default class UserProvider extends AutocompleteProvider { users: Array = null; room: Room = null; constructor(room) { - super(USER_REGEX, { - keys: ['name'], - }); + super(USER_REGEX, FORCED_USER_REGEX); this.room = room; this.matcher = new FuzzyMatcher([], { keys: ['name', 'userId'], @@ -87,15 +90,9 @@ export default class UserProvider extends AutocompleteProvider { this.users = null; } - async getCompletions(query: string, selection: {start: number, end: number}, force = false) { + async getCompletions(query: string, selection: SelectionRange, force = false) { const MemberAvatar = sdk.getComponent('views.avatars.MemberAvatar'); - // Disable autocompletions when composing commands because of various issues - // (see https://github.com/vector-im/riot-web/issues/4762) - if (/^(\/ban|\/unban|\/op|\/deop|\/invite|\/kick|\/verify)/.test(query)) { - return []; - } - // lazy-load user list into matcher if (this.users === null) this._makeUsers(); @@ -114,7 +111,7 @@ export default class UserProvider extends AutocompleteProvider { // relies on the length of the entity === length of the text in the decoration. completion: user.rawDisplayName.replace(' (IRC)', ''), completionId: user.userId, - suffix: range.start === 0 ? ': ' : ' ', + suffix: (selection.beginning && range.start === 0) ? ': ' : ' ', href: makeUserPermalink(user.userId), component: ( Date: Sun, 13 May 2018 03:16:55 +0100 Subject: [PATCH 018/702] autocomplete polishing * suppress autocomplete when navigating through history * only search for slashcommands if in the first block of the editor * handle suffix returns from providers correctly * fix bugs when pressing ctrl-a, typing and then tab to complete a replacement by collapsing selection to anchor when inserting a completion in the editor --- src/components/views/rooms/Autocomplete.js | 2 +- .../views/rooms/MessageComposerInput.js | 29 ++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/components/views/rooms/Autocomplete.js b/src/components/views/rooms/Autocomplete.js index 5b56727705..4bc91b5c2b 100644 --- a/src/components/views/rooms/Autocomplete.js +++ b/src/components/views/rooms/Autocomplete.js @@ -114,7 +114,7 @@ export default class Autocomplete extends React.Component { processQuery(query, selection) { return this.autocompleter.getCompletions( - query, selection, this.state.forceComplete, + query, selection, this.state.forceComplete ).then((completions) => { // Only ever process the completions for the most recent query being processed if (query !== this.queryRequested) { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index a8a9188971..83760d932d 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -178,6 +178,7 @@ export default class MessageComposerInput extends React.Component { this.plainWithIdPills = new PlainWithPillsSerializer({ pillFormat: 'id' }); this.plainWithPlainPills = new PlainWithPillsSerializer({ pillFormat: 'plain' }); + this.suppressAutoComplete = false; this.direction = ''; } @@ -535,6 +536,8 @@ export default class MessageComposerInput extends React.Component { onKeyDown = (ev: Event, change: Change, editor: Editor) => { + this.suppressAutoComplete = false; + // skip void nodes - see // https://github.com/ianstormtaylor/slate/issues/762#issuecomment-304855095 if (ev.keyCode === KeyCode.LEFT) { @@ -978,6 +981,8 @@ export default class MessageComposerInput extends React.Component { // we skip it for now given we know we're about to setState anyway editorState = change.value; + this.suppressAutoComplete = true; + this.setState({ editorState }, ()=>{ this.refs.editor.focus(); }); @@ -1061,13 +1066,15 @@ export default class MessageComposerInput extends React.Component { let editorState = activeEditorState; if (range) { - const change = editorState.change().moveOffsetsTo(range.start, range.end); + const change = editorState.change() + .collapseToAnchor() + .moveOffsetsTo(range.start, range.end); editorState = change.value; } - const change = editorState.change().insertInlineAtRange( - editorState.selection, inline - ); + const change = editorState.change() + .insertInlineAtRange(editorState.selection, inline) + .insertText(suffix); editorState = change.value; this.setState({ editorState, originalEditorState: activeEditorState }, ()=>{ @@ -1185,13 +1192,12 @@ export default class MessageComposerInput extends React.Component { } getAutocompleteQuery(editorState: Value) { - // FIXME: do we really want to regenerate this every time the control is rerendered? - // We can just return the current block where the selection begins, which // should be enough to capture any autocompletion input, given autocompletion // providers only search for the first match which intersects with the current selection. // This avoids us having to serialize the whole thing to plaintext and convert // selection offsets in & out of the plaintext domain. + return editorState.document.getDescendant(editorState.selection.anchorKey).text; // Don't send markdown links to the autocompleter @@ -1199,10 +1205,19 @@ export default class MessageComposerInput extends React.Component { } getSelectionRange(editorState: Value) { + let beginning = false; + const query = this.getAutocompleteQuery(editorState); + const firstChild = editorState.document.nodes.get(0); + const firstGrandChild = firstChild && firstChild.nodes.get(0); + beginning = (firstChild && firstGrandChild && + firstChild.object === 'block' && firstGrandChild.object === 'text' && + editorState.selection.anchorKey === firstGrandChild.key); + // return a character range suitable for handing to an autocomplete provider. // the range is relative to the anchor of the current editor selection. // if the selection spans multiple blocks, then we collapse it for the calculation. const range = { + beginning, // whether the selection is in the first block of the editor or not start: editorState.selection.anchorOffset, end: (editorState.selection.anchorKey == editorState.selection.focusKey) ? editorState.selection.focusOffset : editorState.selection.anchorOffset, @@ -1273,7 +1288,7 @@ export default class MessageComposerInput extends React.Component { room={this.props.room} onConfirm={this.setDisplayedCompletion} onSelectionChange={this.setDisplayedCompletion} - query={this.getAutocompleteQuery(activeEditorState)} + query={ this.suppressAutoComplete ? '' : this.getAutocompleteQuery(activeEditorState) } selection={this.getSelectionRange(activeEditorState)} />
From e06763cd59da8b07255f46ab7e1abc4604c637cc Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 03:18:41 +0100 Subject: [PATCH 019/702] show all slashcommands on / --- src/autocomplete/CommandProvider.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/autocomplete/CommandProvider.js b/src/autocomplete/CommandProvider.js index 0545095cf0..4f2aed3dc6 100644 --- a/src/autocomplete/CommandProvider.js +++ b/src/autocomplete/CommandProvider.js @@ -129,7 +129,14 @@ export default class CommandProvider extends AutocompleteProvider { if (!selection.beginning) return completions; const {command, range} = this.getCurrentCommand(query, selection); if (command) { - completions = this.matcher.match(command[0]).map((result) => { + let results; + if (command[0] == '/') { + results = COMMANDS; + } + else { + results = this.matcher.match(command[0]); + } + completions = results.map((result) => { return { completion: result.command + ' ', component: ( Date: Sun, 13 May 2018 03:26:22 +0100 Subject: [PATCH 020/702] don't lose focus after a / command --- src/components/views/rooms/MessageComposerInput.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 83760d932d..a1b569b5f4 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -745,9 +745,10 @@ export default class MessageComposerInput extends React.Component { }); } if (cmd.promise) { - cmd.promise.then(function() { + cmd.promise.then(()=>{ console.log("Command success."); - }, function(err) { + this.refs.editor.focus(); + }, (err)=>{ console.error("Command failure: %s", err); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); Modal.createTrackedDialog('Server error', '', ErrorDialog, { From 79f7c5d6ab0e7b0bad860039403fef195381cdbe Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 03:29:56 +0100 Subject: [PATCH 021/702] remove // support, as it never worked if you want to escape a /, do it with \/ or just precede with a space --- src/SlashCommands.js | 2 +- src/components/views/rooms/MessageComposerInput.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index d45e45e84c..7f32c1e25a 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -434,7 +434,7 @@ module.exports = { // trim any trailing whitespace, as it can confuse the parser for // IRC-style commands input = input.replace(/\s+$/, ""); - if (input[0] === "/" && input[1] !== "/") { + if (input[0] === "/") { const bits = input.match(/^(\S+?)( +((.|\n)*))?$/); let cmd; let args; diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index a1b569b5f4..2a59ccbe7d 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -731,7 +731,7 @@ export default class MessageComposerInput extends React.Component { const firstGrandChild = firstChild && firstChild.nodes.get(0); if (firstChild && firstGrandChild && firstChild.object === 'block' && firstGrandChild.object === 'text' && - firstGrandChild.text[0] === '/' && firstGrandChild.text[1] !== '/') + firstGrandChild.text[0] === '/') { commandText = this.plainWithIdPills.serialize(editorState); cmd = SlashCommands.processInput(this.props.room.roomId, commandText); From dd0726f06802666f531db8a7c5784797b7148010 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 21:17:43 +0100 Subject: [PATCH 022/702] fix navigating history downwards on tall messages; remove obsolete code --- src/RichText.js | 36 ------------------- .../views/rooms/MessageComposerInput.js | 32 +---------------- 2 files changed, 1 insertion(+), 67 deletions(-) diff --git a/src/RichText.js b/src/RichText.js index 7ffb4dd785..d867636dc9 100644 --- a/src/RichText.js +++ b/src/RichText.js @@ -223,42 +223,6 @@ export function selectionStateToTextOffsets(selectionState: SelectionState, }; } -export function textOffsetsToSelectionState({start, end}: SelectionRange, - contentBlocks: Array): SelectionState { - let selectionState = SelectionState.createEmpty(); - // Subtract block lengths from `start` and `end` until they are less than the current - // block length (accounting for the NL at the end of each block). Set them to -1 to - // indicate that the corresponding selection state has been determined. - for (const block of contentBlocks) { - const blockLength = block.getLength(); - // -1 indicating that the position start position has been found - if (start !== -1) { - if (start < blockLength + 1) { - selectionState = selectionState.merge({ - anchorKey: block.getKey(), - anchorOffset: start, - }); - start = -1; // selection state for the start calculated - } else { - start -= blockLength + 1; // +1 to account for newline between blocks - } - } - // -1 indicating that the position end position has been found - if (end !== -1) { - if (end < blockLength + 1) { - selectionState = selectionState.merge({ - focusKey: block.getKey(), - focusOffset: end, - }); - end = -1; // selection state for the end calculated - } else { - end -= blockLength + 1; // +1 to account for newline between blocks - } - } - } - return selectionState; -} - // modified version of https://github.com/draft-js-plugins/draft-js-plugins/blob/master/draft-js-emoji-plugin/src/modifiers/attachImmutableEntitiesToEmojis.js export function attachImmutableEntitiesToEmoji(editorState: EditorState): EditorState { const contentState = editorState.getCurrentContent(); diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 2a59ccbe7d..3e8d3cd868 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -494,14 +494,6 @@ export default class MessageComposerInput extends React.Component { if (this.props.onContentChanged) { this.props.onContentChanged(textContent, selection); } - - // Scroll to the bottom of the editor if the cursor is on the last line of the - // composer. For some reason the editor won't scroll automatically if we paste - // blocks of text in or insert newlines. - if (textContent.slice(selection.start).indexOf("\n") === -1) { - let editorRoot = this.refs.editor.refs.editor.parentNode.parentNode; - editorRoot.scrollTop = editorRoot.scrollHeight; - } */ }); } @@ -933,7 +925,7 @@ export default class MessageComposerInput extends React.Component { else { const scrollCorrection = editorNode.scrollHeight - editorNode.clientHeight - editorNode.scrollTop; - const distanceFromBottom = cursorRect.bottom - editorRect.bottom + scrollCorrection; + const distanceFromBottom = editorRect.bottom - cursorRect.bottom + scrollCorrection; console.log(`Cursor distance from editor bottom is ${distanceFromBottom}`); if (distanceFromBottom < EDGE_THRESHOLD) { navigateHistory = true; @@ -1082,28 +1074,6 @@ export default class MessageComposerInput extends React.Component { // this.refs.editor.focus(); }); -/* - let selection; - if (range) { - selection = RichText.textOffsetsToSelectionState( - range, contentState.getBlocksAsArray(), - ); - } else { - selection = activeEditorState.getSelection(); - } - - contentState = Modifier.replaceText(contentState, selection, completion, null, entityKey); - - // Move the selection to the end of the block - const afterSelection = contentState.getSelectionAfter(); - if (suffix) { - contentState = Modifier.replaceText(contentState, afterSelection, suffix); - } - - let editorState = EditorState.push(activeEditorState, contentState, 'insert-characters'); - editorState = EditorState.forceSelection(editorState, contentState.getSelectionAfter()); - this.setState({editorState, originalEditorState: activeEditorState}); -*/ return true; }; From ddfe0691c43c309e5f4265e6663667c15da10557 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 22:41:39 +0100 Subject: [PATCH 023/702] fix insert_mention --- .../views/rooms/MessageComposerInput.js | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 3e8d3cd868..8b72dc1a0b 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -243,23 +243,24 @@ export default class MessageComposerInput extends React.Component { case 'focus_composer': editor.focus(); break; -/* - case 'insert_mention': { - // Pretend that we've autocompleted this user because keeping two code - // paths for inserting a user pill is not fun - const selection = this.state.editorState.getSelection(); - const member = this.props.room.getMember(payload.user_id); - const completion = member ? - member.rawDisplayName.replace(' (IRC)', '') : payload.user_id; - this.setDisplayedCompletion({ - completion, - selection, - href: makeUserPermalink(payload.user_id), - suffix: selection.getStartOffset() === 0 ? ': ' : ' ', - }); - } + case 'insert_mention': + { + // Pretend that we've autocompleted this user because keeping two code + // paths for inserting a user pill is not fun + const selection = this.getSelectionRange(this.state.editorState); + const member = this.props.room.getMember(payload.user_id); + const completion = member ? + member.rawDisplayName.replace(' (IRC)', '') : payload.user_id; + this.setDisplayedCompletion({ + completion, + completionId: payload.user_id, + selection, + href: makeUserPermalink(payload.user_id), + suffix: (selection.beginning && selection.start === 0) ? ': ' : ' ', + }); + } break; - +/* case 'quote': { // old quoting, whilst rich quoting is in labs /// XXX: Not doing rich-text quoting from formatted-body because draft-js /// has regressed such that when links are quoted, errors are thrown. See From a247ea2f77d0ad10faf63c3c798abb59c8b237d1 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 22:43:20 +0100 Subject: [PATCH 024/702] delete duplicate propTypes(!!!) --- .../views/rooms/MessageComposerInput.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 8b72dc1a0b..756c9eb1a9 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -100,6 +100,8 @@ export default class MessageComposerInput extends React.Component { // called with current plaintext content (as a string) whenever it changes onContentChanged: PropTypes.func, + onFilesPasted: PropTypes.func, + onInputStateChanged: PropTypes.func, }; @@ -1292,19 +1294,3 @@ export default class MessageComposerInput extends React.Component { ); } } - -MessageComposerInput.propTypes = { - // a callback which is called when the height of the composer is - // changed due to a change in content. - onResize: PropTypes.func, - - // js-sdk Room object - room: PropTypes.object.isRequired, - - // called with current plaintext content (as a string) whenever it changes - onContentChanged: PropTypes.func, - - onFilesPasted: PropTypes.func, - - onInputStateChanged: PropTypes.func, -}; From 7405b49b4416ab8803c64283f26c983097e8fd5d Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 23:34:00 +0100 Subject: [PATCH 025/702] unify setState() and onChange() also make emoji autocomplete work again also remove the onInputContentChanged prop also slateify the onInputStateChanged prop --- src/components/views/rooms/MessageComposer.js | 18 +- .../views/rooms/MessageComposerInput.js | 163 +++++------------- 2 files changed, 42 insertions(+), 139 deletions(-) diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 28a90b375a..9aaa33f0fa 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -35,7 +35,6 @@ export default class MessageComposer extends React.Component { this.onUploadFileSelected = this.onUploadFileSelected.bind(this); this.uploadFiles = this.uploadFiles.bind(this); this.onVoiceCallClick = this.onVoiceCallClick.bind(this); - this.onInputContentChanged = this.onInputContentChanged.bind(this); this._onAutocompleteConfirm = this._onAutocompleteConfirm.bind(this); this.onToggleFormattingClicked = this.onToggleFormattingClicked.bind(this); this.onToggleMarkdownClicked = this.onToggleMarkdownClicked.bind(this); @@ -44,13 +43,10 @@ export default class MessageComposer extends React.Component { this._onRoomViewStoreUpdate = this._onRoomViewStoreUpdate.bind(this); this.state = { - autocompleteQuery: '', - selection: null, inputState: { - style: [], + marks: [], blockType: null, isRichtextEnabled: SettingsStore.getValue('MessageComposerInput.isRichTextEnabled'), - wordCount: 0, }, showFormatting: SettingsStore.getValue('MessageComposer.showFormatting'), isQuoting: Boolean(RoomViewStore.getQuotingEvent()), @@ -209,13 +205,6 @@ export default class MessageComposer extends React.Component { // this._startCallApp(true); } - onInputContentChanged(content: string, selection: {start: number, end: number}) { - this.setState({ - autocompleteQuery: content, - selection, - }); - } - onInputStateChanged(inputState) { this.setState({inputState}); } @@ -348,7 +337,6 @@ export default class MessageComposer extends React.Component { room={this.props.room} placeholder={placeholderText} onFilesPasted={this.uploadFiles} - onContentChanged={this.onInputContentChanged} onInputStateChanged={this.onInputStateChanged} />, formattingButton, stickerpickerButton, @@ -365,10 +353,10 @@ export default class MessageComposer extends React.Component { ); } - const {style, blockType} = this.state.inputState; + const {marks, blockType} = this.state.inputState; const formatButtons = ["bold", "italic", "strike", "underline", "code", "quote", "bullet", "numbullet"].map( (name) => { - const active = style.includes(name) || blockType === name; + const active = marks.includes(name) || blockType === name; const suffix = active ? '-o-n' : ''; const onFormatButtonClicked = this.onFormatButtonClicked.bind(this, name); const className = 'mx_MessageComposer_format_button mx_filterFlipColor'; diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 756c9eb1a9..025e42be1a 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -184,23 +184,6 @@ export default class MessageComposerInput extends React.Component { this.direction = ''; } -/* - findPillEntities(contentState: ContentState, contentBlock: ContentBlock, callback) { - contentBlock.findEntityRanges( - (character) => { - const entityKey = character.getEntity(); - return ( - entityKey !== null && - ( - contentState.getEntity(entityKey).getType() === 'LINK' || - contentState.getEntity(entityKey).getType() === ENTITY_TYPES.AT_ROOM_PILL - ) - ); - }, callback, - ); - } -*/ - /* * "Does the right thing" to create an Editor value, based on: * - whether we've got rich text mode enabled @@ -226,14 +209,12 @@ export default class MessageComposerInput extends React.Component { } componentWillUpdate(nextProps, nextState) { -/* // this is dirty, but moving all this state to MessageComposer is dirtier if (this.props.onInputStateChanged && nextState !== this.state) { const state = this.getSelectionInfo(nextState.editorState); state.isRichtextEnabled = nextState.isRichtextEnabled; this.props.onInputStateChanged(state); } -*/ } onAction = (payload) => { @@ -375,6 +356,19 @@ export default class MessageComposerInput extends React.Component { } } + if (editorState.document.getFirstText().text !== '') { + this.onTypingActivity(); + } else { + this.onFinishedTyping(); + } + + /* + // XXX: what was this ever doing? + if (!state.hasOwnProperty('originalEditorState')) { + state.originalEditorState = null; + } + */ + /* editorState = RichText.attachImmutableEntitiesToEmoji(editorState); @@ -405,6 +399,10 @@ export default class MessageComposerInput extends React.Component { // Reset selection editorState = EditorState.forceSelection(editorState, currentSelection); } +*/ + + const text = editorState.startText.text; + const currentStartOffset = editorState.startOffset; // Automatic replacement of plaintext emoji to Unicode emoji if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) { @@ -415,23 +413,26 @@ export default class MessageComposerInput extends React.Component { const emojiUc = asciiList[emojiMatch[1]]; // hex unicode -> shortname -> actual unicode const unicodeEmoji = shortnameToUnicode(EMOJI_UNICODE_TO_SHORTNAME[emojiUc]); - const newContentState = Modifier.replaceText( - editorState.getCurrentContent(), - currentSelection.merge({ - anchorOffset: currentStartOffset - emojiMatch[1].length - 1, - focusOffset: currentStartOffset, - }), - unicodeEmoji, - ); - editorState = EditorState.push( - editorState, - newContentState, - 'insert-characters', - ); - editorState = EditorState.forceSelection(editorState, newContentState.getSelectionAfter()); + + const range = Range.create({ + anchorKey: editorState.selection.startKey, + anchorOffset: currentStartOffset - emojiMatch[1].length - 1, + focusKey: editorState.selection.startKey, + focusOffset: currentStartOffset, + }); + change = change.insertTextAtRange(range, unicodeEmoji); + editorState = change.value; } } -*/ + + // Record the editor state for this room so that it can be retrieved after + // switching to another room and back + dis.dispatch({ + action: 'editor_state', + room_id: this.props.room.roomId, + editor_state: editorState, + }); + /* Since a modification was made, set originalEditorState to null, since newState is now our original */ this.setState({ editorState, @@ -439,68 +440,6 @@ export default class MessageComposerInput extends React.Component { }); }; - /** - * We're overriding setState here because it's the most convenient way to monitor changes to the editorState. - * Doing it using a separate function that calls setState is a possibility (and was the old approach), but that - * approach requires a callback and an extra setState whenever trying to set multiple state properties. - * - * @param state - * @param callback - */ - setState(state, callback) { -/* - if (state.editorState != null) { - state.editorState = RichText.attachImmutableEntitiesToEmoji( - state.editorState); - - // Hide the autocomplete if the cursor location changes but the plaintext - // content stays the same. We don't hide if the pt has changed because the - // autocomplete will probably have different completions to show. - if ( - !state.editorState.getSelection().equals( - this.state.editorState.getSelection(), - ) - && state.editorState.getCurrentContent().getPlainText() === - this.state.editorState.getCurrentContent().getPlainText() - ) { - this.autocomplete.hide(); - } - - if (state.editorState.getCurrentContent().hasText()) { - this.onTypingActivity(); - } else { - this.onFinishedTyping(); - } - - // Record the editor state for this room so that it can be retrieved after - // switching to another room and back - dis.dispatch({ - action: 'editor_state', - room_id: this.props.room.roomId, - editor_state: state.editorState.getCurrentContent(), - }); - - if (!state.hasOwnProperty('originalEditorState')) { - state.originalEditorState = null; - } - } -*/ - super.setState(state, () => { - if (callback != null) { - callback(); - } -/* - const textContent = this.state.editorState.getCurrentContent().getPlainText(); - const selection = RichText.selectionStateToTextOffsets( - this.state.editorState.getSelection(), - this.state.editorState.getCurrentContent().getBlocksAsArray()); - if (this.props.onContentChanged) { - this.props.onContentChanged(textContent, selection); - } -*/ - }); - } - enableRichtext(enabled: boolean) { if (enabled === this.state.isRichtextEnabled) return; @@ -1133,36 +1072,12 @@ export default class MessageComposerInput extends React.Component { /* returns inline style and block type of current SelectionState so MessageComposer can render formatting buttons. */ getSelectionInfo(editorState: Value) { - return {}; -/* - const styleName = { - BOLD: _td('bold'), - ITALIC: _td('italic'), - STRIKETHROUGH: _td('strike'), - UNDERLINE: _td('underline'), - }; - - const originalStyle = editorState.getCurrentInlineStyle().toArray(); - const style = originalStyle - .map((style) => styleName[style] || null) - .filter((styleName) => !!styleName); - - const blockName = { - 'code-block': _td('code'), - 'blockquote': _td('quote'), - 'unordered-list-item': _td('bullet'), - 'ordered-list-item': _td('numbullet'), - }; - const originalBlockType = editorState.getCurrentContent() - .getBlockForKey(editorState.getSelection().getStartKey()) - .getType(); - const blockType = blockName[originalBlockType] || null; - return { - style, - blockType, + marks: editorState.activeMarks, + // XXX: shouldn't we return all the types of blocks in the current selection, + // not just the anchor? + blockType: editorState.anchorBlock.type, }; -*/ } getAutocompleteQuery(editorState: Value) { From 7ecb4e3b188890946712cca2580c7904ddadcb4a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 13 May 2018 23:35:39 +0100 Subject: [PATCH 026/702] remove dead removeMDLinks code --- .../views/rooms/MessageComposerInput.js | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 025e42be1a..4a9dfa4b4c 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -1088,9 +1088,6 @@ export default class MessageComposerInput extends React.Component { // selection offsets in & out of the plaintext domain. return editorState.document.getDescendant(editorState.selection.anchorKey).text; - - // Don't send markdown links to the autocompleter - // return this.removeMDLinks(contentState, ['@', '#']); } getSelectionRange(editorState: Value) { @@ -1119,43 +1116,6 @@ export default class MessageComposerInput extends React.Component { return range; } -/* - // delinkifies any matrix.to markdown links (i.e. pills) of form - // [#foo:matrix.org](https://matrix.to/#/#foo:matrix.org). - // the prefixes is an array of sigils that will be matched on. - removeMDLinks(contentState: ContentState, prefixes: string[]) { - const plaintext = contentState.getPlainText(); - if (!plaintext) return ''; - return plaintext.replace(REGEX_MATRIXTO_MARKDOWN_GLOBAL, - (markdownLink, text, resource, prefix, offset) => { - if (!prefixes.includes(prefix)) return markdownLink; - // Calculate the offset relative to the current block that the offset is in - let sum = 0; - const blocks = contentState.getBlocksAsArray(); - let block; - for (let i = 0; i < blocks.length; i++) { - block = blocks[i]; - sum += block.getLength(); - if (sum > offset) { - sum -= block.getLength(); - break; - } - } - offset -= sum; - - const entityKey = block.getEntityAt(offset); - const entity = entityKey ? contentState.getEntity(entityKey) : null; - if (entity && entity.getData().isCompletion) { - // This is a completed mention, so do not insert MD link, just text - return text; - } else { - // This is either a MD link that was typed into the composer or another - // type of pill (e.g. room pill) - return markdownLink; - } - }); - } -*/ onMarkdownToggleClicked = (e) => { e.preventDefault(); // don't steal focus from the editor! this.handleKeyCommand('toggle-mode'); From b10f9a9cb780a209b6e64c9b2343571eff7a93bb Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 14 May 2018 02:54:55 +0100 Subject: [PATCH 027/702] remove spurious vendor prefixing --- res/css/structures/_RoomView.scss | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/res/css/structures/_RoomView.scss b/res/css/structures/_RoomView.scss index b8e1190375..02418f70db 100644 --- a/res/css/structures/_RoomView.scss +++ b/res/css/structures/_RoomView.scss @@ -176,10 +176,7 @@ hr.mx_RoomView_myReadMarker { z-index: 1000; overflow: hidden; - -webkit-transition: all .2s ease-out; - -moz-transition: all .2s ease-out; - -ms-transition: all .2s ease-out; - -o-transition: all .2s ease-out; + transition: all .2s ease-out; } .mx_RoomView_statusArea_expanded { From c1000a7cd5aaecded59d0ffa0456012af4e15e8d Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 14 May 2018 03:02:12 +0100 Subject: [PATCH 028/702] emojioneify the composer and also fix up the selectedness CSS for pills and emoji --- res/css/_common.scss | 4 + res/css/views/elements/_RichText.scss | 4 + src/RichText.js | 81 +---------------- src/autocomplete/PlainWithPillsSerializer.js | 3 + src/components/views/elements/Pill.js | 3 + .../views/rooms/MessageComposerInput.js | 91 +++++++++++++++---- 6 files changed, 88 insertions(+), 98 deletions(-) diff --git a/res/css/_common.scss b/res/css/_common.scss index c4cda6821e..38f576a532 100644 --- a/res/css/_common.scss +++ b/res/css/_common.scss @@ -291,6 +291,10 @@ textarea { vertical-align: middle; } +.mx_emojione_selected { + background-color: $accent-color; +} + ::-moz-selection { background-color: $accent-color; color: $selection-fg-color; diff --git a/res/css/views/elements/_RichText.scss b/res/css/views/elements/_RichText.scss index 474a123455..5c390af30a 100644 --- a/res/css/views/elements/_RichText.scss +++ b/res/css/views/elements/_RichText.scss @@ -25,6 +25,10 @@ padding-right: 5px; } +.mx_UserPill_selected { + background-color: $accent-color ! important; +} + .mx_EventTile_highlight .mx_EventTile_content .markdown-body a.mx_UserPill_me, .mx_EventTile_content .mx_AtRoomPill, .mx_MessageComposer_input .mx_AtRoomPill { diff --git a/src/RichText.js b/src/RichText.js index d867636dc9..50ed33d803 100644 --- a/src/RichText.js +++ b/src/RichText.js @@ -51,10 +51,6 @@ const MARKDOWN_REGEX = { STRIKETHROUGH: /~{2}[^~]*~{2}/g, }; -const USERNAME_REGEX = /@\S+:\S+/g; -const ROOM_REGEX = /#\S+:\S+/g; -const EMOJI_REGEX = new RegExp(emojione.unicodeRegexp, 'g'); - const ZWS_CODE = 8203; const ZWS = String.fromCharCode(ZWS_CODE); // zero width space @@ -73,7 +69,7 @@ export function htmlToEditorState(html: string): Value { return Html.serialize(html); } -function unicodeToEmojiUri(str) { +export function unicodeToEmojiUri(str) { let replaceWith, unicode, alt; if ((!emojione.unicodeAlt) || (emojione.sprites)) { // if we are using the shortname as the alt tag then we need a reversed array to map unicode code point to shortnames @@ -113,27 +109,6 @@ function findWithRegex(regex, contentBlock: ContentBlock, callback: (start: numb } } -// Workaround for https://github.com/facebook/draft-js/issues/414 -const emojiDecorator = { - strategy: (contentState, contentBlock, callback) => { - findWithRegex(EMOJI_REGEX, contentBlock, callback); - }, - component: (props) => { - const uri = unicodeToEmojiUri(props.children[0].props.text); - const shortname = emojione.toShort(props.children[0].props.text); - const style = { - display: 'inline-block', - width: '1em', - maxHeight: '1em', - background: `url(${uri})`, - backgroundSize: 'contain', - backgroundPosition: 'center center', - overflow: 'hidden', - }; - return ({ props.children }); - }, -}; - /** * Returns a composite decorator which has access to provided scope. */ @@ -223,60 +198,6 @@ export function selectionStateToTextOffsets(selectionState: SelectionState, }; } -// modified version of https://github.com/draft-js-plugins/draft-js-plugins/blob/master/draft-js-emoji-plugin/src/modifiers/attachImmutableEntitiesToEmojis.js -export function attachImmutableEntitiesToEmoji(editorState: EditorState): EditorState { - const contentState = editorState.getCurrentContent(); - const blocks = contentState.getBlockMap(); - let newContentState = contentState; - - blocks.forEach((block) => { - const plainText = block.getText(); - - const addEntityToEmoji = (start, end) => { - const existingEntityKey = block.getEntityAt(start); - if (existingEntityKey) { - // avoid manipulation in case the emoji already has an entity - const entity = newContentState.getEntity(existingEntityKey); - if (entity && entity.get('type') === 'emoji') { - return; - } - } - - const selection = SelectionState.createEmpty(block.getKey()) - .set('anchorOffset', start) - .set('focusOffset', end); - const emojiText = plainText.substring(start, end); - newContentState = newContentState.createEntity( - 'emoji', 'IMMUTABLE', { emojiUnicode: emojiText }, - ); - const entityKey = newContentState.getLastCreatedEntityKey(); - newContentState = Modifier.replaceText( - newContentState, - selection, - emojiText, - null, - entityKey, - ); - }; - - findWithRegex(EMOJI_REGEX, block, addEntityToEmoji); - }); - - if (!newContentState.equals(contentState)) { - const oldSelection = editorState.getSelection(); - editorState = EditorState.push( - editorState, - newContentState, - 'convert-to-immutable-emojis', - ); - // this is somewhat of a hack, we're undoing selection changes caused above - // it would be better not to make those changes in the first place - editorState = EditorState.forceSelection(editorState, oldSelection); - } - - return editorState; -} - export function hasMultiLineSelection(editorState: EditorState): boolean { const selectionState = editorState.getSelection(); const anchorKey = selectionState.getAnchorKey(); diff --git a/src/autocomplete/PlainWithPillsSerializer.js b/src/autocomplete/PlainWithPillsSerializer.js index 6827f1fe73..0e850f2a33 100644 --- a/src/autocomplete/PlainWithPillsSerializer.js +++ b/src/autocomplete/PlainWithPillsSerializer.js @@ -61,6 +61,9 @@ class PlainWithPillsSerializer { (node.object == 'block' && Block.isBlockList(node.nodes)) ) { return node.nodes.map(this._serializeNode).join('\n'); + } + else if (node.type == 'emoji') { + return node.data.get('emojiUnicode'); } else if (node.type == 'pill') { switch (this.pillFormat) { case 'plain': diff --git a/src/components/views/elements/Pill.js b/src/components/views/elements/Pill.js index 7e5ad379de..673e4fdd03 100644 --- a/src/components/views/elements/Pill.js +++ b/src/components/views/elements/Pill.js @@ -59,6 +59,8 @@ const Pill = React.createClass({ room: PropTypes.instanceOf(Room), // Whether to include an avatar in the pill shouldShowPillAvatar: PropTypes.bool, + // Whether to render this pill as if it were highlit by a selection + isSelected: PropTypes.bool, }, @@ -233,6 +235,7 @@ const Pill = React.createClass({ const classes = classNames(pillClass, { "mx_UserPill_me": userId === MatrixClientPeg.get().credentials.userId, + "mx_UserPill_selected": this.props.isSelected, }); if (this.state.pillType) { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 4a9dfa4b4c..e682d28ff6 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -58,7 +58,7 @@ import {MATRIXTO_URL_PATTERN, MATRIXTO_MD_LINK_PATTERN} from '../../../linkify-m const REGEX_MATRIXTO = new RegExp(MATRIXTO_URL_PATTERN); const REGEX_MATRIXTO_MARKDOWN_GLOBAL = new RegExp(MATRIXTO_MD_LINK_PATTERN, 'g'); -import {asciiRegexp, shortnameToUnicode, emojioneList, asciiList, mapUnicodeToShort} from 'emojione'; +import {asciiRegexp, unicodeRegexp, shortnameToUnicode, emojioneList, asciiList, mapUnicodeToShort, toShort} from 'emojione'; import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore"; import {makeUserPermalink} from "../../../matrix-to"; import ReplyPreview from "./ReplyPreview"; @@ -69,6 +69,7 @@ import {ContentHelpers} from 'matrix-js-sdk'; const EMOJI_SHORTNAMES = Object.keys(emojioneList); const EMOJI_UNICODE_TO_SHORTNAME = mapUnicodeToShort(); const REGEX_EMOJI_WHITESPACE = new RegExp('(?:^|\\s)(' + asciiRegexp + ')\\s$'); +const EMOJI_REGEX = new RegExp(unicodeRegexp, 'g'); const TYPING_USER_TIMEOUT = 10000, TYPING_SERVER_TIMEOUT = 30000; @@ -76,6 +77,7 @@ const ENTITY_TYPES = { AT_ROOM_PILL: 'ATROOMPILL', }; + function onSendMessageFailed(err, room) { // XXX: temporary logging to try to diagnose // https://github.com/vector-im/riot-web/issues/3148 @@ -351,12 +353,20 @@ export default class MessageComposerInput extends React.Component { if (this.direction !== '') { const focusedNode = editorState.focusInline || editorState.focusText; if (focusedNode.isVoid) { - change = change[`collapseToEndOf${ this.direction }Text`](); + if (editorState.isCollapsed) { + change = change[`collapseToEndOf${ this.direction }Text`](); + } + else { + const block = this.direction === 'Previous' ? editorState.previousText : editorState.nextText; + if (block) { + change = change.moveFocusToEndOf(block) + } + } editorState = change.value; } } - if (editorState.document.getFirstText().text !== '') { + if (!editorState.document.isEmpty) { this.onTypingActivity(); } else { this.onFinishedTyping(); @@ -369,9 +379,33 @@ export default class MessageComposerInput extends React.Component { } */ -/* - editorState = RichText.attachImmutableEntitiesToEmoji(editorState); + // emojioneify any emoji + // deliberately lose any inlines and pills via Plain.serialize as we know + // they won't contain emoji + // XXX: is getTextsAsArray a private API? + editorState.document.getTextsAsArray().forEach(node => { + if (node.text !== '' && HtmlUtils.containsEmoji(node.text)) { + let match; + while ((match = EMOJI_REGEX.exec(node.text)) !== null) { + const range = Range.create({ + anchorKey: node.key, + anchorOffset: match.index, + focusKey: node.key, + focusOffset: match.index + match[0].length, + }); + const inline = Inline.create({ + type: 'emoji', + data: { emojiUnicode: match[0] }, + isVoid: true, + }); + change = change.insertInlineAtRange(range, inline); + editorState = change.value; + } + } + }); + +/* const currentBlock = editorState.getSelection().getStartKey(); const currentSelection = editorState.getSelection(); const currentStartOffset = editorState.getSelection().getStartOffset(); @@ -400,7 +434,6 @@ export default class MessageComposerInput extends React.Component { editorState = EditorState.forceSelection(editorState, currentSelection); } */ - const text = editorState.startText.text; const currentStartOffset = editorState.startOffset; @@ -912,8 +945,12 @@ export default class MessageComposerInput extends React.Component { // Move selection to the end of the selected history const change = editorState.change().collapseToEndOf(editorState.document); + // XXX: should we be calling this.onChange(change) now? - // we skip it for now given we know we're about to setState anyway + // Answer: yes, if we want it to do any of the fixups on stuff like emoji. + // however, this should already have been done and persisted in the history, + // so shouldn't be necessary. + editorState = change.value; this.suppressAutoComplete = true; @@ -991,11 +1028,6 @@ export default class MessageComposerInput extends React.Component { // we can't put text in here otherwise the editor tries to select it isVoid: true, }); - } else { - inline = Inline.create({ - type: 'autocompletion', - nodes: [Text.create(completion)] - }); } let editorState = activeEditorState; @@ -1007,13 +1039,23 @@ export default class MessageComposerInput extends React.Component { editorState = change.value; } - const change = editorState.change() - .insertInlineAtRange(editorState.selection, inline) - .insertText(suffix); + let change; + if (inline) { + change = editorState.change() + .insertInlineAtRange(editorState.selection, inline) + .insertText(suffix); + } + else { + change = editorState.change() + .insertTextAtRange(editorState.selection, completion) + .insertText(suffix); + } editorState = change.value; - this.setState({ editorState, originalEditorState: activeEditorState }, ()=>{ -// this.refs.editor.focus(); + this.onChange(change); + + this.setState({ + originalEditorState: activeEditorState }); return true; @@ -1027,7 +1069,7 @@ export default class MessageComposerInput extends React.Component { return

{children}

} case 'pill': { - const { data, text } = node; + const { data } = node; const url = data.get('url'); const completion = data.get('completion'); @@ -1039,6 +1081,7 @@ export default class MessageComposerInput extends React.Component { type={Pill.TYPE_AT_ROOM_MENTION} room={this.props.room} shouldShowPillAvatar={shouldShowPillAvatar} + isSelected={isSelected} />; } else if (Pill.isPillUrl(url)) { @@ -1046,14 +1089,26 @@ export default class MessageComposerInput extends React.Component { url={url} room={this.props.room} shouldShowPillAvatar={shouldShowPillAvatar} + isSelected={isSelected} />; } else { + const { text } = node; return { text } ; } } + case 'emoji': { + const { data } = node; + const emojiUnicode = data.get('emojiUnicode'); + const uri = RichText.unicodeToEmojiUri(emojiUnicode); + const shortname = toShort(emojiUnicode); + const className = classNames('mx_emojione', { + mx_emojione_selected: isSelected + }); + return {; + } } }; From 12a56e8b8e13e9d49c191605a6fb5591566e17d6 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 15 May 2018 00:59:55 +0100 Subject: [PATCH 029/702] remove spurious comment --- src/components/views/rooms/MessageComposerInput.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index e682d28ff6..204ad524fe 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -381,8 +381,6 @@ export default class MessageComposerInput extends React.Component { // emojioneify any emoji - // deliberately lose any inlines and pills via Plain.serialize as we know - // they won't contain emoji // XXX: is getTextsAsArray a private API? editorState.document.getTextsAsArray().forEach(node => { if (node.text !== '' && HtmlUtils.containsEmoji(node.text)) { From 4eb6942211e613a11c999d1c44f38691d47fd49a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 15 May 2018 01:16:06 +0100 Subject: [PATCH 030/702] let onChange set originalEditorState --- src/components/views/rooms/MessageComposerInput.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 204ad524fe..39d49ecf83 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -346,7 +346,7 @@ export default class MessageComposerInput extends React.Component { } } - onChange = (change: Change) => { + onChange = (change: Change, originalEditorState: value) => { let editorState = change.value; @@ -467,7 +467,7 @@ export default class MessageComposerInput extends React.Component { /* Since a modification was made, set originalEditorState to null, since newState is now our original */ this.setState({ editorState, - originalEditorState: null, + originalEditorState: originalEditorState || null }); }; @@ -1050,11 +1050,7 @@ export default class MessageComposerInput extends React.Component { } editorState = change.value; - this.onChange(change); - - this.setState({ - originalEditorState: activeEditorState - }); + this.onChange(change, activeEditorState); return true; }; From f5c67229a46648268aefd3b3206c54c8227818a3 Mon Sep 17 00:00:00 2001 From: Kenneth Larsson Date: Mon, 14 May 2018 23:41:38 +0000 Subject: [PATCH 031/702] Translated using Weblate (Swedish) Currently translated at 69.0% (811 of 1175 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/sv/ --- src/i18n/strings/sv.json | 95 ++++++++++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 18 deletions(-) diff --git a/src/i18n/strings/sv.json b/src/i18n/strings/sv.json index e987ed29e2..a35509e1b4 100644 --- a/src/i18n/strings/sv.json +++ b/src/i18n/strings/sv.json @@ -135,7 +135,7 @@ "Failed to save settings": "Det gick inte att spara inställningarna", "Failed to send email": "Det gick inte att skicka epost", "Failed to send request.": "Det gick inte att sända begäran.", - "Failed to set avatar.": "Det gick inte att sätta profilbilden.", + "Failed to set avatar.": "Misslyckades med att ange avatar.", "Failed to set display name": "Det gick inte att sätta namnet", "Failed to set up conference call": "Det gick inte att starta konferenssamtalet", "Failed to toggle moderator status": "Det gick inte att växla moderator-status", @@ -181,7 +181,7 @@ "Guest access is disabled on this Home Server.": "Gäståtkomst är inte aktiverat på den här hemservern.", "Guests cannot join this room even if explicitly invited.": "Gäster kan inte gå med i det här rummet fastän de är uttryckligen inbjudna.", "Hangup": "Lägg på", - "Hide read receipts": "Göm kvitteringar", + "Hide read receipts": "Dölj läskvitton", "Hide Text Formatting Toolbar": "Göm textformatteringsverktygsfältet", "Historical": "Historiska", "Home": "Hem", @@ -293,7 +293,7 @@ "Reject invitation": "Avvisa inbjudan", "Rejoin": "Gå med tillbaka", "Remote addresses for this room:": "Fjärradresser för det här rummet:", - "Remove Contact Information?": "Ta bort kontaktinformation?", + "Remove Contact Information?": "Ta bort kontaktuppgifter?", "%(senderName)s removed their display name (%(oldDisplayName)s).": "%(senderName)s tog bort sitt visningsnamn (%(oldDisplayName)s).", "%(senderName)s removed their profile picture.": "%(senderName)s tog bort sin profilbild.", "Remove": "Ta bort", @@ -403,18 +403,18 @@ "Thu": "Tors", "Fri": "Fre", "Sat": "Lör", - "Jan": "Jan", - "Feb": "Feb", - "Mar": "Mar", - "Apr": "Apr", - "May": "Maj", - "Jun": "Jun", - "Jul": "Juli", - "Aug": "Aug", - "Sep": "Sep", - "Oct": "Okt", - "Nov": "Nov", - "Dec": "Dec", + "Jan": "jan", + "Feb": "feb", + "Mar": "mar", + "Apr": "apr", + "May": "maj", + "Jun": "jun", + "Jul": "jul", + "Aug": "aug", + "Sep": "sep", + "Oct": "okt", + "Nov": "nov", + "Dec": "dec", "Name or matrix ID": "Namn eller matrix ID", "Invite to Community": "", "Unable to enable Notifications": "Det går inte att aktivera Notifieringar", @@ -647,8 +647,8 @@ "Offline": "Offline", "(~%(count)s results)|other": "(~%(count)s resultat)", "(~%(count)s results)|one": "(~%(count)s resultat)", - "Upload avatar": "Ladda upp profilbild", - "Remove avatar": "Ta bort profilbild", + "Upload avatar": "Ladda upp avatar", + "Remove avatar": "Ta bort avatar", "This invitation was sent to an email address which is not associated with this account:": "Den här inbjudan skickades till en epostadress som inte är kopplad till detta konto:", "To link to a room it must have an address.": "För att länka till ett rum behöver det en adress.", "%(userName)s (power %(powerLevelNumber)s)": "%(userName)s (nivå %(powerLevelNumber)s)", @@ -752,5 +752,64 @@ "This will allow you to reset your password and receive notifications.": "Det här låter dig återställa lösenordet och ta emot aviseringar.", "You have no visible notifications": "Du har inga synliga aviseringar", "Your password was successfully changed. You will not receive push notifications on other devices until you log back in to them": "Ditt lösenord har ändrats. Du kommer inte att få push-aviseringar på andra enheter förrän du har loggat in på dem igen", - "Failed to upload image": "Det gick inte att ladda upp bild" + "Failed to upload image": "Det gick inte att ladda upp bild", + "New Password": "Nytt lösenord", + "Do you want to set an email address?": "Vill du ange en epostadress?", + "Your home server does not support device management.": "Din hemserver stöder inte enhetshantering.", + "Unable to load device list": "Det gick inte att ladda enhetslista", + "Delete %(count)s devices|other": "Ta bort %(count)s enheter", + "Delete %(count)s devices|one": "Ta bort enhet", + "Device Name": "Enhetsnamn", + "Select devices": "Välj enheter", + "Disable Emoji suggestions while typing": "Inaktivera Emoji-förslag medan du skriver", + "Use compact timeline layout": "Använd kompakt chattlayout", + "Not a valid Riot keyfile": "Inte en giltig Riot-nyckelfil", + "Authentication check failed: incorrect password?": "Autentiseringskontroll misslyckades: felaktigt lösenord?", + "Always show encryption icons": "Visa alltid krypteringsikoner", + "Disable big emoji in chat": "Inaktivera stor emoji i chatt", + "Hide avatars in user and room mentions": "Dölj avatarer i användar- och rumsnämningar", + "%(senderDisplayName)s changed the avatar for %(roomName)s": "%(senderDisplayName)s bytte avatar för %(roomName)s", + "%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s tog bort rummets avatar.", + "%(senderDisplayName)s changed the room avatar to ": "%(senderDisplayName)s ändrade rummets avatar till ", + "Automatically replace plain text Emoji": "Ersätt text-emojis automatiskt", + "%(weekDayName)s %(time)s": "%(weekDayName)s %(time)s", + "%(weekDayName)s, %(monthName)s %(day)s %(time)s": "%(weekDayName)s, %(day)s %(monthName)s %(time)s", + "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s": "%(weekDayName)s, %(day)s %(monthName)s %(fullYear)s", + "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s": "%(weekDayName)s, %(day)s %(monthName)s %(fullYear)s %(time)s", + "You seem to be uploading files, are you sure you want to quit?": "Du verkar ladda upp filer, är du säker på att du vill avsluta?", + "You seem to be in a call, are you sure you want to quit?": "Du verkar vara i ett samtal, är du säker på att du vill avsluta?", + "Active call": "Aktivt samtal", + "Show devices, send anyway or cancel.": "Visa enheter, skicka ändå eller avbryt.", + "%(count)s of your messages have not been sent.|one": "Ditt meddelande skickades inte.", + "%(count)s Resend all or cancel all now. You can also select individual messages to resend or cancel.|other": "Skicka om alla eller ångra alla nu. Du kan även välja enskilda meddelanden för att skicka om eller ångra.", + "%(count)s Resend all or cancel all now. You can also select individual messages to resend or cancel.|one": "Skicka om meddelande eller ångra meddelande nu.", + "Connectivity to the server has been lost.": "Anslutning till servern har brutits.", + "Sent messages will be stored until your connection has returned.": "Skickade meddelanden kommer att lagras tills anslutningen är tillbaka.", + "There's no one else here! Would you like to invite others or stop warning about the empty room?": "Det är ingen annan här! Vill du bjuda in någon eller sluta varna om det tomma rummet?", + "Unknown room %(roomId)s": "Okänt rum %(roomId)s", + "Room": "Rum", + "Clear filter": "Töm filter", + "Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.": "Försökte ladda en viss punkt i det här rummets tidslinje, men du har inte behörighet att visa det aktuella meddelandet.", + "Tried to load a specific point in this room's timeline, but was unable to find it.": "Försökte ladda en specifik punkt i det här rummets tidslinje, men kunde inte hitta den.", + "Success": "Det lyckades", + "Unable to remove contact information": "Det gick inte att ta bort kontaktuppgifter", + "Autocomplete Delay (ms):": "Autokompletteringsfördröjning (ms):", + "Ignored Users": "Ignorerade användare", + "These are experimental features that may break in unexpected ways": "Detta är experimentell funktionalitet som kan sluta fungera helt oväntat", + "Use with caution": "Använd med försiktighet", + "To return to your account in future you need to set a password": "För att återvända till ditt konto i framtiden måste du ange ett lösenord", + "An email has been sent to %(emailAddress)s. Once you've followed the link it contains, click below.": "Ett epostmeddelande har skickats till %(emailAddress)s. När du har öppnat länken i det, klicka nedan.", + "Please note you are logging into the %(hs)s server, not matrix.org.": "Observera att du loggar in på %(hs)s-servern, inte matrix.org.", + "This homeserver doesn't offer any login flows which are supported by this client.": "Denna hemserver erbjuder inga inloggningsflöden som stöds av den här klienten.", + "Upload new:": "Ladda upp ny:", + "Copied!": "Kopierat!", + "Failed to copy": "Det gick inte att kopiera", + "Removed or unknown message type": "Borttagen eller okänd meddelandetyp", + "Message removed by %(userId)s": "Meddelande borttaget av %(userId)s", + "Message removed": "Meddelande borttaget", + "Robot check is currently unavailable on desktop - please use a web browser": "Robotkontrollen är för närvarande inte tillgänglig för skrivbordsversionen - vänligen använd en webbläsare", + "This Home Server would like to make sure you are not a robot": "Den här hemservern vill bekräfta att du inte är en robot", + "Sign in with CAS": "Logga in med CAS", + "Unknown devices": "Okända enheter", + "\"%(RoomName)s\" contains devices that you haven't seen before.": "\"%(RoomName)s\" innehåller enheter som du inte har sett tidigare." } From 05c469399d10927509640f84c42f97d27083dc8c Mon Sep 17 00:00:00 2001 From: Osoitz Date: Tue, 8 May 2018 09:26:45 +0000 Subject: [PATCH 032/702] Translated using Weblate (Basque) Currently translated at 100.0% (1172 of 1172 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/eu/ --- src/i18n/strings/eu.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/eu.json b/src/i18n/strings/eu.json index e478c3270b..93acd5fbc2 100644 --- a/src/i18n/strings/eu.json +++ b/src/i18n/strings/eu.json @@ -1176,5 +1176,6 @@ "Unable to reply": "Ezin erantzun", "At this time it is not possible to reply with an emote.": "Une honetan ezin da irriabartxo batekin erantzun.", "Unable to load event that was replied to, it either does not exist or you do not have permission to view it.": "Ezin izan da erantzundako gertaera kargatu, edo ez dago edo ez duzu ikusteko baimenik.", - "Collapse Reply Thread": "Tolestu erantzun-haria" + "Collapse Reply Thread": "Tolestu erantzun-haria", + "Enable widget screenshots on supported widgets": "Gaitu trepeten pantaila-argazkiak onartzen duten trepetetan" } From 5b26a56b9ab7c7afc4af918f9d912fc1bee9e096 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 16 May 2018 09:42:07 +0000 Subject: [PATCH 033/702] Translated using Weblate (Bulgarian) Currently translated at 100.0% (1172 of 1172 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/bg/ --- src/i18n/strings/bg.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/bg.json b/src/i18n/strings/bg.json index 2a2b90f59f..9322865c7a 100644 --- a/src/i18n/strings/bg.json +++ b/src/i18n/strings/bg.json @@ -1167,5 +1167,15 @@ "At this time it is not possible to reply with a file so this will be sent without being a reply.": "В момента не може да се отговаря с файл, така че това ще се изпрати без да бъде отговор.", "Unable to reply": "Не може да се отговори", "At this time it is not possible to reply with an emote.": "В момента не може да се отговори с емотикона.", - "Unable to load event that was replied to, it either does not exist or you do not have permission to view it.": "Не може да се зареди събитието, на което е отговорено. Или не съществува или нямате достъп да го видите." + "Unable to load event that was replied to, it either does not exist or you do not have permission to view it.": "Не може да се зареди събитието, на което е отговорено. Или не съществува или нямате достъп да го видите.", + "Popout widget": "Изкарай в нов прозорец", + "Log out and remove encryption keys?": "Изход и изтриване на ключовете за шифроване?", + "Clear Storage and Sign Out": "Изчисти запазените данни и излез", + "Send Logs": "Изпрати логове", + "Refresh": "Опресни", + "We encountered an error trying to restore your previous session.": "Възникна грешка при възстановяване на предишната Ви сесия.", + "Clearing your browser's storage may fix the problem, but will sign you out and cause any encrypted chat history to become unreadable.": "Изчистване на запазените данни в браузъра може да поправи проблема, но ще Ви изкара от профила и ще направи шифрованите съобщения нечетими.", + "Collapse Reply Thread": "Свий отговорите", + "Enable widget screenshots on supported widgets": "Включи скрийншоти за поддържащи ги приспособления", + "Riot bugs are tracked on GitHub: create a GitHub issue.": "Бъговете по Riot се следят в GitHub: създайте проблем в GitHub." } From c5c3c51cf0bd9908ff9fc3ad6b50c55572f94492 Mon Sep 17 00:00:00 2001 From: Kenneth Larsson Date: Wed, 16 May 2018 09:55:27 +0000 Subject: [PATCH 034/702] Translated using Weblate (Swedish) Currently translated at 69.9% (820 of 1172 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/sv/ --- src/i18n/strings/sv.json | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/i18n/strings/sv.json b/src/i18n/strings/sv.json index a35509e1b4..edb7f4b065 100644 --- a/src/i18n/strings/sv.json +++ b/src/i18n/strings/sv.json @@ -347,7 +347,7 @@ "Start authentication": "Starta autentisering", "Start Chat": "Starta en chatt", "Cancel": "Avbryt", - "Create new room": "Nytt rum", + "Create new room": "Skapa nytt rum", "Custom Server Options": "Egna serverinställningar", "Dismiss": "Avvisa", "powered by Matrix": "drivs av Matrix", @@ -361,7 +361,7 @@ "Delete widget": "Ta bort widget", "Define the power level of a user": "Definiera anseende för en användare", "Do you want to load widget from URL:": "Vill du ladda widgeten från URL:", - "Edit": "Editera", + "Edit": "Ändra", "Enable automatic language detection for syntax highlighting": "Aktivera automatisk språkdetektering för syntaxmarkering", "Integrations Error": "Integrationsfel", "Publish this room to the public in %(domain)s's room directory?": "Publicera rummet i den offentliga rumskatalogen på %(domain)s?", @@ -417,14 +417,14 @@ "Dec": "dec", "Name or matrix ID": "Namn eller matrix ID", "Invite to Community": "", - "Unable to enable Notifications": "Det går inte att aktivera Notifieringar", - "Failed to invite user": "Misslyckades med att bjuda in användaren", + "Unable to enable Notifications": "Det går inte att aktivera aviseringar", + "Failed to invite user": "Det gick inte att bjuda in användaren", "The information being sent to us to help make Riot.im better includes:": "Informationen som skickas till oss för att hjälpa Riot.im att bli bättre inkluderar:", "Review Devices": "Granska enheter", "Answer Anyway": "Svara ändå", "VoIP is unsupported": "VoIP stöds ej", "Who would you like to add to this room?": "Vem vill du lägga till i det här rummet?", - "Failed to invite": "Misslyckades med att bjuda in", + "Failed to invite": "Inbjudan misslyckades", "You need to be logged in.": "Du måste vara inloggad.", "You need to be able to invite users to do that.": "Du måste kunna bjuda in användare för att göra det.", "You are not in this room.": "Du är inte i det här rummet.", @@ -791,7 +791,7 @@ "Clear filter": "Töm filter", "Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.": "Försökte ladda en viss punkt i det här rummets tidslinje, men du har inte behörighet att visa det aktuella meddelandet.", "Tried to load a specific point in this room's timeline, but was unable to find it.": "Försökte ladda en specifik punkt i det här rummets tidslinje, men kunde inte hitta den.", - "Success": "Det lyckades", + "Success": "Slutfört", "Unable to remove contact information": "Det gick inte att ta bort kontaktuppgifter", "Autocomplete Delay (ms):": "Autokompletteringsfördröjning (ms):", "Ignored Users": "Ignorerade användare", @@ -811,5 +811,14 @@ "This Home Server would like to make sure you are not a robot": "Den här hemservern vill bekräfta att du inte är en robot", "Sign in with CAS": "Logga in med CAS", "Unknown devices": "Okända enheter", - "\"%(RoomName)s\" contains devices that you haven't seen before.": "\"%(RoomName)s\" innehåller enheter som du inte har sett tidigare." + "\"%(RoomName)s\" contains devices that you haven't seen before.": "\"%(RoomName)s\" innehåller enheter som du inte har sett tidigare.", + "Delete Widget": "Ta bort widget", + "Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?": "Widget tas bort för alla användare i rummet. Är du säker på att du vill ta bort den?", + "Minimize apps": "Minimera appar", + "Picture": "Bild", + "Blacklist": "Svartlista", + "Unblacklist": "Ta bort svartlistning", + "Failed to invite the following users to %(groupId)s:": "Det gick inte att bjuda in följande användare till %(groupId)s:", + "Failed to invite users to %(groupId)s": "Det gick inte att bjuda in användare till %(groupId)s", + "This room is not public. You will not be able to rejoin without an invite.": "Detta rum är inte offentligt. Du kommer inte kunna gå med igen utan en inbjudan." } From ae208da805f693cf016655834f267ecf9846c22c Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 17 May 2018 00:01:23 +0100 Subject: [PATCH 035/702] nudge towards supporting formatting buttons in MD --- .../views/rooms/MessageComposerInput.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 39d49ecf83..1a2450696c 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -536,11 +536,12 @@ export default class MessageComposerInput extends React.Component { this.enableRichtext(!this.state.isRichtextEnabled); return true; } -/* - let newState: ?EditorState = null; + + let newState: ?Value = null; // Draft handles rich text mode commands by default but we need to do it ourselves for Markdown. if (this.state.isRichtextEnabled) { +/* // These are block types, not handled by RichUtils by default. const blockCommands = ['code-block', 'blockquote', 'unordered-list-item', 'ordered-list-item']; const currentBlockType = RichUtils.getCurrentBlockType(this.state.editorState); @@ -563,7 +564,9 @@ export default class MessageComposerInput extends React.Component { newState = RichUtils.toggleBlockType(this.state.editorState, currentBlockType); } } +*/ } else { +/* const contentState = this.state.editorState.getCurrentContent(); const multipleLinesSelected = RichText.hasMultiLineSelection(this.state.editorState); @@ -599,16 +602,17 @@ export default class MessageComposerInput extends React.Component { 'blockquote': -2, }[command]; - // Returns a function that collapses a selectionState to its end and moves it by offset - const collapseAndOffsetSelection = (selectionState, offset) => { - const key = selectionState.getEndKey(); - return new SelectionState({ + // Returns a function that collapses a selection to its end and moves it by offset + const collapseAndOffsetSelection = (selection, offset) => { + const key = selection.endKey(); + return new Range({ anchorKey: key, anchorOffset: offset, focusKey: key, focusOffset: offset, }); }; if (modifyFn) { + const previousSelection = this.state.editorState.getSelection(); const newContentState = RichText.modifyText(contentState, previousSelection, modifyFn); newState = EditorState.push( @@ -633,15 +637,11 @@ export default class MessageComposerInput extends React.Component { } } - if (newState == null) { - newState = RichUtils.handleKeyCommand(this.state.editorState, command); - } - if (newState != null) { this.setState({editorState: newState}); return true; } -*/ +*/ return false; }; /* From e51554c626429c3ce42a100824d56762670446c6 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 17 May 2018 02:13:17 +0100 Subject: [PATCH 036/702] actually hook up RTE --- src/ComposerHistoryManager.js | 2 +- .../views/rooms/MessageComposerInput.js | 295 +++++++++++------- 2 files changed, 189 insertions(+), 108 deletions(-) diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index ce0eb8f0c3..28749ace15 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -17,7 +17,7 @@ limitations under the License. import { Value } from 'slate'; import Html from 'slate-html-serializer'; -import { Markdown as Md } from 'slate-md-serializer'; +import Md from 'slate-md-serializer'; import Plain from 'slate-plain-serializer'; import * as RichText from './RichText'; import Markdown from './Markdown'; diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 1a2450696c..70a9b9bd83 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -23,7 +23,7 @@ import { Editor } from 'slate-react'; import { Value, Document, Event, Inline, Text, Range, Node } from 'slate'; import Html from 'slate-html-serializer'; -import { Markdown as Md } from 'slate-md-serializer'; +import Md from 'slate-md-serializer'; import Plain from 'slate-plain-serializer'; import PlainWithPillsSerializer from "../../../autocomplete/PlainWithPillsSerializer"; @@ -107,43 +107,6 @@ export default class MessageComposerInput extends React.Component { onInputStateChanged: PropTypes.func, }; -/* - static getKeyBinding(ev: SyntheticKeyboardEvent): string { - // Restrict a subset of key bindings to ONLY having ctrl/meta* pressed and - // importantly NOT having alt, shift, meta/ctrl* pressed. draft-js does not - // handle this in `getDefaultKeyBinding` so we do it ourselves here. - // - // * if macOS, read second option - const ctrlCmdCommand = { - // C-m => Toggles between rich text and markdown modes - [KeyCode.KEY_M]: 'toggle-mode', - [KeyCode.KEY_B]: 'bold', - [KeyCode.KEY_I]: 'italic', - [KeyCode.KEY_U]: 'underline', - [KeyCode.KEY_J]: 'code', - [KeyCode.KEY_O]: 'split-block', - }[ev.keyCode]; - - if (ctrlCmdCommand) { - if (!isOnlyCtrlOrCmdKeyEvent(ev)) { - return null; - } - return ctrlCmdCommand; - } - - // Handle keys such as return, left and right arrows etc. - return getDefaultKeyBinding(ev); - } - - static getBlockStyle(block: ContentBlock): ?string { - if (block.getType() === 'strikethrough') { - return 'mx_Markdown_STRIKETHROUGH'; - } - - return null; - } -*/ - client: MatrixClient; autocomplete: Autocomplete; historyManager: ComposerHistoryManager; @@ -181,6 +144,8 @@ export default class MessageComposerInput extends React.Component { this.plainWithMdPills = new PlainWithPillsSerializer({ pillFormat: 'md' }); this.plainWithIdPills = new PlainWithPillsSerializer({ pillFormat: 'id' }); this.plainWithPlainPills = new PlainWithPillsSerializer({ pillFormat: 'plain' }); + this.md = new Md(); + this.html = new Html(); this.suppressAutoComplete = false; this.direction = ''; @@ -191,9 +156,9 @@ export default class MessageComposerInput extends React.Component { * - whether we've got rich text mode enabled * - contentState was passed in */ - createEditorState(richText: boolean, value: ?Value): Value { - if (value instanceof Value) { - return value; + createEditorState(richText: boolean, editorState: ?Value): Value { + if (editorState instanceof Value) { + return editorState; } else { // ...or create a new one. @@ -275,7 +240,7 @@ export default class MessageComposerInput extends React.Component { } } break; -*/ +*/ } }; @@ -403,7 +368,7 @@ export default class MessageComposerInput extends React.Component { } }); -/* +/* const currentBlock = editorState.getSelection().getStartKey(); const currentSelection = editorState.getSelection(); const currentStartOffset = editorState.getSelection().getStartOffset(); @@ -477,27 +442,54 @@ export default class MessageComposerInput extends React.Component { // FIXME: this conversion should be handled in the store, surely // i.e. "convert my current composer value into Rich or MD, as ComposerHistoryManager already does" - let value = null; + let editorState = null; if (enabled) { - // const md = new Markdown(this.state.editorState.getCurrentContent().getPlainText()); - // contentState = RichText.htmlToContentState(md.toHTML()); + // const sourceWithPills = this.plainWithMdPills.serialize(this.state.editorState); + // const markdown = new Markdown(sourceWithPills); + // editorState = this.html.deserialize(markdown.toHTML()); - value = Md.deserialize(Plain.serialize(this.state.editorState)); + // we don't really want a custom MD parser hanging around, but the + // alternative would be: + editorState = this.md.deserialize(this.plainWithMdPills.serialize(this.state.editorState)); } else { // let markdown = RichText.stateToMarkdown(this.state.editorState.getCurrentContent()); // value = ContentState.createFromText(markdown); - value = Plain.deserialize(Md.serialize(this.state.editorState)); + editorState = Plain.deserialize(this.md.serialize(this.state.editorState)); } Analytics.setRichtextMode(enabled); this.setState({ - editorState: this.createEditorState(enabled, value), + editorState: this.createEditorState(enabled, editorState), isRichtextEnabled: enabled, }); SettingsStore.setValue("MessageComposerInput.isRichTextEnabled", null, SettingLevel.ACCOUNT, enabled); - } + }; + + /** + * Check if the current selection has a mark with `type` in it. + * + * @param {String} type + * @return {Boolean} + */ + + hasMark = type => { + const { editorState } = this.state + return editorState.activeMarks.some(mark => mark.type == type) + }; + + /** + * Check if the any of the currently selected blocks are of `type`. + * + * @param {String} type + * @return {Boolean} + */ + + hasBlock = type => { + const { editorState } = this.state + return editorState.blocks.some(node => node.type == type) + }; onKeyDown = (ev: Event, change: Change, editor: Editor) => { @@ -514,6 +506,22 @@ export default class MessageComposerInput extends React.Component { this.direction = ''; } + if (isOnlyCtrlOrCmdKeyEvent(ev)) { + const ctrlCmdCommand = { + // C-m => Toggles between rich text and markdown modes + [KeyCode.KEY_M]: 'toggle-mode', + [KeyCode.KEY_B]: 'bold', + [KeyCode.KEY_I]: 'italic', + [KeyCode.KEY_U]: 'underline', + [KeyCode.KEY_J]: 'code', + }[ev.keyCode]; + + if (ctrlCmdCommand) { + return this.handleKeyCommand(ctrlCmdCommand); + } + return false; + } + switch (ev.keyCode) { case KeyCode.ENTER: return this.handleReturn(ev); @@ -529,7 +537,7 @@ export default class MessageComposerInput extends React.Component { // don't intercept it return; } - } + }; handleKeyCommand = (command: string): boolean => { if (command === 'toggle-mode') { @@ -541,32 +549,79 @@ export default class MessageComposerInput extends React.Component { // Draft handles rich text mode commands by default but we need to do it ourselves for Markdown. if (this.state.isRichtextEnabled) { -/* - // These are block types, not handled by RichUtils by default. - const blockCommands = ['code-block', 'blockquote', 'unordered-list-item', 'ordered-list-item']; - const currentBlockType = RichUtils.getCurrentBlockType(this.state.editorState); + const type = command; + const { editorState } = this.state; + const change = editorState.change(); + const { document } = editorState; + switch (type) { + // list-blocks: + case 'bulleted-list': + case 'numbered-list': { + // Handle the extra wrapping required for list buttons. + const isList = this.hasBlock('list-item'); + const isType = editorState.blocks.some(block => { + return !!document.getClosest(block.key, parent => parent.type == type); + }); - const shouldToggleBlockFormat = ( - command === 'backspace' || - command === 'split-block' - ) && currentBlockType !== 'unstyled'; - - if (blockCommands.includes(command)) { - newState = RichUtils.toggleBlockType(this.state.editorState, command); - } else if (command === 'strike') { - // this is the only inline style not handled by Draft by default - newState = RichUtils.toggleInlineStyle(this.state.editorState, 'STRIKETHROUGH'); - } else if (shouldToggleBlockFormat) { - const currentStartOffset = this.state.editorState.getSelection().getStartOffset(); - const currentEndOffset = this.state.editorState.getSelection().getEndOffset(); - if (currentStartOffset === 0 && currentEndOffset === 0) { - // Toggle current block type (setting it to 'unstyled') - newState = RichUtils.toggleBlockType(this.state.editorState, currentBlockType); + if (isList && isType) { + change + .setBlocks(DEFAULT_NODE) + .unwrapBlock('bulleted-list') + .unwrapBlock('numbered-list'); + } else if (isList) { + change + .unwrapBlock( + type == 'bulleted-list' ? 'numbered-list' : 'bulleted-list' + ) + .wrapBlock(type); + } else { + change.setBlocks('list-item').wrapBlock(type); + } } + break; + + // simple blocks + case 'paragraph': + case 'block-quote': + case 'heading-one': + case 'heading-two': + case 'heading-three': + case 'list-item': + case 'code-block': { + const isActive = this.hasBlock(type); + const isList = this.hasBlock('list-item'); + + if (isList) { + change + .setBlocks(isActive ? DEFAULT_NODE : type) + .unwrapBlock('bulleted-list') + .unwrapBlock('numbered-list'); + } else { + change.setBlocks(isActive ? DEFAULT_NODE : type); + } + } + break; + + // marks: + case 'bold': + case 'italic': + case 'code': + case 'underline': + case 'strikethrough': { + change.toggleMark(type); + } + break; + + default: + console.warn(`ignoring unrecognised RTE command ${type}`); + return false; } -*/ + + this.onChange(change); + + return true; } else { -/* +/* const contentState = this.state.editorState.getCurrentContent(); const multipleLinesSelected = RichText.hasMultiLineSelection(this.state.editorState); @@ -641,7 +696,8 @@ export default class MessageComposerInput extends React.Component { this.setState({editorState: newState}); return true; } -*/ +*/ + } return false; }; /* @@ -671,19 +727,14 @@ export default class MessageComposerInput extends React.Component { if (ev.shiftKey) { return; } -/* - const currentBlockType = RichUtils.getCurrentBlockType(this.state.editorState); - if ( - ['code-block', 'blockquote', 'unordered-list-item', 'ordered-list-item'] - .includes(currentBlockType) - ) { - // By returning false, we allow the default draft-js key binding to occur, - // which in this case invokes "split-block". This creates a new block of the - // same type, allowing the user to delete it with backspace. - // See handleKeyCommand (when command === 'backspace') - return false; + + if (this.state.editorState.blocks.some( + block => block in ['code-block', 'block-quote', 'bulleted-list', 'numbered-list'] + )) { + // allow the user to terminate blocks by hitting return rather than sending a msg + return; } -*/ + const editorState = this.state.editorState; let contentText; @@ -989,6 +1040,17 @@ export default class MessageComposerInput extends React.Component { await this.setDisplayedCompletion(null); // restore originalEditorState }; + /* returns inline style and block type of current SelectionState so MessageComposer can render formatting + buttons. */ + getSelectionInfo(editorState: Value) { + return { + marks: editorState.activeMarks, + // XXX: shouldn't we return all the types of blocks in the current selection, + // not just the anchor? + blockType: editorState.anchorBlock.type, + }; + } + /* If passed null, restores the original editor content from state.originalEditorState. * If passed a non-null displayedCompletion, modifies state.originalEditorState to compute new state.editorState. */ @@ -1059,9 +1121,24 @@ export default class MessageComposerInput extends React.Component { const { attributes, children, node, isSelected } = props; switch (node.type) { - case 'paragraph': { - return

{children}

- } + case 'paragraph': + return

{children}

; + case 'block-quote': + return
{children}
; + case 'bulleted-list': + return
    {children}
; + case 'heading-one': + return

{children}

; + case 'heading-two': + return

{children}

; + case 'heading-three': + return

{children}

; + case 'list-item': + return
  • {children}
  • ; + case 'numbered-list': + return
      {children}
    ; + case 'code-block': + return

    {children}

    ; case 'pill': { const { data } = node; const url = data.get('url'); @@ -1106,29 +1183,35 @@ export default class MessageComposerInput extends React.Component { } }; + renderMark = props => { + const { children, mark, attributes } = props; + switch (mark.type) { + case 'bold': + return {children}; + case 'italic': + return {children}; + case 'code': + return {children}; + case 'underline': + return {children}; + case 'strikethrough': + return {children}; + } + }; + onFormatButtonClicked = (name: "bold" | "italic" | "strike" | "code" | "underline" | "quote" | "bullet" | "numbullet", e) => { e.preventDefault(); // don't steal focus from the editor! const command = { code: 'code-block', - quote: 'blockquote', - bullet: 'unordered-list-item', - numbullet: 'ordered-list-item', + quote: 'block-quote', + bullet: 'bulleted-list', + numbullet: 'numbered-list', + strike: 'strike-through', }[name] || name; this.handleKeyCommand(command); }; - /* returns inline style and block type of current SelectionState so MessageComposer can render formatting - buttons. */ - getSelectionInfo(editorState: Value) { - return { - marks: editorState.activeMarks, - // XXX: shouldn't we return all the types of blocks in the current selection, - // not just the anchor? - blockType: editorState.anchorBlock.type, - }; - } - getAutocompleteQuery(editorState: Value) { // We can just return the current block where the selection begins, which // should be enough to capture any autocompletion input, given autocompletion @@ -1154,7 +1237,7 @@ export default class MessageComposerInput extends React.Component { const range = { beginning, // whether the selection is in the first block of the editor or not start: editorState.selection.anchorOffset, - end: (editorState.selection.anchorKey == editorState.selection.focusKey) ? + end: (editorState.selection.anchorKey == editorState.selection.focusKey) ? editorState.selection.focusOffset : editorState.selection.anchorOffset, } if (range.start > range.end) { @@ -1203,11 +1286,9 @@ export default class MessageComposerInput extends React.Component { onChange={this.onChange} onKeyDown={this.onKeyDown} renderNode={this.renderNode} + renderMark={this.renderMark} spellCheck={true} /* - blockStyleFn={MessageComposerInput.getBlockStyle} - keyBindingFn={MessageComposerInput.getKeyBinding} - handleKeyCommand={this.handleKeyCommand} handlePastedText={this.onTextPasted} handlePastedFiles={this.props.onFilesPasted} stripPastedStyles={!this.state.isRichtextEnabled} From 123c4d0f6c027c6b74db273486d4d230c3217908 Mon Sep 17 00:00:00 2001 From: random Date: Wed, 16 May 2018 15:51:37 +0000 Subject: [PATCH 037/702] Translated using Weblate (Italian) Currently translated at 99.1% (1162 of 1172 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/it/ --- src/i18n/strings/it.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/it.json b/src/i18n/strings/it.json index ba7417bcc8..82382a3967 100644 --- a/src/i18n/strings/it.json +++ b/src/i18n/strings/it.json @@ -1151,5 +1151,21 @@ "Collapse panel": "Riduci pannello", "With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!": "Con il tuo attuale browser, l'aspetto e la sensazione generale dell'applicazione potrebbero essere completamente sbagliati e alcune delle funzionalità potrebbero non funzionare. Se vuoi provare comunque puoi continuare, ma non riceverai aiuto per qualsiasi problema tu possa riscontrare!", "Checking for an update...": "Controllo aggiornamenti...", - "There are advanced notifications which are not shown here": "Ci sono notifiche avanzate che non sono mostrate qui" + "There are advanced notifications which are not shown here": "Ci sono notifiche avanzate che non sono mostrate qui", + "Every page you use in the app": "Ogni pagina che usi nell'app", + "e.g. ": "es. ", + "Your User Agent": "Il tuo User Agent", + "Your device resolution": "La risoluzione del dispositivo", + "Missing roomId.": "ID stanza mancante.", + "Always show encryption icons": "Mostra sempre icone di cifratura", + "Enable widget screenshots on supported widgets": "Attiva le schermate dei widget sui widget supportati", + "At this time it is not possible to reply with a file so this will be sent without being a reply.": "Al momento non è possibile rispondere con un file quindi verrà inviato senza essere una risposta.", + "Unable to reply": "Impossibile rispondere", + "At this time it is not possible to reply with an emote.": "Al momento non è possibile rispondere con una emoticon.", + "Picture": "Immagine", + "Unable to load event that was replied to, it either does not exist or you do not have permission to view it.": "Impossibile caricare l'evento a cui si è risposto, o non esiste o non hai il permesso di visualizzarlo.", + "Riot bugs are tracked on GitHub: create a GitHub issue.": "Gli errori di Riot sono monitorati su GitHub: segnala un problema su GitHub.", + "Log out and remove encryption keys?": "Disconnettere e rimuovere le chiavi di cifratura?", + "Refresh": "Aggiorna", + "We encountered an error trying to restore your previous session.": "Abbiamo riscontrato un errore tentando di ripristinare la tua sessione precedente." } From d9236a58487beaa6ac7a814663e0f01b84009330 Mon Sep 17 00:00:00 2001 From: strix aluco Date: Wed, 16 May 2018 16:09:18 +0000 Subject: [PATCH 038/702] Translated using Weblate (Ukrainian) Currently translated at 23.1% (271 of 1172 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/uk/ --- src/i18n/strings/uk.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/uk.json b/src/i18n/strings/uk.json index cb7809814a..c3ff95b938 100644 --- a/src/i18n/strings/uk.json +++ b/src/i18n/strings/uk.json @@ -265,5 +265,11 @@ "To return to your account in future you need to set a password": "Щоб мати змогу користуватись обліковкою у майбутньому, треба зазначити пароль", "Logged in as:": "Ви зайшли як:", "click to reveal": "натисніть щоб побачити", - "Homeserver is": "Домашній сервер —" + "Homeserver is": "Домашній сервер —", + "The version of Riot.im": "Версія Riot.im", + "Whether or not you're logged in (we don't record your user name)": "Чи увійшли ви, чи ні (ми не зберігаємо ваше ім'я користувача)", + "Your language of choice": "Обрана мова", + "Which officially provided instance you are using, if any": "Яким офіційно наданим примірником ви користуєтесь (якщо користуєтесь)", + "Whether or not you're using the Richtext mode of the Rich Text Editor": "Чи використовуєте ви режим Richtext у редакторі Rich Text Editor", + "Your homeserver's URL": "URL адреса вашого домашнього серверу" } From b28ed6075bbf65fdb78bd09e4773ab2a6f25a936 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 17 May 2018 18:15:34 +0100 Subject: [PATCH 039/702] Implement slightly hacky CSS soln. to thumbnail sizing As the slightly nicer alternative to fixupHeight being applied once we actually have a timelineWidth. The niceness comes from not needing timelineWidth, which means we can implement at render time with CSS. (Despite still calculating aspect ratios when we render.) --- res/css/views/messages/_MImageBody.scss | 13 +++- src/components/views/messages/MImageBody.js | 66 ++++++--------------- 2 files changed, 29 insertions(+), 50 deletions(-) diff --git a/res/css/views/messages/_MImageBody.scss b/res/css/views/messages/_MImageBody.scss index 1c809f0743..9f0e77f765 100644 --- a/res/css/views/messages/_MImageBody.scss +++ b/res/css/views/messages/_MImageBody.scss @@ -20,5 +20,14 @@ limitations under the License. } .mx_MImageBody_thumbnail { - max-width: 100%; -} \ No newline at end of file + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; +} + +.mx_MImageBody_thumbnail_container { + overflow: hidden; + position: relative; +} diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index 6cc492acf8..87fe8d906c 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -21,15 +21,15 @@ import PropTypes from 'prop-types'; import { MatrixClient } from 'matrix-js-sdk'; import MFileBody from './MFileBody'; -import ImageUtils from '../../../ImageUtils'; import Modal from '../../../Modal'; import sdk from '../../../index'; -import dis from '../../../dispatcher'; import { decryptFile } from '../../../utils/DecryptFile'; import Promise from 'bluebird'; import { _t } from '../../../languageHandler'; import SettingsStore from "../../../settings/SettingsStore"; +const THUMBNAIL_MAX_HEIGHT = 600; + export default class extends React.Component { displayName: 'MImageBody' @@ -48,14 +48,12 @@ export default class extends React.Component { constructor(props) { super(props); - this.onAction = this.onAction.bind(this); this.onImageError = this.onImageError.bind(this); this.onImageLoad = this.onImageLoad.bind(this); this.onImageEnter = this.onImageEnter.bind(this); this.onImageLeave = this.onImageLeave.bind(this); this.onClientSync = this.onClientSync.bind(this); this.onClick = this.onClick.bind(this); - this.fixupHeight = this.fixupHeight.bind(this); this._isGif = this._isGif.bind(this); this.state = { @@ -140,7 +138,6 @@ export default class extends React.Component { } onImageLoad() { - this.fixupHeight(); this.props.onWidgetLoad(); } @@ -176,7 +173,6 @@ export default class extends React.Component { } componentDidMount() { - this.dispatcherRef = dis.register(this.onAction); const content = this.props.mxEvent.getContent(); if (content.file !== undefined && this.state.decryptedUrl === null) { let thumbnailPromise = Promise.resolve(null); @@ -217,7 +213,6 @@ export default class extends React.Component { componentWillUnmount() { this.unmounted = true; - dis.unregister(this.dispatcherRef); this.context.matrixClient.removeListener('sync', this.onClientSync); this._afterComponentWillUnmount(); @@ -234,50 +229,25 @@ export default class extends React.Component { _afterComponentWillUnmount() { } - onAction(payload) { - if (payload.action === "timeline_resize") { - this.fixupHeight(); - } - } - - fixupHeight() { - if (!this.refs.image) { - console.warn(`Refusing to fix up height on ${this.displayName} with no image element`); - return; - } - - const content = this.props.mxEvent.getContent(); - const timelineWidth = this.refs.body.offsetWidth; - const maxHeight = 600; // let images take up as much width as they can so long as the height doesn't exceed 600px. - // the alternative here would be 600*timelineWidth/800; to scale them down to fit inside a 4:3 bounding box - - // FIXME: this will break on clientside generated thumbnails (as per e2e rooms) - // which may well be much smaller than the 800x600 bounding box. - - // FIXME: It will also break really badly for images with broken or missing thumbnails - - // FIXME: Because we don't know what size of thumbnail the server's actually going to send - // us, we can't even really layout the page nicely for it. Instead we have to assume - // it'll target 800x600 and we'll downsize if needed to make things fit. - - // console.log("trying to fit image into timelineWidth of " + this.refs.body.offsetWidth + " or " + this.refs.body.clientWidth); - let thumbHeight = null; - if (content.info) { - thumbHeight = ImageUtils.thumbHeight(content.info.w, content.info.h, timelineWidth, maxHeight); - } - this.refs.image.style.height = thumbHeight + "px"; - // console.log("Image height now", thumbHeight); - } - _messageContent(contentUrl, thumbUrl, content) { + const maxHeight = Math.min(THUMBNAIL_MAX_HEIGHT, content.info.h); + const maxWidth = content.info.w * maxHeight / content.info.h; const thumbnail = ( - {content.body} +
    + { /* Calculate aspect ratio, using %padding will size _container correctly */ } +
    + + { /* Thumbnail CSS class resizes to exactly container size with inline CSS + to restrict width */ } + {content.body} +
    ); From bbcf2fea53d81cb344e36e21221c298be46e30d5 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 18 May 2018 09:47:49 +0100 Subject: [PATCH 040/702] Fix e2e image thumbnail spinner containing box correct size --- src/components/views/messages/MImageBody.js | 55 ++++++++++----------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index 87fe8d906c..f1454d1ac5 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -232,7 +232,29 @@ export default class extends React.Component { _messageContent(contentUrl, thumbUrl, content) { const maxHeight = Math.min(THUMBNAIL_MAX_HEIGHT, content.info.h); const maxWidth = content.info.w * maxHeight / content.info.h; - const thumbnail = ( + + let img = null; + // e2e image hasn't been decrypted yet + if (content.file !== undefined && this.state.decryptedUrl === null) { + img =
    + {content.body} +
    ; + } else if (thumbUrl && !this.state.imgError) { + img = {content.body}; + } + const thumbnail = img ?
    { /* Calculate aspect ratio, using %padding will size _container correctly */ } @@ -240,20 +262,13 @@ export default class extends React.Component { { /* Thumbnail CSS class resizes to exactly container size with inline CSS to restrict width */ } - {content.body} + { img }
    -
    - ); + : null; return ( - { thumbUrl && !this.state.imgError ? thumbnail : '' } + { thumbnail } ); @@ -271,24 +286,6 @@ export default class extends React.Component { ); } - if (content.file !== undefined && this.state.decryptedUrl === null) { - // Need to decrypt the attachment - // The attachment is decrypted in componentDidMount. - // For now add an img tag with a spinner. - return ( - -
    - {content.body} -
    -
    - ); - } const contentUrl = this._getContentUrl(); let thumbUrl; From b41b9aa4facd2e4767d993f1d173ec9fdbc03c37 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 18 May 2018 09:58:52 +0100 Subject: [PATCH 041/702] Remove fixupHeight call from MStickerBody --- src/components/views/messages/MStickerBody.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/views/messages/MStickerBody.js b/src/components/views/messages/MStickerBody.js index 3a412fc2e2..cdb60f0074 100644 --- a/src/components/views/messages/MStickerBody.js +++ b/src/components/views/messages/MStickerBody.js @@ -40,7 +40,6 @@ export default class MStickerBody extends MImageBody { } _onImageLoad() { - this.fixupHeight(); this.setState({ placeholderClasses: 'mx_MStickerBody_placeholder_invisible', }); @@ -110,8 +109,6 @@ export default class MStickerBody extends MImageBody { // The pixel size of sticker images is generally larger than their intended display // size so they render at native reolution on HiDPI displays. We therefore need to // explicity set the size so they render at the intended size. - // XXX: This will be clobberred when we run fixupHeight(), but we need to do it - // here otherwise the stickers are momentarily displayed at the pixel size. const imageStyle = { height: content.info.h, // leave the browser the calculate the width automatically From d11442de0434282c70052327420ab359de9bd161 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 18 May 2018 10:15:59 +0100 Subject: [PATCH 042/702] Adjust comment --- src/components/views/messages/MImageBody.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index f1454d1ac5..f98432a166 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -260,8 +260,7 @@ export default class extends React.Component { { /* Calculate aspect ratio, using %padding will size _container correctly */ }
    - { /* Thumbnail CSS class resizes to exactly container size with inline CSS - to restrict width */ } + { /* mx_MImageBody_thumbnail resizes img to exactly container size */ } { img } : null; From 7e7e2a747313d2d9d45d67bb5019b1fc0b7ef20a Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 18 May 2018 10:27:22 +0100 Subject: [PATCH 043/702] Add more comments to explain thumbnail sizing --- res/css/views/messages/_MImageBody.scss | 4 ++++ src/components/views/messages/MImageBody.js | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/res/css/views/messages/_MImageBody.scss b/res/css/views/messages/_MImageBody.scss index 9f0e77f765..9667337f5a 100644 --- a/res/css/views/messages/_MImageBody.scss +++ b/res/css/views/messages/_MImageBody.scss @@ -28,6 +28,10 @@ limitations under the License. } .mx_MImageBody_thumbnail_container { + // Prevent the padding-bottom (added inline in MImageBody.js) from + // effecting elements below the container. overflow: hidden; + + // Make sure the _thumbnail is positioned relative to the _container position: relative; } diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index f98432a166..656bd02840 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -230,7 +230,10 @@ export default class extends React.Component { } _messageContent(contentUrl, thumbUrl, content) { + // The maximum height of the thumbnail as it is rendered as an const maxHeight = Math.min(THUMBNAIL_MAX_HEIGHT, content.info.h); + // The maximum width of the thumbnail, as dictated by it's natural + // maximum height. const maxWidth = content.info.w * maxHeight / content.info.h; let img = null; @@ -246,6 +249,8 @@ export default class extends React.Component { }} /> ; } else if (thumbUrl && !this.state.imgError) { + // Restrict the width of the thumbnail here, otherwise it will fill the container + // which has the same width as the timeline img = {content.body} Date: Thu, 17 May 2018 18:41:24 +0000 Subject: [PATCH 044/702] Translated using Weblate (Russian) Currently translated at 99.8% (1170 of 1172 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/ru/ --- src/i18n/strings/ru.json | 50 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/i18n/strings/ru.json b/src/i18n/strings/ru.json index f766069b16..24e9750698 100644 --- a/src/i18n/strings/ru.json +++ b/src/i18n/strings/ru.json @@ -1,6 +1,6 @@ { "Account": "Аккаунт", - "Add email address": "Добавить адрес email", + "Add email address": "Добавить email", "Add phone number": "Добавить номер телефона", "Admin": "Администратор", "Advanced": "Подробности", @@ -39,7 +39,7 @@ "Display name": "Отображаемое имя", "Displays action": "Отображение действий", "Ed25519 fingerprint": "Ed25519 отпечаток", - "Email, name or matrix ID": "Email-адрес, имя или идентификатор", + "Email, name or matrix ID": "Email, имя или matrix ID", "Emoji": "Смайлы", "Encrypted messages will not be visible on clients that do not yet implement encryption": "Зашифрованные сообщения не будут видны в клиентах, еще не поддерживающих сквозное шифрование", "Encrypted room": "Зашифрованная комната", @@ -47,7 +47,7 @@ "End-to-end encryption is in beta and may not be reliable": "Сквозное шифрование сейчас в бета-тестировании и может не работать", "Error": "Ошибка", "Event information": "Информация о событии", - "Export E2E room keys": "Экспорт ключей сквозного шифрования", + "Export E2E room keys": "Экспорт ключей шифрования", "Failed to change password. Is your password correct?": "Не удалось сменить пароль. Вы правильно ввели текущий пароль?", "Failed to leave room": "Не удалось выйти из комнаты", "Failed to reject invitation": "Не удалось отклонить приглашение", @@ -64,9 +64,9 @@ "Historical": "Архив", "Homeserver is": "Домашний сервер это", "Identity Server is": "Сервер идентификации это", - "I have verified my email address": "Я подтвердил свой адрес email", - "Import E2E room keys": "Импорт ключей сквозного шифрования", - "Invalid Email Address": "Недопустимый адрес email", + "I have verified my email address": "Я подтвердил свой email", + "Import E2E room keys": "Импорт ключей шифрования", + "Invalid Email Address": "Недопустимый email", "Invite new room members": "Пригласить в комнату новых участников", "Invites": "Приглашения", "Invites user with given id to current room": "Приглашает пользователя с заданным ID в текущую комнату", @@ -103,9 +103,9 @@ "Settings": "Настройки", "Start a chat": "Начать разговор", "Start Chat": "Начать разговор", - "Unable to add email address": "Не удается добавить адрес email", + "Unable to add email address": "Не удается добавить email", "Unable to remove contact information": "Не удалось удалить контактную информацию", - "Unable to verify email address.": "Не удалось проверить адрес email.", + "Unable to verify email address.": "Не удалось проверить email.", "Unban": "Разблокировать", "Unencrypted room": "Нешифрованная комната", "unencrypted": "без шифрования", @@ -159,7 +159,7 @@ "Failed to lookup current room": "Не удалось найти текущую комнату", "Failed to send request.": "Не удалось отправить запрос.", "Failed to set up conference call": "Не удалось сделать конференц-звонок", - "Failed to verify email address: make sure you clicked the link in the email": "Не удалось проверить email-адрес: убедитесь, что вы перешли по ссылке в письме", + "Failed to verify email address: make sure you clicked the link in the email": "Не удалось проверить email: убедитесь, что вы перешли по ссылке в письме", "Failure to create room": "Не удалось создать комнату", "%(userId)s from %(fromPowerLevel)s to %(toPowerLevel)s": "для %(userId)s с %(fromPowerLevel)s на %(toPowerLevel)s", "click to reveal": "нажмите для открытия", @@ -185,7 +185,7 @@ "Set a display name:": "Введите отображаемое имя:", "Passwords don't match.": "Пароли не совпадают.", "Password too short (min %(MIN_PASSWORD_LENGTH)s).": "Пароль слишком короткий (мин. %(MIN_PASSWORD_LENGTH)s).", - "This doesn't look like a valid email address.": "Это не похоже на допустимый адрес email.", + "This doesn't look like a valid email address.": "Это не похоже на допустимый email.", "This server does not support authentication with a phone number.": "Этот сервер не поддерживает аутентификацию с помощью номера телефона.", "User names may only contain letters, numbers, dots, hyphens and underscores.": "Имена пользователей могут содержать только буквы, цифры, точки, дефисы и символы подчеркивания.", "An unknown error occurred.": "Произошла неизвестная ошибка.", @@ -224,7 +224,7 @@ "Thu": "Чт", "Fri": "Пт", "Sat": "Сб", - "Your email address does not appear to be associated with a Matrix ID on this Homeserver.": "Ваш email-адрес не связан ни с одним пользователем на этом сервере.", + "Your email address does not appear to be associated with a Matrix ID on this Homeserver.": "Ваш email не связан ни с одним пользователем на этом сервере.", "To use it, just wait for autocomplete results to load and tab through them.": "Чтобы воспользоваться этой функцией, дождитесь загрузки результатов в окне автодополнения, а затем используйте Tab для прокрутки.", "%(senderName)s turned on end-to-end encryption (algorithm %(algorithm)s).": "%(senderName)s включил(а) в комнате сквозное шифрование (алгоритм %(algorithm)s).", "%(senderName)s unbanned %(targetName)s.": "%(senderName)s разблокировал(а) %(targetName)s.", @@ -337,7 +337,7 @@ "Success": "Успех", "The default role for new room members is": "Права по умолчанию для новых участников комнаты", "The main address for this room is": "Основной адрес этой комнаты", - "This email address is already in use": "Этот email-адрес уже используется", + "This email address is already in use": "Этот email уже используется", "This email address was not found": "Этот адрес электронной почты не найден", "The email address linked to your account must be entered.": "Необходимо ввести адрес электронной почты, связанный с вашей учетной записью.", "The file '%(fileName)s' failed to upload": "Не удалось отправить файл '%(fileName)s'", @@ -404,8 +404,8 @@ "Device ID:": "ID устройства:", "device id: ": "ID устройства: ", "Device key:": "Ключ устройства:", - "Email address": "Email-адрес", - "Email address (optional)": "Email-адрес (необязательно)", + "Email address": "Email", + "Email address (optional)": "Email (необязательно)", "Error decrypting attachment": "Ошибка расшифровки вложения", "Export": "Экспорт", "Failed to set avatar.": "Не удалось установить аватар.", @@ -510,11 +510,11 @@ "Sign in with CAS": "Войти с помощью CAS", "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.": "Вы можете войти на другой сервер Matrix, указав его URL-адрес.", "This allows you to use this app with an existing Matrix account on a different home server.": "Это позволяет использовать приложение с учетной записью Matrix на другом сервере.", - "You can also set a custom identity server but this will typically prevent interaction with users based on email address.": "Кроме того, можно выбрать другой сервер идентификации, однако в таком случае вы, скорее всего, не сможете взаимодействовать с пользователями посредством их email-адресов.", + "You can also set a custom identity server but this will typically prevent interaction with users based on email address.": "Кроме того, можно выбрать другой сервер идентификации, однако в таком случае вы, скорее всего, не сможете взаимодействовать с пользователями посредством их emailов.", "Please check your email to continue registration.": "Чтобы продолжить регистрацию, проверьте электронную почту.", "Token incorrect": "Неверный код проверки", "Please enter the code it contains:": "Введите полученный код:", - "If you don't specify an email address, you won't be able to reset your password. Are you sure?": "Если не указать email-адрес, вы не сможете при необходимости сбросить свой пароль. Уверены?", + "If you don't specify an email address, you won't be able to reset your password. Are you sure?": "Если не указать email, вы не сможете при необходимости сбросить свой пароль. Уверены?", "You are registering with %(SelectedTeamName)s": "Вы регистрируетесь в %(SelectedTeamName)s", "Default server": "Сервер по умолчанию", "Custom server": "Другой сервер", @@ -603,7 +603,7 @@ "Seen by %(userName)s at %(dateTime)s": "Прочитано %(userName)s в %(dateTime)s", "Send anyway": "Отправить в любом случае", "Show Text Formatting Toolbar": "Показать инструменты форматирования текста", - "This invitation was sent to an email address which is not associated with this account:": "Это приглашение было отправлено на email-адрес, не связанный с вашей учетной записью:", + "This invitation was sent to an email address which is not associated with this account:": "Это приглашение было отправлено на email, не связанный с вашей учетной записью:", "To link to a room it must have an address.": "Чтобы иметь возможность ссылаться на комнату, ей нужно присвоить адрес.", "Unable to ascertain that the address this invite was sent to matches one associated with your account.": "Не удалось установить, что адрес в этом приглашении соответствует вашей учетной записи.", "Undecryptable": "Невозможно расшифровать", @@ -619,7 +619,7 @@ "Can't connect to homeserver - please check your connectivity, ensure your homeserver's SSL certificate is trusted, and that a browser extension is not blocking requests.": "Не удается подключиться к домашнему серверу - проверьте подключение, убедитесь, что ваш SSL-сертификат домашнего сервера является доверенным и что расширение браузера не блокирует запросы.", "You have been banned from %(roomName)s by %(userName)s.": "%(userName)s заблокировал(а) вас в %(roomName)s.", "You have been kicked from %(roomName)s by %(userName)s.": "%(userName)s выгнал(а) вас из %(roomName)s.", - "You may wish to login with a different account, or add this email to this account.": "При желании вы можете войти в систему под другим именем или привязать этот email-адрес к вашей учетной записи.", + "You may wish to login with a different account, or add this email to this account.": "При желании вы можете войти в систему под другим именем или привязать этот email к вашей учетной записи.", "Your home server does not support device management.": "Ваш сервер не поддерживает управление устройствами.", "(could not connect media)": "(сбой подключения)", "(no answer)": "(нет ответа)", @@ -628,7 +628,7 @@ "Not a valid Riot keyfile": "Недействительный файл ключей Riot", "Your browser does not support the required cryptography extensions": "Ваш браузер не поддерживает требуемые криптографические расширения", "Authentication check failed: incorrect password?": "Ошибка аутентификации: возможно, неправильный пароль?", - "Do you want to set an email address?": "Хотите указать email-адрес?", + "Do you want to set an email address?": "Хотите указать email?", "This will allow you to reset your password and receive notifications.": "Это позволит при необходимости сбросить пароль и получать уведомления.", "Press to start a chat with someone": "Нажмите , чтобы начать разговор с кем-либо", "You're not in any rooms yet! Press to make a room or to browse the directory": "Вы еще не вошли ни в одну из комнат! Нажмите , чтобы создать комнату, или , чтобы посмотреть каталог комнат", @@ -745,7 +745,7 @@ "Failed to add the following rooms to %(groupId)s:": "Не удалось добавить эти комнаты в %(groupId)s:", "Matrix ID": "Matrix ID", "Matrix Room ID": "Matrix ID комнаты", - "email address": "адрес email", + "email address": "email", "Try using one of the following valid address types: %(validTypesList)s.": "Попробуйте использовать один из следующих допустимых типов адресов: %(validTypesList)s.", "You have entered an invalid address.": "Введен неправильный адрес.", "Unpin Message": "Открепить сообщение", @@ -953,7 +953,7 @@ "Send a message (unencrypted)…": "Отправить сообщение (нешифрованное)…", "Replying": "Отвечает", "Minimize apps": "Свернуть приложения", - "Privacy is important to us, so we don't collect any personal or identifiable data for our analytics.": "Конфиденциальность важна для нас, поэтому мы не собираем никаких личных или идентифицируемых данных для нашей аналитики.", + "Privacy is important to us, so we don't collect any personal or identifiable data for our analytics.": "Конфиденциальность важна для нас, поэтому мы не собираем никаких личных или идентифицирующих данных для нашей аналитики.", "Learn more about how we use analytics.": "Подробнее о том, как мы используем аналитику.", "The information being sent to us to help make Riot.im better includes:": "Информация, отправляемая нам, чтобы помочь нам сделать Riot.im лучше, включает в себя:", "Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.": "Если на этой странице встречаются сведения личного характера, например имя комнаты, имя пользователя или группы, они удаляются перед отправкой на сервер.", @@ -1017,7 +1017,7 @@ "Friday": "Пятница", "Update": "Обновить", "What's New": "Что изменилось", - "Add an email address above to configure email notifications": "Добавьте email-адрес выше для настройки email-уведомлений", + "Add an email address above to configure email notifications": "Добавьте email выше для настройки уведомлений", "Expand panel": "Развернуть панель", "On": "Включить", "%(count)s Members|other": "%(count)s членов", @@ -1073,7 +1073,7 @@ "Tuesday": "Вторник", "Enter keywords separated by a comma:": "Введите ключевые слова, разделенные запятой:", "Search…": "Поиск…", - "You have successfully set a password and an email address!": "Вы успешно установили пароль и адрес email!", + "You have successfully set a password and an email address!": "Вы успешно установили пароль и email!", "Remove %(name)s from the directory?": "Удалить %(name)s из каталога?", "Riot uses many advanced browser features, some of which are not available or experimental in your current browser.": "Riot использует многие передовые возможности браузера, некоторые из которых недоступны или являются экспериментальным в вашем текущем браузере.", "Developer Tools": "Инструменты разработчика", @@ -1082,7 +1082,7 @@ "Explore Account Data": "Просмотр данных аккаунта", "All messages (noisy)": "Все сообщения (со звуком)", "Saturday": "Суббота", - "Remember, you can always set an email address in user settings if you change your mind.": "Помните, что вы всегда сможете задать адрес email в настройках пользователя, если передумаете.", + "Remember, you can always set an email address in user settings if you change your mind.": "Помните, что вы всегда сможете задать email в настройках пользователя, если передумаете.", "Direct Chat": "Прямой чат", "The server may be unavailable or overloaded": "Сервер, вероятно, недоступен или перегружен", "Reject": "Отклонить", @@ -1141,7 +1141,7 @@ "Mentions only": "Только при упоминаниях", "Wednesday": "Среда", "You can now return to your account after signing out, and sign in on other devices.": "Теперь вы сможете вернуться к своей учетной записи после выхода из системы и войти на других устройствах.", - "Enable email notifications": "Включить уведомления по email", + "Enable email notifications": "Включить уведомления на email", "Event Type": "Тип мероприятия", "Download this file": "Скачать файл", "Pin Message": "Закрепить сообщение", From 40e9091724d0cfb41823db2b180f95a41d1bfc54 Mon Sep 17 00:00:00 2001 From: Szimszon Date: Fri, 18 May 2018 09:46:58 +0000 Subject: [PATCH 045/702] Translated using Weblate (Hungarian) Currently translated at 99.7% (1172 of 1175 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/hu/ --- src/i18n/strings/hu.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/hu.json b/src/i18n/strings/hu.json index b7d0561c34..c27f76737f 100644 --- a/src/i18n/strings/hu.json +++ b/src/i18n/strings/hu.json @@ -1177,5 +1177,6 @@ "At this time it is not possible to reply with an emote.": "Jelenleg nem lehet emodzsival válaszolni.", "Unable to load event that was replied to, it either does not exist or you do not have permission to view it.": "Nem lehet betölteni azt az eseményt amire válaszoltál, mert vagy nem létezik, vagy nincs jogod megnézni.", "Collapse Reply Thread": "Beszélgetés szál becsukása", - "Enable widget screenshots on supported widgets": "Ahol az a kisalkalmazásban támogatott ott képernyőkép készítés engedélyezése" + "Enable widget screenshots on supported widgets": "Ahol az a kisalkalmazásban támogatott ott képernyőkép készítés engedélyezése", + "Send analytics data": "Analitikai adatok küldése" } From 23ea8ca91743241d67ca7257e667597d762f5eee Mon Sep 17 00:00:00 2001 From: Szimszon Date: Fri, 18 May 2018 09:51:16 +0000 Subject: [PATCH 046/702] Translated using Weblate (Hungarian) Currently translated at 100.0% (1175 of 1175 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/hu/ --- src/i18n/strings/hu.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/hu.json b/src/i18n/strings/hu.json index c27f76737f..096989f514 100644 --- a/src/i18n/strings/hu.json +++ b/src/i18n/strings/hu.json @@ -1178,5 +1178,8 @@ "Unable to load event that was replied to, it either does not exist or you do not have permission to view it.": "Nem lehet betölteni azt az eseményt amire válaszoltál, mert vagy nem létezik, vagy nincs jogod megnézni.", "Collapse Reply Thread": "Beszélgetés szál becsukása", "Enable widget screenshots on supported widgets": "Ahol az a kisalkalmazásban támogatott ott képernyőkép készítés engedélyezése", - "Send analytics data": "Analitikai adatok küldése" + "Send analytics data": "Analitikai adatok küldése", + "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Szeretnél segíteni a Riot javításában analitikai adatok elküldésével? Ez sütit (cookie) használ. (Nézd meg a sütikről és titoktartási irányelvekről szóló leírást).", + "Help improve Riot by sending usage data? This will use a cookie.": "Szeretnél segíteni a Riot javításában analitikai adatok elküldésével? Ez sütit (cookie) használ.", + "Yes please": "Igen, kérlek" } From 6699c4faed2cb5e9bf43afecfac8b34f86b20a52 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 18 May 2018 11:29:30 +0100 Subject: [PATCH 047/702] Spelling/grammar --- res/css/views/messages/_MImageBody.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/css/views/messages/_MImageBody.scss b/res/css/views/messages/_MImageBody.scss index 9667337f5a..5eef236b26 100644 --- a/res/css/views/messages/_MImageBody.scss +++ b/res/css/views/messages/_MImageBody.scss @@ -29,7 +29,7 @@ limitations under the License. .mx_MImageBody_thumbnail_container { // Prevent the padding-bottom (added inline in MImageBody.js) from - // effecting elements below the container. + // affecting elements below the container. overflow: hidden; // Make sure the _thumbnail is positioned relative to the _container From 015093b371074c1318fa140c166585c4c68b6778 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 18 May 2018 11:33:33 +0100 Subject: [PATCH 048/702] Move inline style to stylesheet --- res/css/views/messages/_MImageBody.scss | 10 ++++++++++ src/components/views/messages/MImageBody.js | 10 ++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/res/css/views/messages/_MImageBody.scss b/res/css/views/messages/_MImageBody.scss index 5eef236b26..64821434dd 100644 --- a/res/css/views/messages/_MImageBody.scss +++ b/res/css/views/messages/_MImageBody.scss @@ -35,3 +35,13 @@ limitations under the License. // Make sure the _thumbnail is positioned relative to the _container position: relative; } + +.mx_MImageBody_thumbnail_spinner { + display: flex; + align-items: center; + width: 100%; +} + +.mx_MImageBody_thumbnail_spinner img { + margin: auto; +} diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index 656bd02840..d9108a2fe1 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -239,14 +239,8 @@ export default class extends React.Component { let img = null; // e2e image hasn't been decrypted yet if (content.file !== undefined && this.state.decryptedUrl === null) { - img =
    - {content.body} + img =
    + {content.body}
    ; } else if (thumbUrl && !this.state.imgError) { // Restrict the width of the thumbnail here, otherwise it will fill the container From f79a8f5a5342aa7e2a23bb62caaad21d3fb054af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20C?= Date: Fri, 18 May 2018 12:37:28 +0000 Subject: [PATCH 049/702] Translated using Weblate (French) Currently translated at 100.0% (1175 of 1175 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/fr/ --- src/i18n/strings/fr.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/fr.json b/src/i18n/strings/fr.json index 4ff8900965..c9d8fcae69 100644 --- a/src/i18n/strings/fr.json +++ b/src/i18n/strings/fr.json @@ -1177,5 +1177,9 @@ "At this time it is not possible to reply with an emote.": "Pour le moment il n'est pas possible de répondre avec un émoji.", "Unable to load event that was replied to, it either does not exist or you do not have permission to view it.": "Impossible de charger l'événement auquel il a été répondu, soit il n'existe pas, soit vous n'avez pas l'autorisation de le voir.", "Collapse Reply Thread": "Dévoiler le fil de réponse", - "Enable widget screenshots on supported widgets": "Activer les captures d'écran des widgets pris en charge" + "Enable widget screenshots on supported widgets": "Activer les captures d'écran des widgets pris en charge", + "Send analytics data": "Envoyer les données analytiques", + "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Aider Riot à s'améliorer en envoyant des données d'utilisation ? Ceci utilisera un cookie. (Voir nos politiques de cookie et de confidentialité).", + "Help improve Riot by sending usage data? This will use a cookie.": "Aider Riot à s'améliorer en envoyant des données d'utilisation ? Ceci utilisera un cookie.", + "Yes please": "Oui, s'il vous plaît" } From b19a9969fe2965e99cfc593eb751fba4d05bd634 Mon Sep 17 00:00:00 2001 From: Klaus Marx Date: Fri, 18 May 2018 10:27:30 +0000 Subject: [PATCH 050/702] Translated using Weblate (German) Currently translated at 99.7% (1172 of 1175 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/de/ --- src/i18n/strings/de_DE.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/de_DE.json b/src/i18n/strings/de_DE.json index 4464940c69..66dc3a7b81 100644 --- a/src/i18n/strings/de_DE.json +++ b/src/i18n/strings/de_DE.json @@ -1177,5 +1177,6 @@ "Clearing your browser's storage may fix the problem, but will sign you out and cause any encrypted chat history to become unreadable.": "Den Browser-Speicher zu löschen kann das Problem lösen, wird dich aber abmelden und verschlüsselte Chats unlesbar machen.", "Collapse Reply Thread": "Antwort-Thread zusammenklappen", "At this time it is not possible to reply with an emote.": "An dieser Stelle ist es nicht möglich mit einer Umschreibung zu antworten.", - "Enable widget screenshots on supported widgets": "Widget-Screenshots bei unterstützten Widgets aktivieren" + "Enable widget screenshots on supported widgets": "Widget-Screenshots bei unterstützten Widgets aktivieren", + "Send analytics data": "Analysedaten senden" } From bd10768c9e6dc2cf99f020f071cb2d4a66044230 Mon Sep 17 00:00:00 2001 From: Krombel Date: Fri, 18 May 2018 13:47:07 +0000 Subject: [PATCH 051/702] Translated using Weblate (German) Currently translated at 100.0% (1175 of 1175 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/de/ --- src/i18n/strings/de_DE.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/i18n/strings/de_DE.json b/src/i18n/strings/de_DE.json index 66dc3a7b81..a8f72e7fa1 100644 --- a/src/i18n/strings/de_DE.json +++ b/src/i18n/strings/de_DE.json @@ -977,7 +977,7 @@ "Did you know: you can use communities to filter your Riot.im experience!": "Wusstest du: Du kannst Communities nutzen um deine Riot.im-Erfahrung zu filtern!", "To set up a filter, drag a community avatar over to the filter panel on the far left hand side of the screen. You can click on an avatar in the filter panel at any time to see only the rooms and people associated with that community.": "Um einen Filter zu setzen, siehe einen Community-Bild auf das Filter-Panel ganz links. Du kannst jederzeit auf einen Avatar im Filter-Panel klicken um nur die Räume und Personen aus der Community zu sehen.", "Clear filter": "Filter zurücksetzen", - "Disable Community Filter Panel": "Deaktivere Community-Filter-Panel", + "Disable Community Filter Panel": "Deaktiviere Community-Filter-Panel", "Your key share request has been sent - please check your other devices for key share requests.": "Deine Schlüssel-Teil-Anfragen wurden gesendet. Bitte prüfe deine anderen Geräte auf die Schlüssel-Teil-Anfragen.", "Key share requests are sent to your other devices automatically. If you rejected or dismissed the key share request on your other devices, click here to request the keys for this session again.": "Schlüssel-Anfragen wurden automatisch zu den anderen Geräten gesendet. Wenn du diese Anfragen auf deinen anderen Geräten abgelehnt oder verpasst hast, klicke hier um die Schlüssel für diese Sitzung erneut anzufragen.", "If your other devices do not have the key for this message you will not be able to decrypt them.": "Wenn deine anderen Geräte keine Schlüssel für diese Nachricht haben, wirst du diese nicht entschlüsseln können.", @@ -1178,5 +1178,8 @@ "Collapse Reply Thread": "Antwort-Thread zusammenklappen", "At this time it is not possible to reply with an emote.": "An dieser Stelle ist es nicht möglich mit einer Umschreibung zu antworten.", "Enable widget screenshots on supported widgets": "Widget-Screenshots bei unterstützten Widgets aktivieren", - "Send analytics data": "Analysedaten senden" + "Send analytics data": "Analysedaten senden", + "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Möchtest du Riot helfen indem du Nutzungsdaten sendest? Dies wird ein Cookie verwenden. (Siehe unsere Datenschutzerklärung).", + "Help improve Riot by sending usage data? This will use a cookie.": "Möchtest du Riot helfen indem du Nutzungsdaten sendest? Dies wird ein Cookie verwenden.", + "Yes please": "Ja, bitte" } From 089ac337f4125c34823709afabd4b9788728e740 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 18 May 2018 15:22:24 +0100 Subject: [PATCH 052/702] remove unused html serializer --- src/components/views/rooms/MessageComposerInput.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 70a9b9bd83..acd7c0fab3 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -145,7 +145,7 @@ export default class MessageComposerInput extends React.Component { this.plainWithIdPills = new PlainWithPillsSerializer({ pillFormat: 'id' }); this.plainWithPlainPills = new PlainWithPillsSerializer({ pillFormat: 'plain' }); this.md = new Md(); - this.html = new Html(); + //this.html = new Html(); // not used atm this.suppressAutoComplete = false; this.direction = ''; From 167742d9008a7588c1c3bf044563db1fcc8e9816 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 19 May 2018 20:28:38 +0100 Subject: [PATCH 053/702] make RTE sending work --- res/css/views/rooms/_MessageComposer.scss | 9 ++ src/RichText.js | 8 - .../views/rooms/MessageComposerInput.js | 137 ++++++++++-------- 3 files changed, 85 insertions(+), 69 deletions(-) diff --git a/res/css/views/rooms/_MessageComposer.scss b/res/css/views/rooms/_MessageComposer.scss index 14f52832f6..72d31cfddd 100644 --- a/res/css/views/rooms/_MessageComposer.scss +++ b/res/css/views/rooms/_MessageComposer.scss @@ -91,6 +91,15 @@ limitations under the License. overflow: auto; } +// FIXME: rather unpleasant hack to get rid of

    margins. +// really we should be mixing in markdown-body from gfm.css instead +.mx_MessageComposer_editor > :first-child { + margin-top: 0 ! important; +} +.mx_MessageComposer_editor > :last-child { + margin-bottom: 0 ! important; +} + @keyframes visualbell { from { background-color: #faa } diff --git a/src/RichText.js b/src/RichText.js index 50ed33d803..e3162a4e2c 100644 --- a/src/RichText.js +++ b/src/RichText.js @@ -61,14 +61,6 @@ export function stateToMarkdown(state) { ''); // this is *not* a zero width space, trust me :) } -export const editorStateToHTML = (editorState: Value) => { - return Html.deserialize(editorState); -} - -export function htmlToEditorState(html: string): Value { - return Html.serialize(html); -} - export function unicodeToEmojiUri(str) { let replaceWith, unicode, alt; if ((!emojione.unicodeAlt) || (emojione.sprites)) { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index acd7c0fab3..ae4d5b6264 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -145,7 +145,26 @@ export default class MessageComposerInput extends React.Component { this.plainWithIdPills = new PlainWithPillsSerializer({ pillFormat: 'id' }); this.plainWithPlainPills = new PlainWithPillsSerializer({ pillFormat: 'plain' }); this.md = new Md(); - //this.html = new Html(); // not used atm + this.html = new Html({ + rules: [ + { + serialize: (obj, children) => { + if (obj.object === 'block' || obj.object === 'inline') { + return this.renderNode({ + node: obj, + children: children, + }); + } + else if (obj.object === 'mark') { + return this.renderMark({ + mark: obj, + children: children, + }); + } + } + } + ] + }); this.suppressAutoComplete = false; this.direction = ''; @@ -397,27 +416,29 @@ export default class MessageComposerInput extends React.Component { editorState = EditorState.forceSelection(editorState, currentSelection); } */ - const text = editorState.startText.text; - const currentStartOffset = editorState.startOffset; + if (editorState.startText !== null) { + const text = editorState.startText.text; + const currentStartOffset = editorState.startOffset; - // Automatic replacement of plaintext emoji to Unicode emoji - if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) { - // The first matched group includes just the matched plaintext emoji - const emojiMatch = REGEX_EMOJI_WHITESPACE.exec(text.slice(0, currentStartOffset)); - if (emojiMatch) { - // plaintext -> hex unicode - const emojiUc = asciiList[emojiMatch[1]]; - // hex unicode -> shortname -> actual unicode - const unicodeEmoji = shortnameToUnicode(EMOJI_UNICODE_TO_SHORTNAME[emojiUc]); + // Automatic replacement of plaintext emoji to Unicode emoji + if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) { + // The first matched group includes just the matched plaintext emoji + const emojiMatch = REGEX_EMOJI_WHITESPACE.exec(text.slice(0, currentStartOffset)); + if (emojiMatch) { + // plaintext -> hex unicode + const emojiUc = asciiList[emojiMatch[1]]; + // hex unicode -> shortname -> actual unicode + const unicodeEmoji = shortnameToUnicode(EMOJI_UNICODE_TO_SHORTNAME[emojiUc]); - const range = Range.create({ - anchorKey: editorState.selection.startKey, - anchorOffset: currentStartOffset - emojiMatch[1].length - 1, - focusKey: editorState.selection.startKey, - focusOffset: currentStartOffset, - }); - change = change.insertTextAtRange(range, unicodeEmoji); - editorState = change.value; + const range = Range.create({ + anchorKey: editorState.selection.startKey, + anchorOffset: currentStartOffset - emojiMatch[1].length - 1, + focusKey: editorState.selection.startKey, + focusOffset: currentStartOffset, + }); + change = change.insertTextAtRange(range, unicodeEmoji); + editorState = change.value; + } } } @@ -444,13 +465,15 @@ export default class MessageComposerInput extends React.Component { let editorState = null; if (enabled) { + // for simplicity when roundtripping, we use slate-md-serializer rather than commonmark + editorState = this.md.deserialize(this.plainWithMdPills.serialize(this.state.editorState)); + + // the alternative would be something like: + // // const sourceWithPills = this.plainWithMdPills.serialize(this.state.editorState); // const markdown = new Markdown(sourceWithPills); // editorState = this.html.deserialize(markdown.toHTML()); - // we don't really want a custom MD parser hanging around, but the - // alternative would be: - editorState = this.md.deserialize(this.plainWithMdPills.serialize(this.state.editorState)); } else { // let markdown = RichText.stateToMarkdown(this.state.editorState.getCurrentContent()); // value = ContentState.createFromText(markdown); @@ -547,6 +570,8 @@ export default class MessageComposerInput extends React.Component { let newState: ?Value = null; + const DEFAULT_NODE = 'paragraph'; + // Draft handles rich text mode commands by default but we need to do it ourselves for Markdown. if (this.state.isRichtextEnabled) { const type = command; @@ -725,11 +750,14 @@ export default class MessageComposerInput extends React.Component { */ handleReturn = (ev) => { if (ev.shiftKey) { + // FIXME: we should insert a
    equivalent rather than letting Slate + // split the current block, otherwise

    will be split into two paragraphs + // and it'll look like a double line-break. return; } if (this.state.editorState.blocks.some( - block => block in ['code-block', 'block-quote', 'bulleted-list', 'numbered-list'] + block => ['code-block', 'block-quote', 'list-item'].includes(block.type) )) { // allow the user to terminate blocks by hitting return rather than sending a msg return; @@ -788,47 +816,25 @@ export default class MessageComposerInput extends React.Component { const mustSendHTML = Boolean(replyingToEv); if (this.state.isRichtextEnabled) { -/* // We should only send HTML if any block is styled or contains inline style let shouldSendHTML = false; if (mustSendHTML) shouldSendHTML = true; - const blocks = contentState.getBlocksAsArray(); - if (blocks.some((block) => block.getType() !== 'unstyled')) { - shouldSendHTML = true; - } else { - const characterLists = blocks.map((block) => block.getCharacterList()); - // For each block of characters, determine if any inline styles are applied - // and if yes, send HTML - characterLists.forEach((characters) => { - const numberOfStylesForCharacters = characters.map( - (character) => character.getStyle().toArray().length, - ).toArray(); - // If any character has more than 0 inline styles applied, send HTML - if (numberOfStylesForCharacters.some((styles) => styles > 0)) { - shouldSendHTML = true; - } - }); - } if (!shouldSendHTML) { - const hasLink = blocks.some((block) => { - return block.getCharacterList().filter((c) => { - const entityKey = c.getEntity(); - return entityKey && contentState.getEntity(entityKey).getType() === 'LINK'; - }).size > 0; + shouldSendHTML = !!editorState.document.findDescendant(node => { + // N.B. node.getMarks() might be private? + return ((node.object === 'block' && node.type !== 'line') || + (node.object === 'inline') || + (node.object === 'text' && node.getMarks().size > 0)); }); - shouldSendHTML = hasLink; } -*/ + contentText = this.plainWithPlainPills.serialize(editorState); if (contentText === '') return true; - let shouldSendHTML = true; if (shouldSendHTML) { - contentHTML = HtmlUtils.processHtmlForSending( - RichText.editorStateToHTML(editorState), - ); + contentHTML = this.html.serialize(editorState); // HtmlUtils.processHtmlForSending(); } } else { const sourceWithPills = this.plainWithMdPills.serialize(editorState); @@ -1047,7 +1053,7 @@ export default class MessageComposerInput extends React.Component { marks: editorState.activeMarks, // XXX: shouldn't we return all the types of blocks in the current selection, // not just the anchor? - blockType: editorState.anchorBlock.type, + blockType: editorState.anchorBlock ? editorState.anchorBlock.type : null, }; } @@ -1121,6 +1127,10 @@ export default class MessageComposerInput extends React.Component { const { attributes, children, node, isSelected } = props; switch (node.type) { + case 'line': + // ideally we'd return { children }
    , but as this isn't + // a valid react component, we don't have much choice. + return

    {children}
    ; case 'paragraph': return

    {children}

    ; case 'block-quote': @@ -1138,7 +1148,7 @@ export default class MessageComposerInput extends React.Component { case 'numbered-list': return
      {children}
    ; case 'code-block': - return

    {children}

    ; + return
    {children}
    ; case 'pill': { const { data } = node; const url = data.get('url'); @@ -1187,15 +1197,15 @@ export default class MessageComposerInput extends React.Component { const { children, mark, attributes } = props; switch (mark.type) { case 'bold': - return {children}; + return {children}; case 'italic': - return {children}; + return {children}; case 'code': - return {children}; + return {children}; case 'underline': - return {children}; + return {children}; case 'strikethrough': - return {children}; + return {children}; } }; @@ -1219,7 +1229,12 @@ export default class MessageComposerInput extends React.Component { // This avoids us having to serialize the whole thing to plaintext and convert // selection offsets in & out of the plaintext domain. - return editorState.document.getDescendant(editorState.selection.anchorKey).text; + if (editorState.selection.anchorKey) { + return editorState.document.getDescendant(editorState.selection.anchorKey).text; + } + else { + return ''; + } } getSelectionRange(editorState: Value) { From a4d9338cf0d63fa6f637a96bbb52694f97bd791a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 19 May 2018 20:38:07 +0100 Subject: [PATCH 054/702] let backspace delete list nodes in RTE --- .../views/rooms/MessageComposerInput.js | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index ae4d5b6264..ab104f825a 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -77,6 +77,10 @@ const ENTITY_TYPES = { AT_ROOM_PILL: 'ATROOMPILL', }; +// the Slate node type to default to for unstyled text when in RTE mode. +// (we use 'line' for oneliners however) +const DEFAULT_NODE = 'paragraph'; + function onSendMessageFailed(err, room) { // XXX: temporary logging to try to diagnose @@ -152,13 +156,13 @@ export default class MessageComposerInput extends React.Component { if (obj.object === 'block' || obj.object === 'inline') { return this.renderNode({ node: obj, - children: children, + children: children, }); } else if (obj.object === 'mark') { return this.renderMark({ mark: obj, - children: children, + children: children, }); } } @@ -548,6 +552,8 @@ export default class MessageComposerInput extends React.Component { switch (ev.keyCode) { case KeyCode.ENTER: return this.handleReturn(ev); + case KeyCode.BACKSPACE: + return this.onBackspace(ev); case KeyCode.UP: return this.onVerticalArrow(ev, true); case KeyCode.DOWN: @@ -562,6 +568,23 @@ export default class MessageComposerInput extends React.Component { } }; + onBackspace = (ev: Event): boolean => { + if (this.state.isRichtextEnabled) { + // let backspace exit lists + const isList = this.hasBlock('list-item'); + if (isList) { + const change = this.state.editorState.change(); + change + .setBlocks(DEFAULT_NODE) + .unwrapBlock('bulleted-list') + .unwrapBlock('numbered-list'); + this.onChange(change); + return true; + } + } + return; + }; + handleKeyCommand = (command: string): boolean => { if (command === 'toggle-mode') { this.enableRichtext(!this.state.isRichtextEnabled); @@ -570,8 +593,6 @@ export default class MessageComposerInput extends React.Component { let newState: ?Value = null; - const DEFAULT_NODE = 'paragraph'; - // Draft handles rich text mode commands by default but we need to do it ourselves for Markdown. if (this.state.isRichtextEnabled) { const type = command; From 58670cc3e54114c00f5bccf43d21440e5c3ceec8 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 19 May 2018 21:14:39 +0100 Subject: [PATCH 055/702] exit list more sanely on backspace --- src/components/views/rooms/MessageComposerInput.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index ab104f825a..6eadbae5ec 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -572,8 +572,9 @@ export default class MessageComposerInput extends React.Component { if (this.state.isRichtextEnabled) { // let backspace exit lists const isList = this.hasBlock('list-item'); - if (isList) { - const change = this.state.editorState.change(); + const { editorState } = this.state; + if (isList && editorState.anchorOffset == 0) { + const change = editorState.change(); change .setBlocks(DEFAULT_NODE) .unwrapBlock('bulleted-list') From d426c3474f2b5703b5c1f69b5ae1313a791c8a6d Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 19 May 2018 21:36:22 +0100 Subject: [PATCH 056/702] fix strikethough & code, improve shift-return & backspace --- .../views/rooms/MessageComposerInput.js | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 6eadbae5ec..d7884e3c83 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -551,9 +551,9 @@ export default class MessageComposerInput extends React.Component { switch (ev.keyCode) { case KeyCode.ENTER: - return this.handleReturn(ev); + return this.handleReturn(ev, change); case KeyCode.BACKSPACE: - return this.onBackspace(ev); + return this.onBackspace(ev, change); case KeyCode.UP: return this.onVerticalArrow(ev, true); case KeyCode.DOWN: @@ -568,19 +568,27 @@ export default class MessageComposerInput extends React.Component { } }; - onBackspace = (ev: Event): boolean => { + onBackspace = (ev: Event, change: Change): Change => { if (this.state.isRichtextEnabled) { // let backspace exit lists const isList = this.hasBlock('list-item'); const { editorState } = this.state; + if (isList && editorState.anchorOffset == 0) { - const change = editorState.change(); change .setBlocks(DEFAULT_NODE) .unwrapBlock('bulleted-list') .unwrapBlock('numbered-list'); - this.onChange(change); - return true; + return change; + } + else if (editorState.anchorOffset == 0 && + (this.hasBlock('block-quote') || + this.hasBlock('heading-one') || + this.hasBlock('heading-two') || + this.hasBlock('heading-three') || + this.hasBlock('code-block'))) + { + return change.setBlocks(DEFAULT_NODE); } } return; @@ -770,12 +778,13 @@ export default class MessageComposerInput extends React.Component { return true; }; */ - handleReturn = (ev) => { + handleReturn = (ev, change) => { if (ev.shiftKey) { + // FIXME: we should insert a
    equivalent rather than letting Slate // split the current block, otherwise

    will be split into two paragraphs // and it'll look like a double line-break. - return; + return change.insertText('\n'); } if (this.state.editorState.blocks.some( @@ -1235,11 +1244,11 @@ export default class MessageComposerInput extends React.Component { e.preventDefault(); // don't steal focus from the editor! const command = { - code: 'code-block', + // code: 'code-block', // let's have the button do inline code for now quote: 'block-quote', bullet: 'bulleted-list', numbullet: 'numbered-list', - strike: 'strike-through', + strike: 'strikethrough', }[name] || name; this.handleKeyCommand(command); }; From 1536ab433acf2ad5bed2eff14e9e9e8534fc2433 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 19 May 2018 22:05:31 +0100 Subject: [PATCH 057/702] make file pasting work again --- .../views/rooms/MessageComposerInput.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index d7884e3c83..c783a7dd7f 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -20,6 +20,7 @@ import PropTypes from 'prop-types'; import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent'; import { Editor } from 'slate-react'; +import { getEventTransfer } from 'slate-react'; import { Value, Document, Event, Inline, Text, Range, Node } from 'slate'; import Html from 'slate-html-serializer'; @@ -755,6 +756,18 @@ export default class MessageComposerInput extends React.Component { } return false; }; + + onPaste = (event: Event, change: Change, editor: Editor): Change => { + const transfer = getEventTransfer(event); + + if (transfer.type === "files") { + return this.props.onFilesPasted(transfer.files); + } + if (transfer.type === "html") { + + } + }; + /* onTextPasted = (text: string, html?: string) => { const currentSelection = this.state.editorState.getSelection(); @@ -1331,14 +1344,10 @@ export default class MessageComposerInput extends React.Component { value={this.state.editorState} onChange={this.onChange} onKeyDown={this.onKeyDown} + onPaste={this.onPaste} renderNode={this.renderNode} renderMark={this.renderMark} spellCheck={true} - /* - handlePastedText={this.onTextPasted} - handlePastedFiles={this.props.onFilesPasted} - stripPastedStyles={!this.state.isRichtextEnabled} - */ />

    From 1f05aea884de58efda88c9c3327e8a4e4a06d594 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 19 May 2018 23:33:07 +0100 Subject: [PATCH 058/702] make HTML pasting work --- .../views/rooms/MessageComposerInput.js | 78 +++++++++++++------ 1 file changed, 53 insertions(+), 25 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index c783a7dd7f..6c178ce078 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -82,6 +82,32 @@ const ENTITY_TYPES = { // (we use 'line' for oneliners however) const DEFAULT_NODE = 'paragraph'; +// map HTML elements through to our Slate schema node types +// used for the HTML deserializer. +// (We don't use the same names so that they are closer to the MD serializer's schema) +const BLOCK_TAGS = { + p: 'paragraph', + blockquote: 'block-quote', + ul: 'bulleted-list', + h1: 'heading-one', + h2: 'heading-two', + h3: 'heading-three', + li: 'list-item', + ol: 'numbered-list', + pre: 'code-block', +}; + +const MARK_TAGS = { + strong: 'bold', + b: 'bold', // deprecated + em: 'italic', + i: 'italic', // deprecated + code: 'code', + u: 'underline', + del: 'strikethrough', + strike: 'strikethrough', // deprecated + s: 'strikethrough', // deprecated +}; function onSendMessageFailed(err, room) { // XXX: temporary logging to try to diagnose @@ -153,6 +179,25 @@ export default class MessageComposerInput extends React.Component { this.html = new Html({ rules: [ { + deserialize: (el, next) => { + const tag = el.tagName.toLowerCase(); + let type = BLOCK_TAGS[tag]; + if (type) { + return { + object: 'block', + type: type, + nodes: next(el.childNodes), + } + } + type = MARK_TAGS[tag]; + if (type) { + return { + object: 'mark', + type: type, + nodes: next(el.childNodes), + } + } + }, serialize: (obj, children) => { if (obj.object === 'block' || obj.object === 'inline') { return this.renderNode({ @@ -763,34 +808,17 @@ export default class MessageComposerInput extends React.Component { if (transfer.type === "files") { return this.props.onFilesPasted(transfer.files); } - if (transfer.type === "html") { - + else if (transfer.type === "html") { + const fragment = this.html.deserialize(transfer.html); + if (this.state.isRichtextEnabled) { + return change.insertFragment(fragment.document); + } + else { + return change.insertText(this.md.serialize(fragment)); + } } }; -/* - onTextPasted = (text: string, html?: string) => { - const currentSelection = this.state.editorState.getSelection(); - const currentContent = this.state.editorState.getCurrentContent(); - - let contentState = null; - if (html && this.state.isRichtextEnabled) { - contentState = Modifier.replaceWithFragment( - currentContent, - currentSelection, - RichText.htmlToContentState(html).getBlockMap(), - ); - } else { - contentState = Modifier.replaceText(currentContent, currentSelection, text); - } - - let newEditorState = EditorState.push(this.state.editorState, contentState, 'insert-characters'); - - newEditorState = EditorState.forceSelection(newEditorState, contentState.getSelectionAfter()); - this.onEditorContentChanged(newEditorState); - return true; - }; -*/ handleReturn = (ev, change) => { if (ev.shiftKey) { From 572a31334fa87b6c1fc8e1b39962f0a6f823b06e Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 19 May 2018 23:34:30 +0100 Subject: [PATCH 059/702] add h4, h5 and h6 --- .../views/rooms/MessageComposerInput.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 6c178ce078..30461ca816 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -92,6 +92,9 @@ const BLOCK_TAGS = { h1: 'heading-one', h2: 'heading-two', h3: 'heading-three', + h4: 'heading-four, + h5: 'heading-five', + h6: 'heading-six', li: 'list-item', ol: 'numbered-list', pre: 'code-block', @@ -632,6 +635,9 @@ export default class MessageComposerInput extends React.Component { this.hasBlock('heading-one') || this.hasBlock('heading-two') || this.hasBlock('heading-three') || + this.hasBlock('heading-four') || + this.hasBlock('heading-five') || + this.hasBlock('heading-six') || this.hasBlock('code-block'))) { return change.setBlocks(DEFAULT_NODE); @@ -687,6 +693,9 @@ export default class MessageComposerInput extends React.Component { case 'heading-one': case 'heading-two': case 'heading-three': + case 'heading-four': + case 'heading-five': + case 'heading-six': case 'list-item': case 'code-block': { const isActive = this.hasBlock(type); @@ -1215,6 +1224,12 @@ export default class MessageComposerInput extends React.Component { return

    {children}

    ; case 'heading-three': return

    {children}

    ; + case 'heading-four': + return

    {children}

    ; + case 'heading-five': + return
    {children}
    ; + case 'heading-six': + return
    {children}
    ; case 'list-item': return
  • {children}
  • ; case 'numbered-list': From 65f0b0571902f723fefee82b90a62c47fc73a54c Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 19 May 2018 23:40:22 +0100 Subject: [PATCH 060/702] fix typo --- src/components/views/rooms/MessageComposerInput.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 30461ca816..a426d69918 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -92,7 +92,7 @@ const BLOCK_TAGS = { h1: 'heading-one', h2: 'heading-two', h3: 'heading-three', - h4: 'heading-four, + h4: 'heading-four', h5: 'heading-five', h6: 'heading-six', li: 'list-item', From 117519566e2721fa50e422db26b4baeab603b3bd Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 19 May 2018 23:40:48 +0100 Subject: [PATCH 061/702] remove HRs from H1/H2s --- res/css/views/rooms/_EventTile.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/res/css/views/rooms/_EventTile.scss b/res/css/views/rooms/_EventTile.scss index ce2bf9c8a4..67c8b8b2d8 100644 --- a/res/css/views/rooms/_EventTile.scss +++ b/res/css/views/rooms/_EventTile.scss @@ -443,6 +443,7 @@ limitations under the License. .mx_EventTile_content .markdown-body h2 { font-size: 1.5em; + border-bottom: none ! important; // override GFM } .mx_EventTile_content .markdown-body a { From f2116943c89c3b8ec4b58a270a5b22de7739ff98 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 00:17:11 +0100 Subject: [PATCH 062/702] switch schema to match the MD serializer --- .../views/rooms/MessageComposerInput.js | 80 +++++++++---------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index a426d69918..5126fb2813 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -84,17 +84,17 @@ const DEFAULT_NODE = 'paragraph'; // map HTML elements through to our Slate schema node types // used for the HTML deserializer. -// (We don't use the same names so that they are closer to the MD serializer's schema) +// (The names here are chosen to match the MD serializer's schema for convenience) const BLOCK_TAGS = { p: 'paragraph', blockquote: 'block-quote', ul: 'bulleted-list', - h1: 'heading-one', - h2: 'heading-two', - h3: 'heading-three', - h4: 'heading-four', - h5: 'heading-five', - h6: 'heading-six', + h1: 'heading1', + h2: 'heading2', + h3: 'heading3', + h4: 'heading4', + h5: 'heading5', + h6: 'heading6', li: 'list-item', ol: 'numbered-list', pre: 'code-block', @@ -106,10 +106,10 @@ const MARK_TAGS = { em: 'italic', i: 'italic', // deprecated code: 'code', - u: 'underline', - del: 'strikethrough', - strike: 'strikethrough', // deprecated - s: 'strikethrough', // deprecated + u: 'underlined', + del: 'deleted', + strike: 'deleted', // deprecated + s: 'deleted', // deprecated }; function onSendMessageFailed(err, room) { @@ -513,8 +513,8 @@ export default class MessageComposerInput extends React.Component { enableRichtext(enabled: boolean) { if (enabled === this.state.isRichtextEnabled) return; - // FIXME: this conversion should be handled in the store, surely - // i.e. "convert my current composer value into Rich or MD, as ComposerHistoryManager already does" + // FIXME: this duplicates similar conversions which happen in the history & store. + // they should be factored out. let editorState = null; if (enabled) { @@ -540,6 +540,7 @@ export default class MessageComposerInput extends React.Component { editorState: this.createEditorState(enabled, editorState), isRichtextEnabled: enabled, }); + SettingsStore.setValue("MessageComposerInput.isRichTextEnabled", null, SettingLevel.ACCOUNT, enabled); }; @@ -588,7 +589,7 @@ export default class MessageComposerInput extends React.Component { [KeyCode.KEY_M]: 'toggle-mode', [KeyCode.KEY_B]: 'bold', [KeyCode.KEY_I]: 'italic', - [KeyCode.KEY_U]: 'underline', + [KeyCode.KEY_U]: 'underlined', [KeyCode.KEY_J]: 'code', }[ev.keyCode]; @@ -632,12 +633,12 @@ export default class MessageComposerInput extends React.Component { } else if (editorState.anchorOffset == 0 && (this.hasBlock('block-quote') || - this.hasBlock('heading-one') || - this.hasBlock('heading-two') || - this.hasBlock('heading-three') || - this.hasBlock('heading-four') || - this.hasBlock('heading-five') || - this.hasBlock('heading-six') || + this.hasBlock('heading1') || + this.hasBlock('heading2') || + this.hasBlock('heading3') || + this.hasBlock('heading4') || + this.hasBlock('heading5') || + this.hasBlock('heading6') || this.hasBlock('code-block'))) { return change.setBlocks(DEFAULT_NODE); @@ -690,12 +691,12 @@ export default class MessageComposerInput extends React.Component { // simple blocks case 'paragraph': case 'block-quote': - case 'heading-one': - case 'heading-two': - case 'heading-three': - case 'heading-four': - case 'heading-five': - case 'heading-six': + case 'heading1': + case 'heading2': + case 'heading3': + case 'heading4': + case 'heading5': + case 'heading6': case 'list-item': case 'code-block': { const isActive = this.hasBlock(type); @@ -716,8 +717,8 @@ export default class MessageComposerInput extends React.Component { case 'bold': case 'italic': case 'code': - case 'underline': - case 'strikethrough': { + case 'underlined': + case 'deleted': { change.toggleMark(type); } break; @@ -830,10 +831,6 @@ export default class MessageComposerInput extends React.Component { handleReturn = (ev, change) => { if (ev.shiftKey) { - - // FIXME: we should insert a
    equivalent rather than letting Slate - // split the current block, otherwise

    will be split into two paragraphs - // and it'll look like a double line-break. return change.insertText('\n'); } @@ -1218,17 +1215,17 @@ export default class MessageComposerInput extends React.Component { return

    {children}
    ; case 'bulleted-list': return
      {children}
    ; - case 'heading-one': + case 'heading1': return

    {children}

    ; - case 'heading-two': + case 'heading2': return

    {children}

    ; - case 'heading-three': + case 'heading3': return

    {children}

    ; - case 'heading-four': + case 'heading4': return

    {children}

    ; - case 'heading-five': + case 'heading5': return
    {children}
    ; - case 'heading-six': + case 'heading6': return
    {children}
    ; case 'list-item': return
  • {children}
  • ; @@ -1289,9 +1286,9 @@ export default class MessageComposerInput extends React.Component { return {children}; case 'code': return {children}; - case 'underline': + case 'underlined': return {children}; - case 'strikethrough': + case 'deleted': return {children}; } }; @@ -1304,7 +1301,8 @@ export default class MessageComposerInput extends React.Component { quote: 'block-quote', bullet: 'bulleted-list', numbullet: 'numbered-list', - strike: 'strikethrough', + underline: 'underlined', + strike: 'deleted', }[name] || name; this.handleKeyCommand(command); }; From c3a6a41e5ded05be0bb370644cbd5e0079a821bf Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 00:49:29 +0100 Subject: [PATCH 063/702] support links in RTE --- src/autocomplete/PlainWithPillsSerializer.js | 2 +- .../views/rooms/MessageComposerInput.js | 31 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/autocomplete/PlainWithPillsSerializer.js b/src/autocomplete/PlainWithPillsSerializer.js index 0e850f2a33..8fa73be6a3 100644 --- a/src/autocomplete/PlainWithPillsSerializer.js +++ b/src/autocomplete/PlainWithPillsSerializer.js @@ -69,7 +69,7 @@ class PlainWithPillsSerializer { case 'plain': return node.data.get('completion'); case 'md': - return `[${ node.text }](${ node.data.get('url') })`; + return `[${ node.text }](${ node.data.get('href') })`; case 'id': return node.data.get('completionId') || node.data.get('completion'); } diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 5126fb2813..5853525832 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -200,6 +200,31 @@ export default class MessageComposerInput extends React.Component { nodes: next(el.childNodes), } } + // special case links + if (tag === 'a') { + const href = el.getAttribute('href'); + let m = href.match(MATRIXTO_URL_PATTERN); + if (m) { + return { + object: 'inline', + type: 'pill', + data: { + href, + completion: el.innerText, + completionId: m[1], + }, + isVoid: true, + } + } + else { + return { + object: 'inline', + type: 'link', + data: { href }, + nodes: next(el.childNodes), + } + } + } }, serialize: (obj, children) => { if (obj.object === 'block' || obj.object === 'inline') { @@ -1161,7 +1186,7 @@ export default class MessageComposerInput extends React.Component { if (href) { inline = Inline.create({ type: 'pill', - data: { completion, completionId, url: href }, + data: { completion, completionId, href }, // we can't put text in here otherwise the editor tries to select it isVoid: true, }); @@ -1233,9 +1258,11 @@ export default class MessageComposerInput extends React.Component { return
      {children}
    ; case 'code-block': return
    {children}
    ; + case 'link': + return {children}; case 'pill': { const { data } = node; - const url = data.get('url'); + const url = data.get('href'); const completion = data.get('completion'); const shouldShowPillAvatar = !SettingsStore.getValue("Pill.shouldHidePillAvatar"); From d76a2aba9baa055614effe28501ed83800e07804 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 01:07:25 +0100 Subject: [PATCH 064/702] use

    as our root node everywhere and fix blank roundtrip bug --- .../views/rooms/MessageComposerInput.js | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 5853525832..754f208373 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -78,8 +78,7 @@ const ENTITY_TYPES = { AT_ROOM_PILL: 'ATROOMPILL', }; -// the Slate node type to default to for unstyled text when in RTE mode. -// (we use 'line' for oneliners however) +// the Slate node type to default to for unstyled text const DEFAULT_NODE = 'paragraph'; // map HTML elements through to our Slate schema node types @@ -259,7 +258,7 @@ export default class MessageComposerInput extends React.Component { } else { // ...or create a new one. - return Plain.deserialize('') + return Plain.deserialize('', { defaultBlock: DEFAULT_NODE }); } } @@ -544,7 +543,13 @@ export default class MessageComposerInput extends React.Component { let editorState = null; if (enabled) { // for simplicity when roundtripping, we use slate-md-serializer rather than commonmark - editorState = this.md.deserialize(this.plainWithMdPills.serialize(this.state.editorState)); + const markdown = this.plainWithMdPills.serialize(this.state.editorState); + if (markdown !== '') { + editorState = this.md.deserialize(markdown); + } + else { + editorState = Plain.deserialize('', { defaultBlock: DEFAULT_NODE }); + } // the alternative would be something like: // @@ -556,7 +561,10 @@ export default class MessageComposerInput extends React.Component { // let markdown = RichText.stateToMarkdown(this.state.editorState.getCurrentContent()); // value = ContentState.createFromText(markdown); - editorState = Plain.deserialize(this.md.serialize(this.state.editorState)); + editorState = Plain.deserialize( + this.md.serialize(this.state.editorState), + { defaultBlock: DEFAULT_NODE } + ); } Analytics.setRichtextMode(enabled); @@ -937,6 +945,7 @@ export default class MessageComposerInput extends React.Component { if (contentText === '') return true; if (shouldSendHTML) { + // FIXME: should we strip out the surrounding

    ? contentHTML = this.html.serialize(editorState); // HtmlUtils.processHtmlForSending(); } } else { @@ -1230,10 +1239,6 @@ export default class MessageComposerInput extends React.Component { const { attributes, children, node, isSelected } = props; switch (node.type) { - case 'line': - // ideally we'd return { children }
    , but as this isn't - // a valid react component, we don't have much choice. - return
    {children}
    ; case 'paragraph': return

    {children}

    ; case 'block-quote': From a0d88a829da8ee71b3a7910e1c534f808727f36a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 02:53:32 +0100 Subject: [PATCH 065/702] support sending inlines from the RTE. includes a horrific hack for sending emoji until https://github.com/ianstormtaylor/slate/pull/1854 is merged or otherwise solved --- .../views/rooms/MessageComposerInput.js | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 754f208373..8c5ab2394f 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -202,12 +202,15 @@ export default class MessageComposerInput extends React.Component { // special case links if (tag === 'a') { const href = el.getAttribute('href'); - let m = href.match(MATRIXTO_URL_PATTERN); + let m; + if (href) { + m = href.match(MATRIXTO_URL_PATTERN); + } if (m) { return { object: 'inline', type: 'pill', - data: { + data: { href, completion: el.innerText, completionId: m[1], @@ -226,7 +229,7 @@ export default class MessageComposerInput extends React.Component { } }, serialize: (obj, children) => { - if (obj.object === 'block' || obj.object === 'inline') { + if (obj.object === 'block') { return this.renderNode({ node: obj, children: children, @@ -238,6 +241,26 @@ export default class MessageComposerInput extends React.Component { children: children, }); } + else if (obj.object === 'inline') { + // special case links, pills and emoji otherwise we + // end up with React components getting rendered out(!) + switch (obj.type) { + case 'pill': + return { obj.data.get('completion') }; + case 'link': + return { children }; + case 'emoji': + // XXX: apparently you can't return plain strings from serializer rules + // until https://github.com/ianstormtaylor/slate/pull/1854 is merged. + // So instead we temporarily wrap emoji from RTE in an arbitrary tag + // (). would be nicer, but in practice it causes CSS issues. + return { obj.data.get('emojiUnicode') }; + } + return this.renderNode({ + node: obj, + children: children, + }); + } } } ] @@ -545,6 +568,7 @@ export default class MessageComposerInput extends React.Component { // for simplicity when roundtripping, we use slate-md-serializer rather than commonmark const markdown = this.plainWithMdPills.serialize(this.state.editorState); if (markdown !== '') { + // weirdly, the Md serializer can't deserialize '' to a valid Value... editorState = this.md.deserialize(markdown); } else { @@ -572,6 +596,8 @@ export default class MessageComposerInput extends React.Component { this.setState({ editorState: this.createEditorState(enabled, editorState), isRichtextEnabled: enabled, + }, ()=>{ + this.refs.editor.focus(); }); SettingsStore.setValue("MessageComposerInput.isRichTextEnabled", null, SettingLevel.ACCOUNT, enabled); @@ -852,6 +878,8 @@ export default class MessageComposerInput extends React.Component { return this.props.onFilesPasted(transfer.files); } else if (transfer.type === "html") { + // FIXME: https://github.com/ianstormtaylor/slate/issues/1497 means + // that we will silently discard nested blocks (e.g. nested lists) :( const fragment = this.html.deserialize(transfer.html); if (this.state.isRichtextEnabled) { return change.insertFragment(fragment.document); @@ -1263,7 +1291,7 @@ export default class MessageComposerInput extends React.Component { return
      {children}
    ; case 'code-block': return
    {children}
    ; - case 'link': + case 'link': return {children}; case 'pill': { const { data } = node; From e9cabf0e8564a30f7e0432fac063144e4a28a8be Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 03:17:51 +0100 Subject: [PATCH 066/702] add pill and emoji serialisation to Md --- .../views/rooms/MessageComposerInput.js | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 8c5ab2394f..d1bf4e4544 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -177,8 +177,23 @@ export default class MessageComposerInput extends React.Component { this.plainWithMdPills = new PlainWithPillsSerializer({ pillFormat: 'md' }); this.plainWithIdPills = new PlainWithPillsSerializer({ pillFormat: 'id' }); this.plainWithPlainPills = new PlainWithPillsSerializer({ pillFormat: 'plain' }); - this.md = new Md(); - this.html = new Html({ + + this.md = new Md({ + rules: [ + { + serialize: (obj, children) => { + switch (obj.type) { + case 'pill': + return `[${ obj.data.get('completion') }](${ obj.data.get('href') })`; + case 'emoji': + return obj.data.get('emojiUnicode'); + } + } + } + ] + }); + + this.html = new Html({ rules: [ { deserialize: (el, next) => { @@ -567,8 +582,13 @@ export default class MessageComposerInput extends React.Component { if (enabled) { // for simplicity when roundtripping, we use slate-md-serializer rather than commonmark const markdown = this.plainWithMdPills.serialize(this.state.editorState); + + // weirdly, the Md serializer can't deserialize '' to a valid Value... if (markdown !== '') { - // weirdly, the Md serializer can't deserialize '' to a valid Value... + // FIXME: the MD deserializer doesn't know how to deserialize pills + // and gives no hooks for doing so, so we should manually fix up + // the editorState first in order to preserve them. + editorState = this.md.deserialize(markdown); } else { From ad7782bc22628f633f147f3df3066a0d106269a0 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 14:07:33 +0100 Subject: [PATCH 067/702] remove the remaining Draft specific stuff from RichText --- src/RichText.js | 150 ------------------------------------------------ 1 file changed, 150 deletions(-) diff --git a/src/RichText.js b/src/RichText.js index e3162a4e2c..65b5dad107 100644 --- a/src/RichText.js +++ b/src/RichText.js @@ -18,48 +18,11 @@ limitations under the License. import React from 'react'; -/* -import { - Editor, - EditorState, - Modifier, - ContentState, - ContentBlock, - convertFromHTML, - DefaultDraftBlockRenderMap, - DefaultDraftInlineStyle, - CompositeDecorator, - SelectionState, - Entity, -} from 'draft-js'; -import { stateToMarkdown as __stateToMarkdown } from 'draft-js-export-markdown'; -*/ - -import Html from 'slate-html-serializer'; - import * as sdk from './index'; import * as emojione from 'emojione'; import { SelectionRange } from "./autocomplete/Autocompleter"; -const MARKDOWN_REGEX = { - LINK: /(?:\[([^\]]+)\]\(([^\)]+)\))|\<(\w+:\/\/[^\>]+)\>/g, - ITALIC: /([\*_])([\w\s]+?)\1/g, - BOLD: /([\*_])\1([\w\s]+?)\1\1/g, - HR: /(\n|^)((-|\*|_) *){3,}(\n|$)/g, - CODE: /`[^`]*`/g, - STRIKETHROUGH: /~{2}[^~]*~{2}/g, -}; - -const ZWS_CODE = 8203; -const ZWS = String.fromCharCode(ZWS_CODE); // zero width space - -export function stateToMarkdown(state) { - return __stateToMarkdown(state) - .replace( - ZWS, // draft-js-export-markdown adds these - ''); // this is *not* a zero width space, trust me :) -} export function unicodeToEmojiUri(str) { let replaceWith, unicode, alt; @@ -87,116 +50,3 @@ export function unicodeToEmojiUri(str) { return str; } - -/** - * Utility function that looks for regex matches within a ContentBlock and invokes {callback} with (start, end) - * From https://facebook.github.io/draft-js/docs/advanced-topics-decorators.html - */ -function findWithRegex(regex, contentBlock: ContentBlock, callback: (start: number, end: number) => any) { - const text = contentBlock.getText(); - let matchArr, start; - while ((matchArr = regex.exec(text)) !== null) { - start = matchArr.index; - callback(start, start + matchArr[0].length); - } -} - -/** - * Returns a composite decorator which has access to provided scope. - */ -export function getScopedRTDecorators(scope: any): CompositeDecorator { - return [emojiDecorator]; -} - -export function getScopedMDDecorators(scope: any): CompositeDecorator { - const markdownDecorators = ['HR', 'BOLD', 'ITALIC', 'CODE', 'STRIKETHROUGH'].map( - (style) => ({ - strategy: (contentState, contentBlock, callback) => { - return findWithRegex(MARKDOWN_REGEX[style], contentBlock, callback); - }, - component: (props) => ( - - { props.children } - - ), - })); - - markdownDecorators.push({ - strategy: (contentState, contentBlock, callback) => { - return findWithRegex(MARKDOWN_REGEX.LINK, contentBlock, callback); - }, - component: (props) => ( - - { props.children } - - ), - }); - // markdownDecorators.push(emojiDecorator); - // TODO Consider renabling "syntax highlighting" when we can do it properly - return [emojiDecorator]; -} - -/** - * Passes rangeToReplace to modifyFn and replaces it in contentState with the result. - */ -export function modifyText(contentState: ContentState, rangeToReplace: SelectionState, - modifyFn: (text: string) => string, inlineStyle, entityKey): ContentState { - let getText = (key) => contentState.getBlockForKey(key).getText(), - startKey = rangeToReplace.getStartKey(), - startOffset = rangeToReplace.getStartOffset(), - endKey = rangeToReplace.getEndKey(), - endOffset = rangeToReplace.getEndOffset(), - text = ""; - - - for (let currentKey = startKey; - currentKey && currentKey !== endKey; - currentKey = contentState.getKeyAfter(currentKey)) { - const blockText = getText(currentKey); - text += blockText.substring(startOffset, blockText.length); - - // from now on, we'll take whole blocks - startOffset = 0; - } - - // add remaining part of last block - text += getText(endKey).substring(startOffset, endOffset); - - return Modifier.replaceText(contentState, rangeToReplace, modifyFn(text), inlineStyle, entityKey); -} - -/** - * Computes the plaintext offsets of the given SelectionState. - * Note that this inherently means we make assumptions about what that means (no separator between ContentBlocks, etc) - * Used by autocomplete to show completions when the current selection lies within, or at the edges of a command. - */ -export function selectionStateToTextOffsets(selectionState: SelectionState, - contentBlocks: Array): {start: number, end: number} { - let offset = 0, start = 0, end = 0; - for (const block of contentBlocks) { - if (selectionState.getStartKey() === block.getKey()) { - start = offset + selectionState.getStartOffset(); - } - if (selectionState.getEndKey() === block.getKey()) { - end = offset + selectionState.getEndOffset(); - break; - } - offset += block.getLength(); - } - - return { - start, - end, - }; -} - -export function hasMultiLineSelection(editorState: EditorState): boolean { - const selectionState = editorState.getSelection(); - const anchorKey = selectionState.getAnchorKey(); - const currentContent = editorState.getCurrentContent(); - const currentContentBlock = currentContent.getBlockForKey(anchorKey); - const start = selectionState.getStartOffset(); - const end = selectionState.getEndOffset(); - const selectedText = currentContentBlock.getText().slice(start, end); - return selectedText.includes('\n'); -} From c5676eef89aa9784a78040ddd6ed16e117aa7d80 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 14:32:06 +0100 Subject: [PATCH 068/702] comment out more old draft stuff --- src/HtmlUtils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js index 7ca404be31..4c1564297d 100644 --- a/src/HtmlUtils.js +++ b/src/HtmlUtils.js @@ -112,7 +112,7 @@ export function charactersToImageNode(alt, useSvg, ...unicode) { />; } - +/* export function processHtmlForSending(html: string): string { const contentDiv = document.createElement('div'); contentDiv.innerHTML = html; @@ -146,6 +146,7 @@ export function processHtmlForSending(html: string): string { return contentHTML; } +*/ /* * Given an untrusted HTML string, return a React node with an sanitized version From 9aba046f21d67b19b5e3b5c4a13814e919f56446 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 14:32:20 +0100 Subject: [PATCH 069/702] fix MD pill serialization --- src/autocomplete/PlainWithPillsSerializer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autocomplete/PlainWithPillsSerializer.js b/src/autocomplete/PlainWithPillsSerializer.js index 8fa73be6a3..7428241b05 100644 --- a/src/autocomplete/PlainWithPillsSerializer.js +++ b/src/autocomplete/PlainWithPillsSerializer.js @@ -69,7 +69,7 @@ class PlainWithPillsSerializer { case 'plain': return node.data.get('completion'); case 'md': - return `[${ node.text }](${ node.data.get('href') })`; + return `[${ node.data.get('completion') }](${ node.data.get('href') })`; case 'id': return node.data.get('completionId') || node.data.get('completion'); } From aac6866779f935a23e876a0ffc5efc5e881c7168 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 14:33:14 +0100 Subject: [PATCH 070/702] switch back to using commonmark for serialising MD when roundtripping and escape MD correctly when serialising via slate-md-serializer --- .../views/rooms/MessageComposerInput.js | 60 +++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index d1bf4e4544..0d603d3135 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -182,11 +182,21 @@ export default class MessageComposerInput extends React.Component { rules: [ { serialize: (obj, children) => { - switch (obj.type) { - case 'pill': - return `[${ obj.data.get('completion') }](${ obj.data.get('href') })`; - case 'emoji': - return obj.data.get('emojiUnicode'); + if (obj.object === 'string') { + // escape any MD in it. i have no idea why the serializer doesn't + // do this already. + // TODO: this can probably be more robust - it doesn't consider + // indenting or lists for instance. + return children.replace(/([*_~`+])/g, '\\$1') + .replace(/^([>#\|])/g, '\\$1'); + } + else if (obj.object === 'inline') { + switch (obj.type) { + case 'pill': + return `[${ obj.data.get('completion') }](${ obj.data.get('href') })`; + case 'emoji': + return obj.data.get('emojiUnicode'); + } } } } @@ -580,27 +590,29 @@ export default class MessageComposerInput extends React.Component { let editorState = null; if (enabled) { - // for simplicity when roundtripping, we use slate-md-serializer rather than commonmark - const markdown = this.plainWithMdPills.serialize(this.state.editorState); - - // weirdly, the Md serializer can't deserialize '' to a valid Value... - if (markdown !== '') { - // FIXME: the MD deserializer doesn't know how to deserialize pills - // and gives no hooks for doing so, so we should manually fix up - // the editorState first in order to preserve them. - - editorState = this.md.deserialize(markdown); - } - else { - editorState = Plain.deserialize('', { defaultBlock: DEFAULT_NODE }); - } - - // the alternative would be something like: + // for consistency when roundtripping, we could use slate-md-serializer rather than + // commonmark, but then we would lose pills as the MD deserialiser doesn't know about + // them and doesn't have any extensibility hooks. // - // const sourceWithPills = this.plainWithMdPills.serialize(this.state.editorState); - // const markdown = new Markdown(sourceWithPills); - // editorState = this.html.deserialize(markdown.toHTML()); + // The code looks like this: + // + // const markdown = this.plainWithMdPills.serialize(this.state.editorState); + // + // // weirdly, the Md serializer can't deserialize '' to a valid Value... + // if (markdown !== '') { + // editorState = this.md.deserialize(markdown); + // } + // else { + // editorState = Plain.deserialize('', { defaultBlock: DEFAULT_NODE }); + // } + // so, instead, we use commonmark proper (which is arguably more logical to the user + // anyway, as they'll expect the RTE view to match what they'll see in the timeline, + // but the HTML->MD conversion is anyone's guess). + + const sourceWithPills = this.plainWithMdPills.serialize(this.state.editorState); + const markdown = new Markdown(sourceWithPills); + editorState = this.html.deserialize(markdown.toHTML()); } else { // let markdown = RichText.stateToMarkdown(this.state.editorState.getCurrentContent()); // value = ContentState.createFromText(markdown); From d799b7e424d54a52bc91d83ab17e06dead767964 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 16:30:39 +0100 Subject: [PATCH 071/702] refactor roundtripping into a single place and fix isRichTextEnabled to be correctly camelCased everywhere... --- src/ComposerHistoryManager.js | 34 +---- src/components/views/rooms/MessageComposer.js | 8 +- .../views/rooms/MessageComposerInput.js | 129 ++++++++++-------- .../views/rooms/MessageComposerInput-test.js | 2 +- 4 files changed, 84 insertions(+), 89 deletions(-) diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index 28749ace15..f997e1d1cd 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -28,8 +28,8 @@ type MessageFormat = 'rich' | 'markdown'; class HistoryItem { - // Keeping message for backwards-compatibility - message: string; + // We store history items in their native format to ensure history is accurate + // and then convert them if our RTE has subsequently changed format. value: Value; format: MessageFormat = 'rich'; @@ -51,32 +51,6 @@ class HistoryItem { format: this.format }; } - - // FIXME: rather than supporting storing history in either format, why don't we pick - // one canonical form? - toValue(outputFormat: MessageFormat): Value { - if (outputFormat === 'markdown') { - if (this.format === 'rich') { - // convert a rich formatted history entry to its MD equivalent - return Plain.deserialize(Md.serialize(this.value)); - // return ContentState.createFromText(RichText.stateToMarkdown(contentState)); - } - else if (this.format === 'markdown') { - return this.value; - } - } else if (outputFormat === 'rich') { - if (this.format === 'markdown') { - // convert MD formatted string to its rich equivalent. - return Md.deserialize(Plain.serialize(this.value)); - // return RichText.htmlToContentState(new Markdown(contentState.getPlainText()).toHTML()); - } - else if (this.format === 'rich') { - return this.value; - } - } - console.error("unknown format -> outputFormat conversion"); - return this.value; - } } export default class ComposerHistoryManager { @@ -110,9 +84,9 @@ export default class ComposerHistoryManager { sessionStorage.setItem(`${this.prefix}[${this.lastIndex++}]`, JSON.stringify(item.toJSON())); } - getItem(offset: number, format: MessageFormat): ?Value { + getItem(offset: number): ?HistoryItem { this.currentIndex = _clamp(this.currentIndex + offset, 0, this.lastIndex - 1); const item = this.history[this.currentIndex]; - return item ? item.toValue(format) : null; + return item; } } diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 9aaa33f0fa..157dc9e704 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -46,7 +46,7 @@ export default class MessageComposer extends React.Component { inputState: { marks: [], blockType: null, - isRichtextEnabled: SettingsStore.getValue('MessageComposerInput.isRichTextEnabled'), + isRichTextEnabled: SettingsStore.getValue('MessageComposerInput.isRichTextEnabled'), }, showFormatting: SettingsStore.getValue('MessageComposer.showFormatting'), isQuoting: Boolean(RoomViewStore.getQuotingEvent()), @@ -227,7 +227,7 @@ export default class MessageComposer extends React.Component { onToggleMarkdownClicked(e) { e.preventDefault(); // don't steal focus from the editor! - this.messageComposerInput.enableRichtext(!this.state.inputState.isRichtextEnabled); + this.messageComposerInput.enableRichtext(!this.state.inputState.isRichTextEnabled); } render() { @@ -380,10 +380,10 @@ export default class MessageComposer extends React.Component {
    { formatButtons }
    - + src={`img/button-md-${!this.state.inputState.isRichTextEnabled}.png`} /> ${body}`); - if (!this.state.isRichtextEnabled) { + if (!this.state.isRichTextEnabled) { content = ContentState.createFromText(RichText.stateToMarkdown(content)); } @@ -374,7 +374,7 @@ export default class MessageComposerInput extends React.Component { startSelection, blockMap); startSelection = SelectionState.createEmpty(contentState.getFirstBlock().getKey()); - if (this.state.isRichtextEnabled) { + if (this.state.isRichTextEnabled) { contentState = Modifier.setBlockType(contentState, startSelection, 'blockquote'); } let editorState = EditorState.push(this.state.editorState, contentState, 'insert-characters'); @@ -582,52 +582,61 @@ export default class MessageComposerInput extends React.Component { }); }; - enableRichtext(enabled: boolean) { - if (enabled === this.state.isRichtextEnabled) return; + mdToRichEditorState(editorState: Value): Value { + // for consistency when roundtripping, we could use slate-md-serializer rather than + // commonmark, but then we would lose pills as the MD deserialiser doesn't know about + // them and doesn't have any extensibility hooks. + // + // The code looks like this: + // + // const markdown = this.plainWithMdPills.serialize(editorState); + // + // // weirdly, the Md serializer can't deserialize '' to a valid Value... + // if (markdown !== '') { + // editorState = this.md.deserialize(markdown); + // } + // else { + // editorState = Plain.deserialize('', { defaultBlock: DEFAULT_NODE }); + // } - // FIXME: this duplicates similar conversions which happen in the history & store. - // they should be factored out. + // so, instead, we use commonmark proper (which is arguably more logical to the user + // anyway, as they'll expect the RTE view to match what they'll see in the timeline, + // but the HTML->MD conversion is anyone's guess). + + const textWithMdPills = this.plainWithMdPills.serialize(editorState); + const markdown = new Markdown(textWithMdPills); + // HTML deserialize has custom rules to turn matrix.to links into pill objects. + return this.html.deserialize(markdown.toHTML()); + } + + richToMdEditorState(editorState: Value): Value { + // FIXME: this conversion loses pills (turning them into pure MD links). + // We need to add a pill-aware deserialize method + // to PlainWithPillsSerializer which recognises pills in raw MD and turns them into pills. + return Plain.deserialize( + // FIXME: we compile the MD out of the RTE state using slate-md-serializer + // which doesn't roundtrip symmetrically with commonmark, which we use for + // compiling MD out of the MD editor state above. + this.md.serialize(editorState), + { defaultBlock: DEFAULT_NODE } + ); + } + + enableRichtext(enabled: boolean) { + if (enabled === this.state.isRichTextEnabled) return; let editorState = null; if (enabled) { - // for consistency when roundtripping, we could use slate-md-serializer rather than - // commonmark, but then we would lose pills as the MD deserialiser doesn't know about - // them and doesn't have any extensibility hooks. - // - // The code looks like this: - // - // const markdown = this.plainWithMdPills.serialize(this.state.editorState); - // - // // weirdly, the Md serializer can't deserialize '' to a valid Value... - // if (markdown !== '') { - // editorState = this.md.deserialize(markdown); - // } - // else { - // editorState = Plain.deserialize('', { defaultBlock: DEFAULT_NODE }); - // } - - // so, instead, we use commonmark proper (which is arguably more logical to the user - // anyway, as they'll expect the RTE view to match what they'll see in the timeline, - // but the HTML->MD conversion is anyone's guess). - - const sourceWithPills = this.plainWithMdPills.serialize(this.state.editorState); - const markdown = new Markdown(sourceWithPills); - editorState = this.html.deserialize(markdown.toHTML()); + editorState = this.mdToRichEditorState(this.state.editorState); } else { - // let markdown = RichText.stateToMarkdown(this.state.editorState.getCurrentContent()); - // value = ContentState.createFromText(markdown); - - editorState = Plain.deserialize( - this.md.serialize(this.state.editorState), - { defaultBlock: DEFAULT_NODE } - ); + editorState = this.richToMdEditorState(this.state.editorState); } Analytics.setRichtextMode(enabled); this.setState({ editorState: this.createEditorState(enabled, editorState), - isRichtextEnabled: enabled, + isRichTextEnabled: enabled, }, ()=>{ this.refs.editor.focus(); }); @@ -710,7 +719,7 @@ export default class MessageComposerInput extends React.Component { }; onBackspace = (ev: Event, change: Change): Change => { - if (this.state.isRichtextEnabled) { + if (this.state.isRichTextEnabled) { // let backspace exit lists const isList = this.hasBlock('list-item'); const { editorState } = this.state; @@ -740,14 +749,14 @@ export default class MessageComposerInput extends React.Component { handleKeyCommand = (command: string): boolean => { if (command === 'toggle-mode') { - this.enableRichtext(!this.state.isRichtextEnabled); + this.enableRichtext(!this.state.isRichTextEnabled); return true; } let newState: ?Value = null; // Draft handles rich text mode commands by default but we need to do it ourselves for Markdown. - if (this.state.isRichtextEnabled) { + if (this.state.isRichTextEnabled) { const type = command; const { editorState } = this.state; const change = editorState.change(); @@ -913,7 +922,7 @@ export default class MessageComposerInput extends React.Component { // FIXME: https://github.com/ianstormtaylor/slate/issues/1497 means // that we will silently discard nested blocks (e.g. nested lists) :( const fragment = this.html.deserialize(transfer.html); - if (this.state.isRichtextEnabled) { + if (this.state.isRichTextEnabled) { return change.insertFragment(fragment.document); } else { @@ -954,7 +963,7 @@ export default class MessageComposerInput extends React.Component { if (cmd) { if (!cmd.error) { - this.historyManager.save(editorState, this.state.isRichtextEnabled ? 'rich' : 'markdown'); + this.historyManager.save(editorState, this.state.isRichTextEnabled ? 'rich' : 'markdown'); this.setState({ editorState: this.createEditorState(), }); @@ -986,7 +995,7 @@ export default class MessageComposerInput extends React.Component { const replyingToEv = RoomViewStore.getQuotingEvent(); const mustSendHTML = Boolean(replyingToEv); - if (this.state.isRichtextEnabled) { + if (this.state.isRichTextEnabled) { // We should only send HTML if any block is styled or contains inline style let shouldSendHTML = false; @@ -1032,7 +1041,7 @@ export default class MessageComposerInput extends React.Component { this.historyManager.save( editorState, - this.state.isRichtextEnabled ? 'rich' : 'markdown', + this.state.isRichTextEnabled ? 'rich' : 'markdown', ); if (commandText && commandText.startsWith('/me')) { @@ -1119,7 +1128,7 @@ export default class MessageComposerInput extends React.Component { if (up) { const scrollCorrection = editorNode.scrollTop; const distanceFromTop = cursorRect.top - editorRect.top + scrollCorrection; - console.log(`Cursor distance from editor top is ${distanceFromTop}`); + //console.log(`Cursor distance from editor top is ${distanceFromTop}`); if (distanceFromTop < EDGE_THRESHOLD) { navigateHistory = true; } @@ -1128,7 +1137,7 @@ export default class MessageComposerInput extends React.Component { const scrollCorrection = editorNode.scrollHeight - editorNode.clientHeight - editorNode.scrollTop; const distanceFromBottom = editorRect.bottom - cursorRect.bottom + scrollCorrection; - console.log(`Cursor distance from editor bottom is ${distanceFromBottom}`); + //console.log(`Cursor distance from editor bottom is ${distanceFromBottom}`); if (distanceFromBottom < EDGE_THRESHOLD) { navigateHistory = true; } @@ -1168,7 +1177,19 @@ export default class MessageComposerInput extends React.Component { return; } - let editorState = this.historyManager.getItem(delta, this.state.isRichtextEnabled ? 'rich' : 'markdown'); + let editorState; + const historyItem = this.historyManager.getItem(delta); + if (historyItem) { + if (historyItem.format === 'rich' && !this.state.isRichTextEnabled) { + editorState = this.richToMdEditorState(historyItem.value); + } + else if (historyItem.format === 'markdown' && this.state.isRichTextEnabled) { + editorState = this.mdToRichEditorState(historyItem.value); + } + else { + editorState = historyItem.value; + } + } // Move selection to the end of the selected history const change = editorState.change().collapseToEndOf(editorState.document); @@ -1468,8 +1489,8 @@ export default class MessageComposerInput extends React.Component {
    + title={this.state.isRichTextEnabled ? _t("Markdown is disabled") : _t("Markdown is enabled")} + src={`img/button-md-${!this.state.isRichTextEnabled}.png`} /> { 'mx_MessageComposer_input_markdownIndicator'); ReactTestUtils.Simulate.click(indicator); - expect(mci.state.isRichtextEnabled).toEqual(false, 'should have changed mode'); + expect(mci.state.isRichTextEnabled).toEqual(false, 'should have changed mode'); done(); }); }); From f981d7b7293c0eb2ad869091cabbb836b0c86a23 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 22:39:40 +0100 Subject: [PATCH 072/702] unify buttons on the node type names, and make them work --- ...o-n.svg => button-text-block-quote-on.svg} | 0 ...-quote.svg => button-text-block-quote.svg} | 0 ...t-bold-o-n.svg => button-text-bold-on.svg} | 0 ...n.svg => button-text-bulleted-list-on.svg} | 0 ...llet.svg => button-text-bulleted-list.svg} | 0 ...t-code-o-n.svg => button-text-code-on.svg} | 0 ...ike-o-n.svg => button-text-deleted-on.svg} | 0 ...ext-strike.svg => button-text-deleted.svg} | 0 ...alic-o-n.svg => button-text-italic-on.svg} | 0 ...n.svg => button-text-numbered-list-on.svg} | 0 ...llet.svg => button-text-numbered-list.svg} | 0 ...-o-n.svg => button-text-underlined-on.svg} | 0 ...derline.svg => button-text-underlined.svg} | 0 src/components/views/rooms/MessageComposer.js | 58 ++++++++------- .../views/rooms/MessageComposerInput.js | 70 ++++++++++--------- 15 files changed, 68 insertions(+), 60 deletions(-) rename res/img/{button-text-quote-o-n.svg => button-text-block-quote-on.svg} (100%) rename res/img/{button-text-quote.svg => button-text-block-quote.svg} (100%) rename res/img/{button-text-bold-o-n.svg => button-text-bold-on.svg} (100%) rename res/img/{button-text-bullet-o-n.svg => button-text-bulleted-list-on.svg} (100%) rename res/img/{button-text-bullet.svg => button-text-bulleted-list.svg} (100%) rename res/img/{button-text-code-o-n.svg => button-text-code-on.svg} (100%) rename res/img/{button-text-strike-o-n.svg => button-text-deleted-on.svg} (100%) rename res/img/{button-text-strike.svg => button-text-deleted.svg} (100%) rename res/img/{button-text-italic-o-n.svg => button-text-italic-on.svg} (100%) rename res/img/{button-text-numbullet-o-n.svg => button-text-numbered-list-on.svg} (100%) rename res/img/{button-text-numbullet.svg => button-text-numbered-list.svg} (100%) rename res/img/{button-text-underline-o-n.svg => button-text-underlined-on.svg} (100%) rename res/img/{button-text-underline.svg => button-text-underlined.svg} (100%) diff --git a/res/img/button-text-quote-o-n.svg b/res/img/button-text-block-quote-on.svg similarity index 100% rename from res/img/button-text-quote-o-n.svg rename to res/img/button-text-block-quote-on.svg diff --git a/res/img/button-text-quote.svg b/res/img/button-text-block-quote.svg similarity index 100% rename from res/img/button-text-quote.svg rename to res/img/button-text-block-quote.svg diff --git a/res/img/button-text-bold-o-n.svg b/res/img/button-text-bold-on.svg similarity index 100% rename from res/img/button-text-bold-o-n.svg rename to res/img/button-text-bold-on.svg diff --git a/res/img/button-text-bullet-o-n.svg b/res/img/button-text-bulleted-list-on.svg similarity index 100% rename from res/img/button-text-bullet-o-n.svg rename to res/img/button-text-bulleted-list-on.svg diff --git a/res/img/button-text-bullet.svg b/res/img/button-text-bulleted-list.svg similarity index 100% rename from res/img/button-text-bullet.svg rename to res/img/button-text-bulleted-list.svg diff --git a/res/img/button-text-code-o-n.svg b/res/img/button-text-code-on.svg similarity index 100% rename from res/img/button-text-code-o-n.svg rename to res/img/button-text-code-on.svg diff --git a/res/img/button-text-strike-o-n.svg b/res/img/button-text-deleted-on.svg similarity index 100% rename from res/img/button-text-strike-o-n.svg rename to res/img/button-text-deleted-on.svg diff --git a/res/img/button-text-strike.svg b/res/img/button-text-deleted.svg similarity index 100% rename from res/img/button-text-strike.svg rename to res/img/button-text-deleted.svg diff --git a/res/img/button-text-italic-o-n.svg b/res/img/button-text-italic-on.svg similarity index 100% rename from res/img/button-text-italic-o-n.svg rename to res/img/button-text-italic-on.svg diff --git a/res/img/button-text-numbullet-o-n.svg b/res/img/button-text-numbered-list-on.svg similarity index 100% rename from res/img/button-text-numbullet-o-n.svg rename to res/img/button-text-numbered-list-on.svg diff --git a/res/img/button-text-numbullet.svg b/res/img/button-text-numbered-list.svg similarity index 100% rename from res/img/button-text-numbullet.svg rename to res/img/button-text-numbered-list.svg diff --git a/res/img/button-text-underline-o-n.svg b/res/img/button-text-underlined-on.svg similarity index 100% rename from res/img/button-text-underline-o-n.svg rename to res/img/button-text-underlined-on.svg diff --git a/res/img/button-text-underline.svg b/res/img/button-text-underlined.svg similarity index 100% rename from res/img/button-text-underline.svg rename to res/img/button-text-underlined.svg diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 157dc9e704..4d00927767 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -215,7 +215,7 @@ export default class MessageComposer extends React.Component { } } - onFormatButtonClicked(name: "bold" | "italic" | "strike" | "code" | "underline" | "quote" | "bullet" | "numbullet", event) { + onFormatButtonClicked(name, event) { event.preventDefault(); this.messageComposerInput.onFormatButtonClicked(name, event); } @@ -303,14 +303,14 @@ export default class MessageComposer extends React.Component {
    ); - const formattingButton = ( + const formattingButton = this.state.inputState.isRichTextEnabled ? ( - ); + ) : null; let placeholderText; if (this.state.isQuoting) { @@ -353,31 +353,27 @@ export default class MessageComposer extends React.Component { ); } - const {marks, blockType} = this.state.inputState; - const formatButtons = ["bold", "italic", "strike", "underline", "code", "quote", "bullet", "numbullet"].map( - (name) => { - const active = marks.includes(name) || blockType === name; - const suffix = active ? '-o-n' : ''; - const onFormatButtonClicked = this.onFormatButtonClicked.bind(this, name); - const className = 'mx_MessageComposer_format_button mx_filterFlipColor'; - return ; - }, - ); + let formatBar; + if (this.state.showFormatting) { + const {marks, blockType} = this.state.inputState; + const formatButtons = ["bold", "italic", "deleted", "underlined", "code", "block-quote", "bulleted-list", "numbered-list"].map( + (name) => { + const active = marks.some(mark => mark.type === name) || blockType === name; + const suffix = active ? '-on' : ''; + const onFormatButtonClicked = this.onFormatButtonClicked.bind(this, name); + const className = 'mx_MessageComposer_format_button mx_filterFlipColor'; + return ; + }, + ); - return ( -
    -
    -
    - { controls } -
    -
    + formatBar =
    -
    +
    { formatButtons }
    + } + + return ( +
    +
    +
    + { controls } +
    +
    + { formatBar }
    ); } diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index aac7c7ddbb..2d5e6d050d 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -132,9 +132,6 @@ export default class MessageComposerInput extends React.Component { // js-sdk Room object room: PropTypes.object.isRequired, - // called with current plaintext content (as a string) whenever it changes - onContentChanged: PropTypes.func, - onFilesPasted: PropTypes.func, onInputStateChanged: PropTypes.func, @@ -319,15 +316,6 @@ export default class MessageComposerInput extends React.Component { dis.unregister(this.dispatcherRef); } - componentWillUpdate(nextProps, nextState) { - // this is dirty, but moving all this state to MessageComposer is dirtier - if (this.props.onInputStateChanged && nextState !== this.state) { - const state = this.getSelectionInfo(nextState.editorState); - state.isRichTextEnabled = nextState.isRichTextEnabled; - this.props.onInputStateChanged(state); - } - } - onAction = (payload) => { const editor = this.refs.editor; let editorState = this.state.editorState; @@ -567,6 +555,27 @@ export default class MessageComposerInput extends React.Component { } } + if (this.props.onInputStateChanged) { + let blockType = editorState.blocks.first().type; + console.log("onInputStateChanged; current block type is " + blockType + " and marks are " + editorState.activeMarks); + + if (blockType === 'list-item') { + const parent = editorState.document.getParent(editorState.blocks.first().key); + if (parent.type === 'numbered-list') { + blockType = 'numbered-list'; + } + else if (parent.type === 'bulleted-list') { + blockType = 'bulleted-list'; + } + } + const inputState = { + marks: editorState.activeMarks, + isRichTextEnabled: this.state.isRichTextEnabled, + blockType + }; + this.props.onInputStateChanged(inputState); + } + // Record the editor state for this room so that it can be retrieved after // switching to another room and back dis.dispatch({ @@ -1239,17 +1248,6 @@ export default class MessageComposerInput extends React.Component { await this.setDisplayedCompletion(null); // restore originalEditorState }; - /* returns inline style and block type of current SelectionState so MessageComposer can render formatting - buttons. */ - getSelectionInfo(editorState: Value) { - return { - marks: editorState.activeMarks, - // XXX: shouldn't we return all the types of blocks in the current selection, - // not just the anchor? - blockType: editorState.anchorBlock ? editorState.anchorBlock.type : null, - }; - } - /* If passed null, restores the original editor content from state.originalEditorState. * If passed a non-null displayedCompletion, modifies state.originalEditorState to compute new state.editorState. */ @@ -1406,18 +1404,22 @@ export default class MessageComposerInput extends React.Component { } }; - onFormatButtonClicked = (name: "bold" | "italic" | "strike" | "code" | "underline" | "quote" | "bullet" | "numbullet", e) => { - e.preventDefault(); // don't steal focus from the editor! + onFormatButtonClicked = (name, e) => { + if (e) { + e.preventDefault(); // don't steal focus from the editor! + } - const command = { - // code: 'code-block', // let's have the button do inline code for now - quote: 'block-quote', - bullet: 'bulleted-list', - numbullet: 'numbered-list', - underline: 'underlined', - strike: 'deleted', - }[name] || name; - this.handleKeyCommand(command); + // XXX: horrible evil hack to ensure the editor is focused so the act + // of focusing it doesn't then cancel the format button being pressed + if (document.activeElement && document.activeElement.className !== 'mx_MessageComposer_editor') { + this.refs.editor.focus(); + setTimeout(()=>{ + this.handleKeyCommand(name); + }, 500); // can't find any callback to hook this to. onFocus and onChange and willComponentUpdate fire too early. + return; + } + + this.handleKeyCommand(name); }; getAutocompleteQuery(editorState: Value) { From e460cf35e0c553825a5d3ee2f11b449249acdcbd Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 22:48:40 +0100 Subject: [PATCH 073/702] hide formatting bar for MD editor --- src/components/views/rooms/MessageComposer.js | 2 +- src/components/views/rooms/MessageComposerInput.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 4d00927767..28502c348d 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -354,7 +354,7 @@ export default class MessageComposer extends React.Component { } let formatBar; - if (this.state.showFormatting) { + if (this.state.showFormatting && this.state.inputState.isRichTextEnabled) { const {marks, blockType} = this.state.inputState; const formatButtons = ["bold", "italic", "deleted", "underlined", "code", "block-quote", "bulleted-list", "numbered-list"].map( (name) => { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 2d5e6d050d..2bb35c5656 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -1405,9 +1405,7 @@ export default class MessageComposerInput extends React.Component { }; onFormatButtonClicked = (name, e) => { - if (e) { - e.preventDefault(); // don't steal focus from the editor! - } + e.preventDefault(); // don't steal focus from the editor! // XXX: horrible evil hack to ensure the editor is focused so the act // of focusing it doesn't then cancel the format button being pressed From b616fd025e56fe9b338c1bada5fb9c12ecb84c71 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 23:34:06 +0100 Subject: [PATCH 074/702] comment out all the tests for now --- src/components/views/rooms/MessageComposerInput.js | 2 +- test/components/views/rooms/MessageComposerInput-test.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 2bb35c5656..1f0a544246 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -557,7 +557,7 @@ export default class MessageComposerInput extends React.Component { if (this.props.onInputStateChanged) { let blockType = editorState.blocks.first().type; - console.log("onInputStateChanged; current block type is " + blockType + " and marks are " + editorState.activeMarks); + // console.log("onInputStateChanged; current block type is " + blockType + " and marks are " + editorState.activeMarks); if (blockType === 'list-item') { const parent = editorState.document.getParent(editorState.blocks.first().key); diff --git a/test/components/views/rooms/MessageComposerInput-test.js b/test/components/views/rooms/MessageComposerInput-test.js index 42921db975..708071df23 100644 --- a/test/components/views/rooms/MessageComposerInput-test.js +++ b/test/components/views/rooms/MessageComposerInput-test.js @@ -10,6 +10,7 @@ const MessageComposerInput = sdk.getComponent('views.rooms.MessageComposerInput' import MatrixClientPeg from '../../../../src/MatrixClientPeg'; import RoomMember from 'matrix-js-sdk'; +/* function addTextToDraft(text) { const components = document.getElementsByClassName('public-DraftEditor-content'); if (components && components.length) { @@ -300,3 +301,4 @@ describe('MessageComposerInput', () => { expect(spy.args[0][1].formatted_body).toEqual('Click here'); }); }); +*/ \ No newline at end of file From 4439a04689605f7244505915e3494a86954cf28c Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 20 May 2018 23:43:42 +0100 Subject: [PATCH 075/702] fix lint --- .eslintrc.js | 1 + src/ComposerHistoryManager.js | 16 +++++----------- src/autocomplete/CommandProvider.js | 3 +-- src/autocomplete/PlainWithPillsSerializer.js | 15 ++++++--------- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index bf423a1ad8..62d24ea707 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -95,6 +95,7 @@ module.exports = { "new-cap": ["warn"], "key-spacing": ["warn"], "prefer-const": ["warn"], + "arrow-parens": "off", // crashes currently: https://github.com/eslint/eslint/issues/6274 "generator-star-spacing": "off", diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index f997e1d1cd..e78fbcdc3b 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -16,11 +16,6 @@ limitations under the License. */ import { Value } from 'slate'; -import Html from 'slate-html-serializer'; -import Md from 'slate-md-serializer'; -import Plain from 'slate-plain-serializer'; -import * as RichText from './RichText'; -import Markdown from './Markdown'; import _clamp from 'lodash/clamp'; @@ -38,17 +33,17 @@ class HistoryItem { this.format = format; } - static fromJSON(obj): HistoryItem { + static fromJSON(obj: Object): HistoryItem { return new HistoryItem( Value.fromJSON(obj.value), - obj.format + obj.format, ); } toJSON(): Object { return { value: this.value.toJSON(), - format: this.format + format: this.format, }; } } @@ -67,10 +62,9 @@ export default class ComposerHistoryManager { for (; item = sessionStorage.getItem(`${this.prefix}[${this.currentIndex}]`); this.currentIndex++) { try { this.history.push( - HistoryItem.fromJSON(JSON.parse(item)) + HistoryItem.fromJSON(JSON.parse(item)), ); - } - catch (e) { + } catch (e) { console.warn("Throwing away unserialisable history", e); } } diff --git a/src/autocomplete/CommandProvider.js b/src/autocomplete/CommandProvider.js index 4f2aed3dc6..d56cefb021 100644 --- a/src/autocomplete/CommandProvider.js +++ b/src/autocomplete/CommandProvider.js @@ -132,8 +132,7 @@ export default class CommandProvider extends AutocompleteProvider { let results; if (command[0] == '/') { results = COMMANDS; - } - else { + } else { results = this.matcher.match(command[0]); } completions = results.map((result) => { diff --git a/src/autocomplete/PlainWithPillsSerializer.js b/src/autocomplete/PlainWithPillsSerializer.js index 7428241b05..c1194ae2e1 100644 --- a/src/autocomplete/PlainWithPillsSerializer.js +++ b/src/autocomplete/PlainWithPillsSerializer.js @@ -31,7 +31,7 @@ class PlainWithPillsSerializer { * @param {String} options.pillFormat - either 'md', 'plain', 'id' */ constructor(options = {}) { - let { + const { pillFormat = 'plain', } = options; this.pillFormat = pillFormat; @@ -46,7 +46,7 @@ class PlainWithPillsSerializer { * @return {String} */ serialize = value => { - return this._serializeNode(value.document) + return this._serializeNode(value.document); } /** @@ -61,8 +61,7 @@ class PlainWithPillsSerializer { (node.object == 'block' && Block.isBlockList(node.nodes)) ) { return node.nodes.map(this._serializeNode).join('\n'); - } - else if (node.type == 'emoji') { + } else if (node.type == 'emoji') { return node.data.get('emojiUnicode'); } else if (node.type == 'pill') { switch (this.pillFormat) { @@ -73,11 +72,9 @@ class PlainWithPillsSerializer { case 'id': return node.data.get('completionId') || node.data.get('completion'); } - } - else if (node.nodes) { + } else if (node.nodes) { return node.nodes.map(this._serializeNode).join(''); - } - else { + } else { return node.text; } } @@ -89,4 +86,4 @@ class PlainWithPillsSerializer { * @type {PlainWithPillsSerializer} */ -export default PlainWithPillsSerializer \ No newline at end of file +export default PlainWithPillsSerializer; From 7de45f8b7beb9e7069b643b02f8b9c904cb5aab4 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 21 May 2018 03:48:59 +0100 Subject: [PATCH 076/702] make quoting work --- src/HtmlUtils.js | 32 ++++-- .../views/context_menus/MessageContextMenu.js | 2 +- .../views/rooms/MessageComposerInput.js | 107 +++++++++++------- 3 files changed, 85 insertions(+), 56 deletions(-) diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js index 4c1564297d..607686d46d 100644 --- a/src/HtmlUtils.js +++ b/src/HtmlUtils.js @@ -403,19 +403,22 @@ class TextHighlighter extends BaseHighlighter { } - /* turn a matrix event body into html - * - * content: 'content' of the MatrixEvent - * - * highlights: optional list of words to highlight, ordered by longest word first - * - * opts.highlightLink: optional href to add to highlighted words - * opts.disableBigEmoji: optional argument to disable the big emoji class. - * opts.stripReplyFallback: optional argument specifying the event is a reply and so fallback needs removing - */ +/* turn a matrix event body into html + * + * content: 'content' of the MatrixEvent + * + * highlights: optional list of words to highlight, ordered by longest word first + * + * opts.highlightLink: optional href to add to highlighted words + * opts.disableBigEmoji: optional argument to disable the big emoji class. + * opts.stripReplyFallback: optional argument specifying the event is a reply and so fallback needs removing + * opts.returnString: return an HTML string rather than JSX elements + * opts.emojiOne: optional param to do emojiOne (default true) + */ export function bodyToHtml(content, highlights, opts={}) { const isHtmlMessage = content.format === "org.matrix.custom.html" && content.formatted_body; + const doEmojiOne = opts.emojiOne === undefined ? true : opts.emojiOne; let bodyHasEmoji = false; let strippedBody; @@ -441,8 +444,9 @@ export function bodyToHtml(content, highlights, opts={}) { if (opts.stripReplyFallback && formattedBody) formattedBody = ReplyThread.stripHTMLReply(formattedBody); strippedBody = opts.stripReplyFallback ? ReplyThread.stripPlainReply(content.body) : content.body; - bodyHasEmoji = containsEmoji(isHtmlMessage ? formattedBody : content.body); - + if (doEmojiOne) { + bodyHasEmoji = containsEmoji(isHtmlMessage ? formattedBody : content.body); + } // Only generate safeBody if the message was sent as org.matrix.custom.html if (isHtmlMessage) { @@ -467,6 +471,10 @@ export function bodyToHtml(content, highlights, opts={}) { delete sanitizeHtmlParams.textFilter; } + if (opts.returnString) { + return isDisplayedWithHtml ? safeBody : strippedBody; + } + let emojiBody = false; if (!opts.disableBigEmoji && bodyHasEmoji) { EMOJI_REGEX.lastIndex = 0; diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index 99ec493ced..22c6f2aa70 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -179,7 +179,7 @@ module.exports = React.createClass({ onQuoteClick: function() { dis.dispatch({ action: 'quote', - text: this.props.eventTileOps.getInnerText(), + event: this.props.mxEvent, }); this.closeMenu(); }, diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 1f0a544246..eb4edfcfcb 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -21,7 +21,7 @@ import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent'; import { Editor } from 'slate-react'; import { getEventTransfer } from 'slate-react'; -import { Value, Document, Event, Inline, Text, Range, Node } from 'slate'; +import { Value, Document, Event, Block, Inline, Text, Range, Node } from 'slate'; import Html from 'slate-html-serializer'; import Md from 'slate-md-serializer'; @@ -342,37 +342,44 @@ export default class MessageComposerInput extends React.Component { }); } break; -/* - case 'quote': { // old quoting, whilst rich quoting is in labs - /// XXX: Not doing rich-text quoting from formatted-body because draft-js - /// has regressed such that when links are quoted, errors are thrown. See - /// https://github.com/vector-im/riot-web/issues/4756. - const body = escape(payload.text); - if (body) { - let content = RichText.htmlToContentState(`
    ${body}
    `); - if (!this.state.isRichTextEnabled) { - content = ContentState.createFromText(RichText.stateToMarkdown(content)); - } + case 'quote': { + const html = HtmlUtils.bodyToHtml(payload.event.getContent(), null, { + returnString: true, + emojiOne: false, + }); + const fragment = this.html.deserialize(html); + // FIXME: do we want to put in a permalink to the original quote here? + // If so, what should be the format, and how do we differentiate it from replies? - const blockMap = content.getBlockMap(); - let startSelection = SelectionState.createEmpty(contentState.getFirstBlock().getKey()); - contentState = Modifier.splitBlock(contentState, startSelection); - startSelection = SelectionState.createEmpty(contentState.getFirstBlock().getKey()); - contentState = Modifier.replaceWithFragment(contentState, - startSelection, - blockMap); - startSelection = SelectionState.createEmpty(contentState.getFirstBlock().getKey()); - if (this.state.isRichTextEnabled) { - contentState = Modifier.setBlockType(contentState, startSelection, 'blockquote'); + const quote = Block.create('block-quote'); + if (this.state.isRichTextEnabled) { + let change = editorState.change(); + if (editorState.anchorText.text === '' && editorState.anchorBlock.nodes.size === 1) { + // replace the current block rather than split the block + change = change.replaceNodeByKey(editorState.anchorBlock.key, quote); } - let editorState = EditorState.push(this.state.editorState, contentState, 'insert-characters'); - editorState = EditorState.moveSelectionToEnd(editorState); - this.onEditorContentChanged(editorState); - editor.focus(); + else { + // insert it into the middle of the block (splitting it) + change = change.insertBlock(quote); + } + change = change.insertFragmentByKey(quote.key, 0, fragment.document) + .focus(); + this.onChange(change); + } + else { + let fragmentChange = fragment.change(); + fragmentChange.moveToRangeOf(fragment.document) + .wrapBlock(quote); + + // FIXME: handle pills and use commonmark rather than md-serialize + const md = this.md.serialize(fragmentChange.value); + let change = editorState.change() + .insertText(md + '\n\n') + .focus(); + this.onChange(change); } } break; -*/ } }; @@ -555,7 +562,7 @@ export default class MessageComposerInput extends React.Component { } } - if (this.props.onInputStateChanged) { + if (this.props.onInputStateChanged && editorState.blocks.size > 0) { let blockType = editorState.blocks.first().type; // console.log("onInputStateChanged; current block type is " + blockType + " and marks are " + editorState.activeMarks); @@ -740,17 +747,31 @@ export default class MessageComposerInput extends React.Component { .unwrapBlock('numbered-list'); return change; } - else if (editorState.anchorOffset == 0 && - (this.hasBlock('block-quote') || - this.hasBlock('heading1') || - this.hasBlock('heading2') || - this.hasBlock('heading3') || - this.hasBlock('heading4') || - this.hasBlock('heading5') || - this.hasBlock('heading6') || - this.hasBlock('code-block'))) - { - return change.setBlocks(DEFAULT_NODE); + else if (editorState.anchorOffset == 0 && editorState.isCollapsed) { + // turn blocks back into paragraphs + if ((this.hasBlock('block-quote') || + this.hasBlock('heading1') || + this.hasBlock('heading2') || + this.hasBlock('heading3') || + this.hasBlock('heading4') || + this.hasBlock('heading5') || + this.hasBlock('heading6') || + this.hasBlock('code-block'))) + { + return change.setBlocks(DEFAULT_NODE); + } + + // remove paragraphs entirely if they're nested + const parent = editorState.document.getParent(editorState.anchorBlock.key); + if (editorState.anchorOffset == 0 && + this.hasBlock('paragraph') && + parent.nodes.size == 1 && + parent.object !== 'document') + { + return change.replaceNodeByKey(editorState.anchorBlock.key, editorState.anchorText) + .collapseToEndOf(parent) + .focus(); + } } } return; @@ -1013,7 +1034,7 @@ export default class MessageComposerInput extends React.Component { if (!shouldSendHTML) { shouldSendHTML = !!editorState.document.findDescendant(node => { // N.B. node.getMarks() might be private? - return ((node.object === 'block' && node.type !== 'line') || + return ((node.object === 'block' && node.type !== 'paragraph') || (node.object === 'inline') || (node.object === 'text' && node.getMarks().size > 0)); }); @@ -1131,13 +1152,13 @@ export default class MessageComposerInput extends React.Component { // heuristic to handle tall emoji, pills, etc pushing the cursor away from the top // or bottom of the page. // XXX: is this going to break on large inline images or top-to-bottom scripts? - const EDGE_THRESHOLD = 8; + const EDGE_THRESHOLD = 15; let navigateHistory = false; if (up) { const scrollCorrection = editorNode.scrollTop; const distanceFromTop = cursorRect.top - editorRect.top + scrollCorrection; - //console.log(`Cursor distance from editor top is ${distanceFromTop}`); + console.log(`Cursor distance from editor top is ${distanceFromTop}`); if (distanceFromTop < EDGE_THRESHOLD) { navigateHistory = true; } @@ -1146,7 +1167,7 @@ export default class MessageComposerInput extends React.Component { const scrollCorrection = editorNode.scrollHeight - editorNode.clientHeight - editorNode.scrollTop; const distanceFromBottom = editorRect.bottom - cursorRect.bottom + scrollCorrection; - //console.log(`Cursor distance from editor bottom is ${distanceFromBottom}`); + console.log(`Cursor distance from editor bottom is ${distanceFromBottom}`); if (distanceFromBottom < EDGE_THRESHOLD) { navigateHistory = true; } From 35ab573bc54c56911a6f566ce6227289658e6e22 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 21 May 2018 18:44:00 +0900 Subject: [PATCH 077/702] Update sinon to 5.0.7 --- package-lock.json | 2353 +++++++++-------- package.json | 2 +- .../structures/TimelinePanel-test.js | 2 +- 3 files changed, 1210 insertions(+), 1147 deletions(-) diff --git a/package-lock.json b/package-lock.json index f183f1635d..97ed7b5dea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,25 @@ { "name": "matrix-react-sdk", - "version": "0.12.2", + "version": "0.12.4", "lockfileVersion": 1, "requires": true, "dependencies": { + "@sinonjs/formatio": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", + "dev": true, + "requires": { + "samsam": "1.3.0" + } + }, "accepts": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", "integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=", "dev": true, "requires": { - "mime-types": "2.1.17", + "mime-types": "~2.1.11", "negotiator": "0.6.1" } }, @@ -26,7 +35,7 @@ "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", "dev": true, "requires": { - "acorn": "3.3.0" + "acorn": "^3.0.4" }, "dependencies": { "acorn": { @@ -44,14 +53,14 @@ "dev": true }, "ajv": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.3.tgz", - "integrity": "sha1-wG9Zh3jETGsWGrr+NGa4GtGBTtI=", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.0.0", - "json-schema-traverse": "0.3.1", - "json-stable-stringify": "1.0.1" + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" } }, "ajv-keywords": { @@ -66,9 +75,9 @@ "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { - "kind-of": "3.2.2", - "longest": "1.0.1", - "repeat-string": "1.6.1" + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" } }, "amdefine": { @@ -106,8 +115,8 @@ "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", "dev": true, "requires": { - "micromatch": "2.3.11", - "normalize-path": "2.1.1" + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" } }, "argparse": { @@ -116,7 +125,7 @@ "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", "dev": true, "requires": { - "sprintf-js": "1.0.3" + "sprintf-js": "~1.0.2" }, "dependencies": { "sprintf-js": { @@ -133,7 +142,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "1.1.0" + "arr-flatten": "^1.0.1" } }, "arr-flatten": { @@ -148,8 +157,8 @@ "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", "dev": true, "requires": { - "define-properties": "1.1.2", - "es-abstract": "1.9.0" + "define-properties": "^1.1.2", + "es-abstract": "^1.7.0" } }, "array-slice": { @@ -164,7 +173,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "1.0.3" + "array-uniq": "^1.0.1" } }, "array-uniq": { @@ -238,9 +247,9 @@ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" }, "babel-cli": { "version": "6.26.0", @@ -248,21 +257,21 @@ "integrity": "sha1-UCq1SHTX24itALiHoGODzgPQAvE=", "dev": true, "requires": { - "babel-core": "6.26.0", - "babel-polyfill": "6.26.0", - "babel-register": "6.26.0", - "babel-runtime": "6.26.0", - "chokidar": "1.7.0", - "commander": "2.11.0", - "convert-source-map": "1.5.0", - "fs-readdir-recursive": "1.0.0", - "glob": "7.1.2", - "lodash": "4.17.4", - "output-file-sync": "1.1.2", - "path-is-absolute": "1.0.1", - "slash": "1.0.0", - "source-map": "0.5.7", - "v8flags": "2.1.1" + "babel-core": "^6.26.0", + "babel-polyfill": "^6.26.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "chokidar": "^1.6.1", + "commander": "^2.11.0", + "convert-source-map": "^1.5.0", + "fs-readdir-recursive": "^1.0.0", + "glob": "^7.1.2", + "lodash": "^4.17.4", + "output-file-sync": "^1.1.2", + "path-is-absolute": "^1.0.1", + "slash": "^1.0.0", + "source-map": "^0.5.6", + "v8flags": "^2.1.1" }, "dependencies": { "glob": { @@ -271,12 +280,12 @@ "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } @@ -287,9 +296,9 @@ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" } }, "babel-core": { @@ -298,25 +307,25 @@ "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", "dev": true, "requires": { - "babel-code-frame": "6.26.0", - "babel-generator": "6.26.0", - "babel-helpers": "6.24.1", - "babel-messages": "6.23.0", - "babel-register": "6.26.0", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "convert-source-map": "1.5.0", - "debug": "2.6.9", - "json5": "0.5.1", - "lodash": "4.17.4", - "minimatch": "3.0.4", - "path-is-absolute": "1.0.1", - "private": "0.1.8", - "slash": "1.0.0", - "source-map": "0.5.7" + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.0", + "debug": "^2.6.8", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.7", + "slash": "^1.0.0", + "source-map": "^0.5.6" } }, "babel-eslint": { @@ -325,11 +334,11 @@ "integrity": "sha1-UpNBn+NnLWZZjTJ9qWlFZ7pqXy8=", "dev": true, "requires": { - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "lodash.assign": "4.2.0", - "lodash.pickby": "4.6.0" + "babel-traverse": "^6.0.20", + "babel-types": "^6.0.19", + "babylon": "^6.0.18", + "lodash.assign": "^4.0.0", + "lodash.pickby": "^4.0.0" } }, "babel-generator": { @@ -338,14 +347,14 @@ "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", "dev": true, "requires": { - "babel-messages": "6.23.0", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "detect-indent": "4.0.0", - "jsesc": "1.3.0", - "lodash": "4.17.4", - "source-map": "0.5.7", - "trim-right": "1.0.1" + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.6", + "trim-right": "^1.0.1" } }, "babel-helper-builder-binary-assignment-operator-visitor": { @@ -354,9 +363,9 @@ "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", "dev": true, "requires": { - "babel-helper-explode-assignable-expression": "6.24.1", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0" + "babel-helper-explode-assignable-expression": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, "babel-helper-builder-react-jsx": { @@ -365,9 +374,9 @@ "integrity": "sha1-Of+DE7dci2Xc7/HzHTg+D/KkCKA=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "esutils": "2.0.2" + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "esutils": "^2.0.2" } }, "babel-helper-call-delegate": { @@ -376,10 +385,10 @@ "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", "dev": true, "requires": { - "babel-helper-hoist-variables": "6.24.1", - "babel-runtime": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0" + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" } }, "babel-helper-define-map": { @@ -388,10 +397,10 @@ "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", "dev": true, "requires": { - "babel-helper-function-name": "6.24.1", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "lodash": "4.17.4" + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" } }, "babel-helper-explode-assignable-expression": { @@ -400,9 +409,9 @@ "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0" + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" } }, "babel-helper-function-name": { @@ -411,11 +420,11 @@ "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", "dev": true, "requires": { - "babel-helper-get-function-arity": "6.24.1", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0" + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" } }, "babel-helper-get-function-arity": { @@ -424,8 +433,8 @@ "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-types": "6.26.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, "babel-helper-hoist-variables": { @@ -434,8 +443,8 @@ "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-types": "6.26.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, "babel-helper-optimise-call-expression": { @@ -444,8 +453,8 @@ "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-types": "6.26.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, "babel-helper-regex": { @@ -454,9 +463,9 @@ "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "lodash": "4.17.4" + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" } }, "babel-helper-remap-async-to-generator": { @@ -465,11 +474,11 @@ "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", "dev": true, "requires": { - "babel-helper-function-name": "6.24.1", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0" + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" } }, "babel-helper-replace-supers": { @@ -478,12 +487,12 @@ "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", "dev": true, "requires": { - "babel-helper-optimise-call-expression": "6.24.1", - "babel-messages": "6.23.0", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0" + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" } }, "babel-helpers": { @@ -492,8 +501,8 @@ "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-template": "6.26.0" + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" } }, "babel-loader": { @@ -502,10 +511,10 @@ "integrity": "sha1-CzQRLVsHSKjc2/Uaz2+b1C1QuMo=", "dev": true, "requires": { - "find-cache-dir": "0.1.1", - "loader-utils": "0.2.17", - "mkdirp": "0.5.1", - "object-assign": "4.1.1" + "find-cache-dir": "^0.1.1", + "loader-utils": "^0.2.16", + "mkdirp": "^0.5.1", + "object-assign": "^4.0.1" } }, "babel-messages": { @@ -514,7 +523,7 @@ "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-add-module-exports": { @@ -529,7 +538,7 @@ "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-syntax-async-functions": { @@ -580,10 +589,10 @@ "integrity": "sha1-Ruo+fFr2KXgqyfHtG3zTj4Qlr9Q=", "dev": true, "requires": { - "babel-helper-function-name": "6.24.1", - "babel-plugin-syntax-async-functions": "6.13.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0" + "babel-helper-function-name": "^6.8.0", + "babel-plugin-syntax-async-functions": "^6.8.0", + "babel-template": "^6.9.0", + "babel-traverse": "^6.10.4" } }, "babel-plugin-transform-async-to-generator": { @@ -592,9 +601,9 @@ "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", "dev": true, "requires": { - "babel-helper-remap-async-to-generator": "6.24.1", - "babel-plugin-syntax-async-functions": "6.13.0", - "babel-runtime": "6.26.0" + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-functions": "^6.8.0", + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-class-properties": { @@ -603,10 +612,10 @@ "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", "dev": true, "requires": { - "babel-helper-function-name": "6.24.1", - "babel-plugin-syntax-class-properties": "6.13.0", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0" + "babel-helper-function-name": "^6.24.1", + "babel-plugin-syntax-class-properties": "^6.8.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" } }, "babel-plugin-transform-es2015-arrow-functions": { @@ -615,7 +624,7 @@ "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-es2015-block-scoped-functions": { @@ -624,7 +633,7 @@ "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-es2015-block-scoping": { @@ -633,11 +642,11 @@ "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "lodash": "4.17.4" + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" } }, "babel-plugin-transform-es2015-classes": { @@ -646,15 +655,15 @@ "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", "dev": true, "requires": { - "babel-helper-define-map": "6.26.0", - "babel-helper-function-name": "6.24.1", - "babel-helper-optimise-call-expression": "6.24.1", - "babel-helper-replace-supers": "6.24.1", - "babel-messages": "6.23.0", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0" + "babel-helper-define-map": "^6.24.1", + "babel-helper-function-name": "^6.24.1", + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-helper-replace-supers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" } }, "babel-plugin-transform-es2015-computed-properties": { @@ -663,8 +672,8 @@ "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-template": "6.26.0" + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" } }, "babel-plugin-transform-es2015-destructuring": { @@ -673,7 +682,7 @@ "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-es2015-duplicate-keys": { @@ -682,8 +691,8 @@ "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-types": "6.26.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, "babel-plugin-transform-es2015-for-of": { @@ -692,7 +701,7 @@ "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-es2015-function-name": { @@ -701,9 +710,9 @@ "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", "dev": true, "requires": { - "babel-helper-function-name": "6.24.1", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0" + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, "babel-plugin-transform-es2015-literals": { @@ -712,7 +721,7 @@ "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-es2015-modules-amd": { @@ -721,9 +730,9 @@ "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", "dev": true, "requires": { - "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0" + "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" } }, "babel-plugin-transform-es2015-modules-commonjs": { @@ -732,10 +741,10 @@ "integrity": "sha1-DYOUApt9xqvhqX7xgeAHWN0uXYo=", "dev": true, "requires": { - "babel-plugin-transform-strict-mode": "6.24.1", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0", - "babel-types": "6.26.0" + "babel-plugin-transform-strict-mode": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-types": "^6.26.0" } }, "babel-plugin-transform-es2015-modules-systemjs": { @@ -744,9 +753,9 @@ "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", "dev": true, "requires": { - "babel-helper-hoist-variables": "6.24.1", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0" + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" } }, "babel-plugin-transform-es2015-modules-umd": { @@ -755,9 +764,9 @@ "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", "dev": true, "requires": { - "babel-plugin-transform-es2015-modules-amd": "6.24.1", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0" + "babel-plugin-transform-es2015-modules-amd": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" } }, "babel-plugin-transform-es2015-object-super": { @@ -766,8 +775,8 @@ "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", "dev": true, "requires": { - "babel-helper-replace-supers": "6.24.1", - "babel-runtime": "6.26.0" + "babel-helper-replace-supers": "^6.24.1", + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-es2015-parameters": { @@ -776,12 +785,12 @@ "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", "dev": true, "requires": { - "babel-helper-call-delegate": "6.24.1", - "babel-helper-get-function-arity": "6.24.1", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0" + "babel-helper-call-delegate": "^6.24.1", + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" } }, "babel-plugin-transform-es2015-shorthand-properties": { @@ -790,8 +799,8 @@ "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-types": "6.26.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, "babel-plugin-transform-es2015-spread": { @@ -800,7 +809,7 @@ "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-es2015-sticky-regex": { @@ -809,9 +818,9 @@ "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", "dev": true, "requires": { - "babel-helper-regex": "6.26.0", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0" + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, "babel-plugin-transform-es2015-template-literals": { @@ -820,7 +829,7 @@ "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-es2015-typeof-symbol": { @@ -829,7 +838,7 @@ "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-es2015-unicode-regex": { @@ -838,9 +847,9 @@ "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", "dev": true, "requires": { - "babel-helper-regex": "6.26.0", - "babel-runtime": "6.26.0", - "regexpu-core": "2.0.0" + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "regexpu-core": "^2.0.0" } }, "babel-plugin-transform-exponentiation-operator": { @@ -849,9 +858,9 @@ "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", "dev": true, "requires": { - "babel-helper-builder-binary-assignment-operator-visitor": "6.24.1", - "babel-plugin-syntax-exponentiation-operator": "6.13.0", - "babel-runtime": "6.26.0" + "babel-helper-builder-binary-assignment-operator-visitor": "^6.24.1", + "babel-plugin-syntax-exponentiation-operator": "^6.8.0", + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-flow-strip-types": { @@ -860,8 +869,8 @@ "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", "dev": true, "requires": { - "babel-plugin-syntax-flow": "6.18.0", - "babel-runtime": "6.26.0" + "babel-plugin-syntax-flow": "^6.18.0", + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-object-rest-spread": { @@ -870,8 +879,8 @@ "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", "dev": true, "requires": { - "babel-plugin-syntax-object-rest-spread": "6.13.0", - "babel-runtime": "6.26.0" + "babel-plugin-syntax-object-rest-spread": "^6.8.0", + "babel-runtime": "^6.26.0" } }, "babel-plugin-transform-react-display-name": { @@ -880,7 +889,7 @@ "integrity": "sha1-Z+K/Hx6ck6sI25Z5LgU5K/LMKNE=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-react-jsx": { @@ -889,9 +898,9 @@ "integrity": "sha1-hAoCjn30YN/DotKfDA2R9jduZqM=", "dev": true, "requires": { - "babel-helper-builder-react-jsx": "6.26.0", - "babel-plugin-syntax-jsx": "6.18.0", - "babel-runtime": "6.26.0" + "babel-helper-builder-react-jsx": "^6.24.1", + "babel-plugin-syntax-jsx": "^6.8.0", + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-react-jsx-self": { @@ -900,8 +909,8 @@ "integrity": "sha1-322AqdomEqEh5t3XVYvL7PBuY24=", "dev": true, "requires": { - "babel-plugin-syntax-jsx": "6.18.0", - "babel-runtime": "6.26.0" + "babel-plugin-syntax-jsx": "^6.8.0", + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-react-jsx-source": { @@ -910,8 +919,8 @@ "integrity": "sha1-ZqwSFT9c0tF7PBkmj0vwGX9E7NY=", "dev": true, "requires": { - "babel-plugin-syntax-jsx": "6.18.0", - "babel-runtime": "6.26.0" + "babel-plugin-syntax-jsx": "^6.8.0", + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-regenerator": { @@ -920,7 +929,7 @@ "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", "dev": true, "requires": { - "regenerator-transform": "0.10.1" + "regenerator-transform": "^0.10.0" } }, "babel-plugin-transform-runtime": { @@ -929,7 +938,7 @@ "integrity": "sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4=", "dev": true, "requires": { - "babel-runtime": "6.26.0" + "babel-runtime": "^6.22.0" } }, "babel-plugin-transform-strict-mode": { @@ -938,8 +947,8 @@ "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-types": "6.26.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" } }, "babel-polyfill": { @@ -948,9 +957,9 @@ "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "core-js": "2.5.1", - "regenerator-runtime": "0.10.5" + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "regenerator-runtime": "^0.10.5" }, "dependencies": { "regenerator-runtime": { @@ -967,30 +976,30 @@ "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", "dev": true, "requires": { - "babel-plugin-check-es2015-constants": "6.22.0", - "babel-plugin-transform-es2015-arrow-functions": "6.22.0", - "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", - "babel-plugin-transform-es2015-block-scoping": "6.26.0", - "babel-plugin-transform-es2015-classes": "6.24.1", - "babel-plugin-transform-es2015-computed-properties": "6.24.1", - "babel-plugin-transform-es2015-destructuring": "6.23.0", - "babel-plugin-transform-es2015-duplicate-keys": "6.24.1", - "babel-plugin-transform-es2015-for-of": "6.23.0", - "babel-plugin-transform-es2015-function-name": "6.24.1", - "babel-plugin-transform-es2015-literals": "6.22.0", - "babel-plugin-transform-es2015-modules-amd": "6.24.1", - "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", - "babel-plugin-transform-es2015-modules-systemjs": "6.24.1", - "babel-plugin-transform-es2015-modules-umd": "6.24.1", - "babel-plugin-transform-es2015-object-super": "6.24.1", - "babel-plugin-transform-es2015-parameters": "6.24.1", - "babel-plugin-transform-es2015-shorthand-properties": "6.24.1", - "babel-plugin-transform-es2015-spread": "6.22.0", - "babel-plugin-transform-es2015-sticky-regex": "6.24.1", - "babel-plugin-transform-es2015-template-literals": "6.22.0", - "babel-plugin-transform-es2015-typeof-symbol": "6.23.0", - "babel-plugin-transform-es2015-unicode-regex": "6.24.1", - "babel-plugin-transform-regenerator": "6.26.0" + "babel-plugin-check-es2015-constants": "^6.22.0", + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoping": "^6.24.1", + "babel-plugin-transform-es2015-classes": "^6.24.1", + "babel-plugin-transform-es2015-computed-properties": "^6.24.1", + "babel-plugin-transform-es2015-destructuring": "^6.22.0", + "babel-plugin-transform-es2015-duplicate-keys": "^6.24.1", + "babel-plugin-transform-es2015-for-of": "^6.22.0", + "babel-plugin-transform-es2015-function-name": "^6.24.1", + "babel-plugin-transform-es2015-literals": "^6.22.0", + "babel-plugin-transform-es2015-modules-amd": "^6.24.1", + "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", + "babel-plugin-transform-es2015-modules-systemjs": "^6.24.1", + "babel-plugin-transform-es2015-modules-umd": "^6.24.1", + "babel-plugin-transform-es2015-object-super": "^6.24.1", + "babel-plugin-transform-es2015-parameters": "^6.24.1", + "babel-plugin-transform-es2015-shorthand-properties": "^6.24.1", + "babel-plugin-transform-es2015-spread": "^6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "^6.24.1", + "babel-plugin-transform-es2015-template-literals": "^6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "^6.22.0", + "babel-plugin-transform-es2015-unicode-regex": "^6.24.1", + "babel-plugin-transform-regenerator": "^6.24.1" } }, "babel-preset-es2016": { @@ -999,7 +1008,7 @@ "integrity": "sha1-+QC/k+LrwNJ235uKtZck6/2Vn4s=", "dev": true, "requires": { - "babel-plugin-transform-exponentiation-operator": "6.24.1" + "babel-plugin-transform-exponentiation-operator": "^6.24.1" } }, "babel-preset-es2017": { @@ -1008,8 +1017,8 @@ "integrity": "sha1-WXvq37n38gi8/YoS6bKym4svFNE=", "dev": true, "requires": { - "babel-plugin-syntax-trailing-function-commas": "6.22.0", - "babel-plugin-transform-async-to-generator": "6.24.1" + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-async-to-generator": "^6.24.1" } }, "babel-preset-flow": { @@ -1018,7 +1027,7 @@ "integrity": "sha1-5xIYiHCFrpoktb5Baa/7WZgWxJ0=", "dev": true, "requires": { - "babel-plugin-transform-flow-strip-types": "6.22.0" + "babel-plugin-transform-flow-strip-types": "^6.22.0" } }, "babel-preset-react": { @@ -1027,12 +1036,12 @@ "integrity": "sha1-umnfrqRfw+xjm2pOzqbhdwLJE4A=", "dev": true, "requires": { - "babel-plugin-syntax-jsx": "6.18.0", - "babel-plugin-transform-react-display-name": "6.25.0", - "babel-plugin-transform-react-jsx": "6.24.1", - "babel-plugin-transform-react-jsx-self": "6.22.0", - "babel-plugin-transform-react-jsx-source": "6.22.0", - "babel-preset-flow": "6.23.0" + "babel-plugin-syntax-jsx": "^6.3.13", + "babel-plugin-transform-react-display-name": "^6.23.0", + "babel-plugin-transform-react-jsx": "^6.24.1", + "babel-plugin-transform-react-jsx-self": "^6.22.0", + "babel-plugin-transform-react-jsx-source": "^6.22.0", + "babel-preset-flow": "^6.23.0" } }, "babel-register": { @@ -1041,13 +1050,13 @@ "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", "dev": true, "requires": { - "babel-core": "6.26.0", - "babel-runtime": "6.26.0", - "core-js": "2.5.1", - "home-or-tmp": "2.0.0", - "lodash": "4.17.4", - "mkdirp": "0.5.1", - "source-map-support": "0.4.18" + "babel-core": "^6.26.0", + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "home-or-tmp": "^2.0.0", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "source-map-support": "^0.4.15" } }, "babel-runtime": { @@ -1055,8 +1064,8 @@ "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "requires": { - "core-js": "2.5.1", - "regenerator-runtime": "0.11.0" + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" } }, "babel-template": { @@ -1065,11 +1074,11 @@ "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "lodash": "4.17.4" + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" } }, "babel-traverse": { @@ -1078,15 +1087,15 @@ "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", "dev": true, "requires": { - "babel-code-frame": "6.26.0", - "babel-messages": "6.23.0", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "debug": "2.6.9", - "globals": "9.18.0", - "invariant": "2.2.2", - "lodash": "4.17.4" + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" } }, "babel-types": { @@ -1095,10 +1104,10 @@ "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "esutils": "2.0.2", - "lodash": "4.17.4", - "to-fast-properties": "1.0.3" + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" } }, "babylon": { @@ -1142,7 +1151,7 @@ "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "better-assert": { @@ -1189,28 +1198,23 @@ "dev": true, "requires": { "bytes": "3.0.0", - "content-type": "1.0.4", + "content-type": "~1.0.4", "debug": "2.6.9", - "depd": "1.1.1", - "http-errors": "1.6.2", + "depd": "~1.1.1", + "http-errors": "~1.6.2", "iconv-lite": "0.4.19", - "on-finished": "2.3.0", + "on-finished": "~2.3.0", "qs": "6.5.1", "raw-body": "2.3.2", - "type-is": "1.6.15" + "type-is": "~1.6.15" } }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=" - }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -1220,9 +1224,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" } }, "browser-encrypt-attachment": { @@ -1247,7 +1251,7 @@ "integrity": "sha1-BnFJtmjfMcS1hTPgLQHoBthgjiw=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "^2.0.1" } }, "browserify-zlib": { @@ -1256,7 +1260,7 @@ "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", "dev": true, "requires": { - "pako": "0.2.9" + "pako": "~0.2.0" }, "dependencies": { "pako": { @@ -1273,9 +1277,9 @@ "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { - "base64-js": "1.2.1", - "ieee754": "1.1.8", - "isarray": "1.0.0" + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" } }, "builtin-status-codes": { @@ -1296,7 +1300,7 @@ "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", "dev": true, "requires": { - "callsites": "0.2.0" + "callsites": "^0.2.0" } }, "callsite": { @@ -1328,8 +1332,8 @@ "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", "dev": true, "requires": { - "align-text": "0.1.4", - "lazy-cache": "1.0.4" + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" } }, "chalk": { @@ -1338,11 +1342,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" } }, "chokidar": { @@ -1351,15 +1355,15 @@ "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", "dev": true, "requires": { - "anymatch": "1.3.2", - "async-each": "1.0.1", - "fsevents": "1.1.2", - "glob-parent": "2.0.0", - "inherits": "2.0.3", - "is-binary-path": "1.0.1", - "is-glob": "2.0.1", - "path-is-absolute": "1.0.1", - "readdirp": "2.1.0" + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" } }, "circular-json": { @@ -1379,7 +1383,7 @@ "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", "dev": true, "requires": { - "restore-cursor": "1.0.1" + "restore-cursor": "^1.0.1" } }, "cli-width": { @@ -1394,8 +1398,8 @@ "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", + "center-align": "^0.1.1", + "right-align": "^0.1.1", "wordwrap": "0.0.2" }, "dependencies": { @@ -1436,15 +1440,15 @@ "integrity": "sha1-RYwH4J4NkA/Ci3Cj/sLazR0st/Y=", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "^4.5.0" } }, "combined-stream": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "commander": { @@ -1464,10 +1468,10 @@ "resolved": "https://registry.npmjs.org/commonmark/-/commonmark-0.28.1.tgz", "integrity": "sha1-Buq41SM4uDn6Gi11rwCF7tGxvq4=", "requires": { - "entities": "1.1.1", - "mdurl": "1.0.1", - "minimist": "1.2.0", - "string.prototype.repeat": "0.2.0" + "entities": "~ 1.1.1", + "mdurl": "~ 1.0.1", + "minimist": "~ 1.2.0", + "string.prototype.repeat": "^0.2.0" } }, "component-bind": { @@ -1499,9 +1503,9 @@ "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" } }, "connect": { @@ -1512,7 +1516,7 @@ "requires": { "debug": "2.6.9", "finalhandler": "1.0.6", - "parseurl": "1.3.2", + "parseurl": "~1.3.2", "utils-merge": "1.0.1" } }, @@ -1522,7 +1526,7 @@ "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", "dev": true, "requires": { - "date-now": "0.1.4" + "date-now": "^0.1.4" } }, "constants-browserify": { @@ -1563,11 +1567,11 @@ "resolved": "https://registry.npmjs.org/counterpart/-/counterpart-0.18.3.tgz", "integrity": "sha512-tli4qPAFeYB34LvvCc/1xYRLCWjf4WsUt6sXfpggDfGDKoI8rhnabz0SljDoBpAK8z1u8GBCg0YDkbvWb16uUQ==", "requires": { - "date-names": "0.1.10", - "except": "0.1.3", - "extend": "3.0.1", - "pluralizers": "0.1.6", - "sprintf-js": "1.1.1" + "date-names": "^0.1.9", + "except": "^0.1.3", + "extend": "^3.0.0", + "pluralizers": "^0.1.6", + "sprintf-js": "^1.0.3" } }, "create-react-class": { @@ -1575,24 +1579,9 @@ "resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.6.2.tgz", "integrity": "sha1-zx7RXxKq1/FO9fLf4F5sQvke8Co=", "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1" - } - }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "requires": { - "boom": "5.2.0" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==" - } + "fbjs": "^0.8.9", + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" } }, "crypto-browserify": { @@ -1619,7 +1608,7 @@ "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { - "es5-ext": "0.10.35" + "es5-ext": "^0.10.9" } }, "dashdash": { @@ -1627,7 +1616,7 @@ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "date-names": { @@ -1668,8 +1657,8 @@ "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", "dev": true, "requires": { - "foreach": "2.0.5", - "object-keys": "1.0.11" + "foreach": "^2.0.5", + "object-keys": "^1.0.8" } }, "del": { @@ -1678,13 +1667,13 @@ "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", "dev": true, "requires": { - "globby": "5.0.0", - "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.0", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "rimraf": "2.6.2" + "globby": "^5.0.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "rimraf": "^2.2.8" } }, "delayed-stream": { @@ -1704,7 +1693,7 @@ "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", "dev": true, "requires": { - "repeating": "2.0.1" + "repeating": "^2.0.0" } }, "di": { @@ -1713,14 +1702,20 @@ "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", "dev": true }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, "doctrine": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", "dev": true, "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" + "esutils": "^2.0.2", + "isarray": "^1.0.0" } }, "dom-serialize": { @@ -1729,10 +1724,10 @@ "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", "dev": true, "requires": { - "custom-event": "1.0.1", - "ent": "2.2.0", - "extend": "3.0.1", - "void-elements": "2.0.1" + "custom-event": "~1.0.0", + "ent": "~2.2.0", + "extend": "^3.0.0", + "void-elements": "^2.0.0" } }, "dom-serializer": { @@ -1740,8 +1735,8 @@ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" + "domelementtype": "~1.1.1", + "entities": "~1.1.1" }, "dependencies": { "domelementtype": { @@ -1767,7 +1762,7 @@ "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz", "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", "requires": { - "domelementtype": "1.3.0" + "domelementtype": "1" } }, "domutils": { @@ -1775,8 +1770,8 @@ "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.6.2.tgz", "integrity": "sha1-GVjMC0yUJuntNn+xyOhUiRsPo/8=", "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" + "dom-serializer": "0", + "domelementtype": "1" } }, "draft-js": { @@ -1784,9 +1779,9 @@ "resolved": "https://registry.npmjs.org/draft-js/-/draft-js-0.11.0-alpha.tgz", "integrity": "sha1-MtshCPkn6bhEbaH3nkR1wrf4aK4=", "requires": { - "fbjs": "0.8.16", - "immutable": "3.7.6", - "object-assign": "4.1.1" + "fbjs": "^0.8.12", + "immutable": "~3.7.4", + "object-assign": "^4.1.0" } }, "draft-js-export-html": { @@ -1794,7 +1789,7 @@ "resolved": "https://registry.npmjs.org/draft-js-export-html/-/draft-js-export-html-0.6.0.tgz", "integrity": "sha1-zIDwVExD0Kf+28U8DLCRToCQ92k=", "requires": { - "draft-js-utils": "1.2.0" + "draft-js-utils": ">=0.2.0" } }, "draft-js-export-markdown": { @@ -1802,7 +1797,7 @@ "resolved": "https://registry.npmjs.org/draft-js-export-markdown/-/draft-js-export-markdown-0.3.0.tgz", "integrity": "sha1-hjkOA86vHTR/xhaGerf1Net2v0I=", "requires": { - "draft-js-utils": "1.2.0" + "draft-js-utils": ">=0.2.0" } }, "draft-js-utils": { @@ -1816,7 +1811,7 @@ "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, "ee-first": { @@ -1847,7 +1842,7 @@ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", "requires": { - "iconv-lite": "0.4.19" + "iconv-lite": "~0.4.13" } }, "engine.io": { @@ -1944,9 +1939,9 @@ "integrity": "sha1-TW5omzcl+GCQknzMhs2fFjW4ni4=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "memory-fs": "0.2.0", - "tapable": "0.1.10" + "graceful-fs": "^4.1.2", + "memory-fs": "^0.2.0", + "tapable": "^0.1.8" }, "dependencies": { "memory-fs": { @@ -1974,7 +1969,7 @@ "integrity": "sha1-uJbiOp5ei6M4cfyZar02NfyaHH0=", "dev": true, "requires": { - "prr": "0.0.0" + "prr": "~0.0.0" } }, "es-abstract": { @@ -1983,11 +1978,11 @@ "integrity": "sha512-kk3IJoKo7A3pWJc0OV8yZ/VEX2oSUytfekrJiqoxBlKJMFAJVJVpGdHClCCTdv+Fn2zHfpDHHIelMFhZVfef3Q==", "dev": true, "requires": { - "es-to-primitive": "1.1.1", - "function-bind": "1.1.1", - "has": "1.0.1", - "is-callable": "1.1.3", - "is-regex": "1.0.4" + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" } }, "es-to-primitive": { @@ -1996,9 +1991,9 @@ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", "dev": true, "requires": { - "is-callable": "1.1.3", - "is-date-object": "1.0.1", - "is-symbol": "1.0.1" + "is-callable": "^1.1.1", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.1" } }, "es5-ext": { @@ -2007,8 +2002,8 @@ "integrity": "sha1-GO6FjOajxFx9eekcFfzKnsVoSU8=", "dev": true, "requires": { - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1" + "es6-iterator": "~2.0.1", + "es6-symbol": "~3.1.1" } }, "es6-iterator": { @@ -2017,9 +2012,9 @@ "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35", - "es6-symbol": "3.1.1" + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" } }, "es6-map": { @@ -2028,12 +2023,12 @@ "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35", - "es6-iterator": "2.0.3", - "es6-set": "0.1.5", - "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", + "es6-set": "~0.1.5", + "es6-symbol": "~3.1.1", + "event-emitter": "~0.3.5" } }, "es6-set": { @@ -2042,11 +2037,11 @@ "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35", - "es6-iterator": "2.0.3", + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" + "event-emitter": "~0.3.5" } }, "es6-symbol": { @@ -2055,8 +2050,8 @@ "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35" + "d": "1", + "es5-ext": "~0.10.14" } }, "es6-weak-map": { @@ -2065,10 +2060,10 @@ "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35", - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1" + "d": "1", + "es5-ext": "^0.10.14", + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" } }, "escape-html": { @@ -2089,10 +2084,10 @@ "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", "dev": true, "requires": { - "es6-map": "0.1.5", - "es6-weak-map": "2.0.2", - "esrecurse": "4.2.0", - "estraverse": "4.2.0" + "es6-map": "^0.1.3", + "es6-weak-map": "^2.0.1", + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" } }, "eslint": { @@ -2101,41 +2096,41 @@ "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", "dev": true, "requires": { - "babel-code-frame": "6.26.0", - "chalk": "1.1.3", - "concat-stream": "1.6.0", - "debug": "2.6.9", - "doctrine": "2.0.0", - "escope": "3.6.0", - "espree": "3.5.1", - "esquery": "1.0.0", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "glob": "7.1.2", - "globals": "9.18.0", - "ignore": "3.3.5", - "imurmurhash": "0.1.4", - "inquirer": "0.12.0", - "is-my-json-valid": "2.16.1", - "is-resolvable": "1.0.0", - "js-yaml": "3.10.0", - "json-stable-stringify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "1.2.1", - "progress": "1.1.8", - "require-uncached": "1.0.3", - "shelljs": "0.7.8", - "strip-bom": "3.0.0", - "strip-json-comments": "2.0.1", - "table": "3.8.3", - "text-table": "0.2.0", - "user-home": "2.0.0" + "babel-code-frame": "^6.16.0", + "chalk": "^1.1.3", + "concat-stream": "^1.5.2", + "debug": "^2.1.1", + "doctrine": "^2.0.0", + "escope": "^3.6.0", + "espree": "^3.4.0", + "esquery": "^1.0.0", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "file-entry-cache": "^2.0.0", + "glob": "^7.0.3", + "globals": "^9.14.0", + "ignore": "^3.2.0", + "imurmurhash": "^0.1.4", + "inquirer": "^0.12.0", + "is-my-json-valid": "^2.10.0", + "is-resolvable": "^1.0.0", + "js-yaml": "^3.5.1", + "json-stable-stringify": "^1.0.0", + "levn": "^0.3.0", + "lodash": "^4.0.0", + "mkdirp": "^0.5.0", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "path-is-inside": "^1.0.1", + "pluralize": "^1.2.1", + "progress": "^1.1.8", + "require-uncached": "^1.0.2", + "shelljs": "^0.7.5", + "strip-bom": "^3.0.0", + "strip-json-comments": "~2.0.1", + "table": "^3.7.8", + "text-table": "~0.2.0", + "user-home": "^2.0.0" }, "dependencies": { "glob": { @@ -2144,12 +2139,12 @@ "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "user-home": { @@ -2158,7 +2153,7 @@ "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", "dev": true, "requires": { - "os-homedir": "1.0.2" + "os-homedir": "^1.0.0" } } } @@ -2181,7 +2176,7 @@ "integrity": "sha512-RiQv+7Z9QDJuzt+NO8sYgkLGT+h+WeCrxP7y8lI7wpU41x3x/2o3PGtHk9ck8QnA9/mlbNcy/hG0eKvmd7npaA==", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "^4.15.0" } }, "eslint-plugin-react": { @@ -2190,10 +2185,10 @@ "integrity": "sha512-KC7Snr4YsWZD5flu6A5c0AcIZidzW3Exbqp7OT67OaD2AppJtlBr/GuPrW/vaQM/yfZotEvKAdrxrO+v8vwYJA==", "dev": true, "requires": { - "doctrine": "2.1.0", - "has": "1.0.1", - "jsx-ast-utils": "2.0.1", - "prop-types": "15.6.0" + "doctrine": "^2.0.2", + "has": "^1.0.1", + "jsx-ast-utils": "^2.0.1", + "prop-types": "^15.6.0" }, "dependencies": { "doctrine": { @@ -2202,7 +2197,7 @@ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "2.0.2" + "esutils": "^2.0.2" } } } @@ -2213,8 +2208,8 @@ "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", "dev": true, "requires": { - "acorn": "5.1.2", - "acorn-jsx": "3.0.1" + "acorn": "^5.1.1", + "acorn-jsx": "^3.0.0" } }, "esprima": { @@ -2229,7 +2224,7 @@ "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", "dev": true, "requires": { - "estraverse": "4.2.0" + "estraverse": "^4.0.0" } }, "esrecurse": { @@ -2238,8 +2233,8 @@ "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", "dev": true, "requires": { - "estraverse": "4.2.0", - "object-assign": "4.1.1" + "estraverse": "^4.1.0", + "object-assign": "^4.0.1" } }, "estraverse": { @@ -2266,8 +2261,8 @@ "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35" + "d": "1", + "es5-ext": "~0.10.14" } }, "eventemitter3": { @@ -2302,9 +2297,9 @@ "integrity": "sha1-SIsdHSRRyz06axks/AMPRMWFX+o=", "dev": true, "requires": { - "array-slice": "0.2.3", - "array-unique": "0.2.1", - "braces": "0.1.5" + "array-slice": "^0.2.3", + "array-unique": "^0.2.1", + "braces": "^0.1.2" }, "dependencies": { "braces": { @@ -2313,7 +2308,7 @@ "integrity": "sha1-wIVxEIUpHYt1/ddOqw+FlygHEeY=", "dev": true, "requires": { - "expand-range": "0.1.1" + "expand-range": "^0.1.0" } }, "expand-range": { @@ -2322,8 +2317,8 @@ "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", "dev": true, "requires": { - "is-number": "0.1.1", - "repeat-string": "0.2.2" + "is-number": "^0.1.1", + "repeat-string": "^0.2.2" } }, "is-number": { @@ -2346,7 +2341,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "0.1.1" + "is-posix-bracket": "^0.1.0" } }, "expand-range": { @@ -2355,7 +2350,7 @@ "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { - "fill-range": "2.2.3" + "fill-range": "^2.1.0" } }, "expect": { @@ -2364,13 +2359,13 @@ "integrity": "sha1-1Fj+TFYAQDa64yMkFqP2Nh8E+WU=", "dev": true, "requires": { - "define-properties": "1.1.2", - "has": "1.0.1", - "is-equal": "1.5.5", - "is-regex": "1.0.4", - "object-inspect": "1.3.0", - "object-keys": "1.0.11", - "tmatch": "2.0.1" + "define-properties": "~1.1.2", + "has": "^1.0.1", + "is-equal": "^1.5.1", + "is-regex": "^1.0.3", + "object-inspect": "^1.1.0", + "object-keys": "^1.0.9", + "tmatch": "^2.0.1" } }, "extend": { @@ -2384,7 +2379,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } }, "extsprintf": { @@ -2393,9 +2388,14 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, "fast-deep-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, "fast-levenshtein": { "version": "2.0.6", @@ -2408,7 +2408,7 @@ "resolved": "https://registry.npmjs.org/fbemitter/-/fbemitter-2.1.1.tgz", "integrity": "sha1-Uj4U/a9SSIBbsC9i78M75wP1GGU=", "requires": { - "fbjs": "0.8.16" + "fbjs": "^0.8.4" } }, "fbjs": { @@ -2416,13 +2416,13 @@ "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.16.tgz", "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", "requires": { - "core-js": "1.2.7", - "isomorphic-fetch": "2.2.1", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "promise": "7.3.1", - "setimmediate": "1.0.5", - "ua-parser-js": "0.7.17" + "core-js": "^1.0.0", + "isomorphic-fetch": "^2.1.1", + "loose-envify": "^1.0.0", + "object-assign": "^4.1.0", + "promise": "^7.1.1", + "setimmediate": "^1.0.5", + "ua-parser-js": "^0.7.9" }, "dependencies": { "core-js": { @@ -2438,8 +2438,8 @@ "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", "dev": true, "requires": { - "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1" + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" } }, "file-entry-cache": { @@ -2448,8 +2448,8 @@ "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", "dev": true, "requires": { - "flat-cache": "1.3.0", - "object-assign": "4.1.1" + "flat-cache": "^1.2.1", + "object-assign": "^4.0.1" } }, "file-saver": { @@ -2474,11 +2474,11 @@ "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", "dev": true, "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.7", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^1.1.3", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" } }, "finalhandler": { @@ -2488,12 +2488,12 @@ "dev": true, "requires": { "debug": "2.6.9", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.3.1", - "unpipe": "1.0.0" + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" } }, "find-cache-dir": { @@ -2502,9 +2502,9 @@ "integrity": "sha1-yN765XyKUqinhPnjHFfHQumToLk=", "dev": true, "requires": { - "commondir": "1.0.1", - "mkdirp": "0.5.1", - "pkg-dir": "1.0.0" + "commondir": "^1.0.1", + "mkdirp": "^0.5.1", + "pkg-dir": "^1.0.0" } }, "find-up": { @@ -2513,8 +2513,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "flat-cache": { @@ -2523,10 +2523,10 @@ "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", "dev": true, "requires": { - "circular-json": "0.3.3", - "del": "2.2.2", - "graceful-fs": "4.1.11", - "write": "0.2.1" + "circular-json": "^0.3.1", + "del": "^2.0.2", + "graceful-fs": "^4.1.2", + "write": "^0.2.1" } }, "flow-parser": { @@ -2540,9 +2540,9 @@ "resolved": "https://registry.npmjs.org/flux/-/flux-2.1.1.tgz", "integrity": "sha1-LGrGUtQzdIiWhInGWG86/yajjqQ=", "requires": { - "fbemitter": "2.1.1", + "fbemitter": "^2.0.0", "fbjs": "0.1.0-alpha.7", - "immutable": "3.7.6" + "immutable": "^3.7.4" }, "dependencies": { "core-js": { @@ -2555,9 +2555,9 @@ "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.1.0-alpha.7.tgz", "integrity": "sha1-rUMIuPIy+zxzYDNJ6nJdHpw5Mjw=", "requires": { - "core-js": "1.2.7", - "promise": "7.3.1", - "whatwg-fetch": "0.9.0" + "core-js": "^1.0.0", + "promise": "^7.0.3", + "whatwg-fetch": "^0.9.0" } }, "whatwg-fetch": { @@ -2572,7 +2572,7 @@ "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-2.4.3.tgz", "integrity": "sha512-sT5Ip9nyAIxWq8Apt1Fdv6yTci5GotaOtO5Ro1/+F3PizttNBcCYz8j/Qze54PPFK73KUbOqh++HUCiyNPqvhA==", "requires": { - "tabbable": "1.1.2" + "tabbable": "^1.0.3" } }, "focus-trap-react": { @@ -2580,7 +2580,7 @@ "resolved": "https://registry.npmjs.org/focus-trap-react/-/focus-trap-react-3.1.2.tgz", "integrity": "sha512-MoQmONoy9gRPyrC5DGezkcOMGgx7MtIOAQDHe098UtL2sA2vmucJwEmQisb+8LRXNYFHxuw5zJ1oLFeKu4Mteg==", "requires": { - "focus-trap": "2.4.3" + "focus-trap": "^2.0.1" } }, "for-in": { @@ -2595,7 +2595,7 @@ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { - "for-in": "1.0.2" + "for-in": "^1.0.1" } }, "foreach": { @@ -2616,22 +2616,13 @@ "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, "form-data": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", - "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.17" - } - }, - "formatio": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", - "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", - "dev": true, - "requires": { - "samsam": "1.1.2" + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" } }, "fs-access": { @@ -2640,7 +2631,7 @@ "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", "dev": true, "requires": { - "null-check": "1.0.0" + "null-check": "^1.0.0" } }, "fs-readdir-recursive": { @@ -2662,8 +2653,8 @@ "dev": true, "optional": true, "requires": { - "nan": "2.7.0", - "node-pre-gyp": "0.6.36" + "nan": "^2.3.0", + "node-pre-gyp": "^0.6.36" }, "dependencies": { "abbrev": { @@ -2699,8 +2690,8 @@ "dev": true, "optional": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.2.9" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" } }, "asn1": { @@ -2744,7 +2735,7 @@ "dev": true, "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "block-stream": { @@ -2752,15 +2743,16 @@ "bundled": true, "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "~2.0.0" } }, "boom": { "version": "2.10.1", "bundled": true, "dev": true, + "optional": true, "requires": { - "hoek": "2.16.3" + "hoek": "2.x.x" } }, "brace-expansion": { @@ -2768,7 +2760,7 @@ "bundled": true, "dev": true, "requires": { - "balanced-match": "0.4.2", + "balanced-match": "^0.4.1", "concat-map": "0.0.1" } }, @@ -2799,7 +2791,7 @@ "bundled": true, "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "concat-map": { @@ -2823,7 +2815,7 @@ "dev": true, "optional": true, "requires": { - "boom": "2.10.1" + "boom": "2.x.x" } }, "dashdash": { @@ -2832,7 +2824,7 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" }, "dependencies": { "assert-plus": { @@ -2875,7 +2867,7 @@ "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, "extend": { @@ -2916,10 +2908,10 @@ "bundled": true, "dev": true, "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.1" + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" } }, "fstream-ignore": { @@ -2928,9 +2920,9 @@ "dev": true, "optional": true, "requires": { - "fstream": "1.0.11", - "inherits": "2.0.3", - "minimatch": "3.0.4" + "fstream": "^1.0.0", + "inherits": "2", + "minimatch": "^3.0.0" } }, "gauge": { @@ -2939,14 +2931,14 @@ "dev": true, "optional": true, "requires": { - "aproba": "1.1.1", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, "getpass": { @@ -2955,7 +2947,7 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" }, "dependencies": { "assert-plus": { @@ -2971,12 +2963,12 @@ "bundled": true, "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "graceful-fs": { @@ -3021,7 +3013,8 @@ "hoek": { "version": "2.16.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "http-signature": { "version": "1.1.1", @@ -3029,9 +3022,9 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.0", - "sshpk": "1.13.0" + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "inflight": { @@ -3039,8 +3032,8 @@ "bundled": true, "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -3085,7 +3078,7 @@ "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, "jsbn": { @@ -3106,7 +3099,7 @@ "dev": true, "optional": true, "requires": { - "jsonify": "0.0.0" + "jsonify": "~0.0.0" } }, "json-stringify-safe": { @@ -3187,15 +3180,15 @@ "dev": true, "optional": true, "requires": { - "mkdirp": "0.5.1", - "nopt": "4.0.1", - "npmlog": "4.1.0", - "rc": "1.2.1", - "request": "2.81.0", - "rimraf": "2.6.1", - "semver": "5.3.0", - "tar": "2.2.1", - "tar-pack": "3.4.0" + "mkdirp": "^0.5.1", + "nopt": "^4.0.1", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "request": "^2.81.0", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^2.2.1", + "tar-pack": "^3.4.0" } }, "nopt": { @@ -3214,10 +3207,10 @@ "dev": true, "optional": true, "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" } }, "number-is-nan": { @@ -3242,7 +3235,7 @@ "bundled": true, "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os-homedir": { @@ -3320,13 +3313,13 @@ "bundled": true, "dev": true, "requires": { - "buffer-shims": "1.0.0", - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "1.0.1", - "util-deprecate": "1.0.2" + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" } }, "request": { @@ -3335,28 +3328,28 @@ "dev": true, "optional": true, "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.15", - "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", - "safe-buffer": "5.0.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.2", - "tunnel-agent": "0.6.0", - "uuid": "3.0.1" + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~4.2.1", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "performance-now": "^0.2.0", + "qs": "~6.4.0", + "safe-buffer": "^5.0.1", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.0.0" } }, "rimraf": { @@ -3364,7 +3357,7 @@ "bundled": true, "dev": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "safe-buffer": { @@ -3405,15 +3398,15 @@ "dev": true, "optional": true, "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jodid25519": "1.0.2", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jodid25519": "^1.0.0", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0" }, "dependencies": { "assert-plus": { @@ -3467,9 +3460,9 @@ "bundled": true, "dev": true, "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" } }, "tar-pack": { @@ -3478,14 +3471,14 @@ "dev": true, "optional": true, "requires": { - "debug": "2.6.8", - "fstream": "1.0.11", - "fstream-ignore": "1.0.5", - "once": "1.4.0", - "readable-stream": "2.2.9", - "rimraf": "2.6.1", - "tar": "2.2.1", - "uid-number": "0.0.6" + "debug": "^2.2.0", + "fstream": "^1.0.10", + "fstream-ignore": "^1.0.5", + "once": "^1.3.3", + "readable-stream": "^2.1.4", + "rimraf": "^2.5.1", + "tar": "^2.2.1", + "uid-number": "^0.0.6" } }, "tough-cookie": { @@ -3544,7 +3537,7 @@ "dev": true, "optional": true, "requires": { - "string-width": "1.0.2" + "string-width": "^1.0.2" } }, "wrappy": { @@ -3566,7 +3559,8 @@ "integrity": "sha1-luQg/efvARrEnCWKYhMU/ldlNvk=" }, "gemini-scrollbar": { - "version": "github:matrix-org/gemini-scrollbar#b302279810d05319ac5ff1bd34910bff32325c7b" + "version": "github:matrix-org/gemini-scrollbar#b302279810d05319ac5ff1bd34910bff32325c7b", + "from": "gemini-scrollbar@github:matrix-org/gemini-scrollbar#b302279810d05319ac5ff1bd34910bff32325c7b" }, "generate-function": { "version": "2.0.0", @@ -3580,7 +3574,7 @@ "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", "dev": true, "requires": { - "is-property": "1.0.2" + "is-property": "^1.0.0" } }, "getpass": { @@ -3588,7 +3582,7 @@ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "gfm.css": { @@ -3601,11 +3595,11 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "glob-base": { @@ -3614,8 +3608,8 @@ "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" } }, "glob-parent": { @@ -3624,7 +3618,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "2.0.1" + "is-glob": "^2.0.0" } }, "globals": { @@ -3639,12 +3633,12 @@ "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { - "array-union": "1.0.2", - "arrify": "1.0.1", - "glob": "7.1.2", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" }, "dependencies": { "glob": { @@ -3653,12 +3647,12 @@ "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } @@ -3679,8 +3673,8 @@ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "requires": { - "ajv": "5.2.3", - "har-schema": "2.0.0" + "ajv": "^5.1.0", + "har-schema": "^2.0.0" } }, "has": { @@ -3689,7 +3683,7 @@ "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", "dev": true, "requires": { - "function-bind": "1.1.1" + "function-bind": "^1.0.2" } }, "has-ansi": { @@ -3698,7 +3692,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "has-binary": { @@ -3730,16 +3724,6 @@ "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", "dev": true }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "requires": { - "boom": "4.3.1", - "cryptiles": "3.1.2", - "sntp": "2.0.2" - } - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -3762,8 +3746,8 @@ "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", "dev": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.1" } }, "htmlparser2": { @@ -3771,12 +3755,12 @@ "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.4.1", - "domutils": "1.6.2", - "entities": "1.1.1", - "inherits": "2.0.3", - "readable-stream": "2.3.3" + "domelementtype": "^1.3.0", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" } }, "http-errors": { @@ -3788,7 +3772,7 @@ "depd": "1.1.1", "inherits": "2.0.3", "setprototypeof": "1.0.3", - "statuses": "1.3.1" + "statuses": ">= 1.3.1 < 2" } }, "http-proxy": { @@ -3797,8 +3781,8 @@ "integrity": "sha1-Bt/ykpUr9k2+hHH6nfcwZtTzd0I=", "dev": true, "requires": { - "eventemitter3": "1.2.0", - "requires-port": "1.0.0" + "eventemitter3": "1.x.x", + "requires-port": "1.x.x" } }, "http-signature": { @@ -3806,9 +3790,9 @@ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.13.1" + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "https-browserify": { @@ -3855,8 +3839,8 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -3870,19 +3854,19 @@ "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", "dev": true, "requires": { - "ansi-escapes": "1.4.0", - "ansi-regex": "2.1.1", - "chalk": "1.1.3", - "cli-cursor": "1.0.2", - "cli-width": "2.2.0", - "figures": "1.7.0", - "lodash": "4.17.4", - "readline2": "1.0.1", - "run-async": "0.1.0", - "rx-lite": "3.1.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "through": "2.3.8" + "ansi-escapes": "^1.1.0", + "ansi-regex": "^2.0.0", + "chalk": "^1.0.0", + "cli-cursor": "^1.0.1", + "cli-width": "^2.0.0", + "figures": "^1.3.5", + "lodash": "^4.3.0", + "readline2": "^1.0.1", + "run-async": "^0.1.0", + "rx-lite": "^3.1.2", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.0", + "through": "^2.3.6" } }, "interpret": { @@ -3896,7 +3880,7 @@ "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", "requires": { - "loose-envify": "1.3.1" + "loose-envify": "^1.0.0" } }, "is-arrow-function": { @@ -3905,7 +3889,7 @@ "integrity": "sha1-Kb4sLY2UUIUri7r7Y1unuNjofsI=", "dev": true, "requires": { - "is-callable": "1.1.3" + "is-callable": "^1.0.4" } }, "is-binary-path": { @@ -3914,7 +3898,7 @@ "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", "dev": true, "requires": { - "binary-extensions": "1.10.0" + "binary-extensions": "^1.0.0" } }, "is-boolean-object": { @@ -3953,17 +3937,17 @@ "integrity": "sha1-XoXxlX4FKIMkf+s4aWWju6Ffuz0=", "dev": true, "requires": { - "has": "1.0.1", - "is-arrow-function": "2.0.3", - "is-boolean-object": "1.0.0", - "is-callable": "1.1.3", - "is-date-object": "1.0.1", - "is-generator-function": "1.0.6", - "is-number-object": "1.0.3", - "is-regex": "1.0.4", - "is-string": "1.0.4", - "is-symbol": "1.0.1", - "object.entries": "1.0.4" + "has": "^1.0.1", + "is-arrow-function": "^2.0.3", + "is-boolean-object": "^1.0.0", + "is-callable": "^1.1.3", + "is-date-object": "^1.0.1", + "is-generator-function": "^1.0.6", + "is-number-object": "^1.0.3", + "is-regex": "^1.0.3", + "is-string": "^1.0.4", + "is-symbol": "^1.0.1", + "object.entries": "^1.0.4" } }, "is-equal-shallow": { @@ -3972,7 +3956,7 @@ "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { - "is-primitive": "2.0.0" + "is-primitive": "^2.0.0" } }, "is-extendable": { @@ -3993,7 +3977,7 @@ "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "is-fullwidth-code-point": { @@ -4002,7 +3986,7 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "is-generator-function": { @@ -4017,7 +4001,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } }, "is-my-json-valid": { @@ -4026,10 +4010,10 @@ "integrity": "sha512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ==", "dev": true, "requires": { - "generate-function": "2.0.0", - "generate-object-property": "1.2.0", - "jsonpointer": "4.0.1", - "xtend": "4.0.1" + "generate-function": "^2.0.0", + "generate-object-property": "^1.1.0", + "jsonpointer": "^4.0.0", + "xtend": "^4.0.0" } }, "is-number": { @@ -4038,7 +4022,7 @@ "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" } }, "is-number-object": { @@ -4059,7 +4043,7 @@ "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", "dev": true, "requires": { - "is-path-inside": "1.0.0" + "is-path-inside": "^1.0.0" } }, "is-path-inside": { @@ -4068,7 +4052,7 @@ "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", "dev": true, "requires": { - "path-is-inside": "1.0.2" + "path-is-inside": "^1.0.1" } }, "is-posix-bracket": { @@ -4095,7 +4079,7 @@ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { - "has": "1.0.1" + "has": "^1.0.1" } }, "is-resolvable": { @@ -4104,7 +4088,7 @@ "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", "dev": true, "requires": { - "tryit": "1.0.3" + "tryit": "^1.0.1" } }, "is-stream": { @@ -4160,8 +4144,8 @@ "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", "requires": { - "node-fetch": "1.7.3", - "whatwg-fetch": "1.1.1" + "node-fetch": "^1.0.1", + "whatwg-fetch": ">=0.10.0" } }, "isstream": { @@ -4185,8 +4169,8 @@ "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", "dev": true, "requires": { - "argparse": "1.0.9", - "esprima": "4.0.0" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, "jsbn": { @@ -4221,8 +4205,9 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, "requires": { - "jsonify": "0.0.0" + "jsonify": "~0.0.0" } }, "json-stringify-safe": { @@ -4245,7 +4230,8 @@ "jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true }, "jsonpointer": { "version": "4.0.1", @@ -4270,42 +4256,48 @@ "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=", "dev": true, "requires": { - "array-includes": "3.0.3" + "array-includes": "^3.0.3" } }, + "just-extend": { + "version": "1.1.27", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz", + "integrity": "sha512-mJVp13Ix6gFo3SBAy9U/kL+oeZqzlYYYLQBwXVBlVzIsZwBqGREnOro24oC/8s8aox+rJhtZ2DiQof++IrkA+g==", + "dev": true + }, "karma": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/karma/-/karma-1.7.1.tgz", "integrity": "sha512-k5pBjHDhmkdaUccnC7gE3mBzZjcxyxYsYVaqiL2G5AqlfLyBO5nw2VdNK+O16cveEPd/gIOWULH7gkiYYwVNHg==", "dev": true, "requires": { - "bluebird": "3.5.1", - "body-parser": "1.18.2", - "chokidar": "1.7.0", - "colors": "1.1.2", - "combine-lists": "1.0.1", - "connect": "3.6.5", - "core-js": "2.5.1", - "di": "0.0.1", - "dom-serialize": "2.2.1", - "expand-braces": "0.1.2", - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "http-proxy": "1.16.2", - "isbinaryfile": "3.0.2", - "lodash": "3.10.1", - "log4js": "0.6.38", - "mime": "1.4.1", - "minimatch": "3.0.4", - "optimist": "0.6.1", - "qjobs": "1.1.5", - "range-parser": "1.2.0", - "rimraf": "2.6.2", - "safe-buffer": "5.1.1", + "bluebird": "^3.3.0", + "body-parser": "^1.16.1", + "chokidar": "^1.4.1", + "colors": "^1.1.0", + "combine-lists": "^1.0.0", + "connect": "^3.6.0", + "core-js": "^2.2.0", + "di": "^0.0.1", + "dom-serialize": "^2.2.0", + "expand-braces": "^0.1.1", + "glob": "^7.1.1", + "graceful-fs": "^4.1.2", + "http-proxy": "^1.13.0", + "isbinaryfile": "^3.0.0", + "lodash": "^3.8.0", + "log4js": "^0.6.31", + "mime": "^1.3.4", + "minimatch": "^3.0.2", + "optimist": "^0.6.1", + "qjobs": "^1.1.4", + "range-parser": "^1.2.0", + "rimraf": "^2.6.0", + "safe-buffer": "^5.0.1", "socket.io": "1.7.3", - "source-map": "0.5.7", + "source-map": "^0.5.3", "tmp": "0.0.31", - "useragent": "2.2.1" + "useragent": "^2.1.12" }, "dependencies": { "glob": { @@ -4314,12 +4306,12 @@ "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "lodash": { @@ -4336,8 +4328,8 @@ "integrity": "sha1-TG1wDRY6nTTGGO/YeRi+SeekqMk=", "dev": true, "requires": { - "fs-access": "1.0.1", - "which": "1.3.0" + "fs-access": "^1.0.0", + "which": "^1.2.1" } }, "karma-cli": { @@ -4346,7 +4338,7 @@ "integrity": "sha1-ys6oQ3Hs4Zh2JlyPoQLru5/uSow=", "dev": true, "requires": { - "resolve": "1.4.0" + "resolve": "^1.1.6" } }, "karma-junit-reporter": { @@ -4355,7 +4347,7 @@ "integrity": "sha1-SSojZyj+TJKqz0GfzQEQpDJ+nX8=", "dev": true, "requires": { - "path-is-absolute": "1.0.1", + "path-is-absolute": "^1.0.0", "xmlbuilder": "3.1.0" } }, @@ -4377,7 +4369,7 @@ "integrity": "sha1-kTIsd/jxPUb+0GKwQuEAnUxFBdg=", "dev": true, "requires": { - "graceful-fs": "4.1.11" + "graceful-fs": "^4.1.2" } }, "karma-spec-reporter": { @@ -4386,7 +4378,7 @@ "integrity": "sha1-SDDccUihVcfXoYbmMjOaDYD63sM=", "dev": true, "requires": { - "colors": "1.1.2" + "colors": "^1.1.2" } }, "karma-summary-reporter": { @@ -4395,7 +4387,7 @@ "integrity": "sha1-nHQKJLYL+RNes59acylsTM0Q2Zs=", "dev": true, "requires": { - "chalk": "1.1.3" + "chalk": "^1.1.3" } }, "karma-webpack": { @@ -4404,11 +4396,11 @@ "integrity": "sha1-OdX9Lt7qPMPvW0BZibN9Ww5qO04=", "dev": true, "requires": { - "async": "0.9.2", - "loader-utils": "0.2.17", - "lodash": "3.10.1", - "source-map": "0.1.43", - "webpack-dev-middleware": "1.12.0" + "async": "~0.9.0", + "loader-utils": "^0.2.5", + "lodash": "^3.8.0", + "source-map": "^0.1.41", + "webpack-dev-middleware": "^1.0.11" }, "dependencies": { "lodash": { @@ -4423,7 +4415,7 @@ "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", "dev": true, "requires": { - "amdefine": "1.0.1" + "amdefine": ">=0.0.4" } } } @@ -4434,7 +4426,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "^1.1.5" } }, "lazy-cache": { @@ -4449,8 +4441,8 @@ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" } }, "linkifyjs": { @@ -4458,9 +4450,9 @@ "resolved": "https://registry.npmjs.org/linkifyjs/-/linkifyjs-2.1.5.tgz", "integrity": "sha512-8FqxPXQDLjI2nNHlM7eGewxE6DHvMbtiW0AiXzm0s4RkTwVZYRDTeVXkiRxLHTd4CuRBQY/JPtvtqJWdS7gHyA==", "requires": { - "jquery": "3.2.1", - "react": "15.6.2", - "react-dom": "15.6.2" + "jquery": ">=1.9.0", + "react": ">=0.14.0", + "react-dom": ">=0.14.0" } }, "loader-utils": { @@ -4469,10 +4461,10 @@ "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", "dev": true, "requires": { - "big.js": "3.2.0", - "emojis-list": "2.1.0", - "json5": "0.5.1", - "object-assign": "4.1.1" + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0", + "object-assign": "^4.0.1" } }, "lodash": { @@ -4491,6 +4483,12 @@ "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", "dev": true }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, "lodash.pickby": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.pickby/-/lodash.pickby-4.6.0.tgz", @@ -4503,8 +4501,8 @@ "integrity": "sha1-LElBFmldb7JUgJQ9P8hy5mKlIv0=", "dev": true, "requires": { - "readable-stream": "1.0.34", - "semver": "4.3.6" + "readable-stream": "~1.0.2", + "semver": "~4.3.3" }, "dependencies": { "isarray": { @@ -4519,10 +4517,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -4534,10 +4532,9 @@ } }, "lolex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz", - "integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=", - "dev": true + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.2.tgz", + "integrity": "sha512-A5pN2tkFj7H0dGIAM6MFvHKMJcPnjZsOMvR7ujCjfgW5TbV6H9vb1PgxLtHvjqNZTHsUolz+6/WEO0N1xNx2ng==" }, "longest": { "version": "1.0.1", @@ -4550,7 +4547,7 @@ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", "requires": { - "js-tokens": "3.0.2" + "js-tokens": "^3.0.0" } }, "lru-cache": { @@ -4560,16 +4557,16 @@ "dev": true }, "matrix-js-sdk": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/matrix-js-sdk/-/matrix-js-sdk-0.10.1.tgz", - "integrity": "sha512-BLo+Okn2o///TyWBKtjFXvhlD32vGfr10eTE51hHx/jwaXO82VyGMzMi+IDPS4SDYUbvXI7PpamECeh9TXnV2w==", + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/matrix-js-sdk/-/matrix-js-sdk-0.10.2.tgz", + "integrity": "sha512-7o9a+4wWmxoW4cfdGVLGjZgTFLpWf/I0UqyicIzdV73qotYIO/q6k1bLf1+G0hgwZ/umwke4CB7GemxvvvxMcA==", "requires": { - "another-json": "0.2.0", - "babel-runtime": "6.26.0", - "bluebird": "3.5.1", - "browser-request": "0.3.3", - "content-type": "1.0.4", - "request": "2.83.0" + "another-json": "^0.2.0", + "babel-runtime": "^6.26.0", + "bluebird": "^3.5.0", + "browser-request": "^0.3.3", + "content-type": "^1.0.2", + "request": "^2.53.0" } }, "matrix-mock-request": { @@ -4578,8 +4575,8 @@ "integrity": "sha1-2aWrqNPYJG6I/3YyWYuZwUE/QjI=", "dev": true, "requires": { - "bluebird": "3.5.1", - "expect": "1.20.2" + "bluebird": "^3.5.0", + "expect": "^1.20.2" } }, "matrix-react-test-utils": { @@ -4588,8 +4585,8 @@ "integrity": "sha1-tUiETQ6+M46hucjxZHTDDRfDvfQ=", "dev": true, "requires": { - "react": "15.6.2", - "react-dom": "15.6.2" + "react": "^15.6.1", + "react-dom": "^15.6.1" } }, "mdurl": { @@ -4614,8 +4611,8 @@ "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", "dev": true, "requires": { - "errno": "0.1.4", - "readable-stream": "2.3.3" + "errno": "^0.1.3", + "readable-stream": "^2.0.1" } }, "micromatch": { @@ -4624,19 +4621,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" } }, "mime": { @@ -4655,7 +4652,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", "requires": { - "mime-db": "1.30.0" + "mime-db": "~1.30.0" } }, "minimatch": { @@ -4663,7 +4660,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "requires": { - "brace-expansion": "1.1.8" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -4728,12 +4725,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "growl": { @@ -4754,7 +4751,7 @@ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "^2.0.0" } } } @@ -4790,13 +4787,34 @@ "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", "dev": true }, + "nise": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.3.3.tgz", + "integrity": "sha512-v1J/FLUB9PfGqZLGDBhQqODkbLotP0WtLo9R4EJY2PPu5f5Xg4o0rA8FDlmrjFSv9vBBKcfnOSpfYYuu5RTHqg==", + "dev": true, + "requires": { + "@sinonjs/formatio": "^2.0.0", + "just-extend": "^1.1.27", + "lolex": "^2.3.2", + "path-to-regexp": "^1.7.0", + "text-encoding": "^0.6.4" + }, + "dependencies": { + "lolex": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.6.0.tgz", + "integrity": "sha512-e1UtIo1pbrIqEXib/yMjHciyqkng5lc0rrIbytgjmRgDR9+2ceNIAcwOWSgylRjoEP9VdVguCSRwnNmlbnOUwA==", + "dev": true + } + } + }, "node-fetch": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", "requires": { - "encoding": "0.1.12", - "is-stream": "1.1.0" + "encoding": "^0.1.11", + "is-stream": "^1.0.1" } }, "node-libs-browser": { @@ -4805,28 +4823,28 @@ "integrity": "sha1-PicsCBnjCJNeJmdECNevDhSRuDs=", "dev": true, "requires": { - "assert": "1.4.1", - "browserify-zlib": "0.1.4", - "buffer": "4.9.1", - "console-browserify": "1.1.0", - "constants-browserify": "1.0.0", + "assert": "^1.1.1", + "browserify-zlib": "^0.1.4", + "buffer": "^4.9.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", "crypto-browserify": "3.3.0", - "domain-browser": "1.1.7", - "events": "1.1.1", + "domain-browser": "^1.1.1", + "events": "^1.0.0", "https-browserify": "0.0.1", - "os-browserify": "0.2.1", + "os-browserify": "^0.2.0", "path-browserify": "0.0.0", - "process": "0.11.10", - "punycode": "1.4.1", - "querystring-es3": "0.2.1", - "readable-stream": "2.3.3", - "stream-browserify": "2.0.1", - "stream-http": "2.7.2", - "string_decoder": "0.10.31", - "timers-browserify": "2.0.4", + "process": "^0.11.0", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.0.5", + "stream-browserify": "^2.0.1", + "stream-http": "^2.3.1", + "string_decoder": "^0.10.25", + "timers-browserify": "^2.0.2", "tty-browserify": "0.0.0", - "url": "0.11.0", - "util": "0.10.3", + "url": "^0.11.0", + "util": "^0.10.3", "vm-browserify": "0.0.4" }, "dependencies": { @@ -4844,7 +4862,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "1.1.0" + "remove-trailing-separator": "^1.0.1" } }, "null-check": { @@ -4893,10 +4911,10 @@ "integrity": "sha1-G/mk3SKI9bM/Opk9JXZh8F0WGl8=", "dev": true, "requires": { - "define-properties": "1.1.2", - "es-abstract": "1.9.0", - "function-bind": "1.1.1", - "has": "1.0.1" + "define-properties": "^1.1.2", + "es-abstract": "^1.6.1", + "function-bind": "^1.1.0", + "has": "^1.0.1" } }, "object.omit": { @@ -4905,8 +4923,8 @@ "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" } }, "on-finished": { @@ -4923,7 +4941,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "onetime": { @@ -4937,8 +4955,8 @@ "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "requires": { - "minimist": "0.0.10", - "wordwrap": "0.0.3" + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" }, "dependencies": { "minimist": { @@ -4954,12 +4972,12 @@ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", "dev": true, "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" }, "dependencies": { "wordwrap": { @@ -5000,9 +5018,9 @@ "integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "mkdirp": "0.5.1", - "object-assign": "4.1.1" + "graceful-fs": "^4.1.4", + "mkdirp": "^0.5.1", + "object-assign": "^4.1.0" } }, "pako": { @@ -5022,10 +5040,10 @@ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" } }, "parsejson": { @@ -5034,7 +5052,7 @@ "integrity": "sha1-q343WfIJ7OmUN5c/fQ8fZK4OZKs=", "dev": true, "requires": { - "better-assert": "1.0.2" + "better-assert": "~1.0.0" } }, "parseqs": { @@ -5043,7 +5061,7 @@ "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", "dev": true, "requires": { - "better-assert": "1.0.2" + "better-assert": "~1.0.0" } }, "parseuri": { @@ -5052,7 +5070,7 @@ "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", "dev": true, "requires": { - "better-assert": "1.0.2" + "better-assert": "~1.0.0" } }, "parseurl": { @@ -5073,7 +5091,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "2.0.1" + "pinkie-promise": "^2.0.0" } }, "path-is-absolute": { @@ -5093,6 +5111,23 @@ "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", "dev": true }, + "path-to-regexp": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "dev": true, + "requires": { + "isarray": "0.0.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } + } + }, "pbkdf2-compat": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz", @@ -5122,7 +5157,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "2.0.4" + "pinkie": "^2.0.0" } }, "pkg-dir": { @@ -5131,7 +5166,7 @@ "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", "dev": true, "requires": { - "find-up": "1.1.2" + "find-up": "^1.0.0" } }, "pluralize": { @@ -5185,7 +5220,7 @@ "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", "requires": { - "asap": "2.0.6" + "asap": "~2.0.3" } }, "prop-types": { @@ -5193,9 +5228,9 @@ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.0.tgz", "integrity": "sha1-zq8IMCL8RrSjX2nhPvda7Q1jmFY=", "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1" + "fbjs": "^0.8.16", + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" } }, "prr": { @@ -5236,7 +5271,7 @@ "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.0.tgz", "integrity": "sha512-pDP/NMRAXoTfrhCfyfSEwJAKLaxBU9eApMeBPB1TkDouZmvPerIClV8lTAd+uF8ZiTaVl69e1FCxQrAd/VTjGw==", "requires": { - "performance-now": "2.1.0" + "performance-now": "^2.1.0" } }, "raf-schd": { @@ -5250,8 +5285,8 @@ "integrity": "sha1-x6vpzIuHwLqodrGf3oP9RkeX44w=", "dev": true, "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" + "is-number": "^3.0.0", + "kind-of": "^4.0.0" }, "dependencies": { "is-number": { @@ -5260,7 +5295,7 @@ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -5269,7 +5304,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "^1.1.5" } } } @@ -5280,7 +5315,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "^1.1.5" } } } @@ -5308,11 +5343,11 @@ "resolved": "https://registry.npmjs.org/react/-/react-15.6.2.tgz", "integrity": "sha1-26BDSrQ5z+gvEI8PURZjkIF5qnI=", "requires": { - "create-react-class": "15.6.2", - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "prop-types": "15.6.0" + "create-react-class": "^15.6.0", + "fbjs": "^0.8.9", + "loose-envify": "^1.1.0", + "object-assign": "^4.1.0", + "prop-types": "^15.5.10" } }, "react-addons-css-transition-group": { @@ -5331,16 +5366,16 @@ "resolved": "https://registry.npmjs.org/react-beautiful-dnd/-/react-beautiful-dnd-4.0.1.tgz", "integrity": "sha512-d73RMu4QOFCyjUELLWFyY/EuclnfqulI9pECx+2gIuJvV0ycf1uR88o+1x0RSB9ILD70inHMzCBKNkWVbbt+vA==", "requires": { - "babel-runtime": "6.26.0", - "invariant": "2.2.2", - "memoize-one": "3.1.1", - "prop-types": "15.6.0", - "raf-schd": "2.1.1", - "react-motion": "0.5.2", - "react-redux": "5.0.7", - "redux": "3.7.2", - "redux-thunk": "2.2.0", - "reselect": "3.0.1" + "babel-runtime": "^6.26.0", + "invariant": "^2.2.2", + "memoize-one": "^3.0.1", + "prop-types": "^15.6.0", + "raf-schd": "^2.1.0", + "react-motion": "^0.5.2", + "react-redux": "^5.0.6", + "redux": "^3.7.2", + "redux-thunk": "^2.2.0", + "reselect": "^3.0.1" } }, "react-dom": { @@ -5348,14 +5383,15 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-15.6.2.tgz", "integrity": "sha1-Qc+t9pO3V/rycIRDodH9WgK+9zA=", "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "prop-types": "15.6.0" + "fbjs": "^0.8.9", + "loose-envify": "^1.1.0", + "object-assign": "^4.1.0", + "prop-types": "^15.5.10" } }, "react-gemini-scrollbar": { "version": "github:matrix-org/react-gemini-scrollbar#5e97aef7e034efc8db1431f4b0efe3b26e249ae9", + "from": "react-gemini-scrollbar@github:matrix-org/react-gemini-scrollbar#5e97aef7e034efc8db1431f4b0efe3b26e249ae9", "requires": { "gemini-scrollbar": "github:matrix-org/gemini-scrollbar#b302279810d05319ac5ff1bd34910bff32325c7b" } @@ -5365,9 +5401,9 @@ "resolved": "https://registry.npmjs.org/react-motion/-/react-motion-0.5.2.tgz", "integrity": "sha512-9q3YAvHoUiWlP3cK0v+w1N5Z23HXMj4IF4YuvjvWegWqNPfLXsOBE/V7UvQGpXxHFKRQQcNcVQE31g9SB/6qgQ==", "requires": { - "performance-now": "0.2.0", - "prop-types": "15.6.0", - "raf": "3.4.0" + "performance-now": "^0.2.0", + "prop-types": "^15.5.8", + "raf": "^3.1.0" }, "dependencies": { "performance-now": { @@ -5382,12 +5418,12 @@ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-5.0.7.tgz", "integrity": "sha512-5VI8EV5hdgNgyjfmWzBbdrqUkrVRKlyTKk1sGH3jzM2M2Mhj/seQgPXaz6gVAj2lz/nz688AdTqMO18Lr24Zhg==", "requires": { - "hoist-non-react-statics": "2.5.0", - "invariant": "2.2.2", - "lodash": "4.17.10", - "lodash-es": "4.17.10", - "loose-envify": "1.3.1", - "prop-types": "15.6.0" + "hoist-non-react-statics": "^2.5.0", + "invariant": "^2.0.0", + "lodash": "^4.17.5", + "lodash-es": "^4.17.5", + "loose-envify": "^1.1.0", + "prop-types": "^15.6.0" }, "dependencies": { "lodash": { @@ -5402,13 +5438,13 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "readdirp": { @@ -5417,10 +5453,10 @@ "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "minimatch": "3.0.4", - "readable-stream": "2.3.3", - "set-immediate-shim": "1.0.1" + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" } }, "readline2": { @@ -5429,8 +5465,8 @@ "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", "mute-stream": "0.0.5" } }, @@ -5440,7 +5476,7 @@ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "dev": true, "requires": { - "resolve": "1.4.0" + "resolve": "^1.1.6" } }, "redux": { @@ -5448,10 +5484,10 @@ "resolved": "https://registry.npmjs.org/redux/-/redux-3.7.2.tgz", "integrity": "sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==", "requires": { - "lodash": "4.17.4", - "lodash-es": "4.17.10", - "loose-envify": "1.3.1", - "symbol-observable": "1.2.0" + "lodash": "^4.2.1", + "lodash-es": "^4.2.1", + "loose-envify": "^1.1.0", + "symbol-observable": "^1.0.3" } }, "redux-thunk": { @@ -5476,9 +5512,9 @@ "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", "dev": true, "requires": { - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "private": "0.1.8" + "babel-runtime": "^6.18.0", + "babel-types": "^6.19.0", + "private": "^0.1.6" } }, "regex-cache": { @@ -5487,7 +5523,7 @@ "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "dev": true, "requires": { - "is-equal-shallow": "0.1.3" + "is-equal-shallow": "^0.1.3" } }, "regexp-quote": { @@ -5501,9 +5537,9 @@ "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", "dev": true, "requires": { - "regenerate": "1.3.3", - "regjsgen": "0.2.0", - "regjsparser": "0.1.5" + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" } }, "regjsgen": { @@ -5518,7 +5554,7 @@ "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "dev": true, "requires": { - "jsesc": "0.5.0" + "jsesc": "~0.5.0" }, "dependencies": { "jsesc": { @@ -5553,36 +5589,34 @@ "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { - "is-finite": "1.0.2" + "is-finite": "^1.0.0" } }, "request": { - "version": "2.83.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.3.1", - "har-validator": "5.0.3", - "hawk": "6.0.2", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.17", - "oauth-sign": "0.8.2", - "performance-now": "2.1.0", - "qs": "6.5.1", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.3", - "tunnel-agent": "0.6.0", - "uuid": "3.1.0" + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" } }, "require-json": { @@ -5597,8 +5631,8 @@ "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", "dev": true, "requires": { - "caller-path": "0.1.0", - "resolve-from": "1.0.1" + "caller-path": "^0.1.0", + "resolve-from": "^1.0.0" } }, "requires-port": { @@ -5618,7 +5652,7 @@ "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", "dev": true, "requires": { - "path-parse": "1.0.5" + "path-parse": "^1.0.5" } }, "resolve-from": { @@ -5633,8 +5667,8 @@ "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", "dev": true, "requires": { - "exit-hook": "1.1.1", - "onetime": "1.1.0" + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" } }, "right-align": { @@ -5643,7 +5677,7 @@ "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", "dev": true, "requires": { - "align-text": "0.1.4" + "align-text": "^0.1.1" } }, "rimraf": { @@ -5652,7 +5686,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" }, "dependencies": { "glob": { @@ -5661,12 +5695,12 @@ "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } @@ -5683,7 +5717,7 @@ "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", "dev": true, "requires": { - "once": "1.4.0" + "once": "^1.3.0" } }, "rx-lite": { @@ -5698,9 +5732,9 @@ "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "samsam": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz", - "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", + "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==", "dev": true }, "sanitize-html": { @@ -5708,9 +5742,9 @@ "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-1.14.1.tgz", "integrity": "sha1-cw/6Ikm98YMz7/5FsoYXPJxa0Lg=", "requires": { - "htmlparser2": "3.9.2", + "htmlparser2": "^3.9.0", "regexp-quote": "0.0.0", - "xtend": "4.0.1" + "xtend": "^4.0.0" } }, "semver": { @@ -5748,9 +5782,9 @@ "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", "dev": true, "requires": { - "glob": "7.1.2", - "interpret": "1.0.4", - "rechoir": "0.6.2" + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" }, "dependencies": { "glob": { @@ -5759,26 +5793,52 @@ "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } }, "sinon": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-1.17.7.tgz", - "integrity": "sha1-RUKk9JugxFwF6y6d2dID4rjv4L8=", + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-5.0.7.tgz", + "integrity": "sha512-GvNLrwpvLZ8jIMZBUhHGUZDq5wlUdceJWyHvZDmqBxnjazpxY1L0FNbGBX6VpcOEoQ8Q4XMWFzm2myJMvx+VjA==", "dev": true, "requires": { - "formatio": "1.1.1", - "lolex": "1.3.2", - "samsam": "1.1.2", - "util": "0.10.3" + "@sinonjs/formatio": "^2.0.0", + "diff": "^3.1.0", + "lodash.get": "^4.4.2", + "lolex": "^2.2.0", + "nise": "^1.2.0", + "supports-color": "^5.1.0", + "type-detect": "^4.0.5" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "lolex": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.6.0.tgz", + "integrity": "sha512-e1UtIo1pbrIqEXib/yMjHciyqkng5lc0rrIbytgjmRgDR9+2ceNIAcwOWSgylRjoEP9VdVguCSRwnNmlbnOUwA==", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "slash": { @@ -5793,11 +5853,6 @@ "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", "dev": true }, - "sntp": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz", - "integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=" - }, "socket.io": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.7.3.tgz", @@ -5958,9 +6013,9 @@ "integrity": "sha512-MYbFX9DYxmTQFfy2v8FC1XZwpwHKYxg3SK8Wb7VPBKuhDjz8gi9re2819MsG4p49HDyiOSUKlmZ+nQBArW5CGw==", "dev": true, "requires": { - "async": "2.6.0", - "loader-utils": "0.2.17", - "source-map": "0.6.1" + "async": "^2.5.0", + "loader-utils": "~0.2.2", + "source-map": "~0.6.1" }, "dependencies": { "async": { @@ -5969,7 +6024,7 @@ "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "^4.14.0" } }, "source-map": { @@ -5986,7 +6041,7 @@ "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", "dev": true, "requires": { - "source-map": "0.5.7" + "source-map": "^0.5.6" } }, "sprintf-js": { @@ -5995,18 +6050,18 @@ "integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=" }, "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", + "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0" } }, "statuses": { @@ -6021,8 +6076,8 @@ "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3" + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" } }, "stream-http": { @@ -6031,11 +6086,11 @@ "integrity": "sha1-QKBQ7I3DtTsz2ZCUFcAsC/Gr+60=", "dev": true, "requires": { - "builtin-status-codes": "3.0.0", - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "to-arraybuffer": "1.0.1", - "xtend": "4.0.1" + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.2.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" } }, "string-width": { @@ -6044,9 +6099,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "string.prototype.repeat": { @@ -6059,21 +6114,16 @@ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" - }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-bom": { @@ -6110,12 +6160,12 @@ "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", "dev": true, "requires": { - "ajv": "4.11.8", - "ajv-keywords": "1.5.1", - "chalk": "1.1.3", - "lodash": "4.17.4", + "ajv": "^4.7.0", + "ajv-keywords": "^1.0.0", + "chalk": "^1.1.1", + "lodash": "^4.0.0", "slice-ansi": "0.0.4", - "string-width": "2.1.1" + "string-width": "^2.0.0" }, "dependencies": { "ajv": { @@ -6124,8 +6174,8 @@ "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", "dev": true, "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" } }, "ansi-regex": { @@ -6146,8 +6196,8 @@ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, "strip-ansi": { @@ -6156,7 +6206,7 @@ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" } } } @@ -6167,6 +6217,12 @@ "integrity": "sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q=", "dev": true }, + "text-encoding": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", + "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", + "dev": true + }, "text-encoding-utf-8": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.1.tgz", @@ -6196,7 +6252,7 @@ "integrity": "sha512-uZYhyU3EX8O7HQP+J9fTVYwsq90Vr68xPEFo7yrVImIxYvHgukBEgOB/SgGoorWVTzGM/3Z+wUNnboA4M8jWrg==", "dev": true, "requires": { - "setimmediate": "1.0.5" + "setimmediate": "^1.0.4" } }, "tmatch": { @@ -6211,7 +6267,7 @@ "integrity": "sha1-jzirlDjhcxXl29izZX6L+yd65Kc=", "dev": true, "requires": { - "os-tmpdir": "1.0.2" + "os-tmpdir": "~1.0.1" } }, "to-array": { @@ -6233,11 +6289,11 @@ "dev": true }, "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "requires": { - "punycode": "1.4.1" + "punycode": "^1.4.1" } }, "trim-right": { @@ -6263,7 +6319,7 @@ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { @@ -6278,9 +6334,15 @@ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { - "prelude-ls": "1.1.2" + "prelude-ls": "~1.1.2" } }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, "type-is": { "version": "1.6.15", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", @@ -6288,7 +6350,7 @@ "dev": true, "requires": { "media-typer": "0.3.0", - "mime-types": "2.1.17" + "mime-types": "~2.1.15" } }, "typedarray": { @@ -6308,10 +6370,10 @@ "integrity": "sha1-RhLAx7qu4rp8SH3kkErhIgefLKg=", "dev": true, "requires": { - "async": "0.2.10", - "source-map": "0.5.7", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" + "async": "~0.2.6", + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" }, "dependencies": { "async": { @@ -6368,8 +6430,8 @@ "integrity": "sha1-z1k+9PLRdYdei7ZY6pLhik/QbY4=", "dev": true, "requires": { - "lru-cache": "2.2.4", - "tmp": "0.0.31" + "lru-cache": "2.2.x", + "tmp": "0.0.x" } }, "util": { @@ -6401,9 +6463,9 @@ "dev": true }, "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" }, "v8flags": { "version": "2.1.1", @@ -6411,13 +6473,14 @@ "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", "dev": true, "requires": { - "user-home": "1.1.1" + "user-home": "^1.1.1" } }, "velocity-vector": { "version": "github:vector-im/velocity#059e3b2348f1110888d033974d3109fd5a3af00f", + "from": "velocity-vector@github:vector-im/velocity#059e3b2348f1110888d033974d3109fd5a3af00f", "requires": { - "jquery": "3.2.1" + "jquery": ">= 1.4.3" } }, "verror": { @@ -6425,9 +6488,9 @@ "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "requires": { - "assert-plus": "1.0.0", + "assert-plus": "^1.0.0", "core-util-is": "1.0.2", - "extsprintf": "1.3.0" + "extsprintf": "^1.2.0" } }, "vm-browserify": { @@ -6451,7 +6514,7 @@ "integrity": "sha1-MbTbZnjyrgHDnqn7hyWpAx5Vins=", "dev": true, "requires": { - "foreachasync": "3.0.0" + "foreachasync": "^3.0.0" } }, "watchpack": { @@ -6460,9 +6523,9 @@ "integrity": "sha1-Yuqkq15bo1/fwBgnVibjwPXj+ws=", "dev": true, "requires": { - "async": "0.9.2", - "chokidar": "1.7.0", - "graceful-fs": "4.1.11" + "async": "^0.9.0", + "chokidar": "^1.0.0", + "graceful-fs": "^4.1.2" } }, "webpack": { @@ -6471,21 +6534,21 @@ "integrity": "sha1-T/MfU9sDM55VFkqdRo7gMklo/pg=", "dev": true, "requires": { - "acorn": "3.3.0", - "async": "1.5.2", - "clone": "1.0.2", - "enhanced-resolve": "0.9.1", - "interpret": "0.6.6", - "loader-utils": "0.2.17", - "memory-fs": "0.3.0", - "mkdirp": "0.5.1", - "node-libs-browser": "0.7.0", - "optimist": "0.6.1", - "supports-color": "3.2.3", - "tapable": "0.1.10", - "uglify-js": "2.7.5", - "watchpack": "0.2.9", - "webpack-core": "0.6.9" + "acorn": "^3.0.0", + "async": "^1.3.0", + "clone": "^1.0.2", + "enhanced-resolve": "~0.9.0", + "interpret": "^0.6.4", + "loader-utils": "^0.2.11", + "memory-fs": "~0.3.0", + "mkdirp": "~0.5.0", + "node-libs-browser": "^0.7.0", + "optimist": "~0.6.0", + "supports-color": "^3.1.0", + "tapable": "~0.1.8", + "uglify-js": "~2.7.3", + "watchpack": "^0.2.1", + "webpack-core": "~0.6.9" }, "dependencies": { "acorn": { @@ -6512,8 +6575,8 @@ "integrity": "sha1-e8xrYp46Q+hx1+Kaymrop/FcuyA=", "dev": true, "requires": { - "errno": "0.1.4", - "readable-stream": "2.3.3" + "errno": "^0.1.3", + "readable-stream": "^2.0.1" } }, "supports-color": { @@ -6522,7 +6585,7 @@ "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { - "has-flag": "1.0.0" + "has-flag": "^1.0.0" } } } @@ -6533,8 +6596,8 @@ "integrity": "sha1-/FcViMhVjad76e+23r3Fo7FyvcI=", "dev": true, "requires": { - "source-list-map": "0.1.8", - "source-map": "0.4.4" + "source-list-map": "~0.1.7", + "source-map": "~0.4.1" }, "dependencies": { "source-map": { @@ -6543,7 +6606,7 @@ "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { - "amdefine": "1.0.1" + "amdefine": ">=0.0.4" } } } @@ -6554,11 +6617,11 @@ "integrity": "sha1-007++y7dp+HTtdvgcolRMhllFwk=", "dev": true, "requires": { - "memory-fs": "0.4.1", - "mime": "1.4.1", - "path-is-absolute": "1.0.1", - "range-parser": "1.2.0", - "time-stamp": "2.0.0" + "memory-fs": "~0.4.1", + "mime": "^1.3.4", + "path-is-absolute": "^1.0.0", + "range-parser": "^1.0.3", + "time-stamp": "^2.0.0" } }, "whatwg-fetch": { @@ -6572,7 +6635,7 @@ "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { - "isexe": "2.0.0" + "isexe": "^2.0.0" } }, "window-size": { @@ -6597,7 +6660,7 @@ "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", "dev": true, "requires": { - "mkdirp": "0.5.1" + "mkdirp": "^0.5.1" } }, "ws": { @@ -6606,8 +6669,8 @@ "integrity": "sha1-iiRPoFJAHgjJiGz0SoUYnh/UBn8=", "dev": true, "requires": { - "options": "0.0.6", - "ultron": "1.0.2" + "options": ">=0.0.5", + "ultron": "1.0.x" } }, "wtf-8": { @@ -6622,7 +6685,7 @@ "integrity": "sha1-LIaIjy1OrehQ+jjKf3Ij9yCVFuE=", "dev": true, "requires": { - "lodash": "3.10.1" + "lodash": "^3.5.0" }, "dependencies": { "lodash": { @@ -6650,9 +6713,9 @@ "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", "window-size": "0.1.0" } }, diff --git a/package.json b/package.json index 60f65f4c39..5864b35fc4 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "react-addons-test-utils": "^15.4.0", "require-json": "0.0.1", "rimraf": "^2.4.3", - "sinon": "^1.17.3", + "sinon": "^5.0.7", "source-map-loader": "^0.2.3", "walk": "^2.3.9", "webpack": "^1.12.14" diff --git a/test/components/structures/TimelinePanel-test.js b/test/components/structures/TimelinePanel-test.js index 74037d2926..ea62d427bc 100644 --- a/test/components/structures/TimelinePanel-test.js +++ b/test/components/structures/TimelinePanel-test.js @@ -235,7 +235,7 @@ describe('TimelinePanel', function() { // now, if we update the events, there shouldn't be any // more requests. - client.paginateEventTimeline.reset(); + client.paginateEventTimeline.resetHistory(); panel.forceUpdate(); expect(messagePanel.props.backPaginating).toBe(false); setTimeout(() => { From 11cea616615989157e335d7ea2e323ce7fc978f8 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 21 May 2018 12:28:08 +0100 Subject: [PATCH 078/702] refocus editor after clicking on autocompletes --- src/components/views/rooms/MessageComposerInput.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index eb4edfcfcb..6919a304c2 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -1313,7 +1313,8 @@ export default class MessageComposerInput extends React.Component { if (range) { const change = editorState.change() .collapseToAnchor() - .moveOffsetsTo(range.start, range.end); + .moveOffsetsTo(range.start, range.end) + .focus(); editorState = change.value; } @@ -1321,12 +1322,14 @@ export default class MessageComposerInput extends React.Component { if (inline) { change = editorState.change() .insertInlineAtRange(editorState.selection, inline) - .insertText(suffix); + .insertText(suffix) + .focus(); } else { change = editorState.change() .insertTextAtRange(editorState.selection, completion) - .insertText(suffix); + .insertText(suffix) + .focus(); } editorState = change.value; From 836dc8b0ef2b3d086747c85fbcdd885d7102304c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 21 May 2018 16:59:13 +0100 Subject: [PATCH 079/702] Factor out all shared logic between MStickerBody and MImageBody The benefits of this: - One code path for determining spinner/placeholder and it's position for loading images/stickers. This includes spinner used in e2e decryption of images. - Very small definition for MStickerBody, only overriding the minimal differences is has from MImageBody. The disadvantages: - Slightly more complicated MImageBody, but hopefully not less readable. --- res/css/views/messages/_MImageBody.scss | 11 +- res/css/views/messages/_MStickerBody.scss | 32 +--- src/components/views/messages/MImageBody.js | 89 ++++++++-- src/components/views/messages/MStickerBody.js | 162 ++++-------------- 4 files changed, 111 insertions(+), 183 deletions(-) diff --git a/res/css/views/messages/_MImageBody.scss b/res/css/views/messages/_MImageBody.scss index 64821434dd..4c763c5991 100644 --- a/res/css/views/messages/_MImageBody.scss +++ b/res/css/views/messages/_MImageBody.scss @@ -37,11 +37,12 @@ limitations under the License. } .mx_MImageBody_thumbnail_spinner { - display: flex; - align-items: center; - width: 100%; + position: absolute; + left: 50%; + top: 50%; } -.mx_MImageBody_thumbnail_spinner img { - margin: auto; +// Inner img and TintableSvg should be centered around 0, 0 +.mx_MImageBody_thumbnail_spinner > * { + transform: translate(-50%, -50%); } diff --git a/res/css/views/messages/_MStickerBody.scss b/res/css/views/messages/_MStickerBody.scss index 3e6bbe5aa4..e4977bcc34 100644 --- a/res/css/views/messages/_MStickerBody.scss +++ b/res/css/views/messages/_MStickerBody.scss @@ -14,33 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -.mx_MStickerBody { - display: block; - margin-right: 34px; - min-height: 110px; - padding: 20px 0; +.mx_MStickerBody_wrapper { + padding: 20px 0px; } -.mx_MStickerBody_image_container { - display: inline-block; - position: relative; -} - -.mx_MStickerBody_image { - max-width: 100%; - opacity: 0; -} - -.mx_MStickerBody_image_visible { - opacity: 1; -} - -.mx_MStickerBody_placeholder { - position: absolute; - opacity: 1; -} - -.mx_MStickerBody_placeholder_invisible { - transition: 500ms; - opacity: 0; +.mx_MStickerBody_tooltip { + position: absolute; + top: 50%; } diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index d9108a2fe1..03dad5e439 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -62,6 +62,8 @@ export default class extends React.Component { decryptedBlob: null, error: null, imgError: false, + imgLoaded: false, + hover: false, }; } @@ -116,6 +118,8 @@ export default class extends React.Component { } onImageEnter(e) { + this.setState({ hover: true }); + if (!this._isGif() || SettingsStore.getValue("autoplayGifsAndVideos")) { return; } @@ -124,6 +128,8 @@ export default class extends React.Component { } onImageLeave(e) { + this.setState({ hover: false }); + if (!this._isGif() || SettingsStore.getValue("autoplayGifsAndVideos")) { return; } @@ -139,6 +145,7 @@ export default class extends React.Component { onImageLoad() { this.props.onWidgetLoad(); + this.setState({ imgLoaded: true }); } _getContentUrl() { @@ -237,14 +244,22 @@ export default class extends React.Component { const maxWidth = content.info.w * maxHeight / content.info.h; let img = null; + let placeholder = null; + // e2e image hasn't been decrypted yet if (content.file !== undefined && this.state.decryptedUrl === null) { - img =
    - {content.body} -
    ; - } else if (thumbUrl && !this.state.imgError) { + placeholder = {content.body}; + } else if (!this.state.imgLoaded) { + // Deliberately, getSpinner is left unimplemented here, MStickerBody overides + placeholder = this.getPlaceholder(); + } + + const showPlaceholder = Boolean(placeholder); + + if (thumbUrl && !this.state.imgError) { // Restrict the width of the thumbnail here, otherwise it will fill the container // which has the same width as the timeline + // mx_MImageBody_thumbnail resizes img to exactly container size img = {content.body}; } - const thumbnail = img ? - -
    - { /* Calculate aspect ratio, using %padding will size _container correctly */ } -
    - { /* mx_MImageBody_thumbnail resizes img to exactly container size */ } + const thumbnail = ( +
    + { /* Calculate aspect ratio, using %padding will size _container correctly */ } +
    + +
    +
    + { placeholder } +
    +
    + +
    { img }
    -
    : null; - return ( - - { thumbnail } - - - ); + { this.state.hover && this.getTooltip() } +
    + ); + + return this.wrapImage(contentUrl, thumbnail); + } + + // Overidden by MStickerBody + wrapImage(contentUrl, children) { + return + {children} + ; + } + + // Overidden by MStickerBody + getPlaceholder() { + // MImageBody doesn't show a placeholder whilst the image loads, (but it could do) + return null; + } + + // Overidden by MStickerBody + getTooltip() { + return null; + } + + // Overidden by MStickerBody + getFileBody() { + return ; } render() { @@ -284,7 +330,6 @@ export default class extends React.Component { ); } - const contentUrl = this._getContentUrl(); let thumbUrl; if (this._isGif() && SettingsStore.getValue("autoplayGifsAndVideos")) { @@ -293,6 +338,12 @@ export default class extends React.Component { thumbUrl = this._getThumbUrl(); } - return this._messageContent(contentUrl, thumbUrl, content); + const thumbnail = this._messageContent(contentUrl, thumbUrl, content); + const fileBody = this.getFileBody(); + + return + { thumbnail } + { fileBody } + ; } } diff --git a/src/components/views/messages/MStickerBody.js b/src/components/views/messages/MStickerBody.js index cdb60f0074..d9ed668e42 100644 --- a/src/components/views/messages/MStickerBody.js +++ b/src/components/views/messages/MStickerBody.js @@ -18,141 +18,39 @@ limitations under the License. import MImageBody from './MImageBody'; import sdk from '../../../index'; -import TintableSVG from '../elements/TintableSvg'; export default class MStickerBody extends MImageBody { - displayName: 'MStickerBody' - - constructor(props) { - super(props); - - this._onMouseEnter = this._onMouseEnter.bind(this); - this._onMouseLeave = this._onMouseLeave.bind(this); - this._onImageLoad = this._onImageLoad.bind(this); - } - - _onMouseEnter() { - this.setState({showTooltip: true}); - } - - _onMouseLeave() { - this.setState({showTooltip: false}); - } - - _onImageLoad() { - this.setState({ - placeholderClasses: 'mx_MStickerBody_placeholder_invisible', - }); - const hidePlaceholderTimer = setTimeout(() => { - this.setState({ - placeholderVisible: false, - imageClasses: 'mx_MStickerBody_image_visible', - }); - }, 500); - this.setState({hidePlaceholderTimer}); - if (this.props.onWidgetLoad) { - this.props.onWidgetLoad(); - } - } - - _afterComponentDidMount() { - if (this.refs.image.complete) { - // Image already loaded - this.setState({ - placeholderVisible: false, - placeholderClasses: '.mx_MStickerBody_placeholder_invisible', - imageClasses: 'mx_MStickerBody_image_visible', - }); - } else { - // Image not already loaded - this.setState({ - placeholderVisible: true, - placeholderClasses: '', - imageClasses: '', - }); - } - } - - _afterComponentWillUnmount() { - if (this.state.hidePlaceholderTimer) { - clearTimeout(this.state.hidePlaceholderTimer); - this.setState({hidePlaceholderTimer: null}); - } - } - - _messageContent(contentUrl, thumbUrl, content) { - let tooltip; - const tooltipBody = ( - this.props.mxEvent && - this.props.mxEvent.getContent() && - this.props.mxEvent.getContent().body) ? - this.props.mxEvent.getContent().body : null; - if (this.state.showTooltip && tooltipBody) { - const RoomTooltip = sdk.getComponent('rooms.RoomTooltip'); - tooltip = ; - } - - const gutterSize = 0; - let placeholderSize = 75; - let placeholderFixupHeight = '100px'; - let placeholderTop = 0; - let placeholderLeft = 0; - - if (content.info) { - placeholderTop = Math.floor((content.info.h/2) - (placeholderSize/2)) + 'px'; - placeholderLeft = Math.floor((content.info.w/2) - (placeholderSize/2) + gutterSize) + 'px'; - placeholderFixupHeight = content.info.h + 'px'; - } - - // The pixel size of sticker images is generally larger than their intended display - // size so they render at native reolution on HiDPI displays. We therefore need to - // explicity set the size so they render at the intended size. - const imageStyle = { - height: content.info.h, - // leave the browser the calculate the width automatically - }; - - placeholderSize = placeholderSize + 'px'; - - // Body 'ref' required by MImageBody - return ( - -
    - { this.state.placeholderVisible && -
    - -
    } - {content.body} - { tooltip } -
    -
    - ); - } - // Empty to prevent default behaviour of MImageBody onClick() { } + + // MStickerBody doesn't need a wrapping ``, but it does need extra padding + // which is added by mx_MStickerBody_wrapper + wrapImage(contentUrl, children) { + return
    { children }
    ; + } + + // Placeholder to show in place of the sticker image if + // img onLoad hasn't fired yet. + getPlaceholder() { + const TintableSVG = sdk.getComponent('elements.TintableSvg'); + return ; + } + + // Tooltip to show on mouse over + getTooltip() { + const content = this.props.mxEvent && this.props.mxEvent.getContent(); + + if (!content || !content.body || !content.info || !content.info.w) return null; + + const RoomTooltip = sdk.getComponent('rooms.RoomTooltip'); + return
    + +
    ; + } + + // Don't show "Download this_file.png ..." + getFileBody() { + return null; + } } From a0bc681052c38f9d3529bc29d8874926dbe14621 Mon Sep 17 00:00:00 2001 From: random Date: Fri, 18 May 2018 10:16:41 +0000 Subject: [PATCH 080/702] Translated using Weblate (Italian) Currently translated at 99.4% (1169 of 1175 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/it/ --- src/i18n/strings/it.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/it.json b/src/i18n/strings/it.json index 82382a3967..b8b8cd7394 100644 --- a/src/i18n/strings/it.json +++ b/src/i18n/strings/it.json @@ -1167,5 +1167,13 @@ "Riot bugs are tracked on GitHub:
    create a GitHub issue.": "Gli errori di Riot sono monitorati su GitHub: segnala un problema su GitHub.", "Log out and remove encryption keys?": "Disconnettere e rimuovere le chiavi di cifratura?", "Refresh": "Aggiorna", - "We encountered an error trying to restore your previous session.": "Abbiamo riscontrato un errore tentando di ripristinare la tua sessione precedente." + "We encountered an error trying to restore your previous session.": "Abbiamo riscontrato un errore tentando di ripristinare la tua sessione precedente.", + "Send analytics data": "Invia dati statistici", + "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Aiutare a migliorare Riot inviando statistiche d'uso? Verrà usato un cookie. (Vedi la nostra politica sui cookie e sulla privacy).", + "Help improve Riot by sending usage data? This will use a cookie.": "Aiutare a migliorare Riot inviando statistiche d'uso? Verrà usato un cookie.", + "Yes please": "Sì grazie", + "Clear Storage and Sign Out": "Elimina lo storage e disconnetti", + "Send Logs": "Invia i log", + "Clearing your browser's storage may fix the problem, but will sign you out and cause any encrypted chat history to become unreadable.": "Eliminare lo storage del browser potrebbe risolvere il problema, ma verrai disconnesso e la cronologia delle chat criptate sarà illeggibile.", + "Collapse Reply Thread": "Riduci finestra di risposta" } From 38f446a364f1be9def92e0ee6a1dd81ebf665c52 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 18 May 2018 12:27:59 +0000 Subject: [PATCH 081/702] Translated using Weblate (Russian) Currently translated at 99.8% (1173 of 1175 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/ru/ --- src/i18n/strings/ru.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/ru.json b/src/i18n/strings/ru.json index 24e9750698..87fb79108e 100644 --- a/src/i18n/strings/ru.json +++ b/src/i18n/strings/ru.json @@ -1175,5 +1175,9 @@ "Unable to reply": "Не удается ответить", "Unable to load event that was replied to, it either does not exist or you do not have permission to view it.": "Не удается загрузить событие, на которое был дан ответ, либо оно не существует, либо у вас нет разрешения на его просмотр.", "Enable widget screenshots on supported widgets": "Включить скриншоты виджета в поддерживаемых виджетах", - "Collapse Reply Thread": "Ответить с цитированием" + "Collapse Reply Thread": "Ответить с цитированием", + "Send analytics data": "Отправить данные аналитики", + "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Помогите улучшить Riot, отправляя данные об использовании? Будут использоваться файлы cookie. (См. наши политики cookie и конфиденциальности).", + "Help improve Riot by sending usage data? This will use a cookie.": "Помогите улучшить Riot, отправляя данные об использовании? Будут использоваться файлы cookie.", + "Yes please": "Да, пожалуйста" } From e4f8c09c32d9a03567de9a1e9a1954928915e29b Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 22 May 2018 10:43:16 +0100 Subject: [PATCH 082/702] Only include placeholder in DOM when necessary --- src/components/views/messages/MImageBody.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index f27124238e..e2316b2fcc 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -276,15 +276,16 @@ export default class extends React.Component { { /* Calculate aspect ratio, using %padding will size _container correctly */ }
    -
    -
    - { placeholder } + { showPlaceholder && +
    +
    + { placeholder } +
    -
    + }
    { img } From fb5dd4a410e25e8ea145d9f6cd7ebae74e67f3d9 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 22 May 2018 10:46:10 +0100 Subject: [PATCH 083/702] Remove spurious fixupHeight --- src/components/views/messages/MImageBody.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index e2316b2fcc..083dc342db 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -211,7 +211,6 @@ export default class extends React.Component { }); }).done(); } - this.fixupHeight(); this._afterComponentDidMount(); } From c249bee9b53f4718319f7bcc9128059709e55260 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 22 May 2018 16:09:54 +0100 Subject: [PATCH 084/702] Grammar --- src/components/views/messages/MImageBody.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index 083dc342db..c210c64318 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -240,7 +240,7 @@ export default class extends React.Component { _messageContent(contentUrl, thumbUrl, content) { // The maximum height of the thumbnail as it is rendered as an const maxHeight = Math.min(THUMBNAIL_MAX_HEIGHT, content.info.h); - // The maximum width of the thumbnail, as dictated by it's natural + // The maximum width of the thumbnail, as dictated by its natural // maximum height. const maxWidth = content.info.w * maxHeight / content.info.h; From 538979a4ee7b6f9e4d92e57749e35a2bcc5d8689 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 22 May 2018 17:13:45 +0100 Subject: [PATCH 085/702] Fix MVideoBody spinner --- src/components/views/messages/MVideoBody.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/views/messages/MVideoBody.js b/src/components/views/messages/MVideoBody.js index 5365daee03..37fc94d1ed 100644 --- a/src/components/views/messages/MVideoBody.js +++ b/src/components/views/messages/MVideoBody.js @@ -147,12 +147,7 @@ module.exports = React.createClass({ // For now add an img tag with a spinner. return ( -
    +
    {content.body}
    From c9c3cf55dea03f97c00239821b50d899c7acdfb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20C?= Date: Tue, 22 May 2018 17:08:52 +0000 Subject: [PATCH 086/702] Translated using Weblate (French) Currently translated at 100.0% (1176 of 1176 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/fr/ --- src/i18n/strings/fr.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/fr.json b/src/i18n/strings/fr.json index 88c5e0ab07..048dcd9d81 100644 --- a/src/i18n/strings/fr.json +++ b/src/i18n/strings/fr.json @@ -1174,5 +1174,6 @@ "Send analytics data": "Envoyer les données analytiques", "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Aider Riot à s'améliorer en envoyant des données d'utilisation ? Ceci utilisera un cookie. (Voir nos politiques de cookie et de confidentialité).", "Help improve Riot by sending usage data? This will use a cookie.": "Aider Riot à s'améliorer en envoyant des données d'utilisation ? Ceci utilisera un cookie.", - "Yes please": "Oui, s'il vous plaît" + "Yes please": "Oui, s'il vous plaît", + "Muted Users": "Utilisateurs ignorés" } From 6df3371c6c562fa006bb2cddbd6b3cdb4cb8e8cc Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 22 May 2018 19:14:54 +0100 Subject: [PATCH 087/702] Add a "reload widget" button. --- res/img/button-refresh.svg | 12 ++++++++++++ src/components/views/elements/AppTile.js | 23 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 res/img/button-refresh.svg diff --git a/res/img/button-refresh.svg b/res/img/button-refresh.svg new file mode 100644 index 0000000000..b4990a2147 --- /dev/null +++ b/res/img/button-refresh.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 0895ede636..4f7a3e298d 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -55,6 +55,7 @@ export default class AppTile extends React.Component { this._grantWidgetPermission = this._grantWidgetPermission.bind(this); this._revokeWidgetPermission = this._revokeWidgetPermission.bind(this); this._onPopoutWidgetClick = this._onPopoutWidgetClick.bind(this); + this._onReloadWidgetClick = this._onReloadWidgetClick.bind(this); } /** @@ -519,6 +520,11 @@ export default class AppTile extends React.Component { { target: '_blank', href: this._getSafeUrl(), rel: 'noopener noreferrer'}).click(); } + _onReloadWidgetClick(e) { + // Reload iframe in this way to avoid cross-origin restrictions + this.refs.appFrame.src = this.refs.appFrame.src; + } + render() { let appTileBody; @@ -606,6 +612,7 @@ export default class AppTile extends React.Component { const showPictureSnapshotButton = this._hasCapability('m.capability.screenshot') && this.props.show; const showPictureSnapshotIcon = 'img/camera_green.svg'; const popoutWidgetIcon = 'img/button-new-window.svg'; + const reloadWidgetIcon = 'img/button-refresh.svg'; const windowStateIcon = (this.props.show ? 'img/minimize.svg' : 'img/maximize.svg'); return ( @@ -624,6 +631,16 @@ export default class AppTile extends React.Component { { this.props.showTitle && this._getTileTitle() } + { /* Reload widget */ } + { this.props.showReload && } + { /* Popout widget */ } { this.props.showPopout && Date: Fri, 18 May 2018 09:51:44 +0000 Subject: [PATCH 088/702] Translated using Weblate (Hungarian) Currently translated at 100.0% (1176 of 1176 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/hu/ --- src/i18n/strings/hu.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/hu.json b/src/i18n/strings/hu.json index 44324384af..6341b4468e 100644 --- a/src/i18n/strings/hu.json +++ b/src/i18n/strings/hu.json @@ -1174,5 +1174,6 @@ "Send analytics data": "Analitikai adatok küldése", "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Szeretnél segíteni a Riot javításában analitikai adatok elküldésével? Ez sütit (cookie) használ. (Nézd meg a sütikről és titoktartási irányelvekről szóló leírást).", "Help improve Riot by sending usage data? This will use a cookie.": "Szeretnél segíteni a Riot javításában analitikai adatok elküldésével? Ez sütit (cookie) használ.", - "Yes please": "Igen, kérlek" + "Yes please": "Igen, kérlek", + "Muted Users": "Elnémított felhasználók" } From 975332633b1b4bec108f3a3535d8f4546e4bc098 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Wed, 23 May 2018 00:26:55 +0100 Subject: [PATCH 089/702] Translation. --- src/i18n/strings/en_EN.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 239b45c32e..ea2749b404 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -103,6 +103,7 @@ "You need to be logged in.": "You need to be logged in.", "You need to be able to invite users to do that.": "You need to be able to invite users to do that.", "Unable to create widget.": "Unable to create widget.", + "Reload widget": "Reload widget", "Missing roomId.": "Missing roomId.", "Failed to send request.": "Failed to send request.", "This room is not recognised.": "This room is not recognised.", From cace5e8bfcf4c83fd916798f176a9a45ed292f73 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 00:41:46 +0100 Subject: [PATCH 090/702] fix bug where selection breaks after inserting emoji --- src/components/views/rooms/MessageComposerInput.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 6919a304c2..b71aaa6a42 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -33,7 +33,6 @@ import PlainWithPillsSerializer from "../../../autocomplete/PlainWithPillsSerial // Entity} from 'draft-js'; import classNames from 'classnames'; -import escape from 'lodash/escape'; import Promise from 'bluebird'; import MatrixClientPeg from '../../../MatrixClientPeg'; @@ -507,6 +506,15 @@ export default class MessageComposerInput extends React.Component { } }); + // work around weird bug where inserting emoji via the macOS + // emoji picker can leave the selection stuck in the emoji's + // child text. This seems to happen due to selection getting + // moved in the normalisation phase after calculating these changes + if (editorState.document.getParent(editorState.anchorKey).type === 'emoji') { + change = change.collapseToStartOfNextText(); + editorState = change.value; + } + /* const currentBlock = editorState.getSelection().getStartKey(); const currentSelection = editorState.getSelection(); From e7a4ffaf4531ffec7399bf42508eee491ec69718 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 00:52:00 +0100 Subject: [PATCH 091/702] fix emojioneifying autoconverted emoji --- .../views/rooms/MessageComposerInput.js | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index b71aaa6a42..cb015dd0ba 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -482,6 +482,32 @@ export default class MessageComposerInput extends React.Component { } */ + if (editorState.startText !== null) { + const text = editorState.startText.text; + const currentStartOffset = editorState.startOffset; + + // Automatic replacement of plaintext emoji to Unicode emoji + if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) { + // The first matched group includes just the matched plaintext emoji + const emojiMatch = REGEX_EMOJI_WHITESPACE.exec(text.slice(0, currentStartOffset)); + if (emojiMatch) { + // plaintext -> hex unicode + const emojiUc = asciiList[emojiMatch[1]]; + // hex unicode -> shortname -> actual unicode + const unicodeEmoji = shortnameToUnicode(EMOJI_UNICODE_TO_SHORTNAME[emojiUc]); + + const range = Range.create({ + anchorKey: editorState.selection.startKey, + anchorOffset: currentStartOffset - emojiMatch[1].length - 1, + focusKey: editorState.selection.startKey, + focusOffset: currentStartOffset - 1, + }); + change = change.insertTextAtRange(range, unicodeEmoji); + editorState = change.value; + } + } + } + // emojioneify any emoji // XXX: is getTextsAsArray a private API? @@ -544,31 +570,6 @@ export default class MessageComposerInput extends React.Component { editorState = EditorState.forceSelection(editorState, currentSelection); } */ - if (editorState.startText !== null) { - const text = editorState.startText.text; - const currentStartOffset = editorState.startOffset; - - // Automatic replacement of plaintext emoji to Unicode emoji - if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) { - // The first matched group includes just the matched plaintext emoji - const emojiMatch = REGEX_EMOJI_WHITESPACE.exec(text.slice(0, currentStartOffset)); - if (emojiMatch) { - // plaintext -> hex unicode - const emojiUc = asciiList[emojiMatch[1]]; - // hex unicode -> shortname -> actual unicode - const unicodeEmoji = shortnameToUnicode(EMOJI_UNICODE_TO_SHORTNAME[emojiUc]); - - const range = Range.create({ - anchorKey: editorState.selection.startKey, - anchorOffset: currentStartOffset - emojiMatch[1].length - 1, - focusKey: editorState.selection.startKey, - focusOffset: currentStartOffset, - }); - change = change.insertTextAtRange(range, unicodeEmoji); - editorState = change.value; - } - } - } if (this.props.onInputStateChanged && editorState.blocks.size > 0) { let blockType = editorState.blocks.first().type; From ab5a4f58a259e6d98b81c33130686b1a27926452 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Tue, 22 May 2018 23:56:17 +0000 Subject: [PATCH 092/702] Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (1176 of 1176 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/zh_Hant/ --- src/i18n/strings/zh_Hant.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/zh_Hant.json b/src/i18n/strings/zh_Hant.json index a2e8d669c9..649caefd35 100644 --- a/src/i18n/strings/zh_Hant.json +++ b/src/i18n/strings/zh_Hant.json @@ -1170,5 +1170,10 @@ "We encountered an error trying to restore your previous session.": "我們在嘗試復原您先前的工作階段時遇到了一點錯誤。", "Clearing your browser's storage may fix the problem, but will sign you out and cause any encrypted chat history to become unreadable.": "清除您瀏覽器的儲存的東西也許可以修復問題,但會將您登出並造成任何已加密的聊天都無法讀取。", "Collapse Reply Thread": "摺疊回覆討論串", - "Enable widget screenshots on supported widgets": "在支援的小工具上啟用小工具螢幕快照" + "Enable widget screenshots on supported widgets": "在支援的小工具上啟用小工具螢幕快照", + "Send analytics data": "傳送分析資料", + "Muted Users": "已靜音的使用者", + "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "透過傳送使用情形資料來協助改善 Riot?這會使用 cookie。(參見我們的 cookie 與隱私政策)。", + "Help improve Riot by sending usage data? This will use a cookie.": "透過傳送使用情形資料來協助改善 Riot?這會使用 cookie。", + "Yes please": "好的,請" } From 794a60b9f8976452add3885f5a07af7f6f5362e4 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 01:36:21 +0100 Subject: [PATCH 093/702] refocus editor immediately after executing commands and persist selections correctly across blur/focus --- .../views/rooms/MessageComposerInput.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index cb015dd0ba..3a0329c399 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -1005,12 +1005,13 @@ export default class MessageComposerInput extends React.Component { this.historyManager.save(editorState, this.state.isRichTextEnabled ? 'rich' : 'markdown'); this.setState({ editorState: this.createEditorState(), + }, ()=>{ + this.refs.editor.focus(); }); } if (cmd.promise) { cmd.promise.then(()=>{ console.log("Command success."); - this.refs.editor.focus(); }, (err)=>{ console.error("Command failure: %s", err); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); @@ -1499,6 +1500,18 @@ export default class MessageComposerInput extends React.Component { this.handleKeyCommand('toggle-mode'); }; + onBlur = (e) => { + this.selection = this.state.editorState.selection; + }; + + onFocus = (e) => { + if (this.selection) { + const change = this.state.editorState.change().select(this.selection); + this.onChange(change); + delete this.selection; + } + }; + render() { const activeEditorState = this.state.originalEditorState || this.state.editorState; @@ -1532,6 +1545,8 @@ export default class MessageComposerInput extends React.Component { onChange={this.onChange} onKeyDown={this.onKeyDown} onPaste={this.onPaste} + onBlur={this.onBlur} + onFocus={this.onFocus} renderNode={this.renderNode} renderMark={this.renderMark} spellCheck={true} From 6ac23248745d9303f0cdc7ce62ca94c018a1c6ba Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 01:43:03 +0100 Subject: [PATCH 094/702] fix wordwrap and pre formatting --- res/css/views/rooms/_MessageComposer.scss | 27 ++--------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/res/css/views/rooms/_MessageComposer.scss b/res/css/views/rooms/_MessageComposer.scss index 72d31cfddd..3eb445d239 100644 --- a/res/css/views/rooms/_MessageComposer.scss +++ b/res/css/views/rooms/_MessageComposer.scss @@ -89,6 +89,7 @@ limitations under the License. max-height: 120px; min-height: 19px; overflow: auto; + word-break: break-word; } // FIXME: rather unpleasant hack to get rid of

    margins. @@ -110,30 +111,6 @@ limitations under the License. animation: 0.2s visualbell; } -.mx_MessageComposer_input_empty .public-DraftEditorPlaceholder-root { - display: none; -} - -/* -.mx_MessageComposer_input .DraftEditor-root { - width: 100%; - flex: 1; - word-break: break-word; - max-height: 120px; - min-height: 21px; - overflow: auto; -} -*/ - -.mx_MessageComposer_input .DraftEditor-root .DraftEditor-editorContainer { - /* Ensure mx_UserPill and mx_RoomPill (see _RichText) are not obscured from the top */ - padding-top: 2px; -} - -.mx_MessageComposer .public-DraftStyleDefault-block { - overflow-x: hidden; -} - .mx_MessageComposer_input blockquote { color: $blockquote-fg-color; margin: 0 0 16px; @@ -141,7 +118,7 @@ limitations under the License. border-left: 4px solid $blockquote-bar-color; } -.mx_MessageComposer_input pre.public-DraftStyleDefault-pre pre { +.mx_MessageComposer_input pre { background-color: $rte-code-bg-color; border-radius: 3px; padding: 10px; From 6fba8311f9af31bee30eadd188d655a38f11478c Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 02:09:30 +0100 Subject: [PATCH 095/702] escape blockquotes correctly and fix NPE --- src/components/views/rooms/MessageComposerInput.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 3a0329c399..4b41c76076 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -184,7 +184,7 @@ export default class MessageComposerInput extends React.Component { // TODO: this can probably be more robust - it doesn't consider // indenting or lists for instance. return children.replace(/([*_~`+])/g, '\\$1') - .replace(/^([>#\|])/g, '\\$1'); + .replace(/^([>#\|])/mg, '\\$1'); } else if (obj.object === 'inline') { switch (obj.type) { @@ -369,6 +369,7 @@ export default class MessageComposerInput extends React.Component { let fragmentChange = fragment.change(); fragmentChange.moveToRangeOf(fragment.document) .wrapBlock(quote); + //.setBlocks('block-quote'); // FIXME: handle pills and use commonmark rather than md-serialize const md = this.md.serialize(fragmentChange.value); @@ -536,7 +537,9 @@ export default class MessageComposerInput extends React.Component { // emoji picker can leave the selection stuck in the emoji's // child text. This seems to happen due to selection getting // moved in the normalisation phase after calculating these changes - if (editorState.document.getParent(editorState.anchorKey).type === 'emoji') { + if (editorState.anchorKey && + editorState.document.getParent(editorState.anchorKey).type === 'emoji') + { change = change.collapseToStartOfNextText(); editorState = change.value; } From fc1c4996fc80bd841dc3dd14165d504bdcbd6707 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 02:15:34 +0100 Subject: [PATCH 096/702] slate-md-serializer 3.1.0 now escapes correctly --- package.json | 2 +- src/components/views/rooms/MessageComposerInput.js | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index dfc02a7e26..eea7a6857f 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "slate": "^0.33.4", "slate-react": "^0.12.4", "slate-html-serializer": "^0.6.1", - "slate-md-serializer": "^3.0.3", + "slate-md-serializer": "^3.1.0", "sanitize-html": "^1.14.1", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 4b41c76076..0b57e90184 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -178,15 +178,7 @@ export default class MessageComposerInput extends React.Component { rules: [ { serialize: (obj, children) => { - if (obj.object === 'string') { - // escape any MD in it. i have no idea why the serializer doesn't - // do this already. - // TODO: this can probably be more robust - it doesn't consider - // indenting or lists for instance. - return children.replace(/([*_~`+])/g, '\\$1') - .replace(/^([>#\|])/mg, '\\$1'); - } - else if (obj.object === 'inline') { + if (obj.object === 'inline') { switch (obj.type) { case 'pill': return `[${ obj.data.get('completion') }](${ obj.data.get('href') })`; From edc8264cff0ee7110d786d76961b59a55830380c Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 02:48:57 +0100 Subject: [PATCH 097/702] shift to custom slate-md-serializer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eea7a6857f..542f6c7cc2 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "slate": "^0.33.4", "slate-react": "^0.12.4", "slate-html-serializer": "^0.6.1", - "slate-md-serializer": "^3.1.0", + "slate-md-serializer": "matrix-org/slate-md-serializer#50a133a8", "sanitize-html": "^1.14.1", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", From 6f3634c33f9d0305d79770b08c0daa01edca0d13 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 03:08:55 +0100 Subject: [PATCH 098/702] bump slate-md-serializer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 542f6c7cc2..63022f6c9d 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "slate": "^0.33.4", "slate-react": "^0.12.4", "slate-html-serializer": "^0.6.1", - "slate-md-serializer": "matrix-org/slate-md-serializer#50a133a8", + "slate-md-serializer": "matrix-org/slate-md-serializer#d6a7652", "sanitize-html": "^1.14.1", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", From a822a1c9a07d7d83ebc7b39149e3d67188dbfea8 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 03:19:33 +0100 Subject: [PATCH 099/702] bump dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 63022f6c9d..f45d3a4d95 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "flux": "2.1.1", "focus-trap-react": "^3.0.5", "fuse.js": "^2.2.0", - "gemini-scrollbar": "matrix-org/gemini-scrollbar#b302279", + "gemini-scrollbar": "matrix-org/gemini-scrollbar#926a4c7", "gfm.css": "^1.1.1", "glob": "^5.0.14", "highlight.js": "^9.0.0", From 079b1238a1954fbf096627b10eb58bc378461e68 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 03:20:59 +0100 Subject: [PATCH 100/702] bump right dep --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f45d3a4d95..79a3bf80e1 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "flux": "2.1.1", "focus-trap-react": "^3.0.5", "fuse.js": "^2.2.0", - "gemini-scrollbar": "matrix-org/gemini-scrollbar#926a4c7", + "gemini-scrollbar": "matrix-org/gemini-scrollbar#b302279", "gfm.css": "^1.1.1", "glob": "^5.0.14", "highlight.js": "^9.0.0", @@ -86,7 +86,7 @@ "slate": "^0.33.4", "slate-react": "^0.12.4", "slate-html-serializer": "^0.6.1", - "slate-md-serializer": "matrix-org/slate-md-serializer#d6a7652", + "slate-md-serializer": "matrix-org/slate-md-serializer#926a4c7", "sanitize-html": "^1.14.1", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", From 95bfface99a917aaa466873ab3b050f9990dae68 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 03:43:40 +0100 Subject: [PATCH 101/702] comment out broken logic for stripping p tags & bump dep --- package.json | 2 +- src/Markdown.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 79a3bf80e1..33bc75eff8 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "slate": "^0.33.4", "slate-react": "^0.12.4", "slate-html-serializer": "^0.6.1", - "slate-md-serializer": "matrix-org/slate-md-serializer#926a4c7", + "slate-md-serializer": "matrix-org/slate-md-serializer#1635f37", "sanitize-html": "^1.14.1", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", diff --git a/src/Markdown.js b/src/Markdown.js index e67f4df4fd..2b16800d85 100644 --- a/src/Markdown.js +++ b/src/Markdown.js @@ -102,6 +102,7 @@ export default class Markdown { // (https://github.com/vector-im/riot-web/issues/3154) softbreak: '
    ', }); +/* const real_paragraph = renderer.paragraph; renderer.paragraph = function(node, entering) { @@ -114,16 +115,21 @@ export default class Markdown { real_paragraph.call(this, node, entering); } }; +*/ renderer.html_inline = html_if_tag_allowed; + renderer.html_block = function(node) { +/* // as with `paragraph`, we only insert line breaks // if there are multiple lines in the markdown. const isMultiLine = is_multi_line(node); - if (isMultiLine) this.cr(); +*/ html_if_tag_allowed.call(this, node); +/* if (isMultiLine) this.cr(); +*/ }; return renderer.render(this.parsed); @@ -150,6 +156,7 @@ export default class Markdown { this.lit(s); }; +/* renderer.paragraph = function(node, entering) { // as with toHTML, only append lines to paragraphs if there are // multiple paragraphs @@ -159,10 +166,12 @@ export default class Markdown { } } }; + renderer.html_block = function(node) { this.lit(node.literal); if (is_multi_line(node) && node.next) this.lit('\n\n'); }; +*/ // convert MD links into console-friendly ' < http://foo >' style links // ...except given this function never gets called with links, it's useless. From f40af434bcfeec7e37015192993adc639b54d79e Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 03:46:53 +0100 Subject: [PATCH 102/702] unbreak Markdown.toPlaintext --- src/Markdown.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Markdown.js b/src/Markdown.js index 2b16800d85..e02118397b 100644 --- a/src/Markdown.js +++ b/src/Markdown.js @@ -156,7 +156,6 @@ export default class Markdown { this.lit(s); }; -/* renderer.paragraph = function(node, entering) { // as with toHTML, only append lines to paragraphs if there are // multiple paragraphs @@ -171,7 +170,6 @@ export default class Markdown { this.lit(node.literal); if (is_multi_line(node) && node.next) this.lit('\n\n'); }; -*/ // convert MD links into console-friendly ' < http://foo >' style links // ...except given this function never gets called with links, it's useless. From 5b4a036e8c7db150aae1f404cb952ecb49d5970f Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 03:53:05 +0100 Subject: [PATCH 103/702] bump dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 33bc75eff8..fb0fd3ec90 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "slate": "^0.33.4", "slate-react": "^0.12.4", "slate-html-serializer": "^0.6.1", - "slate-md-serializer": "matrix-org/slate-md-serializer#1635f37", + "slate-md-serializer": "matrix-org/slate-md-serializer#f5deb3f", "sanitize-html": "^1.14.1", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", From 424dea1d4aeafa6267d971050a87d880a77f9a53 Mon Sep 17 00:00:00 2001 From: Kenneth Larsson Date: Wed, 23 May 2018 08:57:55 +0000 Subject: [PATCH 104/702] Translated using Weblate (Swedish) Currently translated at 77.2% (909 of 1176 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/sv/ --- src/i18n/strings/sv.json | 97 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 93 insertions(+), 4 deletions(-) diff --git a/src/i18n/strings/sv.json b/src/i18n/strings/sv.json index f583dfd271..6a0bd10025 100644 --- a/src/i18n/strings/sv.json +++ b/src/i18n/strings/sv.json @@ -74,7 +74,7 @@ "Continue": "Fortsätt", "Could not connect to the integration server": "Det gick inte att ansluta till integrationsservern", "Create an account": "Skapa ett konto", - "Create Room": "Skapa ett rum", + "Create Room": "Skapa rum", "Cryptography": "Kryptografi", "Current password": "Nuvarande lösenord", "Curve25519 identity key": "Curve25519 -identitetsnyckel", @@ -107,7 +107,7 @@ "Email address (optional)": "Epostadress (valfri)", "Email, name or matrix ID": "Epostadress, namn, eller Matrix-ID", "Emoji": "Emoji", - "Enable encryption": "Sätt på kryptering", + "Enable encryption": "Aktivera kryptering", "Encrypted messages will not be visible on clients that do not yet implement encryption": "Krypterade meddelanden syns inte på klienter som inte ännu stöder kryptering", "Encrypted room": "Krypterat rum", "%(senderName)s ended the call.": "%(senderName)s avslutade samtalet.", @@ -307,7 +307,7 @@ "Room %(roomId)s not visible": "Rummet %(roomId)s är inte synligt", "Room Colour": "Rumsfärg", "Room contains unknown devices": "Det finns okända enheter i rummet", - "Room name (optional)": "Rummets namn (valfri)", + "Room name (optional)": "Rumsnamn (valfri)", "%(roomName)s does not exist.": "%(roomName)s finns inte.", "%(roomName)s is not accessible at this time.": "%(roomName)s är inte tillgängligt för tillfället.", "Rooms": "Rum", @@ -819,5 +819,94 @@ "Unblacklist": "Ta bort svartlistning", "Failed to invite the following users to %(groupId)s:": "Det gick inte att bjuda in följande användare till %(groupId)s:", "Failed to invite users to %(groupId)s": "Det gick inte att bjuda in användare till %(groupId)s", - "This room is not public. You will not be able to rejoin without an invite.": "Detta rum är inte offentligt. Du kommer inte kunna gå med igen utan en inbjudan." + "This room is not public. You will not be able to rejoin without an invite.": "Detta rum är inte offentligt. Du kommer inte kunna gå med igen utan en inbjudan.", + "Ignores a user, hiding their messages from you": "Ignorerar en användare och döljer dess meddelanden för dig", + "Stops ignoring a user, showing their messages going forward": "Slutar ignorera en användare och visar dess meddelanden för framöver", + "Opens the Developer Tools dialog": "Öppna dialogrutan Utvecklarverktyg", + "Notify the whole room": "Meddela hela rummet", + "Room Notification": "Rumsavisering", + "Users": "Användare", + "unknown device": "okänd enhet", + "verified": "verifierad", + "Verification": "Verifiering", + "User ID": "Användar-ID", + "unencrypted": "okrypterad", + "Export room keys": "Exportera rumsnycklar", + "Import room keys": "Importera rumsnycklar", + "File to import": "Fil att importera", + "Which officially provided instance you are using, if any": "Vilken officiellt tillhandahållen instans du använder, om någon", + "(unknown failure: %(reason)s)": "(okänt fel: %(reason)s)", + "(could not connect media)": "(det gick inte ansluta media)", + " (unsupported)": " (stöds ej)", + "Drop file here to upload": "Släpp fil här för att ladda upp", + "Ongoing conference call%(supportedText)s.": "Pågående konferenssamtal%(supportedText)s.", + "%(senderName)s sent an image": "%(senderName)s skickade en bild", + "%(senderName)s sent a video": "%(senderName)s skickade en video", + "%(senderName)s uploaded a file": "%(senderName)s laddade upp en fil", + "Options": "Alternativ", + "Unencrypted message": "Okrypterat meddelande", + "Verified": "Verifierad", + "Unverified": "Overifierad", + "Replying": "Svarar", + "Drop here to favourite": "Släpp här för att favorisera", + "Drop here to tag direct chat": "Släpp här för att göra till direkt-chatt", + "Drop here to restore": "Släpp här för att återställa", + "Drop here to demote": "Släpp här för att göra till låg prioritet", + "You're not in any rooms yet! Press to make a room or to browse the directory": "Du är inte i något rum ännu! Tryck för att skapa ett rum eller för att bläddra i katalogen", + "Would you like to accept or decline this invitation?": "Vill du acceptera eller avböja denna inbjudan?", + "You have been invited to join this room by %(inviterName)s": "Du har blivit inbjuden att gå med i rummet av %(inviterName)s", + "Kick this user?": "Kicka användaren?", + "To send messages, you must be a": "För att skicka meddelanden, måste du vara", + "To invite users into the room, you must be a": "För att bjuda in användare i rummet, måste du vara", + "To configure the room, you must be a": "För att konfigurera rummet, måste du vara", + "To kick users, you must be a": "För att kicka användare, måste du vara", + "To ban users, you must be a": "För att banna användare, måste du vara", + "To remove other users' messages, you must be a": "För att ta bort andra användares meddelanden, måste du vara", + "%(user)s is a %(userRole)s": "%(user)s är %(userRole)s", + "You have been kicked from %(roomName)s by %(userName)s.": "Du har blivit kickad från %(roomName)s av %(userName)s.", + "You have been kicked from this room by %(userName)s.": "Du har blivit kickad från detta rum av %(userName)s.", + "You have been banned from %(roomName)s by %(userName)s.": "Du har blivit bannad från %(roomName)s av %(userName)s.", + "You have been banned from this room by %(userName)s.": "Du har blivit bannad från detta rum av %(userName)s.", + "This room": "Detta rum", + "You are trying to access %(roomName)s.": "Du försöker komma åt %(roomName)s.", + "You are trying to access a room.": "Du försöker komma åt ett rum.", + "This is a preview of this room. Room interactions have been disabled": "Detta är en förhandsvisning av rummet. Rumsinteraktioner har inaktiverats", + "To change the room's avatar, you must be a": "För att ändra rummets avatar, måste du vara", + "To change the room's name, you must be a": "För att ändra rummets namn, måste du vara", + "To change the room's main address, you must be a": "För att ändra rummets huvudadress, måste du vara", + "To change the room's history visibility, you must be a": "För att ändra visning av rummets historik, måste du vara", + "To change the permissions in the room, you must be a": "För att ändra behörigheter i rummet, måste du vara", + "To change the topic, you must be a": "För att ändra ämnet, måste du vara", + "To modify widgets in the room, you must be a": "För att ändra widgets i rummet, måste du vara", + "Banned by %(displayName)s": "Bannad av %(displayName)s", + "The visibility of existing history will be unchanged": "Synlighet av befintlig historik förblir oförändrad", + "You should not yet trust it to secure data": "Du bör ännu inte lita på att den säkrar data", + "(warning: cannot be disabled again!)": "(varning: kan inte inaktiveras igen!)", + "Muted Users": "Dämpade användare", + "This room is not accessible by remote Matrix servers": "Detta rum är inte tillgängligt för externa Matrix-servrar", + "To send events of type , you must be a": "För att skicka händelser av typen , måste du vara", + "Unable to load event that was replied to, it either does not exist or you do not have permission to view it.": "Det gick inte att ladda händelsen som svarades på, antingen finns den inte eller så har du inte behörighet att se den.", + "Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.": "Är du säker på att du vill ta bort den här händelsen? Observera att om du tar bort en rumsnamns- eller ämnesändring kan det ångra ändringen.", + "Send Custom Event": "Skicka anpassad händelse", + "You must specify an event type!": "Du måste ange en händelsetyp!", + "Event sent!": "Händelse skickad!", + "Failed to send custom event.": "Det gick inte att skicka anpassad händelse.", + "Event Type": "Händelsetyp", + "Event Content": "Händelseinnehåll", + "Example": "Exempel", + "example": "exempel", + "Create": "Skapa", + "Advanced options": "Avancerade alternativ", + "Block users on other matrix homeservers from joining this room": "Blockera användare på andra Matrix-hemservrar från att gå med i detta rum", + "This setting cannot be changed later!": "Den här inställningen kan inte ändras senare!", + "Unknown error": "Okänt fel", + "Incorrect password": "Felaktigt lösenord", + "This will make your account permanently unusable. You will not be able to re-register the same user ID.": "Detta kommer att göra ditt konto permanent oanvändbart. Du kommer inte att kunna registrera samma användar-ID igen.", + "This action is irreversible.": "Denna åtgärd går inte att ångra.", + "To verify that this device can be trusted, please contact its owner using some other means (e.g. in person or a phone call) and ask them whether the key they see in their User Settings for this device matches the key below:": "För att verifiera att denna enhet kan litas på, vänligen kontakta ägaren på annat sätt (t ex personligen eller med ett telefonsamtal) och fråga om nyckeln ägaren har i sina användarinställningar för enheten matchar nyckeln nedan:", + "Device name": "Enhetsnamn", + "Device key": "Enhetsnyckel", + "Verify device": "Verifiera enhet", + "I verify that the keys match": "Jag verifierar att nycklarna matchar", + "In future this verification process will be more sophisticated.": "I framtiden kommer denna verifieringsprocess att bli mer sofistikerad." } From a6e7a8106c0b5bc94053de2640b2f9ff09808fdb Mon Sep 17 00:00:00 2001 From: Kenneth Larsson Date: Wed, 23 May 2018 09:42:21 +0000 Subject: [PATCH 105/702] Translated using Weblate (Swedish) Currently translated at 78.2% (923 of 1179 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/sv/ --- src/i18n/strings/sv.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/sv.json b/src/i18n/strings/sv.json index 6a0bd10025..0247b5c080 100644 --- a/src/i18n/strings/sv.json +++ b/src/i18n/strings/sv.json @@ -908,5 +908,19 @@ "Device key": "Enhetsnyckel", "Verify device": "Verifiera enhet", "I verify that the keys match": "Jag verifierar att nycklarna matchar", - "In future this verification process will be more sophisticated.": "I framtiden kommer denna verifieringsprocess att bli mer sofistikerad." + "In future this verification process will be more sophisticated.": "I framtiden kommer denna verifieringsprocess att bli mer sofistikerad.", + "If it matches, press the verify button below. If it doesn't, then someone else is intercepting this device and you probably want to press the blacklist button instead.": "Om det matchar, tryck på verifieringsknappen nedan. Om inte så är det risk att någon annan försöker avlyssna enheten och då vill du förmodligen trycka på svartlistsknappen istället.", + "State Key": "Lägesnyckel", + "Send Account Data": "Skicka kontodata", + "Explore Account Data": "Utforska kontodata", + "Toolbox": "Verktygslåda", + "Developer Tools": "Utvecklarverktyg", + "Unverify": "Ta bort verifiering", + "Verify...": "Verifiera...", + "You added a new device '%(displayName)s', which is requesting encryption keys.": "Du har lagt till en ny enhet '%(displayName)s', som begär krypteringsnycklar.", + "Your unverified device '%(displayName)s' is requesting encryption keys.": "Din overifierade enhet '%(displayName)s' begär krypteringsnycklar.", + "Start verification": "Starta verifiering", + "Share without verifying": "Dela utan att verifiera", + "Ignore request": "Ignorera begäran", + "Loading device info...": "Laddar enhetsinfo..." } From b9f597b75f1a816deece2e955bd68e0cda62f4be Mon Sep 17 00:00:00 2001 From: Szimszon Date: Wed, 23 May 2018 10:15:48 +0000 Subject: [PATCH 106/702] Translated using Weblate (Hungarian) Currently translated at 100.0% (1180 of 1180 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/hu/ --- src/i18n/strings/hu.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/hu.json b/src/i18n/strings/hu.json index 6341b4468e..27363baf0f 100644 --- a/src/i18n/strings/hu.json +++ b/src/i18n/strings/hu.json @@ -1175,5 +1175,9 @@ "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Szeretnél segíteni a Riot javításában analitikai adatok elküldésével? Ez sütit (cookie) használ. (Nézd meg a sütikről és titoktartási irányelvekről szóló leírást).", "Help improve Riot by sending usage data? This will use a cookie.": "Szeretnél segíteni a Riot javításában analitikai adatok elküldésével? Ez sütit (cookie) használ.", "Yes please": "Igen, kérlek", - "Muted Users": "Elnémított felhasználók" + "Muted Users": "Elnémított felhasználók", + "Warning: This widget might use cookies.": "Figyelmeztetés: Ez a kisalkalmazás sütiket (cookies) használhat.", + "Terms and Conditions": "Általános Szerződési Feltételek", + "To continue using the %(homeserverDomain)s homeserver you must review and agree to our terms and conditions.": "A %(homeserverDomain)s szerver használatának folytatásához el kell olvasnod és el kell fogadnod az általános szerződési feltételeket.", + "Review terms and conditions": "Általános Szerződési Feltételek elolvasása" } From 94f7d1b2246613412af71d0f0da182de6512584b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20C?= Date: Wed, 23 May 2018 10:42:04 +0000 Subject: [PATCH 107/702] Translated using Weblate (French) Currently translated at 100.0% (1180 of 1180 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/fr/ --- src/i18n/strings/fr.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/fr.json b/src/i18n/strings/fr.json index 048dcd9d81..a08e5ee250 100644 --- a/src/i18n/strings/fr.json +++ b/src/i18n/strings/fr.json @@ -1175,5 +1175,9 @@ "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Aider Riot à s'améliorer en envoyant des données d'utilisation ? Ceci utilisera un cookie. (Voir nos politiques de cookie et de confidentialité).", "Help improve Riot by sending usage data? This will use a cookie.": "Aider Riot à s'améliorer en envoyant des données d'utilisation ? Ceci utilisera un cookie.", "Yes please": "Oui, s'il vous plaît", - "Muted Users": "Utilisateurs ignorés" + "Muted Users": "Utilisateurs ignorés", + "Warning: This widget might use cookies.": "Avertissement : ce widget utilise peut-être des cookies.", + "Terms and Conditions": "Conditions générales", + "To continue using the %(homeserverDomain)s homeserver you must review and agree to our terms and conditions.": "Pour continuer à utiliser le serveur d'accueil %(homeserverDomain)s, vous devez lire et accepter nos conditions générales.", + "Review terms and conditions": "Voir les conditions générales" } From 87c3e92014754ff454f07cd642cb456dc19dd43f Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 13:32:48 +0100 Subject: [PATCH 108/702] bump dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fb0fd3ec90..5dc3e698f2 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "slate": "^0.33.4", "slate-react": "^0.12.4", "slate-html-serializer": "^0.6.1", - "slate-md-serializer": "matrix-org/slate-md-serializer#f5deb3f", + "slate-md-serializer": "matrix-org/slate-md-serializer#11fe1b6", "sanitize-html": "^1.14.1", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", From fb5240aabd67a6a6f07d85b5f003c757e38b95dd Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 14:00:54 +0100 Subject: [PATCH 109/702] explain why we're now including

    s --- src/Markdown.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Markdown.js b/src/Markdown.js index e02118397b..9d9a8621c9 100644 --- a/src/Markdown.js +++ b/src/Markdown.js @@ -102,6 +102,15 @@ export default class Markdown { // (https://github.com/vector-im/riot-web/issues/3154) softbreak: '
    ', }); + + // Trying to strip out the wrapping

    causes a lot more complication + // than it's worth, i think. For instance, this code will go and strip + // out any

    tag (no matter where it is in the tree) which doesn't + // contain \n's. + // On the flip side,

    s are quite opionated and restricted on where + // you can nest them. + // + // Let's try sending with

    s anyway for now, though. /* const real_paragraph = renderer.paragraph; From b0ff61f7ef3757dee9f6dc9ee0881b7868d6c015 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 14:12:08 +0100 Subject: [PATCH 110/702] switch code schema to match slate-md-serializer --- .../views/rooms/MessageComposerInput.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 0b57e90184..94ef88d04b 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -95,7 +95,7 @@ const BLOCK_TAGS = { h6: 'heading6', li: 'list-item', ol: 'numbered-list', - pre: 'code-block', + pre: 'code', }; const MARK_TAGS = { @@ -103,7 +103,7 @@ const MARK_TAGS = { b: 'bold', // deprecated em: 'italic', i: 'italic', // deprecated - code: 'code', + code: 'inline-code', u: 'underlined', del: 'deleted', strike: 'deleted', // deprecated @@ -710,7 +710,7 @@ export default class MessageComposerInput extends React.Component { [KeyCode.KEY_B]: 'bold', [KeyCode.KEY_I]: 'italic', [KeyCode.KEY_U]: 'underlined', - [KeyCode.KEY_J]: 'code', + [KeyCode.KEY_J]: 'inline-code', }[ev.keyCode]; if (ctrlCmdCommand) { @@ -760,7 +760,7 @@ export default class MessageComposerInput extends React.Component { this.hasBlock('heading4') || this.hasBlock('heading5') || this.hasBlock('heading6') || - this.hasBlock('code-block'))) + this.hasBlock('code'))) { return change.setBlocks(DEFAULT_NODE); } @@ -832,7 +832,7 @@ export default class MessageComposerInput extends React.Component { case 'heading5': case 'heading6': case 'list-item': - case 'code-block': { + case 'code': { const isActive = this.hasBlock(type); const isList = this.hasBlock('list-item'); @@ -850,7 +850,7 @@ export default class MessageComposerInput extends React.Component { // marks: case 'bold': case 'italic': - case 'code': + case 'inline-code': case 'underlined': case 'deleted': { change.toggleMark(type); @@ -885,8 +885,8 @@ export default class MessageComposerInput extends React.Component { 'underline': (text) => `${text}`, 'strike': (text) => `${text}`, // ("code" is triggered by ctrl+j by draft-js by default) - 'code': (text) => treatInlineCodeAsBlock ? textMdCodeBlock(text) : `\`${text}\``, - 'code-block': textMdCodeBlock, + 'inline-code': (text) => treatInlineCodeAsBlock ? textMdCodeBlock(text) : `\`${text}\``, + 'code': textMdCodeBlock, 'blockquote': (text) => text.split('\n').map((line) => `> ${line}\n`).join('') + '\n', 'unordered-list-item': (text) => text.split('\n').map((line) => `\n- ${line}`).join(''), 'ordered-list-item': (text) => text.split('\n').map((line, i) => `\n${i + 1}. ${line}`).join(''), @@ -897,8 +897,8 @@ export default class MessageComposerInput extends React.Component { 'italic': -1, 'underline': -4, 'strike': -6, - 'code': treatInlineCodeAsBlock ? -5 : -1, - 'code-block': -5, + 'inline-code': treatInlineCodeAsBlock ? -5 : -1, + 'code': -5, 'blockquote': -2, }[command]; @@ -971,7 +971,7 @@ export default class MessageComposerInput extends React.Component { } if (this.state.editorState.blocks.some( - block => ['code-block', 'block-quote', 'list-item'].includes(block.type) + block => ['code', 'block-quote', 'list-item'].includes(block.type) )) { // allow the user to terminate blocks by hitting return rather than sending a msg return; @@ -1369,7 +1369,7 @@ export default class MessageComposerInput extends React.Component { return

  • {children}
  • ; case 'numbered-list': return
      {children}
    ; - case 'code-block': + case 'code': return
    {children}
    ; case 'link': return {children}; @@ -1424,7 +1424,7 @@ export default class MessageComposerInput extends React.Component { return {children}; case 'italic': return {children}; - case 'code': + case 'inline-code': return {children}; case 'underlined': return {children}; From 294565c47e67eb207900e45cd7355f069f8ae888 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 23 May 2018 14:12:36 +0100 Subject: [PATCH 111/702] switch code schema to match slate-md-serializer --- .../{button-text-code-on.svg => button-text-inline-code-on.svg} | 0 res/img/{button-text-code.svg => button-text-inline-code.svg} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename res/img/{button-text-code-on.svg => button-text-inline-code-on.svg} (100%) rename res/img/{button-text-code.svg => button-text-inline-code.svg} (100%) diff --git a/res/img/button-text-code-on.svg b/res/img/button-text-inline-code-on.svg similarity index 100% rename from res/img/button-text-code-on.svg rename to res/img/button-text-inline-code-on.svg diff --git a/res/img/button-text-code.svg b/res/img/button-text-inline-code.svg similarity index 100% rename from res/img/button-text-code.svg rename to res/img/button-text-inline-code.svg From 9f9cde12cead6ca442a480a694417655c389e8ec Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Wed, 23 May 2018 17:18:33 +0100 Subject: [PATCH 112/702] Make devTools styling more consistent and easier to edit event data. --- res/css/views/dialogs/_DevtoolsDialog.scss | 18 ++++++++++++++++-- src/components/views/dialogs/DevtoolsDialog.js | 10 +++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/res/css/views/dialogs/_DevtoolsDialog.scss b/res/css/views/dialogs/_DevtoolsDialog.scss index 8918373ecf..a8e25bb08b 100644 --- a/res/css/views/dialogs/_DevtoolsDialog.scss +++ b/res/css/views/dialogs/_DevtoolsDialog.scss @@ -14,8 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. */ +.mx_DevTools_content { + margin: 10px 0; +} + .mx_DevTools_RoomStateExplorer_button, .mx_DevTools_RoomStateExplorer_query { margin-bottom: 10px; + max-width: 684px; + width: 100%; +} + +.mx_DevTools_LabalCell { + font-weight: bold; } .mx_DevTools_label_left { @@ -38,7 +48,6 @@ limitations under the License. .mx_DevTools_inputLabelCell { - padding-bottom: 21px; display: table-cell; font-weight: bold; padding-right: 24px; @@ -46,7 +55,6 @@ limitations under the License. .mx_DevTools_inputCell { display: table-cell; - padding-bottom: 21px; width: 240px; } @@ -62,6 +70,12 @@ limitations under the License. font-size: 16px; } +.mx_DevTools_textarea { + font-size: 12px; + min-height: 250px; + width: 100%; +} + .mx_DevTools_tgl { display: none; diff --git a/src/components/views/dialogs/DevtoolsDialog.js b/src/components/views/dialogs/DevtoolsDialog.js index 1d3c8ecc09..f2a969ef41 100644 --- a/src/components/views/dialogs/DevtoolsDialog.js +++ b/src/components/views/dialogs/DevtoolsDialog.js @@ -132,17 +132,17 @@ class SendCustomEvent extends GenericEditor { } return
    -
    +
    { this.textInput('eventType', _t('Event Type')) } { this.state.isStateEvent && this.textInput('stateKey', _t('State Key')) }
    -
    +
    -