From b395fad8348410a2f957fc37ba263687ad02ec77 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 22 Aug 2019 14:07:43 +0100 Subject: [PATCH] add feature flag, allowing to revert to old slate editor --- src/components/structures/RoomView.js | 33 +++++++++++++++++++-------- src/settings/Settings.js | 6 +++++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 535a1f3df3..5edf19f3ef 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -1550,7 +1550,6 @@ module.exports = React.createClass({ render: function() { const RoomHeader = sdk.getComponent('rooms.RoomHeader'); - const MessageComposer = sdk.getComponent('rooms.MessageComposer'); const ForwardMessage = sdk.getComponent("rooms.ForwardMessage"); const AuxPanel = sdk.getComponent("rooms.AuxPanel"); const SearchBar = sdk.getComponent("rooms.SearchBar"); @@ -1778,15 +1777,29 @@ module.exports = React.createClass({ myMembership === 'join' && !this.state.searchResults ); if (canSpeak) { - messageComposer = - ; + if (SettingsStore.isFeatureEnabled("feature_cider_composer")) { + const MessageComposer = sdk.getComponent('rooms.MessageComposer'); + messageComposer = + ; + } else { + const SlateMessageComposer = sdk.getComponent('rooms.SlateMessageComposer'); + messageComposer = + ; + } } // TODO: Why aren't we storing the term/scope/count in this format diff --git a/src/settings/Settings.js b/src/settings/Settings.js index b33ef3f8d7..fd6f2bcdb1 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -114,6 +114,12 @@ export const SETTINGS = { supportedLevels: LEVELS_FEATURE, default: false, }, + "feature_cider_composer": { + isFeature: true, + displayName: _td("Use the new, faster, but still experimental composer for writing messages (requires refresh)"), + supportedLevels: LEVELS_FEATURE, + default: false, + }, "MessageComposerInput.suggestEmoji": { supportedLevels: LEVELS_ACCOUNT_SETTINGS, displayName: _td('Enable Emoji suggestions while typing'),