From 10c6f24a8325376c62db690e35f00c0949e46b38 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 10 Dec 2017 12:46:12 +0000 Subject: [PATCH 1/8] CSS and Context Menu tweaks for Rich Quoting/Replies Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/context_menus/MessageContextMenu.js | 4 +-- .../views/rooms/_Autocomplete.scss | 29 +++++++++++++++++-- .../views/rooms/_EventTile.scss | 4 +-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index d8f9a4daa2..dfff031fc9 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -171,8 +171,8 @@ module.exports = React.createClass({ onQuoteClick: function() { dis.dispatch({ - action: 'quote', - text: this.props.eventTileOps.getInnerText(), + action: 'quote_event', + event: this.props.mxEvent, }); this.closeMenu(); }, diff --git a/src/skins/vector/css/matrix-react-sdk/views/rooms/_Autocomplete.scss b/src/skins/vector/css/matrix-react-sdk/views/rooms/_Autocomplete.scss index 6bf3f3b60a..8ce81c0dea 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/rooms/_Autocomplete.scss +++ b/src/skins/vector/css/matrix-react-sdk/views/rooms/_Autocomplete.scss @@ -1,4 +1,17 @@ .mx_Autocomplete { + position: absolute; + bottom: 0; + z-index: 1001; + width: 100%; + border: 1px solid $primary-hairline-color; + background: $primary-bg-color; + border-bottom: none; + border-radius: 4px 4px 0 0; + max-height: 50vh; + overflow: auto +} + +.mx_Quoting { position: absolute; bottom: 0; z-index: 1000; @@ -11,7 +24,7 @@ overflow: auto } -.mx_Autocomplete_ProviderSection { +.mx_Autocomplete_ProviderSection, .mx_Quoting_section { border-bottom: 1px solid $primary-hairline-color; } @@ -74,13 +87,25 @@ outline: none; } -.mx_Autocomplete_provider_name { +.mx_Autocomplete_provider_name, .mx_Quoting_header { margin: 12px; color: $primary-fg-color; font-weight: 400; opacity: 0.4; } +.mx_Quoting_title { + float: left; +} + +.mx_Quoting_cancel { + float: right; +} + +.mx_Quoting_clear { + clear: both; +} + /* styling for common completion elements */ .mx_Autocomplete_Completion_subtitle { font-style: italic; diff --git a/src/skins/vector/css/matrix-react-sdk/views/rooms/_EventTile.scss b/src/skins/vector/css/matrix-react-sdk/views/rooms/_EventTile.scss index cfc46e85ab..b4a4242025 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/rooms/_EventTile.scss +++ b/src/skins/vector/css/matrix-react-sdk/views/rooms/_EventTile.scss @@ -109,7 +109,7 @@ limitations under the License. /* this is used for the tile for the event which is selected via the URL. * TODO: ultimately we probably want some transition on here. */ -.mx_EventTile_selected .mx_EventTile_line { +.mx_EventTile_selected > .mx_EventTile_line { border-left: $accent-color 5px solid; padding-left: 60px; background-color: $event-selected-color; @@ -209,7 +209,7 @@ limitations under the License. visibility: visible; } -.mx_EventTile_selected .mx_MessageTimestamp { +.mx_EventTile_selected > div > a > .mx_MessageTimestamp { left: 3px; width: auto; } From 54a9ccdee759d38b24f3597a8e4fc70a980117c2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 12 Dec 2017 23:36:10 +0000 Subject: [PATCH 2/8] throw new quoting behind flags Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/context_menus/MessageContextMenu.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index dfff031fc9..f2a106749d 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -170,10 +170,17 @@ module.exports = React.createClass({ }, onQuoteClick: function() { - dis.dispatch({ - action: 'quote_event', - event: this.props.mxEvent, - }); + if (SettingsStore.isFeatureEnabled("feature_rich_quoting")) { + dis.dispatch({ + action: 'quote_event', + event: this.props.mxEvent, + }); + } else { + dis.dispatch({ + action: 'quote', + text: this.props.eventTileOps.getInnerText(), + }); + } this.closeMenu(); }, From 4bc99b7f01c7b9488c748b05cb722ccb7217190d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 12 Dec 2017 23:40:02 +0000 Subject: [PATCH 3/8] move QuotePreview CSS out to own file Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/skins/vector/css/_components.scss | 1 + .../views/rooms/_Autocomplete.scss | 30 ++-------------- .../views/rooms/_QuotePreview.scss | 35 +++++++++++++++++++ 3 files changed, 39 insertions(+), 27 deletions(-) create mode 100644 src/skins/vector/css/matrix-react-sdk/views/rooms/_QuotePreview.scss diff --git a/src/skins/vector/css/_components.scss b/src/skins/vector/css/_components.scss index 0dd6a1b1b7..0166585148 100644 --- a/src/skins/vector/css/_components.scss +++ b/src/skins/vector/css/_components.scss @@ -70,6 +70,7 @@ @import "./matrix-react-sdk/views/rooms/_RoomTile.scss"; @import "./matrix-react-sdk/views/rooms/_SearchableEntityList.scss"; @import "./matrix-react-sdk/views/rooms/_TopUnreadMessagesBar.scss"; +@import "./matrix-react-sdk/views/rooms/_QuotePreview.scss"; @import "./matrix-react-sdk/views/settings/_DevicesPanel.scss"; @import "./matrix-react-sdk/views/settings/_IntegrationsManager.scss"; @import "./matrix-react-sdk/views/voip/_CallView.scss"; diff --git a/src/skins/vector/css/matrix-react-sdk/views/rooms/_Autocomplete.scss b/src/skins/vector/css/matrix-react-sdk/views/rooms/_Autocomplete.scss index 8ce81c0dea..732ada088b 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/rooms/_Autocomplete.scss +++ b/src/skins/vector/css/matrix-react-sdk/views/rooms/_Autocomplete.scss @@ -11,20 +11,7 @@ overflow: auto } -.mx_Quoting { - position: absolute; - bottom: 0; - z-index: 1000; - width: 100%; - border: 1px solid $primary-hairline-color; - background: $primary-bg-color; - border-bottom: none; - border-radius: 4px 4px 0 0; - max-height: 50vh; - overflow: auto -} - -.mx_Autocomplete_ProviderSection, .mx_Quoting_section { +.mx_Autocomplete_ProviderSection { border-bottom: 1px solid $primary-hairline-color; } @@ -87,25 +74,13 @@ outline: none; } -.mx_Autocomplete_provider_name, .mx_Quoting_header { +.mx_Autocomplete_provider_name { margin: 12px; color: $primary-fg-color; font-weight: 400; opacity: 0.4; } -.mx_Quoting_title { - float: left; -} - -.mx_Quoting_cancel { - float: right; -} - -.mx_Quoting_clear { - clear: both; -} - /* styling for common completion elements */ .mx_Autocomplete_Completion_subtitle { font-style: italic; @@ -115,3 +90,4 @@ .mx_Autocomplete_Completion_description { color: gray; } + diff --git a/src/skins/vector/css/matrix-react-sdk/views/rooms/_QuotePreview.scss b/src/skins/vector/css/matrix-react-sdk/views/rooms/_QuotePreview.scss new file mode 100644 index 0000000000..f0fb62b8e6 --- /dev/null +++ b/src/skins/vector/css/matrix-react-sdk/views/rooms/_QuotePreview.scss @@ -0,0 +1,35 @@ +.mx_QuotePreview { + position: absolute; + bottom: 0; + z-index: 1000; + width: 100%; + border: 1px solid $primary-hairline-color; + background: $primary-bg-color; + border-bottom: none; + border-radius: 4px 4px 0 0; + max-height: 50vh; + overflow: auto +} + +.mx_QuotePreview_section { + border-bottom: 1px solid $primary-hairline-color; +} + +.mx_QuotePreview_header { + margin: 12px; + color: $primary-fg-color; + font-weight: 400; + opacity: 0.4; +} + +.mx_QuotePreview_title { + float: left; +} + +.mx_QuotePreview_cancel { + float: right; +} + +.mx_QuotePreview_clear { + clear: both; +} From 9c38794ad588474e8b3201ae1a985dca5551a536 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 15 Dec 2017 18:37:44 +0000 Subject: [PATCH 4/8] Style datesep inside Quote Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/skins/vector/css/_components.scss | 1 + .../views/elements/_Quote.scss | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/skins/vector/css/matrix-react-sdk/views/elements/_Quote.scss diff --git a/src/skins/vector/css/_components.scss b/src/skins/vector/css/_components.scss index 0166585148..c2725aeb9c 100644 --- a/src/skins/vector/css/_components.scss +++ b/src/skins/vector/css/_components.scss @@ -39,6 +39,7 @@ @import "./matrix-react-sdk/views/elements/_RichText.scss"; @import "./matrix-react-sdk/views/elements/_RoleButton.scss"; @import "./matrix-react-sdk/views/elements/_ToolTipButton.scss"; +@import "./matrix-react-sdk/views/elements/_Quote.scss"; @import "./matrix-react-sdk/views/groups/_GroupPublicityToggle.scss"; @import "./matrix-react-sdk/views/groups/_GroupRoomList.scss"; @import "./matrix-react-sdk/views/groups/_GroupUserSettings.scss"; diff --git a/src/skins/vector/css/matrix-react-sdk/views/elements/_Quote.scss b/src/skins/vector/css/matrix-react-sdk/views/elements/_Quote.scss new file mode 100644 index 0000000000..2ccde389d6 --- /dev/null +++ b/src/skins/vector/css/matrix-react-sdk/views/elements/_Quote.scss @@ -0,0 +1,22 @@ +/* +Copyright 2017 Vector Creations Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +.mx_Quote .mx_DateSeparator { + font-size: 1em !important; + margin-bottom: 0; + padding-bottom: 1px; + bottom: -5px; +} From 304d281ed2ae4801cba26441ee948f30ab2b791c Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 16 Dec 2017 19:01:56 +0000 Subject: [PATCH 5/8] change reply to be its own thing Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/context_menus/MessageContextMenu.js | 38 ++++++++++++------- src/i18n/strings/en_EN.json | 3 +- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index f2a106749d..84bebc1341 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -25,6 +25,7 @@ import { _t } from 'matrix-react-sdk/lib/languageHandler'; const Modal = require('matrix-react-sdk/lib/Modal'); const Resend = require("matrix-react-sdk/lib/Resend"); import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore"; +import {makeEventPermalink} from 'matrix-react-sdk/lib/matrix-to'; module.exports = React.createClass({ displayName: 'MessageContextMenu', @@ -170,17 +171,18 @@ module.exports = React.createClass({ }, onQuoteClick: function() { - if (SettingsStore.isFeatureEnabled("feature_rich_quoting")) { - dis.dispatch({ - action: 'quote_event', - event: this.props.mxEvent, - }); - } else { - dis.dispatch({ - action: 'quote', - text: this.props.eventTileOps.getInnerText(), - }); - } + dis.dispatch({ + action: 'quote', + text: this.props.eventTileOps.getInnerText(), + }); + this.closeMenu(); + }, + + onReplyClick: function() { + dis.dispatch({ + action: 'quote_event', + event: this.props.mxEvent, + }); this.closeMenu(); }, @@ -197,6 +199,7 @@ module.exports = React.createClass({ let permalinkButton; let externalURLButton; let quoteButton; + let replyButton; if (eventStatus === 'not_sent') { resendButton = ( @@ -268,8 +271,8 @@ module.exports = React.createClass({ // XXX: if we use room ID, we should also include a server where the event can be found (other than in the domain of the event ID) permalinkButton = (
); @@ -279,6 +282,14 @@ module.exports = React.createClass({ { _t('Quote') } ); + + if (SettingsStore.isFeatureEnabled("feature_rich_quoting")) { + replyButton = ( +