Merge pull request #1288 from matrix-org/luke/track-richtext-mode
Track whether the user has richtext mode enabled
This commit is contained in:
commit
390e77ee22
2 changed files with 11 additions and 0 deletions
|
@ -31,6 +31,7 @@ const customVariables = {
|
||||||
'User Type': 3,
|
'User Type': 3,
|
||||||
'Chosen Language': 4,
|
'Chosen Language': 4,
|
||||||
'Instance': 5,
|
'Instance': 5,
|
||||||
|
'RTE: Uses Richtext Mode': 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,6 +146,11 @@ class Analytics {
|
||||||
if (this.disabled) return;
|
if (this.disabled) return;
|
||||||
this._setVisitVariable('User Type', guest ? 'Guest' : 'Logged In');
|
this._setVisitVariable('User Type', guest ? 'Guest' : 'Logged In');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setRichtextMode(state) {
|
||||||
|
if (this.disabled) return;
|
||||||
|
this._setVisitVariable('RTE: Uses Richtext Mode', state ? 'on' : 'off');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!global.mxAnalytics) {
|
if (!global.mxAnalytics) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import KeyCode from '../../../KeyCode';
|
||||||
import Modal from '../../../Modal';
|
import Modal from '../../../Modal';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
|
import Analytics from '../../../Analytics';
|
||||||
|
|
||||||
import dis from '../../../dispatcher';
|
import dis from '../../../dispatcher';
|
||||||
import UserSettingsStore from '../../../UserSettingsStore';
|
import UserSettingsStore from '../../../UserSettingsStore';
|
||||||
|
@ -160,6 +161,8 @@ export default class MessageComposerInput extends React.Component {
|
||||||
|
|
||||||
const isRichtextEnabled = UserSettingsStore.getSyncedSetting('MessageComposerInput.isRichTextEnabled', false);
|
const isRichtextEnabled = UserSettingsStore.getSyncedSetting('MessageComposerInput.isRichTextEnabled', false);
|
||||||
|
|
||||||
|
Analytics.setRichtextMode(isRichtextEnabled);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
// whether we're in rich text or markdown mode
|
// whether we're in rich text or markdown mode
|
||||||
isRichtextEnabled,
|
isRichtextEnabled,
|
||||||
|
@ -526,6 +529,8 @@ export default class MessageComposerInput extends React.Component {
|
||||||
contentState = ContentState.createFromText(markdown);
|
contentState = ContentState.createFromText(markdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Analytics.setRichtextMode(enabled);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
editorState: this.createEditorState(enabled, contentState),
|
editorState: this.createEditorState(enabled, contentState),
|
||||||
isRichtextEnabled: enabled,
|
isRichtextEnabled: enabled,
|
||||||
|
|
Loading…
Reference in a new issue